s.end<=r).map(s=>({...s})),i=e.fencedCodeRanges.filter(s=>s.end<=r).map(s=>({...s}));return{text:o,context:{inlineCodeRanges:a,fencedCodeRanges:i}}}function IQ(t){let{text:e,context:n}=t;if(!e.includes("![")&&!e.includes("[[")&&!e.includes("^[")&&!e.includes("[^"))return t;let r=p=>Xm(p,n.inlineCodeRanges)!==null||Xm(p,n.fencedCodeRanges)!==null,o=e.length,a=e.lastIndexOf("![[",o);a!==-1&&!r(a)&&e.indexOf("]]",a+3)===-1&&(o=a);let i=e.slice(0,o),s=i.lastIndexOf("[[");s!==-1&&(s===0||i[s-1]!=="!")&&!r(s)&&i.indexOf("]]",s+2)===-1&&(o=Math.min(o,s));let l=i.lastIndexOf("![");l!==-1&&!i.startsWith("![[",l)&&!r(l)&&i.indexOf(")",l+2)===-1&&(o=Math.min(o,l));let c=i.lastIndexOf("^[");c!==-1&&!r(c)&&i.indexOf("]",c+2)===-1&&(o=Math.min(o,c));let u=i.lastIndexOf("[^");return u!==-1&&!r(u)&&i.indexOf("]",u+2)===-1&&(o=Math.min(o,u)),o===e.length?t:NQ(e,n,o)}function wM(t,e,n,r){let o=Math.min(t.length,n),a=Math.min(t.length,r);if(t.length<=o)return{text:t,context:e};let i=o,s=Xm(i,e.inlineCodeRanges);s&&s.end>i&&(i=Math.min(a,s.end));let l=Xm(i,e.fencedCodeRanges);return l&&l.end>i&&(i=Math.min(a,l.end)),NQ(t,e,i)}function vF(t,e){return t.includes("&")?A_(t,e,{includeInline:!0,includeFenced:!0,transform:FQ,contextWhenNoRanges:e}):{text:t,context:e}}function xQ(t,e){if(!t.includes("<"))return t;let n=nc(t),o={inlineCodeRanges:wl(t,n),fencedCodeRanges:n};return SM(t,o,{...e,enabled:!0}).text}function EQ(t,e){if(!t.includes("&"))return t;let n=e?.preserveInlineCode??!0,r=e?.preserveFencedCode??!0;if(!n&&!r)return FQ(t);let o=r?nc(t):[],i={inlineCodeRanges:n?wl(t,o):[],fencedCodeRanges:o};return vF(t,i).text}var Mbe,TQ,TM=U(()=>{Hy();vz();wQ();Mbe=Object.freeze({amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",ndash:"–",mdash:"—",hellip:"…",copy:"©",reg:"®",trade:"™"}),TQ=0});function Bbe(t){if(!t.includes("\\"))return{protectedText:t,escapeSegments:[],escapeBase:""};let e=fM("ESC"),n=[];return{protectedText:t.replace(Lbe,(o,a)=>{let i=vM(e,n.length);return n.push(a),i}),escapeSegments:n,escapeBase:e}}function _be(t,e,n){if(e.length===0)return t;let r=new RegExp(`${yM(n)}_(\\d+)@@`,"g");return t.replace(r,(o,a)=>{let i=Number.parseInt(a,10);return Number.isNaN(i)||i<0||i>=e.length?"":e[i]})}function Hbe(t){let e=t.trim();if(!e)return"";let n=e.indexOf("|");if(n===-1)return e.startsWith("#")?e.slice(1):e;let r=e.slice(n+1).trim();if(r.length>0)return r;let o=e.slice(0,n).trim();return o.startsWith("#")?o.slice(1):o}function Vbe(t){return t.includes("[[")?t.replace(/!\[\[[^\]\n\r]*?\]\]/g," ").replace(/\[\[[^\]\n\r]*?\]\]/g,n=>{let r=Hbe(n.slice(2,-2));return r.length>0?r:" "}):t}function Ube(t){return t.replace(/^\s*(?:[-*+]\s+|\d+\.\s+)?\[(?: |x|X|\/|-)?\]\]?\s*/gm,"").replace(/^\s*([*_-])(?:\s*\1){2,}\s*$/gm,"")}function Kbe(t){return t.includes("^")?t.replace(/(^|[ \t])\^[0-9A-Za-z-]+(?=\s|$)/gm,"$1"):t}function Wbe(t,e,n){let r=fM("INLINE"),o=fM("CODE"),a=[],i=[],s=D_(e,!0,!0);if(s.length===0)return{protectedText:t,inlineSegments:a,fencedSegments:i,inlineBase:r,fencedBase:o};let l=0,c="";for(let u of s){if(u.start>l&&(c+=t.slice(l,u.start)),u.kind==="inline"){let p=M_(t.slice(u.start,u.end)),m=vM(r,a.length);a.push(p),c+=m}else{if(n){let h=c.length>0&&!/\s$/.test(c),b=t[u.end]??"",v=b!==""&&!/\s/.test(b);h&&v&&(c+=" "),l=u.end;continue}let p=kM(t.slice(u.start,u.end)),m=vM(o,i.length);i.push(p),c.length>0&&!/\s$/.test(c)&&(c+=" "),c+=m;let f=t[u.end]??"";f!==""&&!/\s/.test(f)&&(c+=" ")}l=u.end}return l0){let i=new RegExp(`${yM(r)}_(\\d+)@@`,"g");a=a.replace(i,(s,l)=>{let c=Number.parseInt(l,10);return Number.isNaN(c)||c<0||c>=e.length?"":e[c]})}if(n.length>0){let i=new RegExp(`${yM(o)}_(\\d+)@@`,"g");a=a.replace(i,(s,l)=>{let c=Number.parseInt(l,10);return Number.isNaN(c)||c<0||c>=n.length?"":n[c]})}return a}function Gbe(t){if(t.length===0)return 0;let e=t[t.length-1],r=typeof e=="object"&&e!==null&&!Array.isArray(e)?3:2;return Math.max(t.length-r,0)}function kM(t){let e=PQ(t),n=e.match(/^\s*([`~]{3,})[^\n\r]*\r?\n?/);if(!n)return e;let r=n[1],o=r[0]??"`",a=r.length,i=e.slice(n[0].length),s=new RegExp(`\\r?\\n?\\s*${o}{${a},}(?:\\s*)$`);return i.replace(s,"")}function FM(t,e=!1,n=!0,r){let o=r&&r.fencedCodeRanges.length>0?r.fencedCodeRanges:nc(t),i={inlineCodeRanges:r&&r.inlineCodeRanges.length>0?r.inlineCodeRanges:wl(t,o),fencedCodeRanges:o},{protectedText:s,inlineSegments:l,fencedSegments:c,inlineBase:u,fencedBase:p}=Wbe(t,i,n),m=Bbe(s),g=m.protectedText.includes("\\")&&m.protectedText.includes(`
`)?m.protectedText.replace(zbe,`
`):m.protectedText,h=(g.includes(">")?g.replace(Obe,""):g).replace(Abe,(w,...k)=>{let F=k,P=Gbe(F),T=w.match(/^([`~]{3,})/u);if(T&&w.endsWith(T[1]))return n?"":kM(w);if(w.startsWith("%%")&&w.endsWith("%%")||w.match(/\[![\w-]+\]/))return"";if(w.startsWith("`")&&w.endsWith("`"))return w.slice(1,-1);if(w.startsWith("!")||w.match(/#[\w\-/]+(?=\s|$)/))return"";let I=w.trimStart();if(I.startsWith("^[")||I.startsWith("[^"))return"";let N=w.match(/(^|[^*\d])\*([^*\n]+)\*(?![*\d])/);if(N){let K=N[2];return typeof K!="string"||!K.trim()?w:`${N[1]??""}${K}`}let O=w.match(/(^|[^_a-zA-Z0-9])_([^_\n]+)_(?![_a-zA-Z0-9])/);if(O){let K=O[2];return typeof K!="string"||!K.trim()?w:`${O[1]??""}${K}`}if(w.match(/^#+\s+/))return e?"":w.replace(/^#+\s+/,"").trim();if(w.match(/^[-+\d]/)||w.match(/^\*\s+/)||w.match(/^\s*\|.*\|/))return"";for(let K=0;K{Hy();TM();Dbe=[/([`~]{3,})[\s\S]*?\1/.source,/%%[\s\S]*?%%/.source,/`[^`]+`/.source,/!\[.*?\]\([^)]+\)/.source,/!\[\[.*?\]\]/.source,/#[\w\-/]+(?=\s|$)/.source,/\\([*_~`])/.source,/\*\*\*((?:(?!\*\*\*).)+)\*\*\*/.source,/___((?:(?!___).)+)___/.source,/\*\*_((?:(?!_\*\*).)+)_\*\*/.source,/__\*((?:(?!\*__).)+)\*__/.source,/\*\*==((?:(?!==\*\*).)+)==\*\*/.source,/==\*\*((?:(?!\*\*==).)+)\*\*==/.source,/__==((?:(?!==__).)+)==__/.source,/==__((?:(?!__==).)+)__==/.source,/\*\*((?:(?!\*\*).)+)\*\*/.source,/__((?:(?!__).)+)__/.source,/(^|[^*\d])\*([^*\n]+)\*(?![*\d])/.source,/(^|[^_a-zA-Z0-9])_([^_\n]+)_(?![_a-zA-Z0-9])/.source,/~~((?:(?!~~).)+)~~/.source,/==((?:(?!==).)+)==/.source,/\[([^\]]+)\]\([^)]+\)/.source,/\[![\w-]+\][+-]?(?:\s+[^\n]*)?/.source,/^(?:[-*+]\s+|\d+\.\s+)/.source,/^(#+)\s+(.*)$/m.source,/^\s*\|.*\|.*$/m.source,/\^\[[^\]]*?]/.source,/\[\^[^\]]+]/.source,/^\s*\[\^[^\]]+]:.*$/m.source],Abe=new RegExp(Dbe.join("|"),"gm"),Obe=/^\s{0,3}(?:>\s*)+/gm,Lbe=/\\([\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E])/g,zbe=/\\\r?\n/g});function Ybe(t){return t.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function $be(t){if(typeof t=="string"){let e=t.trim();return e.length>0?e:null}if(Array.isArray(t))for(let e of t){if(typeof e!="string")continue;let n=e.trim();if(n)return n}return null}function MQ(t,e){if(!t.text.trim())return"";let n=e.stripHtmlInPreview?SM(t.text,t.context,{enabled:!0,preserveFencedCode:!0}):t;if(!n.text.trim())return"";let r=e.stripLatexInPreview?CQ(n.text,n.context,{enabled:!0}):n;if(!r.text.trim())return"";let o=vF(r.text,r.context);if(!o.text.trim())return"";let a=IQ(o);if(!a.text.trim())return"";let i=FM(a.text,e.skipHeadingsInPreview,e.skipCodeBlocksInPreview,a.context),s=bM(i);return s?s.length>PM?`${s.substring(0,PM-1)}…`:s:""}function AQ(t,e){return!!(kA(t)||fC(e))}function OQ(t,e){let n=e?.stripHtml!==!1;if(!(n&&t.includes("<"))){let u=wl(t),p=vF(t,{inlineCodeRanges:u,fencedCodeRanges:[]}),m=R_(p.text,p.context.inlineCodeRanges),g=bM(m);return g.length>0?g:void 0}let o=nc(t),a={inlineCodeRanges:wl(t,o),fencedCodeRanges:o},i=n?SM(t,a,{enabled:!0}):{text:t,context:a},s=vF(i.text,i.context),l=R_(s.text,s.context.inlineCodeRanges),c=bM(l);return c.length>0?c:void 0}function LQ(t,e,n){let r=PM+RQ,o=DQ,a=e.previewProperties.length>0,i=e.previewPropertiesFallback;if(n&&a)for(let c of e.previewProperties){let u=sl(n,c),p=$be(u);if(!p)continue;let m=p.length>o?p.slice(0,o):p,g=nc(m),f=wl(m,g),h=wM(m,{inlineCodeRanges:f,fencedCodeRanges:g},r,o),b=MQ(h,e);if(b)return b}if(a&&!i||!t)return"";let s=Ybe(t);if(!s.trim())return"";let l=e.skipCodeBlocksInPreview?(()=>{let c=q$(s,o,qbe);if(!c)return{text:"",context:{inlineCodeRanges:[],fencedCodeRanges:[]}};let u=wl(c);return wM(c,{inlineCodeRanges:u,fencedCodeRanges:[]},r,o)})():(()=>{let c=s.length>o?s.slice(0,o):s,u=nc(c),p=wl(c,u);return wM(c,{inlineCodeRanges:p,fencedCodeRanges:u},r,o)})();return MQ(l,e)}var PM,RQ,DQ,qbe,zQ=U(()=>{Hy();rs();Ot();TM();O_();PM=500,RQ=400,DQ=PM+RQ*2,qbe=DQ*50});var Ab,L_=U(()=>{TM();O_();zQ();Ab=class{static isExcalidrawFile(e,n){return AQ(e,n)}static stripMarkdownSyntax(e,n=!1,r=!0,o){return FM(e,n,r,o)}static stripHtmlTagsPreservingCode(e,n){return xQ(e,n)}static decodeHtmlEntitiesPreservingCode(e,n){return EQ(e,n)}static normalizeExcerpt(e,n){return OQ(e,n)}static extractCodeBlockContent(e){return kM(e)}static extractPreviewText(e,n,r){return LQ(e,n,r)}}});function CM(t){if(!t)return{shouldClearPreview:!0,shouldClearProperties:!0,shouldClearFeatureImage:!0,shouldClearWordCounts:!0,shouldClearCharacterCounts:!0};let{oldSettings:e,newSettings:n}=t,o=e.skipHeadingsInPreview!==n.skipHeadingsInPreview||e.skipCodeBlocksInPreview!==n.skipCodeBlocksInPreview||e.stripHtmlInPreview!==n.stripHtmlInPreview||e.stripLatexInPreview!==n.stripLatexInPreview||!go(e.previewProperties,n.previewProperties)||e.previewPropertiesFallback!==n.previewPropertiesFallback||e.showFilePreview!==n.showFilePreview,a=kv(e)!==kv(n),i=!go(e.featureImageProperties,n.featureImageProperties),l=!go(e.featureImageExcludeProperties,n.featureImageExcludeProperties)||e.featureImagePixelSize!==n.featureImagePixelSize||e.showFeatureImage&&!n.showFeatureImage||n.showFeatureImage&&(i||e.downloadExternalFeatureImages!==n.downloadExternalFeatureImages);return{shouldClearPreview:o,shouldClearProperties:a,shouldClearFeatureImage:l,shouldClearWordCounts:!Pp(e)&&Pp(n),shouldClearCharacterCounts:!Cp(e)&&Cp(n)}}function Xbe(t,e){let n=t.frontmatterPosition?.end?.offset;if(typeof n!="number"||n<=0)return 0;let r=Math.min(Math.max(0,n),e.length);for(;r=t.length)return null;let r=t[n];if(r==="-"||r==="*")n+=1;else{let a=t.charCodeAt(n);if(a<49||a>57)return null;for(n+=1;n57)break;n+=1}if(t[n]!==".")return null;n+=1}if(n>=t.length||!pz(t.charCodeAt(n))||(n=$m(t,n),n+2>=t.length)||t[n]!=="["||t[n+2]!=="]"||t.slice(n+3).trim().length===0)return null;let o=t[n+1];return o===" "?"unfinished":o==="x"||o==="X"?"complete":null}function eSe(t,e){let n=Math.min(Math.max(0,e),t.length),r=n===0?t:t.slice(n);if(r.length===0)return{taskTotal:0,taskUnfinished:0};let o=0,a=0,i=0,s=!1,l="",c=0,u=0;for(;i0?[{value:e,valueKind:"string"}]:[]}if(typeof t=="number")return Number.isFinite(t)?[{value:t.toString(),valueKind:"number"}]:[];if(typeof t=="boolean")return[{value:t?"true":"false",valueKind:"boolean"}];if(Array.isArray(t)){let e=[];for(let n of t)e.push(...BQ(n));return e}return[]}function z_(t,e){if(!t)return[];let n=[];for(let r=0;r{NM=require("obsidian");Ud();zn();Sl();ed();Hy();L_();Ot();Am();gl();Nb();I_();c_();mM();Ob=class extends Cb{constructor(){super(...arguments);this.PARALLEL_LIMIT=$t.contentProvider.parallelLimit;this.readFailureAttemptsByPath=new Map;this.emptyFrontmatterRetryCounts=new Map;this.processors=[{id:"preview",needsProcessing:n=>gf(n.settings)&&(!n.fileData||n.fileModified||n.fileData.previewStatus==="unprocessed")&&(n.hasContent||n.isDrawing),run:async n=>await this.processPreview(n)},{id:"wordCount",needsProcessing:n=>Pp(n.settings)&&(!n.fileData||n.fileModified||n.fileData.wordCount===null)?n.isDrawing||n.hasContent:!1,run:async n=>await this.processWordCount(n)},{id:"characterCount",needsProcessing:n=>Cp(n.settings)&&(!n.fileData||n.fileModified||n.fileData.characterCountWithSpaces===null||n.fileData.characterCountWithoutSpaces===null)?n.isDrawing||n.hasContent:!1,run:async n=>await this.processCharacterCount(n)},{id:"tasks",needsProcessing:n=>hf(n.settings)&&(!n.fileData||n.fileModified||n.fileData.taskTotal===null||n.fileData.taskUnfinished===null)?n.isDrawing||n.taskCountsFromMetadata!==null||n.hasContent:!1,run:async n=>await this.processTasks(n)},{id:"properties",needsProcessing:n=>!n.propertiesEnabled||!Np(n.settings)?!1:!n.fileData||n.fileModified||n.fileData.properties===null,run:async n=>await this.processProperties(n)},{id:"featureImage",needsProcessing:n=>!Cg(n.settings)||!n.isDrawing&&!n.featureImageReference&&!n.hasContent&&!n.featureImageExcluded?!1:!n.fileData||n.fileModified||n.fileData.featureImageKey===null||n.fileData.featureImageStatus==="unprocessed"||!n.featureImageExcluded&&n.drawingProviderId!==null&&n.fileData.featureImageKey!==Uc(n.file,n.drawingProviderId),run:async n=>await this.processFeatureImage(n)}]}getContentType(){return"markdownPipeline"}getRelevantSettings(){return["showFilePreview","skipHeadingsInPreview","skipCodeBlocksInPreview","stripHtmlInPreview","stripLatexInPreview","previewProperties","previewPropertiesFallback","showFeatureImage","featureImageProperties","featureImageExcludeProperties","featureImagePixelSize","downloadExternalFeatureImages","textCountDisplay","showTooltips","showTooltipWordCount","showFileIconUnfinishedTask","showFileBackgroundUnfinishedTask","calendarEnabled","manualSortGroupHeaderProperty","manualSortPropertyKey","noteGrouping","folderAppearances","tagAppearances","propertyAppearances","wordCountTargetProperty"]}recordReadFailure(n){let o=(this.readFailureAttemptsByPath.get(n)??0)+1;return this.readFailureAttemptsByPath.set(n,o),{attempts:o,shouldFallback:o>=$t.contentProvider.retry.maxAttempts}}clearReadFailures(n){this.readFailureAttemptsByPath.delete(n)}shouldRegenerate(n,r){let{shouldClearPreview:o,shouldClearProperties:a,shouldClearFeatureImage:i,shouldClearWordCounts:s,shouldClearCharacterCounts:l}=CM({oldSettings:n,newSettings:r});return o||a||i||s||l}async clearContent(n){let{shouldClearPreview:r,shouldClearProperties:o,shouldClearFeatureImage:a,shouldClearWordCounts:i,shouldClearCharacterCounts:s}=CM(n);if(!r&&!o&&!a&&!i&&!s)return;let l=kt();r&&await l.batchClearAllFileContent("preview"),o&&await l.batchClearAllFileContent("properties"),a&&await l.batchClearFeatureImageContent("markdown"),i&&await l.batchClearAllFileContent("wordCount"),s&&await l.batchClearAllFileContent("characterCount"),this.emptyFrontmatterRetryCounts.clear()}needsProcessing(n,r,o){if(r.extension!=="md")return!1;let a=gu(o);if(a.length===0)return!1;let i=Np(o),s=n!==null&&n.markdownPipelineMtime!==r.stat.mtime;if(!n)return!0;if(s){if(a.length===1&&a[0]==="tasks"){let h=this.app.metadataCache.getFileCache(r),b=h?Ib(h):null;if(b!==null&&xb(n,b))return!1}return!0}let l=gf(o)&&n.previewStatus==="unprocessed",c=Cg(o)&&(n.featureImageKey===null||n.featureImageStatus==="unprocessed");if(Cg(o)&&!c){let f=this.app.metadataCache.getFileCache(r)?.frontmatter;if(!bw(o.featureImageExcludeProperties).matches(f)){let b=Lv(r,f),v=b?Uc(r,b):null;c=v!==null&&n.featureImageKey!==v}}let u=i&&n.properties===null,p=Pp(o)&&n.wordCount===null,m=Cp(o)&&(n.characterCountWithSpaces===null||n.characterCountWithoutSpaces===null),g=hf(o)&&(n.taskTotal===null||n.taskUnfinished===null);return l||c||u||p||m||g}async processFile(n,r,o){if(n.file.extension!=="md")return{update:null,processed:!0};if(gu(o).length===0)return{update:null,processed:!0};let a=XA(o),i=Np(o)&&a.length>0,s=gf(o),l=Cg(o),c=Pp(o),u=Cp(o),p=hf(o),m=s&&o.previewProperties.length>0,g=l&&o.featureImageProperties.length>0,f=l&&o.featureImageExcludeProperties.length>0,h=this.app.metadataCache.getFileCache(n.file);if(!h)return this.emptyFrontmatterRetryCounts.delete(n.path),{update:null,processed:!1};let b=h.frontmatter??null,v=Lv(n.file,b),y=v!==null,S=r!==null&&r.markdownPipelineMtime!==n.file.stat.mtime,w=s&&(!r||S||r.previewStatus==="unprocessed")&&!y,k=m&&w,F=i&&(r===null||S||r.properties===null),P=l&&(!r||S||r.featureImageKey===null||r.featureImageStatus==="unprocessed")&&!y;if(b===null&&(F||k||P&&(g||f))){let ee=this.emptyFrontmatterRetryCounts.get(n.path)??0;if(Date.now()-n.file.stat.mtime<=$t.contentProvider.metadataCache.recentFileWindowMs&&ee<$t.contentProvider.metadataCache.emptyValueRetryLimit)return this.emptyFrontmatterRetryCounts.set(n.path,ee+1),{update:null,processed:!1}}let I=bw(o.featureImageExcludeProperties),N=l&&b!==null&&I.matches(b),K=c&&(!r||S||r.wordCount===null)&&!y,X=u&&(!r||S||r.characterCountWithSpaces===null||r.characterCountWithoutSpaces===null)&&!y,L=p&&(!r||S||r.taskTotal===null||r.taskUnfinished===null),V=L?y?{taskTotal:0,taskUnfinished:0}:Ib(h):null,D=L&&!y&&V===null,A=P&&b&&!N?d_({app:this.app,file:n.file,content:"",settings:o,frontmatter:b,bodyStartIndex:0}):null,_=w||K||X||D||P&&!N&&!A,E={path:n.path},R=()=>V&&(!r||!xb({taskTotal:r.taskTotal,taskUnfinished:r.taskUnfinished},V))?(E.taskTotal=V.taskTotal,E.taskUnfinished=V.taskUnfinished,!0):!1;if(_){let ee=NM.Platform.isMobile?$t.markdown.maxReadBytes.mobile:$t.markdown.maxReadBytes.desktop;if(n.file.stat.size>ee){if(b===null&&!y&&P&&n.file.name.toLowerCase().endsWith(".md")){let J=this.emptyFrontmatterRetryCounts.get(n.path)??0;if(Date.now()-n.file.stat.mtime<=$t.contentProvider.metadataCache.recentFileWindowMs&&J<$t.contentProvider.metadataCache.emptyValueRetryLimit)return this.emptyFrontmatterRetryCounts.set(n.path,J+1),{update:null,processed:!1}}this.emptyFrontmatterRetryCounts.delete(n.path);let j=R();if(K&&(!r||r.wordCount!==0)&&(E.wordCount=0,j=!0),X&&(!r||r.characterCountWithSpaces!==0||r.characterCountWithoutSpaces!==0)&&(E.characterCountWithSpaces=0,E.characterCountWithoutSpaces=0,j=!0),D&&(!r||r.taskTotal!==0||r.taskUnfinished!==0)&&(E.taskTotal=0,E.taskUnfinished=0,j=!0),i){let J=z_(b,a);(!r||r.properties===null||!wh(r.properties,J))&&(E.properties=J,j=!0)}if(w&&(!r||r.previewStatus!=="none")&&(E.preview="",j=!0),P&&(A||N)){let J=await this.processMarkdownFeatureImage({file:n.file,fileData:r,settings:o,content:"",frontmatter:b,bodyStartIndex:0,drawingProviderId:v,featureImageReference:A,featureImageExcluded:N});J&&(E.featureImageKey=J.featureImageKey,E.featureImage=J.featureImage,j=!0)}else P&&!A&&(!r||r.featureImageKey===null||r.featureImageStatus==="unprocessed")&&(E.featureImageKey=r?.featureImageKey??"",E.featureImage=this.createEmptyBlob(),j=!0);return j?{update:E,processed:!0}:{update:null,processed:!0}}}this.emptyFrontmatterRetryCounts.delete(n.path);let M,C=!1,x=0,z=0;try{_?(M=await this.readFileContent(n.file),C=!0,x=Xbe(h,M),z=OG(M),this.clearReadFailures(n.path)):M=""}catch(ee){console.error(`Error reading markdown content for ${n.path}:`,ee);let{shouldFallback:$}=this.recordReadFailure(n.path),j=R();if(K&&(!r||r.wordCount===null||$&&r.wordCount!==0)&&(E.wordCount=0,j=!0),X&&(!r||r.characterCountWithSpaces===null||r.characterCountWithoutSpaces===null||$&&(r.characterCountWithSpaces!==0||r.characterCountWithoutSpaces!==0))&&(E.characterCountWithSpaces=0,E.characterCountWithoutSpaces=0,j=!0),D&&(!r||r.taskTotal===null||r.taskUnfinished===null||$&&(r.taskTotal!==0||r.taskUnfinished!==0))&&(E.taskTotal=0,E.taskUnfinished=0,j=!0),i){let J=z_(b,a);(!r||r.properties===null||!wh(r.properties,J))&&(E.properties=J,j=!0)}if(w&&$&&(!r||r.previewStatus!=="none")&&(E.preview="",j=!0),P&&A){let J=await this.processMarkdownFeatureImage({file:n.file,fileData:r,settings:o,content:"",frontmatter:b,bodyStartIndex:0,drawingProviderId:v,featureImageReference:A,featureImageExcluded:N});J&&(E.featureImageKey=J.featureImageKey,E.featureImage=J.featureImage,j=!0)}else if(P&&N){let J=await this.processMarkdownFeatureImage({file:n.file,fileData:r,settings:o,content:"",frontmatter:b,bodyStartIndex:0,drawingProviderId:v,featureImageReference:null,featureImageExcluded:N});J&&(E.featureImageKey=J.featureImageKey,E.featureImage=J.featureImage,j=!0)}else P&&!A&&$&&(!r||r.featureImageKey===null||r.featureImageStatus==="unprocessed")&&(E.featureImageKey=r?.featureImageKey??"",E.featureImage=this.createEmptyBlob(),j=!0);return j?{update:E,processed:$}:{update:null,processed:$}}!y&&b===null&&(v=Zbe(n.file,M),y=v!==null);let H={file:n.file,fileData:r,settings:o,content:M,frontmatter:b,bodyStartIndex:x,textCountStartIndex:z,isDrawing:y,drawingProviderId:v,fileModified:S,propertiesEnabled:i,propertyNameFields:a,hasContent:C,featureImageReference:A,featureImageExcluded:N,taskCountsFromMetadata:V};for(let ee of this.processors){if(!ee.needsProcessing(H))continue;let $=await ee.run(H);$&&($.wordCount!==void 0&&(E.wordCount=$.wordCount),$.characterCountWithSpaces!==void 0&&(E.characterCountWithSpaces=$.characterCountWithSpaces),$.characterCountWithoutSpaces!==void 0&&(E.characterCountWithoutSpaces=$.characterCountWithoutSpaces),$.taskTotal!==void 0&&(E.taskTotal=$.taskTotal),$.taskUnfinished!==void 0&&(E.taskUnfinished=$.taskUnfinished),$.preview!==void 0&&(E.preview=$.preview),$.properties!==void 0&&(E.properties=$.properties),$.featureImageKey!==void 0&&(E.featureImageKey=$.featureImageKey),$.featureImage!==void 0&&(E.featureImage=$.featureImage))}return E.wordCount!==void 0||E.characterCountWithSpaces!==void 0||E.characterCountWithoutSpaces!==void 0||E.taskTotal!==void 0||E.taskUnfinished!==void 0||E.preview!==void 0||E.properties!==void 0||E.featureImageKey!==void 0?{update:E,processed:!0}:{update:null,processed:!0}}async processPreview(n){try{let r=n.isDrawing?"":Ab.extractPreviewText(n.content,n.settings,n.frontmatter??void 0);if(!n.fileData)return{preview:r};if(r.length===0&&n.fileData.previewStatus==="none")return null;if(n.fileData.previewStatus==="has"){let a=kt().getCachedPreviewText(n.file.path);if(a.length>0&&a===r)return null}return{preview:r}}catch(r){return console.error(`Error generating preview for ${n.file.path}:`,r),!n.fileData||n.fileData.previewStatus==="unprocessed"?{preview:""}:null}}async processWordCount(n){try{let r=n.isDrawing?0:AG(n.content,n.textCountStartIndex);return!n.fileData||n.fileData.wordCount===null||n.fileData.wordCount!==r?{wordCount:r}:null}catch(r){return console.error(`Error generating word count for ${n.file.path}:`,r),!n.fileData||n.fileData.wordCount===null?{wordCount:0}:null}}async processCharacterCount(n){try{let r=n.isDrawing?{withSpaces:0,withoutSpaces:0}:LG(n.content,n.textCountStartIndex);return!n.fileData||n.fileData.characterCountWithSpaces===null||n.fileData.characterCountWithoutSpaces===null||n.fileData.characterCountWithSpaces!==r.withSpaces||n.fileData.characterCountWithoutSpaces!==r.withoutSpaces?{characterCountWithSpaces:r.withSpaces,characterCountWithoutSpaces:r.withoutSpaces}:null}catch(r){return console.error(`Error generating character count for ${n.file.path}:`,r),!n.fileData||n.fileData.characterCountWithSpaces===null||n.fileData.characterCountWithoutSpaces===null?{characterCountWithSpaces:0,characterCountWithoutSpaces:0}:null}}async processTasks(n){try{let r=n.isDrawing?{taskTotal:0,taskUnfinished:0}:n.taskCountsFromMetadata??eSe(n.content,n.bodyStartIndex);return!n.fileData||n.fileData.taskTotal===null||n.fileData.taskUnfinished===null||n.fileData.taskTotal!==r.taskTotal||n.fileData.taskUnfinished!==r.taskUnfinished?{taskTotal:r.taskTotal,taskUnfinished:r.taskUnfinished}:null}catch(r){return console.error(`Error generating tasks for ${n.file.path}:`,r),!n.fileData||n.fileData.taskTotal===null||n.fileData.taskUnfinished===null?{taskTotal:0,taskUnfinished:0}:null}}async processProperties(n){try{let r=z_(n.frontmatter,n.propertyNameFields);return!n.fileData||n.fileData.properties===null||!wh(n.fileData.properties,r)?{properties:r}:null}catch(r){return console.error(`Error generating property values for ${n.file.path}:`,r),!n.fileData||n.fileData.properties===null?{properties:[]}:null}}async processFeatureImage(n){let r=await this.processMarkdownFeatureImage({file:n.file,fileData:n.fileData,settings:n.settings,content:n.content,frontmatter:n.frontmatter,bodyStartIndex:n.bodyStartIndex,drawingProviderId:n.drawingProviderId,featureImageReference:n.featureImageReference,featureImageExcluded:n.featureImageExcluded});return r?{featureImageKey:r.featureImageKey,featureImage:r.featureImage}:null}async processMarkdownFeatureImage(n){if(n.featureImageExcluded)return n.fileData?.featureImageKey===""&&n.fileData.featureImageStatus==="none"?null:{featureImageKey:"",featureImage:this.createEmptyBlob()};if(n.drawingProviderId){let i=Uc(n.file,n.drawingProviderId);return n.fileData?.featureImageKey===i&&n.fileData.featureImageStatus==="none"?null:{featureImageKey:i,featureImage:this.createEmptyBlob()}}let r=n.featureImageReference??d_({app:this.app,file:n.file,content:n.content,settings:n.settings,frontmatter:n.frontmatter,bodyStartIndex:n.bodyStartIndex});if(!r)return n.fileData&&n.fileData.featureImageKey===""?null:{featureImageKey:"",featureImage:this.createEmptyBlob()};let o=this.getFeatureImageKey(r);if(n.fileData?.featureImageKey===o&&n.fileData.featureImageStatus==="has")return null;try{let i=await this.createThumbnailBlob(r,n.settings);return{featureImageKey:o,featureImage:i??this.createEmptyBlob()}}catch(i){return console.error(`Error generating feature image for ${n.file.path}:`,i),{featureImageKey:o,featureImage:this.createEmptyBlob()}}}}});function tSe(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;let n=[...t].sort(),r=[...e].sort();return n.every((o,a)=>o===r[a])}var IM,_Q=U(()=>{zn();rk();Yr();dn();lM();IM=class extends Fg{constructor(){super(...arguments);this.pendingHiddenStates=new Map}clearPendingHiddenStates(){this.pendingHiddenStates.size>0&&this.pendingHiddenStates.clear()}getContentType(){return"metadata"}getRelevantSettings(){return["useFrontmatterMetadata","frontmatterNameField","frontmatterIconField","frontmatterColorField","frontmatterBackgroundField","frontmatterCreatedField","frontmatterModifiedField","frontmatterDateFormat","vaultProfile","vaultProfiles"]}shouldRegenerate(n,r){let o=Qo(n),a=Qo(r);return!tSe(o,a)||!r.useFrontmatterMetadata&&n.useFrontmatterMetadata?!0:r.useFrontmatterMetadata?n.useFrontmatterMetadata!==r.useFrontmatterMetadata||n.frontmatterNameField!==r.frontmatterNameField||n.frontmatterIconField!==r.frontmatterIconField||n.frontmatterColorField!==r.frontmatterColorField||n.frontmatterBackgroundField!==r.frontmatterBackgroundField||n.frontmatterCreatedField!==r.frontmatterCreatedField||n.frontmatterModifiedField!==r.frontmatterModifiedField||n.frontmatterDateFormat!==r.frontmatterDateFormat:!1}async clearContent(n){this.clearPendingHiddenStates(),await kt().batchClearAllFileContent("metadata")}onSettingsChanged(n){super.onSettingsChanged(n),Qo(n).length===0&&this.clearPendingHiddenStates()}stopProcessing(){super.stopProcessing(),this.clearPendingHiddenStates()}needsProcessing(n,r,o){let a=Qo(o);if(!(o.useFrontmatterMetadata||a.length>0)||r.extension!=="md")return!1;let s=a.length>0,l=s?po(a):null,c=!1,u=!1,p=()=>{c||!l||(u=Xo(r,l,this.app),c=!0)},m=()=>{c&&this.pendingHiddenStates.set(r.path,u)},g=n!==null&&n.metadataMtime!==r.stat.mtime;return!n||n.metadata===null||g?(p(),m(),!0):s&&(p(),n.metadata?.hidden!==u)?(m(),!0):!1}async processFile(n,r,o){if(n.file.extension!=="md")return{update:null,processed:!0};let a=Qo(o),i=o.useFrontmatterMetadata,s=a.length>0,l=s?po(a):null;if(!i&&!s)return{update:null,processed:!0};try{let c=this.app.metadataCache.getFileCache(n.file);if(!c&&(i||s&&n.file.extension==="md"))return{update:null,processed:!1};let u=i?Fz(c,o):{},p={};if(i&&(u.fn&&(p.name=u.fn),u.fc!==void 0&&(p.created=u.fc),u.fm!==void 0&&(p.modified=u.fm),u.icon&&(p.icon=u.icon),u.color&&(p.color=u.color),u.background&&(p.background=u.background)),s&&n.file.extension==="md"){let g,f=this.pendingHiddenStates.get(n.path);f!==void 0?(g=f,this.pendingHiddenStates.delete(n.path)):g=l?Xo(n.file,l,this.app):!1,p.hidden=g}let m=Object.keys(p).length>0?p:{};return r&&this.metadataEqual(r.metadata,m)?{update:null,processed:!0}:{update:{path:n.path,metadata:m},processed:!0}}catch(c){return console.error(`Error extracting metadata for ${n.path}:`,c),{update:null,processed:!1}}}metadataEqual(n,r){if(n===null&&r===null)return!0;if(n===null||r===null)return!1;let o=Object.keys(n),a=Object.keys(r);return o.length!==a.length?!1:o.every(i=>{let s=i;return n[s]===r[s]})}}});var HQ,xM,VQ=U(()=>{HQ=require("obsidian");Ud();zn();Sn();lM();xM=class extends Fg{constructor(){super(...arguments);this.emptyTagRetryCounts=new Map}getContentType(){return"tags"}getRelevantSettings(){return["showTags"]}shouldRegenerate(n,r){return!!(!r.showTags&&n.showTags||r.showTags&&!n.showTags)}async clearContent(n){await kt().batchClearAllFileContent("tags"),this.emptyTagRetryCounts.clear()}needsProcessing(n,r,o){if(!o.showTags||r.extension!=="md")return!1;let a=n!==null&&n.tagsMtime!==r.stat.mtime;return!n||n.tags===null||a}async processFile(n,r,o){if(!o.showTags)return{update:null,processed:!0};if(n.file.extension!=="md")return{update:null,processed:!0};try{let a=this.app.metadataCache.getFileCache(n.file);if(!a)return this.emptyTagRetryCounts.delete(n.path),{update:null,processed:!1};let i=(0,HQ.getAllTags)(a),s=sO(i),l=r!==null&&r.tagsMtime===0&&r.tags!==null&&r.tags.length>0&&s.length===0,c=r!==null&&r.tagsMtime===0&&r.tags===null&&s.length===0&&Date.now()-n.file.stat.mtime<=$t.contentProvider.metadataCache.recentFileWindowMs,u=l||c;if(u||this.emptyTagRetryCounts.delete(n.path),u){let p=this.emptyTagRetryCounts.get(n.path)??0;if(p<$t.contentProvider.metadataCache.emptyValueRetryLimit)return this.emptyTagRetryCounts.set(n.path,p+1),{update:null,processed:!1};this.emptyTagRetryCounts.delete(n.path)}return r&&this.tagsEqual(r.tags,s)?{update:null,processed:!0}:{update:{path:n.path,tags:s},processed:!0}}catch(a){return console.error(`Error extracting tags for ${n.path}:`,a),{update:null,processed:!1}}}tagsEqual(n,r){return n===r?!0:n===null||r===null||n.length!==r.length?!1:n.every((o,a)=>o===r[a])}}});function KQ(t){let{app:e,contentRegistryRef:n,pendingSyncTimeoutIdRef:r,clearCacheRebuildNotice:o}=t;(0,UQ.useEffect)(()=>{if(!n.current){let a=new Db(e),i=P_();n.current=new Rb,n.current.registerProvider(new Ob(e,a,i)),n.current.registerProvider(new Cb(e,a,i)),n.current.registerProvider(new IM(e)),n.current.registerProvider(new xM(e))}return()=>{o(),n.current&&(n.current.stopAllProcessing(),n.current=null),r.current!==null&&(typeof window<"u"&&window.clearTimeout(r.current),r.current=null)}},[e,o,n,r])}var UQ,WQ=U(()=>{UQ=ue(ze());x_();E_();B_();mM();_Q();VQ()});function gs(t){let e=[];fF(t)&&e.push("markdownPipeline"),t.showTags&&e.push("tags");let n=Qo(t);return(t.useFrontmatterMetadata||n.length>0)&&e.push("metadata"),e}function Ng(t){let e=new Set;gu(t).forEach(n=>e.add(n));for(let n of gs(t))(n==="tags"||n==="metadata")&&e.add(n);return Array.from(e)}function EM(t,e){if(t.length===0||e.length===0)return 0;if(e.includes("featureImage"))return t.length;if(!e.some(a=>a!=="featureImage"))return 0;let o=0;for(let a of t)qo(a.path)&&(o+=1);return o}function __(t,e){return(e??gs(t)).filter(r=>r==="markdownPipeline"?fF(t):r==="tags"?t.showTags:r==="metadata"?t.useFrontmatterMetadata||Qo(t).length>0:!1)}function yF(t,e){if(t===e)return!1;if(!t||!e)return(t?.length??0)!==(e?.length??0);if(t.length!==e.length)return!0;for(let n=0;n{Mr();dn();Nb()});function nSe(t){switch(t){case"markdownPipeline":return jQ;case"tags":return GQ;case"metadata":return qQ;default:return 0}}function H_(t){let e=0;for(let n of t)e|=nSe(n);return e}function rSe(t){let e=[];return(t&jQ)!==0&&e.push("markdownPipeline"),(t&GQ)!==0&&e.push("tags"),(t&qQ)!==0&&e.push("metadata"),e}function YQ(t){let{app:e,settings:n,latestSettingsRef:r,stoppedRef:o,contentRegistryRef:a,metadataWaitDisposersRef:i,pendingMetadataWaitPathsRef:s}=t,l=(0,_o.useCallback)(()=>{let N=i.current;if(N.size!==0){for(let O of N)try{O()}catch{}N.clear()}},[i]),c=(0,_o.useRef)(null),u=(0,_o.useRef)(new Map),p=(0,_o.useRef)(null),m=(0,_o.useRef)(null),g=(0,_o.useRef)(null),f=(0,_o.useRef)(null);(0,_o.useEffect)(()=>{let N=H_(gs(n));s.current.forEach((O,K)=>{let G=O&N;if(G===0){s.current.delete(K);return}G!==O&&s.current.set(K,G)})},[s,n]),(0,_o.useEffect)(()=>{gs(n).length>0||(l(),s.current.clear())},[l,s,n]);let h=(0,_o.useCallback)(()=>{f.current!==null&&(typeof window<"u"&&window.clearTimeout(f.current),f.current=null)},[]),b=(0,_o.useCallback)(()=>{if(f.current!==null||typeof window>"u")return;let N=1e4;f.current=window.setTimeout(()=>{f.current=null;let O=s.current.size;if(O===0)return;let K=[];for(let G of s.current.keys())if(K.push(G),K.length>=20)break;console.error("Notebook Navigator could not resolve metadata for all files.",{unresolved:K,totalPending:O,hint:"Reduce file size, fix invalid frontmatter, exclude the files, or disable metadata-dependent providers."})},N)},[s]),v=(0,_o.useCallback)(()=>{let N=c.current;N&&(s.current.size>0||p.current===null&&g.current===null&&(m.current||u.current.size>0||N()))},[p,c,s,u,m,g]),y=(0,_o.useCallback)(()=>{if(o.current){u.current.clear();return}let N=a.current;if(!N){u.current.clear();return}let O=r.current,K=H_(gs(O));if(K===0){u.current.clear();return}let G=u.current;u.current=new Map;for(let[X,L]of G){if(L.length===0)continue;let V=X&K;if(V===0)continue;let D=rSe(V);D.length!==0&&N.queueFilesForAllProviders(L,O,{include:D})}v()},[a,r,v,o]),S=(0,_o.useCallback)(()=>{if(p.current===null){if(typeof window>"u"){y();return}p.current=window.setTimeout(()=>{p.current=null,y()},0)}},[y]),w=(0,_o.useCallback)((N,O)=>{let K=u.current.get(O);K?K.push(N):u.current.set(O,[N]),S()},[S]),k=(0,_o.useCallback)(N=>{let O=s.current.get(N.path)??0;O===0||!e.metadataCache.getFileCache(N)||(s.current.delete(N.path),w(N,O),s.current.size===0&&h())},[e,h,s,w]),F=(0,_o.useCallback)(()=>{if(g.current!==null&&typeof window<"u"&&window.clearTimeout(g.current),g.current=null,o.current){m.current=null;return}let N=m.current;if(!N)return;let O=500;for(let K=0;K{g.current=null,F()},0):F();return}s.current.size===0&&(h(),v())},[e,h,v,s,w,o]),P=(0,_o.useCallback)(()=>{m.current||s.current.size!==0&&(m.current=s.current.keys(),typeof window<"u"?g.current=window.setTimeout(()=>{g.current=null,F()},0):F())},[s,F]),T=(0,_o.useCallback)(()=>{if(c.current)return;let N=null,O=null,K=!1,G=()=>{if(!K){if(K=!0,h(),p.current!==null&&typeof window<"u"&&window.clearTimeout(p.current),p.current=null,u.current.clear(),g.current!==null&&typeof window<"u"&&window.clearTimeout(g.current),g.current=null,m.current=null,N){try{e.metadataCache.offref(N)}catch{}N=null}if(O){try{e.metadataCache.offref(O)}catch{}O=null}i.current.delete(G),c.current=null}};N=e.metadataCache.on("resolved",()=>{h(),P(),s.current.size>0&&b()}),O=e.metadataCache.on("changed",X=>{!(X instanceof V_.TFile)||X.extension!=="md"||k(X)}),c.current=G,i.current.add(G),P(),s.current.size>0&&b()},[e,h,k,i,s,b,P]);return{queueMetadataContentWhenReady:(0,_o.useCallback)((N,O,K)=>{let G=K??r.current,X=__(G,O),L=H_(X);if(X.length===0||L===0)return;let V=[],D=new Set;for(let M of N)M.extension==="md"&&(D.has(M.path)||(D.add(M.path),V.push(M)));if(V.length===0)return;let A=Eb(V,X,G,{conservativeMetadata:!0,app:e});if(A.length===0)return;let _=[],E=0;for(let M of A){let C=s.current.get(M.path)??0;if((C&L)===L)continue;!!e.metadataCache.getFileCache(M)?_.push(M):(s.current.set(M.path,C|L),E+=1)}let R=M=>{if(M.length===0||o.current)return;let C=r.current,x=__(C,O);x.length===0||!a.current||a.current.queueFilesForAllProviders(M,C,{include:x})};if(_.length>0&&R(_),E>0){T();return}s.current.size>0&&!c.current&&T()},[e,a,T,r,c,s,o]),disposeMetadataWaitDisposers:l}}var _o,V_,jQ,GQ,qQ,$Q=U(()=>{_o=ue(ze()),V_=require("obsidian");Mb();ff();jQ=1,GQ=2,qQ=4});function oSe(t){return t==="preview"||t==="tags"||t==="featureImage"||t==="metadata"||t==="wordCount"||t==="characterCount"||t==="tasks"||t==="properties"}function aSe(t){if(!mt(t))return!1;let e=t.total;if(typeof e!="number"||!Number.isFinite(e)||e<0)return!1;let n=t.source;if(n!==void 0&&n!=="rebuild"&&n!=="settings")return!1;let r=t.types;return!(r!==void 0&&(!Array.isArray(r)||r.some(o=>!oSe(o))))}function bF(){let t=ye.get(ut.cacheRebuildNoticeKey);return aSe(t)?t:null}function Lb(t){ye.set(ut.cacheRebuildNoticeKey,t)}function Ep(){ye.remove(ut.cacheRebuildNoticeKey)}var MM=U(()=>{Ue();Jr();Zr()});function QQ(t){let{contentRegistryRef:e,pendingSyncTimeoutIdRef:n,rebuildFileCacheRef:r,cancelTagTreeRebuildDebouncer:o,cancelPropertyTreeRebuildDebouncer:a,disposeMetadataWaitDisposers:i,pendingMetadataWaitPathsRef:s,setFileData:l,tagTreeService:c,propertyTreeService:u,setIsStorageReady:p,isStorageReadyRef:m,hasBuiltInitialCacheRef:g,buildFileCacheFnRef:f,latestSettingsRef:h,stoppedRef:b,clearCacheRebuildNotice:v,startCacheRebuildNotice:y,getIndexableFiles:S}=t;return{rebuildCache:(0,XQ.useCallback)(async()=>{v(),Ep();let k=b.current;b.current=!0,e.current&&e.current.stopAllProcessing(),n.current!==null&&(typeof window<"u"&&window.clearTimeout(n.current),n.current=null);let F=r.current;if(F)try{F.cancel()}catch{}o(),a(),i(),s.current.clear();try{await kt().clearDatabase()}catch(N){throw console.error("Failed to clear database during cache rebuild:",N),b.current=k,N}let P=new Map,T=new Map;l({tagTree:P,propertyTree:T,tagged:0,untagged:0,hiddenRootTags:new Map}),c&&c.updateTagTree(P,0,0),u&&u.updatePropertyTree(T),cN(),m.current=!1,p(!1),g.current=!1;let I=f.current;if(!I){b.current=k,console.error("Rebuild cache requested before initialization completed.");return}b.current=!1;try{let N=h.current,O=Ng(N),K=EM(S(),O);K>0&&O.length>0&&Lb({total:K,source:"rebuild",types:O}),y(K,O),g.current=!0,await I(!0)}catch(N){throw v(),Ep(),g.current=!1,b.current=k,N}b.current=k},[f,a,o,v,e,i,S,g,m,h,s,n,r,l,p,y,b,u,c])}}var XQ,ZQ=U(()=>{XQ=ue(ze());zn();Ba();ff();MM()});function JQ(t){let{app:e,contentRegistryRef:n,queueMetadataContentWhenReady:r}=t,o=(0,U_.useCallback)((i,s)=>{let l=n.current;if(!l||i.length===0)return{markdownFiles:[]};let c=[],u=[];for(let p of i){if(p.extension==="md"){c.push(p);continue}Ip(p)&&u.push(p)}return s.showFeatureImage&&u.length>0&&l.queueFilesForAllProviders(u,s,{include:["fileThumbnails"]}),{markdownFiles:c}},[n]),a=(0,U_.useCallback)((i,s,l)=>{if(!n.current)return;let c=gs(l),u=Np(l);if(!(l.showFilePreview||l.showFeatureImage||u||c.length>0))return;let m=[];try{let f=i.filter(y=>y.extension==="md"),h=c.length>0?Eb(f,c,l,{conservativeMetadata:!0,app:e}):[],b=gM(i,l),v=new Map;for(let y of[...h,...b])v.set(y.path,y);if(m=Array.from(v.values()),m.length===0){let y=kt(),S=gu(l);c.includes("tags")&&S.push("tags"),c.includes("metadata")&&S.push("metadata");let w=y.getFilesNeedingAnyContent(S);w.size>0&&(m=s.filter(k=>w.has(k.path)))}}catch(f){console.error("Failed to check content needs from IndexedDB:",f)}if(m.length===0)return;let{markdownFiles:g}=o(m,l);c.length>0&&r(g,c,l)},[e,n,o,r]);return{queueIndexableFilesForContentGeneration:o,queueIndexableFilesNeedingContentGeneration:a}}var U_,e7=U(()=>{U_=ue(ze());zn();Mb();ff();Nb()});function t7(t){let{app:e,latestSettingsRef:n,showHiddenItems:r}=t,o=(0,K_.useCallback)(()=>cj(e,n.current,{showHiddenItems:r}),[e,n,r]),a=(0,K_.useCallback)(()=>uj(e,n.current,{showHiddenItems:!0}),[e,n]);return{getVisibleMarkdownFiles:o,getIndexableFiles:a}}var K_,n7=U(()=>{K_=ue(ze());Yr()});function o7(t){let{app:e,settings:n,showHiddenItems:r,hiddenFolders:o,hiddenTags:a,hiddenFileProperties:i,fileVisibility:s,profileId:l,isStorageReady:c,isStorageReadyRef:u,latestSettingsRef:p,stoppedRef:m,setFileData:g,getVisibleMarkdownFiles:f,tagTreeService:h}=t,b=(0,hs.useRef)(o),v=(0,hs.useRef)(a);(0,hs.useEffect)(()=>{b.current=o},[o]),(0,hs.useEffect)(()=>{v.current=a},[a]);let y=(0,hs.useRef)(null),S=(0,hs.useRef)(null),w=(0,hs.useRef)(!1),k=(0,hs.useCallback)(()=>{let T=kt(),I=r?[]:b.current,N=new Set(f().map(L=>L.path)),{tagTree:O,tagged:K,untagged:G,hiddenRootTags:X}=uN(T,I,N,v.current,r);return g(L=>({...L,tagTree:O,tagged:K,untagged:G,hiddenRootTags:X})),h&&h.updateTagTree(O,K,G),O},[f,g,r,h]);y.current=k;let F=(0,hs.useCallback)(T=>{let I=S.current;if(I){try{I.cancel()}catch{}T?.reset&&(S.current=null)}},[]),P=(0,hs.useCallback)(T=>{if(!(m.current||!u.current)&&p.current.showTags&&(S.current||(S.current=(0,r7.debounce)(()=>{m.current||!u.current||p.current.showTags&&y.current?.()},Lt.DEBOUNCE_TAG_TREE,!0)),S.current(),T?.flush))try{S.current.run()}catch{}},[u,p,m]);return(0,hs.useEffect)(()=>{if(!c){w.current=!1;return}if(!w.current){w.current=!0;return}n.showTags&&P()},[r,n.showTags,c,P,o,i,a,s,l]),(0,hs.useEffect)(()=>!c||!n.showTags?void 0:kt().onContentChange(N=>{if(m.current)return;let O=!1,K=!1,G=null,X=!1;for(let L of N)if(L.changes.tags!==void 0&&(O=!0,X||(G=e.workspace.getActiveFile()?.path??null,X=!0),G&&L.path===G)){K=!0;break}O&&P({flush:K})}),[e.workspace,c,n.showTags,P,m]),{rebuildTagTree:k,scheduleTagTreeRebuild:P,cancelTagTreeRebuildDebouncer:F}}var hs,r7,a7=U(()=>{hs=ue(ze()),r7=require("obsidian");jr();zn();Ba()});function W_(t){return Hv(t)}function iSe(t){let e=new Map,n=nn(t);return ep(n.propertyKeys).forEach(o=>{let a=o.key.trim(),i=Me(a);!a||!i||e.has(i)||e.set(i,a)}),e}function sSe(t,e){for(let[n,r]of e.entries()){if(t.has(n))continue;let o={id:Gn(n),kind:"key",key:n,valuePath:null,name:r,displayPath:r,children:new Map,notesWithValue:new Set};t.set(n,o),bO(o)}}function i7(t){let{app:e,settings:n,showHiddenItems:r,hiddenFolders:o,hiddenFileProperties:a,hiddenFileNames:i,hiddenFileTags:s,fileVisibility:l,profileId:c,isStorageReady:u,isStorageReadyRef:p,latestSettingsRef:m,stoppedRef:g,setFileData:f,getVisibleMarkdownFiles:h,propertyTreeService:b}=t,v=(0,Ka.useRef)(o),y=(0,Ka.useRef)(null),S=(0,Ka.useRef)(null),w=(0,Ka.useMemo)(()=>W_(n),[n]),k=(0,Ka.useRef)(!1),F=Oi(n),P=(0,Ka.useRef)(F),T=(0,Ka.useRef)(n.showProperties);(0,Ka.useEffect)(()=>{v.current=o},[o]);let I=(0,Ka.useCallback)(()=>{let G=new Map;return f(X=>({...X,propertyTree:G})),b?.updatePropertyTree(G),G},[b,f]),N=(0,Ka.useCallback)(()=>{let G=m.current,X=iSe(G),L=new Set(X.keys());if(!(G.showProperties&&X.size>0))return I();let D=kt(),A=r?[]:v.current,_=h().map(R=>R.path),E=Nj({forEachFile:R=>{_.forEach(M=>{let C=D.getFile(M);C&&R(M,C)})}},{excludedFolderPatterns:A,includedPropertyKeys:L});return sSe(E,X),f(R=>({...R,propertyTree:E})),b?.updatePropertyTree(E),E},[I,h,m,b,f,r]);y.current=N;let O=(0,Ka.useCallback)(G=>{let X=S.current;if(X){try{X.cancel()}catch{}G?.reset&&(S.current=null)}},[]),K=(0,Ka.useCallback)(G=>{let X=m.current;if(!(g.current||!p.current)){if(!W_(X)){I();return}if(S.current||(S.current=(0,zb.debounce)(()=>{if(!(g.current||!p.current)){if(!W_(m.current)){I();return}y.current?.()}},Lt.DEBOUNCE_TAG_TREE,!0)),S.current(),G?.flush)try{S.current.run()}catch{}}},[I,p,m,g]);return(0,Ka.useEffect)(()=>{let G=P.current,X=T.current,L=G!==F,V=X!==n.showProperties,D=()=>{P.current=F,T.current=n.showProperties};if(!u){k.current=!1,D();return}if(!k.current){k.current=!0,D();return}if(!w){I(),D();return}let A=h().length;if(L&&!V&&n.showProperties&&A>0){D();return}K(),D()},[r,u,w,K,I,h,o,a,i,s,l,c,F,n.showProperties]),(0,Ka.useEffect)(()=>{if(!u||!w)return;let G=!r&&s.length>0,X=!r&&a.length>0;return kt().onContentChange(D=>{if(g.current)return;let A=!1,_=!1,E=null,R=!1;for(let M of D){let C=M.changes.properties!==void 0,x=G&&M.changes.tags!==void 0,z=X&&M.metadataHiddenChanged===!0;if(!(!C&&!x&&!z)&&(A=!0,R||(E=e.workspace.getActiveFile()?.path??null,R=!0),E&&M.path===E)){_=!0;break}}if(A){let M=_&&D.every(C=>C.path===E);K({flush:M})}})},[e.workspace,a,s,u,w,K,r,g]),(0,Ka.useEffect)(()=>{if(!u||!w)return;let G=A=>A instanceof zb.TFile?A.extension==="md":A instanceof zb.TFolder,X=A=>{g.current||G(A)&&K()},L=A=>{g.current||G(A)&&K()},V=e.vault.on("delete",X),D=e.vault.on("rename",L);return()=>{e.vault.offref(V),e.vault.offref(D)}},[e.vault,u,w,K,g]),{rebuildPropertyTree:N,schedulePropertyTreeRebuild:K,cancelPropertyTreeRebuildDebouncer:O}}var Ka,zb,s7=U(()=>{Ka=ue(ze()),zb=require("obsidian");jr();zn();cn();Ot();dn()});async function SF(t,e){let n=[],r=[],o=[],a;if(e)a=e;else{let s=kt();a=new Map,s.forEachFile((l,c)=>{a.set(l,c)})}let i=new Set;for(let s of t){i.add(s.path);let l=a.get(s.path);l?s.stat.mtime!==l.mtime&&r.push(s):n.push(s)}for(let[s]of a)i.has(s)||o.push(s);return{toAdd:n,toUpdate:r,toRemove:o,cachedFiles:a}}var j_=U(()=>{zn()});function d7(t){let{app:e,api:n,settings:r,latestSettingsRef:o,stoppedRef:a,isFirstLoadRef:i,isIndexedDBReady:s,hasBuiltInitialCacheRef:l,setIsStorageReady:c,isStorageReadyRef:u,contentRegistryRef:p,pendingSyncTimeoutIdRef:m,pendingRenameDataRef:g,buildFileCacheFnRef:f,rebuildFileCacheRef:h,activeVaultEventRefsRef:b,activeMetadataEventRefRef:v,rebuildTagTree:y,scheduleTagTreeRebuild:S,cancelTagTreeRebuildDebouncer:w,rebuildPropertyTree:k,schedulePropertyTreeRebuild:F,cancelPropertyTreeRebuildDebouncer:P,startCacheRebuildNotice:T,getIndexableFiles:I,queueMetadataContentWhenReady:N,queueIndexableFilesForContentGeneration:O,queueIndexableFilesNeedingContentGeneration:K,disposeMetadataWaitDisposers:G}=t;(0,l7.useEffect)(()=>{let X=async(B,q=!1)=>{if(!a.current)if(i.current&&(i.current=!1),q){let ie=performance.now();try{Rr("storage.initialLoad.start",{indexableFileCount:B.length});let le=performance.now(),{toAdd:Te,toUpdate:ke,toRemove:Fe,cachedFiles:te}=await SF(B),pe=Math.round(performance.now()-le);Fe.length>0&&await eT(Fe),(Te.length>0||ke.length>0)&&await Iv([...Te,...ke],te,g.current);let ve=performance.now();y();let Ie=Math.round(performance.now()-ve),qe=performance.now();k();let xe=Math.round(performance.now()-qe);u.current=!0,c(!0),n?.[Ea].setStorageReady(!0);let Ce=gs(r),vt=Ce.length>0,Rt={metadataDependentTypes:Ce};if(p.current&&vt){let Ve=[],Ae=[],Ke=0;for(let Be of B){if(Be.extension==="md"){Ve.push(Be);continue}Ip(Be)&&Ae.push(Be)}if(Ce.length>0&&Ve.length>0&&N(Ve,Ce,r),r.showFeatureImage&&Ae.length>0){let Be=gM(Ae,r);Ke=Be.length,Be.length>0&&p.current.queueFilesForAllProviders(Be,r,{include:["fileThumbnails"]})}Rt.markdownFiles=Ve.length,Rt.fileThumbnailFiles=Ae.length,Rt.filesNeedingThumbnails=Ke}VA({status:"storageReady",indexableFileCount:B.length,cachedFileCount:te.size,diff:{toAdd:Te.length,toUpdate:ke.length,toRemove:Fe.length},queued:Rt,timingsMs:{diff:pe,tagTree:Ie,propertyTree:xe,initialLoad:Math.round(performance.now()-ie)}})}catch(le){Rr("storage.initialLoad.failed",{error:le}),VA({status:"initialLoadFailed",indexableFileCount:B.length,error:le}),console.error("Failed during initial load sequence:",le)}}else{m.current!==null&&(typeof window<"u"&&window.clearTimeout(m.current),m.current=null);let ie=async()=>{if(!a.current)try{let{toAdd:le,toUpdate:Te,toRemove:ke,cachedFiles:Fe}=await SF(B);if(Rr("storage.diff.processed",{indexableFileCount:B.length,cachedFileCount:Fe.size,toAdd:le.length,toUpdate:Te.length,toRemove:ke.length}),le.length>0||Te.length>0||ke.length>0){try{let te=[...le,...Te];te.length>0&&await Iv(te,Fe,g.current),ke.length>0&&(await eT(ke),r.showTags&&S(),Hv(r)&&F({flush:!0}))}catch(te){console.error("Failed to update IndexedDB cache:",te)}K([...le,...Te],B,r)}}catch(le){console.error("Error processing file cache diff:",le)}};typeof window<"u"?m.current=window.setTimeout(()=>{m.current=null,Q(()=>ie())},0):Q(()=>ie())}},L=async(B=!1)=>{if(a.current)return;let q=I();await X(q,B)};f.current=L;let V=h.current;if(V||(V=(0,Mp.debounce)(()=>{if(a.current)return;let B=f.current;B&&Q(()=>B(!1))},Lt.FILE_OPERATION_DELAY,!0),h.current=V),s&&!l.current){if(l.current=!0,kt().consumePendingRebuildNotice()){let q=o.current,ie=Ng(q),le=EM(I(),ie);T(le,ie)}Q(()=>L(!0))}let D=B=>{if(!(a.current||!p.current))try{let q=o.current,ie=gs(q),{markdownFiles:le}=O(B,q);ie.length>0&&N(le,ie,q)}catch(q){console.error("Failed to queue content refresh for files:",q)}},A=B=>{D([B])},_=new Map,E=null,R=!1,M=new Map,C=null,x=!1,z=()=>{E!==null&&(typeof window<"u"&&window.clearTimeout(E),E=null)},H=()=>{C!==null&&(typeof window<"u"&&window.clearTimeout(C),C=null)},Y=B=>{let q=new Map;for(let ie of B){let le=e.vault.getAbstractFileByPath(ie.path);le instanceof Mp.TFile&&q.set(le.path,le)}return Array.from(q.values())},ee=()=>{E=null,!R&&Q(async()=>{if(a.current){_.clear();return}let B=Array.from(_.values());if(_.clear(),B.length===0)return;let q=Y(B);if(q.length===0)return;let ie=!1;R=!0;try{let Te=kt().getFiles(q.map(ke=>ke.path));await Iv(q,Te,g.current),ie=!0}catch(le){console.error("Failed to record file changes on modify:",le)}finally{R=!1}ie&&D(q),_.size>0&&!a.current&&$()})},$=()=>{if(!(a.current||R||E!==null)){if(typeof window<"u"){E=window.setTimeout(ee,Lt.FILE_OPERATION_DELAY);return}ee()}},j=()=>{C=null,!x&&Q(async()=>{if(a.current){M.clear();return}let B=Array.from(M.values());if(M.clear(),B.length===0)return;let q=Y(B).filter(pe=>pe.extension==="md"&&!yh(pe.path));if(q.length===0)return;let ie=o.current,le=gs(ie),Te=gu(ie),Fe=le.length===1&&le[0]==="markdownPipeline"&&Te.length===1&&Te[0]==="tasks"?Eb(q,le,ie,{app:e,conservativeMetadata:!0}):q;if(Fe.length===0)return;let te=!0;x=!0;try{le.length>0&&await LW(Fe,le)}catch(pe){te=!1,console.error("Failed to mark files for regeneration:",pe)}finally{x=!1}te&&D(Fe),M.size>0&&!a.current&&J()})},J=()=>{if(!(a.current||x||C!==null)){if(typeof window<"u"){C=window.setTimeout(j,Lt.FILE_OPERATION_DELAY);return}j()}},re=B=>{oj(e,B)},oe=(B,q)=>{if(B instanceof Mp.TFile){re(q),re(B.path);try{let ie=kt(),le=ie.getFile(q);if(le){let Te=qo(q),ke=qo(B.path),Fe=ke?Te?le.previewStatus:"unprocessed":"none",te={...le,previewStatus:Fe,markdownPipelineMtime:Te&&ke?0:le.markdownPipelineMtime,metadataMtime:Te&&ke?0:le.metadataMtime};g.current.set(B.path,te),ie.seedMemoryFile(B.path,te),le.featureImageStatus==="has"&&ie.beginFeatureImageBlobMove(q,B.path),Te&&ke&&ie.beginPreviewTextMove(q,B.path),Q(async()=>{try{await ie.setFile(B.path,{...te,mtime:B.stat.mtime});let pe=[ie.moveFeatureImageBlob(q,B.path)];Te&&ke?pe.push(ie.movePreviewText(q,B.path)):Te&&pe.push(ie.deletePreviewText(q).catch(ve=>{console.error("Failed to delete preview text after rename:",{oldPath:q,newPath:B.path,error:ve})})),await Promise.all(pe),A(B)}finally{V?.()}});return}}catch(ie){console.error("Failed to capture renamed file data:",ie)}}V?.()},Z=B=>{if(a.current||!(B instanceof Mp.TFile)||yh(B.path))return;if(wN(e,B.path)){re(B.path);return}B.extension!=="md"&&!Ip(B)||(_.set(B.path,B),$())},ce=B=>{B instanceof Mp.TFile&&yh(B.path)||(V?.(),B instanceof Mp.TFile&&re(B.path))},ae=[e.vault.on("create",ce),e.vault.on("delete",ce),e.vault.on("rename",oe),e.vault.on("modify",Z)];b.current=ae;let se=B=>{a.current||!(B instanceof Mp.TFile)||B.extension!=="md"||yh(B.path)||gs(o.current).length!==0&&(M.set(B.path,B),J())},ne=e.metadataCache.on("changed",se);return v.current=ne,()=>{f.current=null,ae.forEach(B=>e.vault.offref(B)),e.metadataCache.offref(ne),b.current=null,v.current=null,m.current!==null&&(typeof window<"u"&&window.clearTimeout(m.current),m.current=null),z(),_.clear(),H(),M.clear(),w({reset:!0}),P({reset:!0}),G()}},[e,n,v,b,f,w,P,p,G,I,l,i,s,u,o,g,m,O,K,N,h,y,k,S,F,c,r,a,T])}var l7,Mp,c7=U(()=>{l7=ue(ze()),Mp=require("obsidian");jr();eg();j_();zn();ot();Mr();cn();gl();Mb();ff();Wu();Nb()});function u7(t){let{settings:e,stoppedRef:n,contentRegistryRef:r,hiddenFolders:o,hiddenFileProperties:a,hiddenFileNames:i,hiddenFileTags:s,scheduleTagTreeRebuild:l,schedulePropertyTreeRebuild:c,getIndexableFiles:u,pendingRenameDataRef:p,queueMetadataContentWhenReady:m,queueIndexableFilesForContentGeneration:g,queueIndexableFilesNeedingContentGeneration:f,startCacheRebuildNotice:h,clearCacheRebuildNotice:b}=t,v=(0,fs.useRef)(!1),y=(0,fs.useRef)(null),S=(0,fs.useRef)(null),w=(0,fs.useRef)(null),k=(0,fs.useRef)(null),F=(0,fs.useCallback)(()=>{w.current!==null&&(typeof window<"u"&&window.clearTimeout(w.current),w.current=null)},[]),P=(0,fs.useCallback)(()=>{F(),y.current=null},[F]),T=(0,fs.useCallback)(async(O,K)=>{let G=r.current;if(!G)return;let X=()=>{bF()?.source==="settings"&&(b(),Ep())},L=await G.handleSettingsChange(O,K),V=O.showFeatureImage!==K.showFeatureImage&&K.showFeatureImage;if((L.length>0||V)&&!n.current){let x=Ng(K);if(x.length>0){if(bF()?.source!=="rebuild"){let Y=kt().getFilesNeedingAnyContent(x).size;Y>0?(Lb({total:Y,source:"settings",types:x}),h(Y,x)):X()}}else X()}if(n.current||!r.current)return;let A=gs(K),_=new Set(L),E=A.filter(x=>_.has(x));if(V&&!E.includes("markdownPipeline")&&E.push("markdownPipeline"),!(E.length>0||V))return;let M=u();if(n.current||!r.current)return;let{markdownFiles:C}=g(M,K);E.length>0&&m(C,E,K)},[b,r,u,g,m,h,n]),I=(0,fs.useCallback)(async()=>{if(!v.current){v.current=!0;try{for(;!n.current;){let O=y.current;if(!O)return;y.current=null;let K=S.current;if(!K){S.current=O;continue}await T(K,O),S.current=O}}finally{v.current=!1}}},[T,n]),N=(0,fs.useCallback)((O,K)=>{if(!n.current&&(S.current||(S.current=O),y.current=K,!v.current)){if(F(),typeof window>"u"){Q(()=>I());return}w.current=window.setTimeout(()=>{w.current=null,Q(()=>I())},Lt.DEBOUNCE_CONTENT)}},[F,I,n]);return(0,fs.useEffect)(()=>{let O=k.current;if(!O){k.current=e;return}let K=r.current,G=K?.getAllRelevantSettings()??[],X=!K||G.some(x=>O[x]!==e[x]),L=kv(O)!==kv(e);(X||L)&&N(O,e);let V=ti(O),D=yF(V,o),A=Qo(O),_=yF(A,a),E=Kc(O),R=yF(E,i),M=Wc(O),C=yF(M,s);D||_?Q(async()=>{try{let x=u(),{toAdd:z,toUpdate:H,toRemove:Y,cachedFiles:ee}=await SF(x);Y.length>0&&await eT(Y),(z.length>0||H.length>0)&&await Iv([...z,...H],ee,p.current),e.showTags&&l(),c(),f([...z,...H],x,e)}catch(x){console.error("Error resyncing cache after exclusion changes:",x)}}):(R||C)&&(e.showTags&&l(),c()),k.current=e},[r,u,i,s,a,o,p,f,N,l,c,e]),(0,fs.useEffect)(()=>()=>{P()},[P]),{resetPendingSettingsChanges:P}}var fs,p7=U(()=>{fs=ue(ze());jr();j_();zn();ot();dn();ed();MM();ff()});var g7=Mc(RM=>{"use strict";var lSe=ze(),dSe=Symbol.for("react.element"),cSe=Symbol.for("react.fragment"),uSe=Object.prototype.hasOwnProperty,pSe=lSe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,mSe={key:!0,ref:!0,__self:!0,__source:!0};function m7(t,e,n){var r,o={},a=null,i=null;n!==void 0&&(a=""+n),e.key!==void 0&&(a=""+e.key),e.ref!==void 0&&(i=e.ref);for(r in e)uSe.call(e,r)&&!mSe.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{$$typeof:dSe,type:t,key:a,ref:i,props:o,_owner:pSe.current}}RM.Fragment=cSe;RM.jsx=m7;RM.jsxs=m7});var Ge=Mc((c5e,h7)=>{"use strict";h7.exports=g7()});function DM({children:t,plugin:e}){let n=f7.Platform.isMobile,r=(0,Bb.useMemo)(()=>{let o=e.fileSystemOps;if(!o)throw new Error("FileSystemOperations not initialized");return{app:e.app,plugin:e,isMobile:n,fileSystemOps:o,metadataService:e.metadataService,tagOperations:e.tagOperations,propertyOperations:e.propertyOperations,tagTreeService:e.tagTreeService,propertyTreeService:e.propertyTreeService,commandQueue:e.commandQueue,omnisearchService:e.omnisearchService,releaseCheckService:e.releaseCheckService}},[e,n]);return(0,y7.jsx)(v7.Provider,{value:r,children:t})}function gt(){let t=(0,Bb.useContext)(v7);if(!t)throw new Error("useServices must be used within a ServicesProvider");return t}function li(){let{fileSystemOps:t}=gt();return t}function Ho(){let{metadataService:t}=gt();if(!t)throw new Error("MetadataService not initialized");return t}function _b(){let{tagOperations:t}=gt();if(!t)throw new Error("TagOperations not initialized");return t}function AM(){let{propertyOperations:t}=gt();if(!t)throw new Error("PropertyOperations not initialized");return t}function qs(){let{commandQueue:t}=gt();if(!t)throw new Error("CommandQueue not initialized");return t}var Bb,f7,y7,v7,mn=U(()=>{Bb=ue(ze()),f7=require("obsidian"),y7=ue(Ge()),v7=(0,Bb.createContext)(null)});function b7(t,e){if(Mi(t))return"excalidraw.md";let n=t.extension.toLowerCase();if(n==="md"){let r=e?.getFileCache(t);if(fC(r?.frontmatter))return"excalidraw.md"}return n}function G_(t){let e=[];return Object.entries(t).forEach(([n,r])=>{if(typeof n!="string"||typeof r!="string")return;let o=Rs(n),a=Zd(r.trim())??"";o.trim().length===0||!a||e.push({needle:o,iconId:a})}),e.sort((n,r)=>{let o=r.needle.length-n.needle.length;return o!==0?o:n.needle.localeCompare(r.needle)}),e}function hSe(t,e){let n=Rs(t);if(!n)return null;for(let r of e)if(!(!r.needle||!r.iconId)&&n.includes(r.needle))return r.iconId;return null}function S7(t,e,n=vv,r){if(!t)return null;let o=mh(n)&&r&&r[n]!==!0?null:lK(n),a=e[t]??o?.[t]??gSe[t];return a?Zd(a)??a:mw(t)?"image":null}function OM(t,e,n={}){let r=n.customIconId;if(r)return r;if(e.showFilenameMatchIcons){let i=n.fileNameNeedles??G_(e.fileNameIconMap),s=n.fileNameForMatch??t.basename,l=hSe(s,i);if(l)return l}let o=n.allowCategoryIcons??e.showCategoryIcons;if(o){let i=b7(t,n.metadataCache),s=S7(i,e.fileTypeIconMap,e.fileTypeIconPreset,e.externalIconProviders);if(s)return s}return n.isExternalFile?"external-link":(n.fallbackMode??(o?"file":"none"))==="file"?"file":null}function w7(t,e,n,r,o=vv,a){if(r)return r;let i=b7(t,n);return S7(i,e,o,a)??"file"}var gSe,LM=U(()=>{rs();Mr();Si();Ot();Sv();gSe=Object.freeze(Object.assign(Object.create(null),{md:"file-text","excalidraw.md":"pencil",canvas:"layout-grid",base:"database",pdf:"file-text"}))});function BM({children:t,plugin:e}){let[n,r]=(0,vo.useState)(0),o=(0,vo.useRef)(null),a=(0,vo.useRef)(null),i=(0,vo.useRef)(null),s=(0,vo.useRef)(null),l=(0,vo.useCallback)(async m=>{m(e.settings),await e.saveSettingsAndUpdate()},[e]),c=vo.default.useMemo(()=>{let m=De(e.settings.tagColors),g=De(e.settings.tagBackgroundColors),f=De(e.settings.propertyColors),h=De(e.settings.propertyBackgroundColors),b=De(e.settings.virtualFolderColors),v=De(e.settings.virtualFolderBackgroundColors),y=De(e.settings.tagIcons,Ln),S=De(e.settings.propertyIcons,Ln),w=De(e.settings.calendarMonthHighlights,Ln),k=e.settings.interfaceIcons,F=a.current,P=F&&F.raw===k?F.sanitized:De(k,Ln);(!F||F.raw!==k)&&(a.current={raw:k,sanitized:P});let T=Ou(e.settings.pinnedNotes),I=i.current,N=I&&bSe(I,T)?I:T;i.current=N;let O=uv(e.settings.collapsedPinnedContexts),K=s.current,G=K&&SSe(K,O)?K:O;s.current=G;let X={...e.settings,dualPaneOrientation:e.getDualPaneOrientation(),tagColors:m,tagBackgroundColors:g,propertyColors:f,propertyBackgroundColors:h,virtualFolderColors:b,virtualFolderBackgroundColors:v,tagIcons:y,propertyIcons:S,calendarMonthHighlights:w,interfaceIcons:P,folderAppearances:q_(e.settings.folderAppearances),tagAppearances:q_(e.settings.tagAppearances),propertyAppearances:q_(e.settings.propertyAppearances),pinnedNotes:N,collapsedPinnedContexts:G};return Array.isArray(e.settings.vaultProfiles)&&(X.vaultProfiles=e.settings.vaultProfiles.map(L=>({...L,hiddenFolders:Array.isArray(L.hiddenFolders)?[...L.hiddenFolders]:[],hiddenFileProperties:Array.isArray(L.hiddenFileProperties)?[...L.hiddenFileProperties]:[],hiddenFileNames:Array.isArray(L.hiddenFileNames)?[...L.hiddenFileNames]:[],hiddenTags:Array.isArray(L.hiddenTags)?[...L.hiddenTags]:[],hiddenFileTags:Array.isArray(L.hiddenFileTags)?[...L.hiddenFileTags]:[],propertyKeys:ep(L.propertyKeys),shortcuts:Yc(L.shortcuts),navRainbow:Bj(L.navRainbow)}))),X},[e,n]),u=vo.default.useMemo(()=>({fileNameIconNeedles:c.showFilenameMatchIcons?G_(c.fileNameIconMap):[]}),[c.showFilenameMatchIcons,c.fileNameIconMap]);(0,vo.useEffect)(()=>{let m=`settings-provider-${Date.now()}`,g=()=>{r(f=>f+1)};return e.registerSettingsUpdateListener(m,g),()=>{e.unregisterSettingsUpdateListener(m)}},[e]);let p=vo.default.useMemo(()=>{let m=nn(c),g=o.current,f=g?.profile.id===m.id,h=go(g?.profile.hiddenFolders??[],m.hiddenFolders),b=go(g?.profile.hiddenFileProperties??[],m.hiddenFileProperties),v=go(g?.profile.hiddenFileNames??[],m.hiddenFileNames),y=go(g?.profile.hiddenTags??[],m.hiddenTags),S=go(g?.profile.hiddenFileTags??[],m.hiddenFileTags),w=g?.profile.fileVisibility===m.fileVisibility,k=m.navigationBanner??null,F=g?.navigationBanner===k,P=g?.profile.periodicNotesFolder===m.periodicNotesFolder,T=g?.profile.name===m.name,I=vSe(g?.profile.propertyKeys,m.propertyKeys),N=ySe(g?.profile.shortcuts,m.shortcuts),O=zN(g?.profile.navRainbow,m.navRainbow);if(f&&h&&b&&v&&y&&S&&w&&F&&P&&T&&I&&N&&O&&g)return g;let K={profile:m,hiddenFolders:m.hiddenFolders,hiddenFileProperties:m.hiddenFileProperties,hiddenFileNames:m.hiddenFileNames,hiddenTags:m.hiddenTags,hiddenFileTags:m.hiddenFileTags,fileVisibility:m.fileVisibility,propertyKeys:I&&g?g.propertyKeys:m.propertyKeys,navigationBanner:k};return o.current=K,K},[c]);return(0,wF.jsx)(k7.Provider,{value:c,children:(0,wF.jsx)(C7.Provider,{value:u,children:(0,wF.jsx)(P7.Provider,{value:p,children:(0,wF.jsx)(F7.Provider,{value:l,children:t})})})})}function pt(){let t=(0,vo.useContext)(k7);if(t===null)throw new Error("useSettingsState must be used within a SettingsProvider");return t}function Ys(){let t=(0,vo.useContext)(F7);if(!t)throw new Error("useSettingsUpdate must be used within a SettingsProvider");return t}function _M(){let t=(0,vo.useContext)(C7);if(!t)throw new Error("useSettingsDerived must be used within a SettingsProvider");return t}function $s(){let t=(0,vo.useContext)(P7);if(!t)throw new Error("useActiveProfile must be used within a SettingsProvider");return t}var vo,wF,k7,F7,P7,C7,T7,zM,fSe,vSe,ySe,q_,bSe,SSe,on=U(()=>{vo=ue(ze());Ia();dn();Ot();Sl();LM();wF=ue(Ge()),k7=(0,vo.createContext)(null),F7=(0,vo.createContext)(null),P7=(0,vo.createContext)(null),C7=(0,vo.createContext)(null),T7=t=>t&&t.length>0?t:void 0,zM=(t,e)=>T7(t)===T7(e),fSe=(t,e)=>vT(t)===vT(e),vSe=(t,e)=>{let n=Array.isArray(t)?t:[],r=Array.isArray(e)?e:[];if(n.length!==r.length)return!1;for(let o=0;o{if(t===e)return!0;let n=Array.isArray(t)?t:[],r=Array.isArray(e)?e:[];if(n.length!==r.length)return!1;for(let o=0;o{if(!t)return Object.create(null);let e=Object.create(null);return Object.entries(t).forEach(([n,r])=>{e[n]={...r}}),e},bSe=(t,e)=>{if(!t)return!1;let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let o of r){let a=t[o],i=e[o];if(!a||a.folder!==i.folder||a.tag!==i.tag||a.property!==i.property)return!1}return!0},SSe=(t,e)=>{if(!t)return!1;let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;let o=t,a=e;for(let i of r)if(o[i]!==a[i])return!1;return!0}});function x7({children:t,plugin:e}){let[n,r]=(0,vs.useState)(0),o=(0,vs.useRef)("");o.current||(o.current=`ux-preferences-${Date.now()}-${Math.random().toString(16).slice(2)}`),(0,vs.useEffect)(()=>{let s=()=>{r(l=>l+1)};return e.registerUXPreferencesListener(o.current,s),()=>{e.unregisterUXPreferencesListener(o.current)}},[e]);let a=(0,vs.useMemo)(()=>e.getUXPreferences(),[e,n]),i=(0,vs.useMemo)(()=>({setSearchActive:s=>{e.setSearchActive(s)},setIncludeDescendantNotes:s=>{e.setIncludeDescendantNotes(s)},toggleIncludeDescendantNotes:()=>{e.toggleIncludeDescendantNotes()},setShowHiddenItems:s=>{e.setShowHiddenItems(s)},toggleShowHiddenItems:()=>{e.toggleShowHiddenItems()},setPinShortcuts:s=>{e.setPinShortcuts(s)},setShowCalendar:s=>{e.setShowCalendar(s)},toggleShowCalendar:()=>{e.toggleShowCalendar()}}),[e]);return(0,Y_.jsx)(N7.Provider,{value:a,children:(0,Y_.jsx)(I7.Provider,{value:i,children:t})})}function Xt(){let t=(0,vs.useContext)(N7);if(!t)throw new Error("useUXPreferences must be used within a UXPreferencesProvider");return t}function wd(){let t=(0,vs.useContext)(I7);if(!t)throw new Error("useUXPreferenceActions must be used within a UXPreferencesProvider");return t}var vs,Y_,N7,I7,Tr=U(()=>{vs=ue(ze()),Y_=ue(Ge()),N7=(0,vs.createContext)(null),I7=(0,vs.createContext)(null)});function wSe(){let t=Hb>0;$_.forEach(e=>{e(t)})}function E7(t){let e=Hb>0;Hb=Math.max(0,Hb+t),e!==Hb>0&&wSe()}function Ig(){return Hb>0}function R7(t){return $_.add(t),t(Ig()),()=>{$_.delete(t)}}function D7({app:t,api:e,children:n}){let r=pt(),{hiddenFolders:o,hiddenFileProperties:a,hiddenFileNames:i,hiddenTags:s,hiddenFileTags:l,fileVisibility:c,profile:u}=$s(),m=Xt().showHiddenItems,{tagTreeService:g,propertyTreeService:f}=gt(),[h,b]=(0,Hn.useState)({tagTree:new Map,propertyTree:new Map,tagged:0,untagged:0,hiddenRootTags:new Map}),v=(0,Hn.useRef)(null),y=(0,Hn.useRef)(!0),S=(0,Hn.useRef)(null),w=(0,Hn.useRef)(!1),k=(0,Hn.useRef)(new Set),F=(0,Hn.useRef)(new Map),P=(0,Hn.useRef)(new Map),T=(0,Hn.useRef)(r);T.current=r;let I=(0,Hn.useRef)(null),N=(0,Hn.useRef)(null),O=(0,Hn.useRef)(null),K=(0,Hn.useRef)(null),[G,X]=(0,Hn.useState)(!1),L=vQ(),V=(0,Hn.useRef)(!1);V.current=G;let D=(0,Hn.useRef)(!1),{clearCacheRebuildNotice:A,startCacheRebuildNotice:_}=hQ({app:t,stoppedRef:w,onRebuildComplete:Ep}),E=(0,Hn.useRef)(!1);(0,Hn.useEffect)(()=>(E7(1),()=>{E7(-1)}),[]);let{getVisibleMarkdownFiles:R,getIndexableFiles:M}=t7({app:t,latestSettingsRef:T,showHiddenItems:m}),{rebuildTagTree:C,scheduleTagTreeRebuild:x,cancelTagTreeRebuildDebouncer:z}=o7({app:t,settings:r,showHiddenItems:m,hiddenFolders:o,hiddenTags:s,hiddenFileProperties:a,fileVisibility:c,profileId:u.id,isStorageReady:G,isStorageReadyRef:V,latestSettingsRef:T,stoppedRef:w,setFileData:b,getVisibleMarkdownFiles:R,tagTreeService:g??null}),{rebuildPropertyTree:H,schedulePropertyTreeRebuild:Y,cancelPropertyTreeRebuildDebouncer:ee}=i7({app:t,settings:r,showHiddenItems:m,hiddenFolders:o,hiddenFileProperties:a,hiddenFileNames:i,hiddenFileTags:l,fileVisibility:c,profileId:u.id,isStorageReady:G,isStorageReadyRef:V,latestSettingsRef:T,stoppedRef:w,setFileData:b,getVisibleMarkdownFiles:R,propertyTreeService:f??null}),{queueMetadataContentWhenReady:$,disposeMetadataWaitDisposers:j}=YQ({app:t,settings:r,latestSettingsRef:T,stoppedRef:w,contentRegistryRef:v,metadataWaitDisposersRef:k,pendingMetadataWaitPathsRef:F}),{queueIndexableFilesForContentGeneration:J,queueIndexableFilesNeedingContentGeneration:re}=JQ({app:t,contentRegistryRef:v,queueMetadataContentWhenReady:$}),{rebuildCache:oe}=QQ({contentRegistryRef:v,pendingSyncTimeoutIdRef:S,rebuildFileCacheRef:O,cancelTagTreeRebuildDebouncer:z,cancelPropertyTreeRebuildDebouncer:ee,disposeMetadataWaitDisposers:j,pendingMetadataWaitPathsRef:F,setFileData:b,tagTreeService:g??null,propertyTreeService:f??null,setIsStorageReady:X,isStorageReadyRef:V,hasBuiltInitialCacheRef:D,buildFileCacheFnRef:K,latestSettingsRef:T,stoppedRef:w,clearCacheRebuildNotice:A,startCacheRebuildNotice:_,getIndexableFiles:M});(0,Hn.useEffect)(()=>{if(!G||E.current)return;E.current=!0;let ke=bF();if(!ke)return;let Fe=Ng(T.current);if(Fe.length===0){Ep();return}let te=kt().getFilesNeedingAnyContent(Fe).size;if(te<=0){Ep();return}let pe=Math.max(ke.total,te);pe!==ke.total&&Lb({...ke,total:pe}),_(pe,Fe)},[G,_]);let Z=(0,Hn.useCallback)(ke=>{if(r.useFrontmatterMetadata){let Fe=Vy(t,ke,r);if(Fe.fn)return Fe.fn}return bm(ke,void 0,r)},[t,r]),ce=(0,Hn.useCallback)(ke=>{let Fe=r.useFrontmatterMetadata?Vy(t,ke,r):null;return M7(ke,Fe)},[t,r]),ae=(0,Hn.useCallback)(ke=>ce(ke).created,[ce]),se=(0,Hn.useCallback)(ke=>ce(ke).modified,[ce]),ne=(0,Hn.useCallback)(ke=>{let Fe=r.useFrontmatterMetadata?Vy(t,ke,r):null,te=M7(ke,Fe);return{name:Fe?.fn||bm(ke,void 0,r),created:te.created,modified:te.modified}},[t,r]),B=(0,Hn.useCallback)(ke=>kt().hasPreview(ke),[]),q=(0,Hn.useCallback)(async ke=>{if(w.current)return;let Fe=T.current;if(Fe.showFeatureImage&&!(ke.extension!=="md"&&!Ip(ke))){try{await kt().clearFileContent(ke.path,"featureImage")}catch(te){console.error("Failed to clear feature image content:",te);return}if(!(w.current||!v.current))try{ke.extension==="md"?$([ke],["markdownPipeline"],Fe):v.current.queueFilesForAllProviders([ke],Fe,{include:["fileThumbnails"]})}catch(te){console.error("Failed to queue feature image regeneration for file:",ke.path,te)}}},[$]),ie=(0,Hn.useMemo)(()=>({fileData:h,getFileDisplayName:Z,getFileCreatedTime:ae,getFileModifiedTime:se,getFileTimestamps:ce,getFileMetadata:ne,getDB:kt,getFile:Ie=>kt().getFile(Ie),getFiles:Ie=>kt().getFiles(Ie),hasPreview:B,isStorageReady:G,getTagTree:()=>h.tagTree,getPropertyTree:()=>h.propertyTree,findTagInTree:Ie=>Li(h.tagTree,Ie),getAllTagPaths:()=>{let Ie=[];for(let qe of h.tagTree.values()){let xe=ml(qe);Ie.push(...xe)}return Ie},getTagDisplayPath:Ie=>Li(h.tagTree,Ie)?.displayPath??Ie,rebuildCache:oe,regenerateFeatureImageForFile:q}),[h,Z,ae,se,ce,ne,B,G,oe,q]);KQ({app:t,contentRegistryRef:v,pendingSyncTimeoutIdRef:S,clearCacheRebuildNotice:A});let{resetPendingSettingsChanges:le}=u7({settings:r,stoppedRef:w,contentRegistryRef:v,hiddenFolders:o,hiddenFileProperties:a,hiddenFileNames:i,hiddenFileTags:l,scheduleTagTreeRebuild:x,schedulePropertyTreeRebuild:Y,getIndexableFiles:M,pendingRenameDataRef:P,queueMetadataContentWhenReady:$,queueIndexableFilesForContentGeneration:J,queueIndexableFilesNeedingContentGeneration:re,startCacheRebuildNotice:_,clearCacheRebuildNotice:A});d7({app:t,api:e,settings:r,latestSettingsRef:T,stoppedRef:w,isFirstLoadRef:y,isIndexedDBReady:L,hasBuiltInitialCacheRef:D,setIsStorageReady:X,isStorageReadyRef:V,contentRegistryRef:v,pendingSyncTimeoutIdRef:S,pendingRenameDataRef:P,buildFileCacheFnRef:K,rebuildFileCacheRef:O,activeVaultEventRefsRef:I,activeMetadataEventRefRef:N,rebuildTagTree:C,rebuildPropertyTree:H,scheduleTagTreeRebuild:x,schedulePropertyTreeRebuild:Y,cancelTagTreeRebuildDebouncer:z,cancelPropertyTreeRebuildDebouncer:ee,startCacheRebuildNotice:_,getIndexableFiles:M,queueMetadataContentWhenReady:$,queueIndexableFilesForContentGeneration:J,queueIndexableFilesNeedingContentGeneration:re,disposeMetadataWaitDisposers:j});let Te=(0,Hn.useMemo)(()=>({...ie,stopAllProcessing:()=>{w.current=!0,le(),v.current&&v.current.stopAllProcessing(),S.current!==null&&(typeof window<"u"&&window.clearTimeout(S.current),S.current=null);try{I.current&&(I.current.forEach(ke=>t.vault.offref(ke)),I.current=null),N.current&&(t.metadataCache.offref(N.current),N.current=null)}catch{}try{O.current?.cancel()}catch{}O.current=null,z({reset:!0}),ee({reset:!0}),j(),F.current.clear()}}),[z,ee,le,ie,j,t.vault,t.metadataCache]);return(0,O7.jsx)(X_.Provider,{value:Te,children:n})}function xo(){let t=(0,Hn.useContext)(X_);if(!t)throw new Error("useFileCache must be used within StorageProvider");return t}function A7(){return(0,Hn.useContext)(X_)}var Hn,O7,X_,Hb,$_,M7,Xi=U(()=>{Hn=ue(ze());rk();fQ();yQ();WQ();$Q();ZQ();e7();n7();a7();s7();c7();p7();Nv();zn();rs();Ba();mn();on();Tr();ff();MM();Mb();O7=ue(Ge()),X_=(0,Hn.createContext)(null),Hb=0,$_=new Set;M7=(t,e)=>({created:e?.fc!==void 0&&e.fc!==br.FIELD_NOT_CONFIGURED&&e.fc!==br.PARSE_FAILED?e.fc:t.stat.ctime,modified:e?.fm!==void 0&&e.fm!==br.FIELD_NOT_CONFIGURED&&e.fm!==br.PARSE_FAILED?e.fm:t.stat.mtime})});function TSe(t){return t.startView==="navigation"?"navigation":"files"}function kSe(t,e){switch(e.type){case"SET_FOCUSED_PANE":return{...t,focusedPane:e.pane};case"SET_SINGLE_PANE_VIEW":return{...t,currentSinglePaneView:e.view};case"SET_PANE_WIDTH":return t.paneWidth===e.width?t:{...t,paneWidth:e.width};case"SET_CONTAINER_WIDTH":return t.containerWidth===e.width?t:{...t,containerWidth:e.width};case"SET_DUAL_PANE":return t.dualPanePreference===e.value?t:{...t,dualPanePreference:e.value};case"SET_PIN_SHORTCUTS":return{...t,pinShortcuts:e.value};default:return t}}function B7({children:t,isMobile:e}){let{plugin:n}=gt(),r=pt(),o=Xt(),{setPinShortcuts:a}=wd(),i=()=>{let g=ye.get(ut.navigationPaneWidthKey)??Ld.defaultWidth,f=TSe(n.settings);return{focusedPane:f,currentSinglePaneView:f,paneWidth:Math.max(Ld.minWidth,g),containerWidth:null,dualPanePreference:n.useDualPane(),dualPane:!1,singlePane:!1,effectiveDualPaneOrientation:n.getDualPaneOrientation(),pinShortcuts:o.pinShortcuts}},[s,l]=(0,Wa.useReducer)(kSe,void 0,i),c=(0,Wa.useRef)(s.pinShortcuts);(0,Wa.useEffect)(()=>{c.current=s.pinShortcuts},[s.pinShortcuts]);let u=(0,Wa.useMemo)(()=>{let m=!e&&s.dualPanePreference,g=r.dualPaneOrientation;if(m&&r.dualPaneOrientation==="horizontal"&&r.narrowSidebarLayout!=="none"&&s.containerWidth!==null){let f=r.narrowSidebarTriggerMode==="customWidth"?r.narrowSidebarCustomWidth:s.paneWidth+EU.minWidth;s.containerWidth>=f||(r.narrowSidebarLayout==="singlePane"?m=!1:r.narrowSidebarLayout==="vertical"&&(g="vertical"))}return{...s,dualPane:m,singlePane:!m,effectiveDualPaneOrientation:g,pinShortcuts:s.pinShortcuts}},[s,e,r.dualPaneOrientation,r.narrowSidebarCustomWidth,r.narrowSidebarLayout,r.narrowSidebarTriggerMode]),p=(0,Wa.useCallback)(m=>{if(m.type==="SET_PIN_SHORTCUTS"){let g=m.value;g!==c.current&&(c.current=g,a(g))}l(m)},[l,a]);return(0,Wa.useEffect)(()=>{let m=`ui-state-${Date.now()}`,g=()=>{l({type:"SET_DUAL_PANE",value:n.useDualPane()})};return n.registerSettingsUpdateListener(m,g),()=>{n.unregisterSettingsUpdateListener(m)}},[n]),(0,Wa.useEffect)(()=>{c.current!==o.pinShortcuts&&(c.current=o.pinShortcuts,l({type:"SET_PIN_SHORTCUTS",value:o.pinShortcuts}))},[l,o.pinShortcuts]),(0,Wa.useEffect)(()=>{if(!e)return;let m=s.currentSinglePaneView,g=s.focusedPane;m==="navigation"&&g!=="navigation"?l({type:"SET_FOCUSED_PANE",pane:"navigation"}):m==="files"&&g==="navigation"&&l({type:"SET_FOCUSED_PANE",pane:"files"})},[e,s.currentSinglePaneView,s.focusedPane]),(0,Q_.jsx)(L7.Provider,{value:u,children:(0,Q_.jsx)(z7.Provider,{value:p,children:t})})}function Yn(){let t=(0,Wa.useContext)(L7);if(!t)throw new Error("useUIState must be used within UIStateProvider");return t}function Vr(){let t=(0,Wa.useContext)(z7);if(!t)throw new Error("useUIDispatch must be used within UIStateProvider");return t}var Wa,Q_,L7,z7,pa=U(()=>{Wa=ue(ze());Ue();Ue();Jr();mn();on();Tr();Q_=ue(Ge());L7=(0,Wa.createContext)(null),z7=(0,Wa.createContext)(null)});function _7(t){if(!Array.isArray(t))return[];let e=[],n=new Set;return t.forEach(r=>{if(typeof r!="string")return;let o=r.trim();if(!o||n.has(o))return;let a=o.replace(";group=none;",";group=custom;");n.has(a)||(n.add(a),e.push(a))}),e}function TF(t){return encodeURIComponent(t)}function H7({selectionType:t,selectedFolderPath:e,selectedTag:n,selectedProperty:r,groupingMode:o,groupId:a}){let i;return t===W.TAG&&n?i=`tag:${TF(n)}`:t===W.PROPERTY&&r?i=`property:${TF(r)}`:i=`folder:${TF(e??"/")}`,`scope=${i};group=${TF(o)};id=${TF(a)}`}var Z_=U(()=>{Ue()});function J_(t,e){let n=!1;if(t.forEach(o=>{e.has(o)||(n=!0)}),!n)return null;let r=new Set;return t.forEach(o=>{e.has(o)&&r.add(o)}),r}function FSe(t,e){switch(e.type){case"SET_EXPANDED_FOLDERS":return{...t,expandedFolders:e.folders};case"SET_EXPANDED_TAGS":return{...t,expandedTags:e.tags};case"SET_EXPANDED_PROPERTIES":return{...t,expandedProperties:e.properties};case"SET_EXPANDED_VIRTUAL_FOLDERS":return{...t,expandedVirtualFolders:e.folders};case"TOGGLE_FOLDER_EXPANDED":{let n=new Set(t.expandedFolders);return n.has(e.folderPath)?n.delete(e.folderPath):n.add(e.folderPath),{...t,expandedFolders:n}}case"TOGGLE_TAG_EXPANDED":{let n=new Set(t.expandedTags);return n.has(e.tagPath)?n.delete(e.tagPath):n.add(e.tagPath),{...t,expandedTags:n}}case"TOGGLE_PROPERTY_EXPANDED":{let n=new Set(t.expandedProperties);return n.has(e.propertyNodeId)?n.delete(e.propertyNodeId):n.add(e.propertyNodeId),{...t,expandedProperties:n}}case"TOGGLE_VIRTUAL_FOLDER_EXPANDED":{let n=new Set(t.expandedVirtualFolders);return n.has(e.folderId)?n.delete(e.folderId):n.add(e.folderId),{...t,expandedVirtualFolders:n}}case"TOGGLE_LIST_GROUP_COLLAPSED":{let n=new Set(t.collapsedListGroups);return n.has(e.collapseKey)?n.delete(e.collapseKey):n.add(e.collapseKey),{...t,collapsedListGroups:n}}case"EXPAND_LIST_GROUP":{if(!t.collapsedListGroups.has(e.collapseKey))return t;let n=new Set(t.collapsedListGroups);return n.delete(e.collapseKey),{...t,collapsedListGroups:n}}case"EXPAND_FOLDERS":{let n=new Set(t.expandedFolders);return e.folderPaths.forEach(r=>n.add(r)),{...t,expandedFolders:n}}case"EXPAND_TAGS":{let n=new Set(t.expandedTags);return e.tagPaths.forEach(r=>n.add(r)),{...t,expandedTags:n}}case"EXPAND_PROPERTIES":{let n=new Set(t.expandedProperties);return e.propertyNodeIds.forEach(r=>n.add(r)),{...t,expandedProperties:n}}case"TOGGLE_DESCENDANT_FOLDERS":{let n=new Set(t.expandedFolders);return e.descendantPaths.forEach(r=>{e.expand?n.add(r):n.delete(r)}),{...t,expandedFolders:n}}case"TOGGLE_DESCENDANT_TAGS":{let n=new Set(t.expandedTags);return e.descendantPaths.forEach(r=>{e.expand?n.add(r):n.delete(r)}),{...t,expandedTags:n}}case"TOGGLE_DESCENDANT_PROPERTIES":{let n=new Set(t.expandedProperties);return e.descendantNodeIds.forEach(r=>{e.expand?n.add(r):n.delete(r)}),{...t,expandedProperties:n}}case"CLEANUP_DELETED_FOLDERS":{let n=J_(t.expandedFolders,e.existingPaths);return n?{...t,expandedFolders:n}:t}case"CLEANUP_DELETED_TAGS":{let n=J_(t.expandedTags,e.existingTags);return n?{...t,expandedTags:n}:t}case"CLEANUP_DELETED_PROPERTIES":{let n=J_(t.expandedProperties,e.existingPropertyNodeIds);return n?{...t,expandedProperties:n}:t}default:return t}}function K7({children:t}){let e=()=>{let o=ye.get(ut.expandedFoldersKey),a=ye.get(ut.expandedTagsKey),i=ye.get(ut.expandedPropertiesKey),s=ye.get(ut.expandedVirtualFoldersKey),l=ye.get(ut.collapsedListGroupsKey),c=new Set(o||[]),u=new Set(a||[]),p=new Set(i||[]),m=new Set(s||[_n,Oe]),g=new Set(_7(l));return{expandedFolders:c,expandedTags:u,expandedProperties:p,expandedVirtualFolders:m,collapsedListGroups:g}},[n,r]=(0,Xs.useReducer)(FSe,void 0,e);return(0,Xs.useEffect)(()=>{ye.set(ut.expandedFoldersKey,Array.from(n.expandedFolders))},[n.expandedFolders]),(0,Xs.useEffect)(()=>{ye.set(ut.expandedTagsKey,Array.from(n.expandedTags))},[n.expandedTags]),(0,Xs.useEffect)(()=>{ye.set(ut.expandedPropertiesKey,Array.from(n.expandedProperties))},[n.expandedProperties]),(0,Xs.useEffect)(()=>{ye.set(ut.expandedVirtualFoldersKey,Array.from(n.expandedVirtualFolders))},[n.expandedVirtualFolders]),(0,Xs.useEffect)(()=>{ye.set(ut.collapsedListGroupsKey,Array.from(n.collapsedListGroups))},[n.collapsedListGroups]),(0,eH.jsx)(V7.Provider,{value:n,children:(0,eH.jsx)(U7.Provider,{value:r,children:t})})}function ta(){let t=(0,Xs.useContext)(V7);if(!t)throw new Error("useExpansionState must be used within ExpansionProvider");return t}function Ra(){let t=(0,Xs.useContext)(U7);if(!t)throw new Error("useExpansionDispatch must be used within ExpansionProvider");return t}var Xs,eH,V7,U7,Qs=U(()=>{Xs=ue(ze());Ue();Jr();Z_();eH=ue(Ge()),V7=(0,Xs.createContext)(null),U7=(0,Xs.createContext)(null)});function G7(t){let e=new Set;return t&&e.add(t.path),e}function tH(t){return!t||t===Oe?t:Gt(t)??t}function kF(t,e){return e<=0||t<0?0:t>=e?e-1:t}function nH(t,e){return!t||!e?!1:t.type===e.type&&t.value===e.value}function rH(t){if(t.selectionType==="folder"&&t.selectedFolder)return{type:"folder",value:t.selectedFolder.path};if(t.selectionType==="tag"&&t.selectedTag){let e=Ze(t.selectedTag);return e?{type:"tag",value:e}:null}if(t.selectionType==="property"&&t.selectedProperty){let e=tH(t.selectedProperty);return e?{type:"property",value:e}:null}return null}function j7(t,e){let n=t.slice(),r=kF(e,n.length);return n.length===0?{navigationHistory:n,navigationHistoryIndex:0}:(r>0&&nH(n[r],n[r-1])&&(n.splice(r,1),r-=1),r0?t.navigationHistory.slice():[e],a=kF(t.navigationHistoryIndex,o.length);if(typeof r=="number"){let c=kF(r,o.length);return o[c]=e,j7(o,c)}let i=n??"record";if(i==="skip")return HM(o,a);if(i==="replace")return o[a]=e,j7(o,a);let s=o[a];if(nH(s,e))return HM(o,a);let l=o.slice(0,a+1);return l.push(e),HM(l,l.length-1)}function hc(t,e){let n=rH({selectionType:e.selectionType,selectedFolder:e.selectedFolder,selectedTag:e.selectedTag,selectedProperty:e.selectedProperty}),{navigationHistory:r,navigationHistoryIndex:o}=PSe(t,n,e.historyBehavior,e.historyIndex);return{...t,selectionType:e.selectionType,selectedFolder:e.selectedFolder,selectedTag:e.selectedTag,selectedProperty:e.selectedProperty,selectedFiles:G7(e.selectedFile),selectedFile:e.selectedFile,anchorIndex:null,lastMovementDirection:null,isRevealOperation:e.isRevealOperation,isFolderChangeWithAutoSelect:e.isFolderChangeWithAutoSelect,isKeyboardNavigation:e.isKeyboardNavigation,isFolderNavigation:e.isFolderNavigation,revealSource:e.revealSource,navigationHistory:r,navigationHistoryIndex:o}}function VM(t,e){let n=t.values().next();if(n.done)return null;let r=n.value;return r?e.vault.getFileByPath(r)??null:null}function fc(t,e){return e.selectedFile?e.selectedFile:VM(e.selectedFiles,t)}function q7(t,e,n){switch(e.type){case"SET_SELECTED_FOLDER":return hc(t,{selectionType:"folder",selectedFolder:e.folder,selectedTag:null,selectedProperty:null,selectedFile:e.autoSelectedFile??null,isRevealOperation:!1,isFolderChangeWithAutoSelect:e.autoSelectedFile!==void 0&&e.autoSelectedFile!==null,isKeyboardNavigation:!1,isFolderNavigation:!0,revealSource:e.source??null,historyBehavior:e.historyBehavior,historyIndex:e.historyIndex});case"SET_SELECTED_TAG":return hc(t,{selectionType:"tag",selectedFolder:null,selectedTag:Ze(e.tag),selectedProperty:null,selectedFile:e.autoSelectedFile??null,isRevealOperation:!1,isFolderChangeWithAutoSelect:e.autoSelectedFile!==void 0&&e.autoSelectedFile!==null,isKeyboardNavigation:!1,isFolderNavigation:!0,revealSource:e.source??null,historyBehavior:e.historyBehavior,historyIndex:e.historyIndex});case"SET_SELECTED_PROPERTY":return hc(t,{selectionType:"property",selectedFolder:null,selectedTag:null,selectedProperty:tH(e.nodeId),selectedFile:e.autoSelectedFile??null,isRevealOperation:!1,isFolderChangeWithAutoSelect:e.autoSelectedFile!==void 0&&e.autoSelectedFile!==null,isKeyboardNavigation:!1,isFolderNavigation:!0,revealSource:e.source??null,historyBehavior:e.historyBehavior,historyIndex:e.historyIndex});case"SET_SELECTED_FILE":return{...t,selectedFiles:G7(e.file),selectedFile:e.file,anchorIndex:null,lastMovementDirection:null,isRevealOperation:!1,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:!1,revealSource:null};case"SET_SELECTION_TYPE":return{...t,selectionType:e.selectionType,isRevealOperation:!1,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,revealSource:null};case"CLEAR_SELECTION":return{...t,selectedFolder:null,selectedTag:null,selectedProperty:null,selectedFiles:new Set,selectedFile:null,anchorIndex:null,lastMovementDirection:null,isRevealOperation:!1,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,revealSource:null};case"REVEAL_FILE":{if(!e.file.parent)return t;let r=e.targetTag===void 0?void 0:Ze(e.targetTag),o=e.source??(e.isManualReveal?"manual":"auto"),a=e.historyBehavior??(o==="startup"?"replace":"record"),i=e.targetFolder??null;return e.isManualReveal?hc(t,{selectionType:"folder",selectedFolder:i??e.file.parent,selectedTag:null,selectedProperty:null,selectedFile:e.file,isRevealOperation:!0,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:t.isFolderNavigation,revealSource:o,historyBehavior:a,historyIndex:e.historyIndex}):r!==void 0?r?hc(t,{selectionType:"tag",selectedFolder:null,selectedTag:r,selectedProperty:null,selectedFile:e.file,isRevealOperation:!0,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:t.isFolderNavigation,revealSource:o,historyBehavior:a,historyIndex:e.historyIndex}):hc(t,{selectionType:"folder",selectedFolder:i??(e.preserveFolder&&t.selectedFolder?t.selectedFolder:e.file.parent),selectedTag:null,selectedProperty:null,selectedFile:e.file,isRevealOperation:!0,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:t.isFolderNavigation,revealSource:o,historyBehavior:a,historyIndex:e.historyIndex}):e.targetProperty!==void 0?e.targetProperty?hc(t,{selectionType:"property",selectedFolder:null,selectedTag:null,selectedProperty:tH(e.targetProperty),selectedFile:e.file,isRevealOperation:!0,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:t.isFolderNavigation,revealSource:o,historyBehavior:a,historyIndex:e.historyIndex}):hc(t,{selectionType:"folder",selectedFolder:i??(e.preserveFolder&&t.selectedFolder?t.selectedFolder:e.file.parent),selectedTag:null,selectedProperty:null,selectedFile:e.file,isRevealOperation:!0,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:t.isFolderNavigation,revealSource:o,historyBehavior:a,historyIndex:e.historyIndex}):t.selectionType==="tag"&&t.selectedTag?hc(t,{selectionType:"tag",selectedFolder:null,selectedTag:t.selectedTag,selectedProperty:null,selectedFile:e.file,isRevealOperation:!0,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:t.isFolderNavigation,revealSource:o,historyBehavior:a,historyIndex:e.historyIndex}):t.selectionType==="property"&&t.selectedProperty?hc(t,{selectionType:"property",selectedFolder:null,selectedTag:null,selectedProperty:t.selectedProperty,selectedFile:e.file,isRevealOperation:!0,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:t.isFolderNavigation,revealSource:o,historyBehavior:a,historyIndex:e.historyIndex}):hc(t,{selectionType:"folder",selectedFolder:i??(e.preserveFolder&&t.selectedFolder?t.selectedFolder:e.file.parent),selectedTag:null,selectedProperty:null,selectedFile:e.file,isRevealOperation:!0,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:t.isFolderNavigation,revealSource:o,historyBehavior:a,historyIndex:e.historyIndex})}case"CLEAR_REVEAL_OPERATION":return t.isRevealOperation?{...t,isRevealOperation:!1}:t;case"CLEANUP_DELETED_FOLDER":return!t.selectedFolder||t.selectedFolder.path!==e.deletedPath?t:{...t,selectedFolder:null,selectedFiles:new Set,selectedFile:null,anchorIndex:null,lastMovementDirection:null,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,revealSource:null};case"CLEANUP_DELETED_FILE":{if(!(t.selectedFiles.has(e.deletedPath)||t.selectedFile?.path===e.deletedPath)&&!e.nextFileToSelect)return t;let o=new Set(t.selectedFiles);o.delete(e.deletedPath);let a=t.anchorIndex;return t.anchorIndex!==null&&o.size===0&&(a=null),e.nextFileToSelect&&o.add(e.nextFileToSelect.path),{...t,selectedFiles:o,selectedFile:e.nextFileToSelect??(n?VM(o,n):null),anchorIndex:a,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,revealSource:null}}case"TOGGLE_FILE_SELECTION":{let r=new Set(t.selectedFiles);return r.has(e.file.path)?r.delete(e.file.path):r.add(e.file.path),{...t,selectedFiles:r,selectedFile:t.selectedFile,anchorIndex:e.anchorIndex!==void 0?e.anchorIndex:t.anchorIndex,lastMovementDirection:null}}case"EXTEND_SELECTION":{let{toIndex:r,allFiles:o}=e;if(t.anchorIndex===null)return t;let a=Math.min(t.anchorIndex,r),i=Math.max(t.anchorIndex,r),s=new Set;for(let l=a;l<=i&&l{r.add(o.path)}),{...t,selectedFiles:r,selectedFile:e.selectedFile,anchorIndex:null,lastMovementDirection:null}}case"APPLY_FILE_SELECTION":return{...t,selectedFiles:new Set(e.selectedFiles),selectedFile:e.selectedFile,anchorIndex:e.anchorIndex!==void 0?e.anchorIndex:t.anchorIndex,lastMovementDirection:e.lastMovementDirection!==void 0?e.lastMovementDirection:null};case"SET_ANCHOR_INDEX":return{...t,anchorIndex:e.index};case"SET_MOVEMENT_DIRECTION":return{...t,lastMovementDirection:e.direction};case"UPDATE_CURRENT_FILE":return{...t,selectedFile:e.file};case"TOGGLE_WITH_CURSOR":{let r=new Set(t.selectedFiles);return r.has(e.file.path)?r.delete(e.file.path):r.add(e.file.path),{...t,selectedFiles:r,selectedFile:e.file,anchorIndex:e.anchorIndex!==void 0?e.anchorIndex:t.anchorIndex,lastMovementDirection:null}}case"SET_KEYBOARD_NAVIGATION":return{...t,isKeyboardNavigation:e.isKeyboardNavigation};case"SET_FOLDER_CHANGE_WITH_AUTO_SELECT":return{...t,isFolderChangeWithAutoSelect:e.isFolderChangeWithAutoSelect};case"SET_FOLDER_NAVIGATION":return{...t,isFolderNavigation:e.isFolderNavigation};case"UPDATE_FILE_PATH":{let r=new Set(t.selectedFiles);r.has(e.oldPath)&&(r.delete(e.oldPath),r.add(e.newPath));let o=t.selectedFile;return t.selectedFile&&t.selectedFile.path===e.oldPath&&n&&(o=n.vault.getFileByPath(e.newPath)??o),{...t,selectedFiles:r,selectedFile:o}}default:return t}}var W7,FF=U(()=>{Ue();cn();Sn();W7=100});function UM(t,e,n){try{return ye.get(t)??e}catch(r){return console.error(n,r),e}}function CSe(t,e){try{let n=ye.get(t);return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}catch(n){return console.error(e,n),[]}}function PF(t,e,n){try{if(e===null){ye.remove(t);return}if(Array.isArray(e)&&e.length===0){ye.remove(t);return}ye.set(t,e)}catch(r){console.error(n,r)}}function Y7({app:t,settings:e}){let n=t.vault,r=UM(ut.selectedFolderKey,null,"Failed to load selected folder from localStorage:"),o=UM(ut.selectedTagKey,null,"Failed to load selected tag from localStorage:"),a=UM(ut.selectedFileKey,null,"Failed to load selected file from localStorage:"),i=CSe(ut.selectedFilesKey,"Failed to load selected files from localStorage:"),s=null;r&&(s=n.getFolderByPath(r));let l=null;if(e.showProperties&&(l=jv(UM(ut.selectedPropertyKey,null,"Failed to load selected property from localStorage:"))),l&&!Uv(e,l)){l=null;try{ye.remove(ut.selectedPropertyKey)}catch(b){console.error("Failed to clear invalid property selection from localStorage:",b)}}let c=null,u=new Set;if(i.forEach(b=>{let v=n.getFileByPath(b);v&&(u.add(v.path),c||(c=v))}),u.size===0&&a){let b=n.getFileByPath(a);b&&(c=b,u.add(b.path))}let p=Ze(o),m="folder";l?(m="property",s=null):p?(m="tag",s=null):s||(s=n.getRoot());let g=rH({selectionType:m,selectedFolder:s,selectedTag:l?null:p,selectedProperty:l});return{selectionType:m,selectedFolder:s,selectedTag:l?null:p,selectedProperty:l,selectedFiles:u,selectedFile:c,anchorIndex:null,lastMovementDirection:null,isRevealOperation:!1,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:!1,revealSource:null,navigationHistory:g?[g]:[],navigationHistoryIndex:0}}function $7(t){let e=(0,Vo.useRef)(t);return e.current=t,e}function X7({app:t,dispatch:e,includeDescendantNotes:n,isMobile:r,propertyTreeService:o,settings:a,showHiddenItems:i,tagTreeService:s}){let l=(0,Vo.useCallback)(c=>{if(!r&&a.autoSelectFirstFileOnFocusChange&&c.length>0)return c[0];let u=t.workspace.getActiveFile();return u&&c.some(p=>p.path===u.path)?u:null},[t.workspace,r,a.autoSelectFirstFileOnFocusChange]);return(0,Vo.useCallback)(c=>{let u={includeDescendantNotes:n,showHiddenItems:i};if(c.type==="SET_SELECTED_FOLDER"&&c.autoSelectedFile===void 0){if(c.folder){let p=Uy(c.folder,a,u,t);e({...c,autoSelectedFile:l(p)})}else e({...c,autoSelectedFile:null});return}if(c.type==="SET_SELECTED_TAG"&&c.autoSelectedFile===void 0){if(c.tag){let p=fx(c.tag,a,u,t,s);e({...c,autoSelectedFile:l(p)})}else e({...c,autoSelectedFile:null});return}if(c.type==="SET_SELECTED_PROPERTY"&&c.autoSelectedFile===void 0){let p=vx(c.nodeId,a,u,t,o);e({...c,autoSelectedFile:l(p)});return}if(c.type==="CLEANUP_DELETED_FILE"&&r){e({...c,nextFileToSelect:null});return}e(c)},[t,e,n,r,o,l,a,i,s])}function Q7({app:t,dispatch:e,enhancedDispatch:n,onFileRename:r,onFileRenameUnsubscribe:o,pluginSettings:a,propertyFeatureEnabled:i,propertyOperations:s,propertyTreeService:l,state:c,stateRef:u,tagOperations:p,tagTreeService:m}){let g=(0,Vo.useRef)(null),f=(0,Vo.useCallback)((b,v)=>{if(!i||b!=="property"||!v){g.current=null;return}if(g.current!==null&&g.current!==v&&(g.current=null),!hT(a,v)){g.current=null,a.showProperties?e({type:"SET_SELECTED_PROPERTY",nodeId:Oe,historyBehavior:"replace"}):e({type:"SET_SELECTED_FOLDER",folder:t.vault.getRoot(),historyBehavior:"replace"});return}if(v===Oe||!l){g.current=null;return}if(!l.hasNodes())return;let y=l.resolveSelectionNodeId(v);if(y===Oe){if(g.current===v)return;g.current=null,a.showProperties?e({type:"SET_SELECTED_PROPERTY",nodeId:Oe,historyBehavior:"replace"}):e({type:"SET_SELECTED_FOLDER",folder:t.vault.getRoot(),historyBehavior:"replace"});return}g.current===v&&(g.current=null),y!==v&&e({type:"SET_SELECTED_PROPERTY",nodeId:y,historyBehavior:"replace"})},[t.vault,e,a,i,l]);(0,Vo.useEffect)(()=>{if(l)return l.addTreeUpdateListener(()=>{let b=u.current;f(b.selectionType,b.selectedProperty)})},[l,f,u]),(0,Vo.useEffect)(()=>{if(m)return m.addTreeUpdateListener(()=>{let b=u.current,v=b.selectedTag;if(b.selectionType!=="tag"||!v||v===zt||v===bt||!m.hasNodes())return;let y=m.resolveSelectionTagPath(v);if(!y){n({type:"SET_SELECTED_FOLDER",folder:t.vault.getRoot(),historyBehavior:"replace"});return}y!==v&&n({type:"SET_SELECTED_TAG",tag:y,historyBehavior:"replace"})})},[t.vault,n,u,m]),(0,Vo.useEffect)(()=>{if(!p)return;let b=w=>{let k=u.current.selectedTag;if(!(!k||!w.oldCanonicalPath||!w.newCanonicalPath)&&(k===w.oldCanonicalPath||k.startsWith(`${w.oldCanonicalPath}/`))){let F=k.slice(w.oldCanonicalPath.length),P=F?`${w.newCanonicalPath}${F}`:w.newCanonicalPath;n({type:"SET_SELECTED_TAG",tag:P,historyBehavior:"replace"})}},v=w=>{let k=u.current.selectedTag;if(!(!k||!w.canonicalPath)&&(k===w.canonicalPath||k.startsWith(`${w.canonicalPath}/`))){let F=w.canonicalPath.includes("/")?w.canonicalPath.slice(0,w.canonicalPath.lastIndexOf("/")):"";n(F?{type:"SET_SELECTED_TAG",tag:F,historyBehavior:"replace"}:{type:"CLEAR_SELECTION"})}},y=p.addTagRenameListener(b),S=p.addTagDeleteListener(v);return()=>{y(),S()}},[n,u,p]),(0,Vo.useEffect)(()=>{if(!s)return;let b=w=>{let k=u.current,F=k.selectedProperty;if(!F||k.selectionType!=="property"||F===Oe)return;let P=Gt(F);if(!P)return;let T=kn(P);if(!T||T.key!==w.oldKey)return;let I=T.valuePath?sa(w.newKey,T.valuePath):Gn(w.newKey);g.current=I,n({type:"SET_SELECTED_PROPERTY",nodeId:I,historyBehavior:"replace"})},v=w=>{let k=u.current,F=k.selectedProperty;if(!F||k.selectionType!=="property"||F===Oe)return;let P=Gt(F);if(!P)return;let T=kn(P);!T||T.key!==w.key||(g.current=null,a.showProperties?n({type:"SET_SELECTED_PROPERTY",nodeId:Oe,historyBehavior:"replace"}):n({type:"SET_SELECTED_FOLDER",folder:t.vault.getRoot(),historyBehavior:"replace"}))},y=s.addPropertyKeyRenameListener(b),S=s.addPropertyKeyDeleteListener(v);return()=>{y(),S()}},[t.vault,n,a.showProperties,s,u]),(0,Vo.useEffect)(()=>{let b=a.showProperties&&c.selectionType==="property"&&c.selectedProperty===Oe;!i&&c.selectionType==="property"&&!b&&(a.showProperties?e({type:"SET_SELECTED_PROPERTY",nodeId:Oe,historyBehavior:"replace"}):e({type:"SET_SELECTED_FOLDER",folder:t.vault.getRoot(),historyBehavior:"replace"}))},[t.vault,e,a.showProperties,i,c.selectedProperty,c.selectionType]);let h=(0,Vo.useMemo)(()=>{let b=Array.from(Cm(a,"navigation"));return b.length===0?"":(b.sort(),b.join(""))},[a]);(0,Vo.useEffect)(()=>{f(c.selectionType,c.selectedProperty)},[h,f,a.showProperties,c.selectedProperty,c.selectionType]),(0,Vo.useEffect)(()=>{let b=`selection-context-${Math.random().toString(36).substring(2,11)}`;return r?.(b,(y,S)=>{e({type:"UPDATE_FILE_PATH",oldPath:y,newPath:S})}),()=>{o?.(b)}},[e,r,o])}function Z7({api:t,app:e,state:n}){(0,Vo.useEffect)(()=>{PF(ut.selectedFolderKey,n.selectedFolder?n.selectedFolder.path:null,"Failed to save selected folder to localStorage:")},[n.selectedFolder]),(0,Vo.useEffect)(()=>{PF(ut.selectedTagKey,n.selectedTag,"Failed to save selected tag to localStorage:")},[n.selectedTag]),(0,Vo.useEffect)(()=>{PF(ut.selectedPropertyKey,n.selectedProperty,"Failed to save selected property to localStorage:")},[n.selectedProperty]),(0,Vo.useEffect)(()=>{let r=n.selectedFile??VM(n.selectedFiles,e);PF(ut.selectedFileKey,r?r.path:null,"Failed to save selected file to localStorage:")},[e,n.selectedFile,n.selectedFiles]),(0,Vo.useEffect)(()=>{PF(ut.selectedFilesKey,n.selectedFiles.size>0?Array.from(n.selectedFiles):null,"Failed to save selected files to localStorage:"),t?.[Ea].selection.updateFileState(n.selectedFiles,n.selectedFile)},[t,n.selectedFile,n.selectedFiles]),(0,Vo.useEffect)(()=>{t?.[Ea].selection.updateNavigationState(n.selectedFolder,n.selectedTag,n.selectedProperty)},[t,n.selectedFolder,n.selectedProperty,n.selectedTag])}var Vo,J7=U(()=>{Vo=ue(ze());ak();Jr();eg();Ue();cn();Sn();dn();FF();FF()});function l9({children:t,app:e,api:n,tagTreeService:r,propertyTreeService:o,onFileRename:a,onFileRenameUnsubscribe:i,isMobile:s}){let l=pt(),c=Xt(),u=Hv(l),{tagOperations:p,propertyOperations:m}=gt(),[g,f]=(0,mr.useReducer)((T,I)=>q7(T,I,e),void 0,()=>Y7({app:e,settings:l})),h=$7(g),b=(0,mr.useRef)(new Set),v=(0,mr.useMemo)(()=>({subscribe:T=>(b.current.add(T),()=>{b.current.delete(T)})}),[]),y=X7({app:e,dispatch:f,includeDescendantNotes:c.includeDescendantNotes,isMobile:s,propertyTreeService:o,settings:l,showHiddenItems:c.showHiddenItems,tagTreeService:r});Q7({app:e,dispatch:f,enhancedDispatch:y,onFileRename:a,onFileRenameUnsubscribe:i,pluginSettings:l,propertyFeatureEnabled:u,propertyOperations:m,propertyTreeService:o,state:g,stateRef:h,tagOperations:p,tagTreeService:r}),Z7({api:n,app:e,state:g}),(0,mr.useEffect)(()=>{b.current.forEach(T=>{T(g)})},[g]);let S=(0,mr.useMemo)(()=>({selectionType:g.selectionType,selectedFolder:g.selectedFolder,selectedTag:g.selectedTag,selectedProperty:g.selectedProperty}),[g.selectedFolder,g.selectedProperty,g.selectedTag,g.selectionType]),w=(0,mr.useMemo)(()=>({selectedFiles:g.selectedFiles,selectedFile:g.selectedFile,anchorIndex:g.anchorIndex,lastMovementDirection:g.lastMovementDirection}),[g.anchorIndex,g.lastMovementDirection,g.selectedFile,g.selectedFiles]),k=(0,mr.useMemo)(()=>({isRevealOperation:g.isRevealOperation,isFolderChangeWithAutoSelect:g.isFolderChangeWithAutoSelect,isKeyboardNavigation:g.isKeyboardNavigation,isFolderNavigation:g.isFolderNavigation,revealSource:g.revealSource}),[g.isFolderChangeWithAutoSelect,g.isFolderNavigation,g.isKeyboardNavigation,g.isRevealOperation,g.revealSource]),F=(0,mr.useMemo)(()=>({isRevealOperation:g.isRevealOperation,revealSource:g.revealSource}),[g.isRevealOperation,g.revealSource]),P=(0,mr.useMemo)(()=>({navigationHistory:g.navigationHistory,navigationHistoryIndex:g.navigationHistoryIndex}),[g.navigationHistory,g.navigationHistoryIndex]);return(0,Rp.jsx)(e9.Provider,{value:S,children:(0,Rp.jsx)(t9.Provider,{value:w,children:(0,Rp.jsx)(n9.Provider,{value:k,children:(0,Rp.jsx)(r9.Provider,{value:F,children:(0,Rp.jsx)(o9.Provider,{value:P,children:(0,Rp.jsx)(a9.Provider,{value:h,children:(0,Rp.jsx)(i9.Provider,{value:v,children:(0,Rp.jsx)(s9.Provider,{value:y,children:t})})})})})})})})}function Ml(){let t=(0,mr.useContext)(e9);if(!t)throw new Error("useNavigationSelection must be used within SelectionProvider");return t}function CF(){let t=(0,mr.useContext)(t9);if(!t)throw new Error("useFileSelection must be used within SelectionProvider");return t}function NSe(){let t=(0,mr.useContext)(n9);if(!t)throw new Error("useSelectionFlags must be used within SelectionProvider");return t}function d9(){let t=(0,mr.useContext)(r9);if(!t)throw new Error("useSelectionReveal must be used within SelectionProvider");return t}function c9(){let t=(0,mr.useContext)(a9);if(!t)throw new Error("useSelectionStateRefValue must be used within SelectionProvider");return t}function u9(){let t=(0,mr.useContext)(i9);if(!t)throw new Error("useSelectionStateSubscription must be used within SelectionProvider");return t}function ISe(){let t=(0,mr.useContext)(o9);if(!t)throw new Error("useSelectionHistory must be used within SelectionProvider");return t}function ar(){let t=Ml(),e=CF(),n=NSe(),r=ISe();return(0,mr.useMemo)(()=>({...t,...e,...n,...r}),[e,t,n,r])}function gr(){let t=(0,mr.useContext)(s9);if(!t)throw new Error("useSelectionDispatch must be used within SelectionProvider");return t}var mr,Rp,e9,t9,n9,r9,o9,a9,i9,s9,Ur=U(()=>{mr=ue(ze());on();Tr();mn();cn();J7();FF();FF();Rp=ue(Ge()),e9=(0,mr.createContext)(null),t9=(0,mr.createContext)(null),n9=(0,mr.createContext)(null),r9=(0,mr.createContext)(null),o9=(0,mr.createContext)(null),a9=(0,mr.createContext)(null),i9=(0,mr.createContext)(null),s9=(0,mr.createContext)(null)});function NF(t){return t instanceof WM.TFolder}function KM(t){return t instanceof WM.TFile}function m9({children:t}){let e=pt(),n=Ys(),{app:r}=gt(),[o,a]=(0,Cn.useState)(0),i=(0,Cn.useRef)(new Map),s=(0,Cn.useMemo)(()=>TT(e.vaultProfiles,e.vaultProfile),[e.vaultProfiles,e.vaultProfile]),l=s.id,c=(0,Cn.useMemo)(()=>s.shortcuts??[],[s]),u=(0,Cn.useMemo)(()=>e.vaultProfiles.map(C=>{let x=C.shortcuts??[];return{id:C.id,shortcuts:x,fingerprint:oH(x)}}),[e.vaultProfiles]);(0,Cn.useEffect)(()=>{let C=i.current,x=new Set(u.map(ee=>ee.id));if(C.forEach((ee,$)=>{x.has($)||C.delete($)}),u.length===0)return;let z=u.filter(ee=>C.get(ee.id)!==ee.fingerprint);if(z.length===0)return;let H=z.filter(ee=>ee.shortcuts.some($=>{if(Co($)){let j=Ze($.tagPath);return j!==null&&j!==$.tagPath}if(la($)){let j=Zu($.nodeId);return j!==null&&j!==$.nodeId}return!1})),Y=new Set(H.map(ee=>ee.id));z.forEach(ee=>{Y.has(ee.id)||C.set(ee.id,ee.fingerprint)}),H.length!==0&&Q(async()=>{await n(ee=>{H.forEach($=>{let j=ee.vaultProfiles.find(Z=>Z.id===$.id);if(!j||!Array.isArray(j.shortcuts)){C.set($.id,$.fingerprint);return}let J=!1,re=j.shortcuts.map(Z=>{if(!Co(Z)){if(!la(Z))return Z;let ae=Zu(Z.nodeId);return!ae||ae===Z.nodeId?Z:(J=!0,{...Z,nodeId:ae})}let ce=Ze(Z.tagPath);return!ce||ce===Z.tagPath?Z:(J=!0,{...Z,tagPath:ce})});if(J){j.shortcuts=re,C.set($.id,oH(re));return}let oe=oH(j.shortcuts??[]);C.set($.id,oe)})})})},[u,n]);let p=(0,Cn.useCallback)(async C=>{if(!l)return!1;let x=!1;return await n(z=>{let H=z.vaultProfiles.find($=>$.id===l);if(!H)return;let Y=Array.isArray(H.shortcuts)?H.shortcuts:[],ee=C(Y);ee&&(H.shortcuts=ee,x=!0)}),x},[l,n]),m=(0,Cn.useMemo)(()=>{let C=new Map;return c.forEach(x=>{C.set(nd(x),x)}),C},[c]),g=(0,Cn.useMemo)(()=>F$(r,c),[r,c,o]),f=(0,Cn.useMemo)(()=>P$(c,g),[c,g]),h=f.folderShortcutKeysByPath,b=f.noteShortcutKeysByPath,v=(0,Cn.useMemo)(()=>{let C=new Map;return c.forEach(x=>{if(Co(x)){let z=Ze(x.tagPath);z&&C.set(z,nd(x))}}),C},[c]),y=(0,Cn.useMemo)(()=>{let C=new Map;return c.forEach(x=>{if(la(x)){let z=Zu(x.nodeId);z&&C.set(z,nd(x))}}),C},[c]),S=(0,Cn.useMemo)(()=>{let C=new Map;return c.forEach(x=>{if(Bi(x)){let z=Ju(x.name);z&&C.set(z,x)}}),C},[c]);(0,Cn.useEffect)(()=>{let C=new Map(h),x=new Map(b),z=new Set(Array.from(C.keys(),bl)),H=new Set(Array.from(x.keys(),bl));if(C.size===0&&x.size===0)return;let Y=r.vault,ee=ae=>C.has(ae)||x.has(ae),$=(ae,se)=>ee(se)?!0:NF(ae)?z.has(bl(se)):H.has(bl(se)),j=ae=>{!NF(ae)&&!KM(ae)||$(ae,ae.path)&&a(se=>se+1)},J=ae=>{!NF(ae)&&!KM(ae)||$(ae,ae.path)&&a(se=>se+1)},re=(ae,se)=>{!NF(ae)&&!KM(ae)||($(ae,se)||$(ae,ae.path))&&a(ne=>ne+1)},oe=Y.on("create",j),Z=Y.on("delete",J),ce=Y.on("rename",(ae,se)=>{re(ae,se)});return()=>{Y.offref(oe),Y.offref(Z),Y.offref(ce)}},[r.vault,h,b]);let w=(0,Cn.useMemo)(()=>c.map(C=>{let x=nd(C);if(Zo(C)){let z=g.folderTargetsByPath.get(C.path)??null;return NF(z)?{key:x,shortcut:C,folder:z,note:null,search:null,tagPath:null,propertyNodeId:null,isMissing:!1}:{key:x,shortcut:C,folder:null,note:null,search:null,tagPath:null,propertyNodeId:null,isMissing:!0}}if(Po(C)){let z=g.noteTargetsByPath.get(C.path)??null;return KM(z)?{key:x,shortcut:C,folder:null,note:z,search:null,tagPath:null,propertyNodeId:null,isMissing:!1}:{key:x,shortcut:C,folder:null,note:null,search:null,tagPath:null,propertyNodeId:null,isMissing:!0}}if(Co(C)){let z=Ze(C.tagPath);return{key:x,shortcut:C,folder:null,note:null,search:null,tagPath:z??C.tagPath,propertyNodeId:null,isMissing:!z}}if(la(C)){let z=Zu(C.nodeId);return{key:x,shortcut:C,folder:null,note:null,search:null,tagPath:null,propertyNodeId:z??C.nodeId,isMissing:!z}}return{key:x,shortcut:C,folder:null,note:null,search:C,tagPath:null,propertyNodeId:null,isMissing:!1}}),[c,g]),k=(0,Cn.useCallback)(async(C,x)=>p(z=>{let H=[...z],Y=typeof x=="number"?Math.max(0,Math.min(x,H.length)):H.length;return H.splice(Y,0,C),H}),[p]),F=(0,Cn.useCallback)(async(C,x)=>{if(C.length===0)return 0;let z=new Set(h.keys()),H=new Set(b.keys()),Y=new Set(v.keys()),ee=new Set(y.keys()),$=new Set(S.keys()),j=!1,J=!1,re=!1,oe=!1,Z=!1,ce=!1,ae=!1,se=!1,ne=!1,B=[];return C.forEach(ie=>{if(ie.type===Dn.FOLDER){if(z.has(ie.path)){j=!0;return}z.add(ie.path),B.push(ie);return}if(ie.type===Dn.NOTE){if(H.has(ie.path)){J=!0;return}H.add(ie.path),B.push(ie);return}if(ie.type===Dn.TAG){let le=Ze(ie.tagPath);if(!le){oe=!0;return}if(Y.has(le)){re=!0;return}Y.add(le),B.push({...ie,tagPath:le});return}if(ie.type===Dn.PROPERTY){let le=Zu(ie.nodeId);if(!le){ce=!0;return}if(ee.has(le)){Z=!0;return}if(ee.add(le),le===ie.nodeId){B.push(ie);return}B.push({...ie,nodeId:le});return}if(ie.type===Dn.SEARCH){let le=ie.name.trim(),Te=ie.query.trim(),ke=DN(ie.startTarget);if(!le){se=!0;return}if(!Te){ne=!0;return}let Fe=Ju(le);if($.has(Fe)){ae=!0;return}$.add(Fe),B.push({...ie,name:le,query:Te,startTarget:ke})}}),j&&de(d.shortcuts.folderExists,{variant:"warning"}),J&&de(d.shortcuts.noteExists,{variant:"warning"}),re&&de(d.shortcuts.tagExists,{variant:"warning"}),oe&&de(d.modals.tagOperation.invalidTagName,{variant:"warning"}),Z&&de(d.shortcuts.propertyExists,{variant:"warning"}),ce&&de(d.shortcuts.invalidProperty,{variant:"warning"}),ae&&de(d.shortcuts.searchExists,{variant:"warning"}),se&&de(d.shortcuts.emptySearchName,{variant:"warning"}),ne&&de(d.shortcuts.emptySearchQuery,{variant:"warning"}),B.length===0?0:await p(ie=>{let le=[...ie],Te=typeof x?.index=="number"?Math.max(0,Math.min(x.index,le.length)):le.length;return B.forEach(ke=>{le.splice(Te,0,ke),Te+=1}),le})?B.length:0},[h,b,v,y,S,p]),P=(0,Cn.useCallback)(async(C,x)=>h.has(C)?(de(d.shortcuts.folderExists,{variant:"warning"}),!1):k({type:Dn.FOLDER,path:C},x?.index),[k,h]),T=(0,Cn.useCallback)(async(C,x)=>b.has(C)?(de(d.shortcuts.noteExists,{variant:"warning"}),!1):k({type:Dn.NOTE,path:C},x?.index),[k,b]),I=(0,Cn.useCallback)(async(C,x)=>{let z=Ze(C);return z?v.has(z)?(de(d.shortcuts.tagExists,{variant:"warning"}),!1):k({type:Dn.TAG,tagPath:z},x?.index):!1},[k,v]),N=(0,Cn.useCallback)(async(C,x)=>{let z=Zu(C);return z?y.has(z)?(de(d.shortcuts.propertyExists,{variant:"warning"}),!1):k({type:Dn.PROPERTY,nodeId:z},x?.index):(de(d.shortcuts.invalidProperty,{variant:"warning"}),!1)},[k,y]),O=(0,Cn.useCallback)(async({name:C,query:x,provider:z,startTarget:H},Y)=>{let ee=x.trim();if(!ee)return de(d.shortcuts.emptySearchQuery,{variant:"warning"}),!1;let $=C.trim();if(!$)return de(d.shortcuts.emptySearchName,{variant:"warning"}),!1;let j=Ju($);if(S.has(j))return de(d.shortcuts.searchExists,{variant:"warning"}),!1;let J=DN(H);return k({type:Dn.SEARCH,name:$,query:ee,provider:z,startTarget:J},Y?.index)},[k,S]),K=(0,Cn.useCallback)(async C=>m.has(C)?p(x=>{let z=x.filter(H=>nd(H)!==C);return z.length===x.length?null:z}):!1,[m,p]),G=(0,Cn.useCallback)(async(C,x,z)=>{let H=m.get(C);if(!H)return!1;if(Bi(H)){let j=x.trim();if(!j)return de(d.shortcuts.emptySearchName,{variant:"warning"}),!1;let J=Ju(j),re=Ju(H.name),oe=S.get(J);return J!==re&&oe?(de(d.shortcuts.searchExists,{variant:"warning"}),!1):p(Z=>{let ce=!1,ae=Z.map(se=>nd(se)!==C||!Bi(se)||se.name===j?se:(ce=!0,{...se,name:j}));return ce?ae:null})}let Y=x.trim(),ee=z?.trim(),$=Y.length===0||ee&&Y===ee?void 0:Y;return p(j=>{let J=!1,re=j.map(oe=>nd(oe)!==C||oe.type===Dn.SEARCH||(oe.alias&&oe.alias.length>0?oe.alias:void 0)===$?oe:(J=!0,{...oe,alias:$}));return J?re:null})},[S,m,p]),X=(0,Cn.useCallback)(async C=>{let x=S.get(Ju(C));return x?K(nd(x)):!1},[K,S]),L=(0,Cn.useCallback)(async()=>p(()=>[]),[p]),V=(0,Cn.useCallback)(async C=>{if(C.length!==c.length)return!1;let x=[];for(let z of C){let H=m.get(z);if(!H)return!1;x.push(H)}return p(()=>x)},[c.length,m,p]),D=(0,Cn.useCallback)(C=>h.has(C),[h]),A=(0,Cn.useCallback)(C=>b.has(C),[b]),_=(0,Cn.useCallback)(C=>{let x=Ze(C);return x?v.has(x):!1},[v]),E=(0,Cn.useCallback)(C=>{let x=Zu(C);return x?y.has(x):!1},[y]),R=(0,Cn.useCallback)(C=>S.get(Ju(C)),[S]),M=(0,Cn.useMemo)(()=>({shortcuts:c,hydratedShortcuts:w,shortcutMap:m,folderShortcutKeysByPath:h,noteShortcutKeysByPath:b,tagShortcutKeysByPath:v,propertyShortcutKeysByNodeId:y,searchShortcutsByName:S,addFolderShortcut:P,addNoteShortcut:T,addTagShortcut:I,addPropertyShortcut:N,addSearchShortcut:O,addShortcutsBatch:F,removeShortcut:K,renameShortcut:G,removeSearchShortcut:X,clearShortcuts:L,reorderShortcuts:V,hasFolderShortcut:D,hasNoteShortcut:A,hasTagShortcut:_,hasPropertyShortcut:E,findSearchShortcut:R}),[c,w,m,h,b,v,y,S,P,T,I,N,O,F,K,G,X,L,V,D,A,_,E,R]);return(0,g9.jsx)(p9.Provider,{value:M,children:t})}function Td(){let t=(0,Cn.useContext)(p9);if(!t)throw new Error("useShortcuts must be used within a ShortcutsProvider");return t}var Cn,WM,g9,xSe,oH,p9,xg=U(()=>{Cn=ue(ze()),WM=require("obsidian");on();mn();Ia();Ee();Fn();Sn();ot();dn();Ay();g9=ue(Ge()),xSe=t=>{if(Zo(t)||Po(t)||Co(t)||la(t)){let n=Co(t)?t.tagPath:la(t)?t.nodeId:t.path;return`${t.type}:${n}`}let e=vT(t.startTarget);return`${t.type}:${t.name}:${t.query}:${t.provider}:${e}`},oH=t=>t.length===0?"empty":t.map(xSe).join("|"),p9=(0,Cn.createContext)(null)});function kd(t){return typeof t=="string"&&t.length>0}function RSe(t){let e=[];for(let n of t)kd(n)&&e.push(n);return e}function h9(t,e){return e?.getPathType?.(t)??null}function DSe(t,e){let n=h9(t,e),r=`${t}.md`,o=h9(r,e);return n==="file"?t:o==="file"?r:t}function ASe(t,e){let n=t.trim();if(!n||!n.startsWith(MSe))return null;try{let r=new URL(n);if(r.protocol!=="obsidian:"||r.hostname!=="open")return null;let o=r.searchParams.get("vault");if(e?.vaultName&&o!==e.vaultName)return null;let a=r.searchParams.get("file");return kd(a)?DSe(a,e):null}catch{return null}}function f9(t,e){let n=t.trim();if(!n)return null;let o=n.split(/\r?\n|(?=obsidian:\/\/open\?)/).map(a=>a.trim()).filter(a=>a.length>0&&!a.startsWith("#")).map(a=>ASe(a,e)).filter(kd);return o.length>0?o:null}function aH(t){let e=Array.from(t??[]);return e.includes(v9)||e.includes(y9)}function Vb(t){let e=Array.from(t??[]);return aH(e)||e.length===2&&e.includes(b9)&&e.includes(S9)}function IF(t){return Array.from(t??[]).includes(ESe)}function OSe(t){let e=t.trim();if(!e)return null;try{let n=JSON.parse(e);if(Array.isArray(n)){let r=RSe(n);return r.length>0?r:null}return console.error("Invalid obsidian/files payload: expected array"),null}catch(n){return console.error("Error parsing obsidian/files payload",n),null}}function xF(t,e){if(!t)return null;let n=t.getData(y9);if(kd(n)){let i=OSe(n);if(i&&i.length>0)return i}let r=t.getData(v9);if(kd(r))return[r];let o=t.getData(b9);if(kd(o)){let i=f9(o,e);if(i&&i.length>0)return i}let a=t.getData(S9);if(kd(a)){let i=f9(a,e);if(i&&i.length>0)return i}return null}function w9(t){let e=t.trim();if(!e)return null;try{let n=JSON.parse(e);if(kd(n))return n;if(n&&typeof n=="object"){let r=n,o=kd(r.canonicalPath)?r.canonicalPath:null,a=kd(r.displayPath)?r.displayPath:null;return o||a||null}}catch{return e}return null}function T9(t){let e=t.trim();if(!e)return null;try{let n=JSON.parse(e);if(kd(n))return n;if(n&&typeof n=="object"){let r=n;return kd(r.nodeId)?r.nodeId:null}}catch{return e}return null}var v9,y9,b9,S9,ESe,MSe,jM=U(()=>{v9="obsidian/file",y9="obsidian/files",b9="text/uri-list",S9="text/plain",ESe="Files",MSe="obsidian://open"});function LSe(t,e){switch(t.type){case"folder":return e.expandedFolders.has(t.id);case"tag":return e.expandedTags.has(t.id);case"property":return e.expandedProperties.has(t.id);case"virtual-folder":return e.expandedVirtualFolders.has(t.id)}}function F9(t){switch(t.type){case"folder":return{type:"TOGGLE_FOLDER_EXPANDED",folderPath:t.id};case"tag":return{type:"TOGGLE_TAG_EXPANDED",tagPath:t.id};case"property":return{type:"TOGGLE_PROPERTY_EXPANDED",propertyNodeId:t.id};case"virtual-folder":return{type:"TOGGLE_VIRTUAL_FOLDER_EXPANDED",folderId:t.id}}}function P9(t,e,n){switch(t){case"folder":return n?{type:"SET_EXPANDED_FOLDERS",folders:new Set(e)}:{type:"EXPAND_FOLDERS",folderPaths:[...e]};case"tag":return n?{type:"SET_EXPANDED_TAGS",tags:new Set(e)}:{type:"EXPAND_TAGS",tagPaths:[...e]};case"property":return n?{type:"SET_EXPANDED_PROPERTIES",properties:new Set(e)}:{type:"EXPAND_PROPERTIES",propertyNodeIds:[...e]}}}function zSe(t){return t.type==="virtual-folder"?F9(t):P9(t.type,[...t.ancestorIds??[],t.id],!0)}function BSe(t,e){let n=LSe(t,e);return{isExpanded:n,hasChildren:t.hasChildren,canExpand:t.hasChildren&&!n,canCollapse:n}}function Fd(t,e,n,r="toggle",o){let a=BSe(t,e);return(r==="expand"?a.canExpand:r==="collapse"?a.canCollapse:a.canExpand||a.canCollapse)?(o?.collapseOtherBranches&&a.canExpand?n(zSe(t)):n(F9(t)),!0):!1}function ys({type:t,ids:e,collapseOtherBranches:n,dispatch:r}){e.length!==0&&r(P9(t,e,n))}function Dp(t){let e=[],n=t.parent;for(;n&&(e.unshift(n.path),n.path!=="/");)n=n.parent;return e}function EF(t){if(!t.includes("/"))return[];let e=t.split("/"),n=[];for(let r=1;r0,ancestorIds:EF(t.data.path)};case he.PROPERTY_KEY:case he.PROPERTY_VALUE:return{type:"property",id:t.data.id,hasChildren:t.data.children.size>0,ancestorIds:iH(t.data.id)};case he.VIRTUAL_FOLDER:return typeof t.tagCollectionId!="string"&&typeof t.propertyCollectionId!="string"?null:{type:"virtual-folder",id:t.data.id,hasChildren:t.hasChildren??!1};default:return null}}var k9,hu=U(()=>{k9=require("obsidian");Ue();Yr();cn()});function x9(t){let{app:e,isMobile:n,tagTreeService:r,propertyTreeService:o}=gt(),a=li(),i=_b(),s=ar(),l=gr(),c=pt(),u=Xt(),p=u.includeDescendantNotes,m=u.showHiddenItems,g=ta(),f=Ra(),h=(0,hn.useRef)(null),b=(0,hn.useRef)(null),v=(0,hn.useRef)(null),y=(0,hn.useRef)(0),S=(0,hn.useRef)(g.expandedFolders),w=(0,hn.useRef)(g.expandedTags),k=(0,hn.useRef)(null),F=(0,hn.useRef)(null),P=(0,hn.useRef)(null),T=(0,hn.useRef)(null),I=(0,hn.useRef)(0),N=(0,hn.useRef)(new Set),O=(0,hn.useMemo)(()=>{let B=c.springLoadedFoldersInitialDelay;return Number.isFinite(B)?Math.round(Math.min(2,Math.max(.1,B))*1e3):GM},[c.springLoadedFoldersInitialDelay]),K=(0,hn.useMemo)(()=>{let B=c.springLoadedFoldersSubsequentDelay;return Number.isFinite(B)?Math.round(Math.min(2,Math.max(.1,B))*1e3):GM},[c.springLoadedFoldersSubsequentDelay]),G=(0,hn.useCallback)(B=>{if(w1(e))try{if(!B){e.dragManager.draggable=null;return}let q=e.dragManager.draggable,ie=q?{...q,...B}:{...B};e.dragManager.draggable=ie}catch(q){console.error("[Notebook Navigator] Failed to set drag payload",q)}},[e]),X=B=>B instanceof HTMLElement,L=B=>B===W.FILE||B===W.FOLDER||B===W.TAG||B===W.PROPERTY,V=(0,hn.useCallback)(B=>{B.classList.add("nn-dragging"),N.current.add(B)},[]),D=(0,hn.useCallback)(()=>{N.current.forEach(B=>{B.classList.remove("nn-dragging")}),N.current.clear()},[]),A=(0,hn.useCallback)(()=>{let B=t.current;B&&B.querySelectorAll(".nn-file[data-drag-path]").forEach(q=>{let ie=xC(q,"data-drag-path");ie&&s.selectedFiles.has(ie)&&V(q)})},[t,V,s.selectedFiles]),_=(0,hn.useCallback)((B,q)=>{let le=(t.current?.ownerDocument??activeDocument).createElement("div");return le.className="nn-drag-preview-badge",le.textContent=`${q}`,zT(B,le)},[t]),E=(0,hn.useCallback)((B,q,ie,le,Te,ke)=>{let Fe=WSe(q,ie,Te,ke);if(Fe.length===0)return!1;let pe=(t.current?.ownerDocument??activeDocument).createElement("div");pe.className="nn-drag-preview-icon";let ve=le??"#ffffff";return pe.style.color=ve,pe.style.setProperty("--icon-color",ve),pe.style.fill=ve,pe.style.stroke=ve,Fe.some(qe=>jSe(pe,qe))?zT(B,pe):!1},[t]),R=(0,hn.useCallback)(()=>ca({selectionType:s.selectionType,selectedFolder:s.selectedFolder,selectedTag:s.selectedTag,selectedProperty:s.selectedProperty},c,{includeDescendantNotes:p,showHiddenItems:m},e,r,o),[s,c,p,m,e,r,o]),M=(0,hn.useCallback)(B=>{let q=[];for(let ie of B){let le=e.vault.getFileByPath(ie);le&&q.push(le)}return q},[e]),C=(0,hn.useCallback)(B=>{let q=e.vault.getAbstractFileByPath(B);return q instanceof Ap.TFile?"file":q instanceof Ap.TFolder?"folder":null},[e]),x=(0,hn.useCallback)(async(B,q)=>{let ie=R();await a.moveFilesToFolder({files:B,targetFolder:q,selectionContext:{selectedFile:s.selectedFile,dispatch:l,allFiles:ie},showNotifications:!0})},[a,R,s.selectedFile,l]),z=(0,hn.useCallback)(B=>{let q=xF(B.dataTransfer??null,{getPathType:C,vaultName:e.vault.getName()});if(!q||q.length===0)return{files:[],hasNonMarkdown:!1};let ie=M(q);if(ie.length===0)return{files:[],hasNonMarkdown:!1};let le=ie.some(Te=>Te.extension!=="md");return{files:ie,hasNonMarkdown:le}},[e,C,M]),H=(0,hn.useCallback)(B=>{if(!X(B.target))return;y.current=0,D();let q=B.target.closest('[data-draggable="true"]');if(!q||!q.instanceOf(HTMLElement))return;let ie=xC(q,"data-drag-path"),le=q.getAttribute("data-drag-type"),Te=q.getAttribute("data-drag-canonical"),ke=q.getAttribute("data-drag-icon"),Fe=q.getAttribute("data-drag-fallback-icon"),te=q.getAttribute("data-drag-base-icon"),pe=q.getAttribute("data-drag-icon-color"),ve=q.getAttribute("data-drag-allow-multi-file")!=="false",Ie=ke&&ke.trim().length>0?ke:void 0,qe=Fe&&Fe.trim().length>0?Fe:void 0,xe=te&&te.trim().length>0?te:void 0,Ce=pe&&pe.trim().length>0?pe:void 0;if(!ie||!B.dataTransfer)return;let vt=ve&&le===W.FILE&&s.selectedFiles.has(ie)&&s.selectedFiles.size>1;if(G(null),vt){let Ve=Array.from(s.selectedFiles);B.dataTransfer.effectAllowed="all",k.current=W.FILE;let Ae=M(Ve);Ae.length>0&&(N9(B.dataTransfer,e.vault.getName(),Ae),G({type:"files",files:Ae,title:`${Ae.length} files`})),A(),_(B,Ve.length);return}if(le===W.FOLDER&&B.dataTransfer.setData("obsidian/file",ie),le===W.FILE||le===W.FOLDER||le===W.TAG||le===W.PROPERTY?k.current=le:k.current=W.FILE,B.dataTransfer.effectAllowed=le===W.PROPERTY?"copy":"all",le===W.FILE){let Ve=e.vault.getFileByPath(ie);Ve&&(N9(B.dataTransfer,e.vault.getName(),[Ve]),G({type:"file",file:Ve,title:Ve.basename}))}else if(le===W.TAG){P.current=ie,T.current=Te??null;try{let Ve={displayPath:ie,canonicalPath:Te??It(ie)};B.dataTransfer.setData(Jg,JSON.stringify(Ve)),B.dataTransfer.setData("text/plain",`#${ie}`)}catch(Ve){console.error("[Notebook Navigator] Failed to attach tag drag payload",Ve)}G({type:"tag",title:ie})}else if(le===W.PROPERTY)try{let Ve={nodeId:ie};B.dataTransfer.setData(lw,JSON.stringify(Ve))}catch(Ve){console.error("[Notebook Navigator] Failed to attach property drag payload",Ve)}V(q);let Rt=L(le)?le:null;E(B,Rt,Ie,Ce,qe,xe)},[s,e,M,G,D,V,A,_,E]);(0,hn.useEffect)(()=>{S.current=g.expandedFolders},[g.expandedFolders]),(0,hn.useEffect)(()=>{w.current=g.expandedTags},[g.expandedTags]);let Y=(0,hn.useCallback)(()=>{b.current!==null&&(window.clearTimeout(b.current),b.current=null),v.current=null},[]);(0,hn.useEffect)(()=>{c.springLoadedFolders||Y()},[c.springLoadedFolders,Y]);let ee=(0,hn.useCallback)(B=>{if(v.current?.type===B.type&&v.current.path===B.path||(Y(),B.isAlreadyExpanded()))return;let q=B.resolveNode();if(!q.isValid||!q.hasChildren)return;let ie=y.current===0?O:K;v.current={type:B.type,path:B.path},b.current=window.setTimeout(()=>{let le=B.resolveNode();if(!le.isValid){Y();return}le.hasChildren&&!B.isAlreadyExpanded()&&(B.expand(),y.current+=1),Y()},ie)},[Y,O,K]),$=(0,hn.useCallback)(B=>{ee({type:"folder",path:B,isAlreadyExpanded:()=>S.current.has(B),resolveNode:()=>{let q=e.vault.getFolderByPath(B);return q?{isValid:!0,hasChildren:q.children.some(ie=>ie instanceof Ap.TFolder)}:{isValid:!1,hasChildren:!1}},expand:()=>{let q=c.collapseOtherBranchesOnExpand?e.vault.getFolderByPath(B):null,ie=q?[...Dp(q),B]:[B];ys({type:"folder",ids:ie,collapseOtherBranches:c.collapseOtherBranchesOnExpand,dispatch:f})}})},[e,f,ee,c.collapseOtherBranchesOnExpand]),j=(0,hn.useCallback)(B=>{r&&ee({type:"tag",path:B,isAlreadyExpanded:()=>w.current.has(B),resolveNode:()=>{if(!r)return{isValid:!1,hasChildren:!1};let q=r.findTagNode(B);return q?{isValid:!0,hasChildren:q.children.size>0}:{isValid:!1,hasChildren:!1}},expand:()=>{let q=c.collapseOtherBranchesOnExpand?[...EF(B),B]:[B];ys({type:"tag",ids:q,collapseOtherBranches:c.collapseOtherBranchesOnExpand,dispatch:f})}})},[r,f,ee,c.collapseOtherBranchesOnExpand]),J=(0,hn.useCallback)((B,q)=>{if(!c.springLoadedFolders){Y();return}if(B==="folder"){$(q);return}j(q)},[c.springLoadedFolders,Y,$,j]),re=(0,hn.useCallback)(B=>{if(!X(B.target))return;let q=B.target.closest('[data-drop-zone="folder"],[data-drop-zone="tag"],[data-drop-zone="tag-root"],[data-drop-zone="property"]'),ie=!!B.dataTransfer?.types?.includes(Gv);if(h.current&&h.current!==q&&(h.current.classList.remove("nn-drag-over"),h.current=null,F.current=null,Y()),!q){ie&&B.dataTransfer&&(B.dataTransfer.dropEffect="none"),F.current=null,Y();return}if(h.current===q&&F.current&&B.dataTransfer){B.preventDefault(),B.dataTransfer.dropEffect=F.current;return}if(ie){q.classList.remove("nn-drag-over"),h.current=null,F.current=null,Y(),B.dataTransfer&&(B.dataTransfer.dropEffect="none");return}if(k.current===W.PROPERTY){q.classList.remove("nn-drag-over"),h.current=null,F.current=null,Y(),B.dataTransfer&&(B.dataTransfer.dropEffect="none");return}if(B.dataTransfer){let le=q.getAttribute("data-drop-zone"),Te=q.getAttribute("data-drop-path"),ke=q.dataset.allowInternalDrop!=="false",Fe=q.dataset.allowExternalDrop!=="false",te=B.dataTransfer.types,pe=Vb(te),ve=!!te?.includes(Jg),Ie=IF(te)||!!(B.dataTransfer.files&&B.dataTransfer.files.length>0),qe=pe||ve,xe=Ie&&!qe;if(le==="property"){let vt=k.current===W.FOLDER,Rt=k.current===W.TAG;if(vt||Rt||!pe||xe){h.current===q&&(q.classList.remove("nn-drag-over"),h.current=null,F.current=null),Y(),B.dataTransfer.dropEffect="none";return}}if(qe&&!ke||xe&&!Fe){h.current===q&&(q.classList.remove("nn-drag-over"),h.current=null,F.current=null),Y(),B.dataTransfer.dropEffect="none";return}if(!C9(le,{hasObsidianData:pe,hasTagPayload:ve,isExternalOnly:xe})){h.current===q&&(q.classList.remove("nn-drag-over"),h.current=null,F.current=null),Y(),B.dataTransfer.dropEffect="none";return}B.preventDefault();let Ce=!!te?.includes("Files")&&!qe;if(le==="folder"){if(k.current===W.TAG){h.current===q&&(q.classList.remove("nn-drag-over"),h.current=null,F.current=null),Y(),B.dataTransfer.dropEffect="none";return}B.dataTransfer.dropEffect=Ce?"copy":"move",Te&&J("folder",Te)}else if(le==="tag"){if(k.current===W.FOLDER){h.current===q&&q.classList.remove("nn-drag-over"),h.current=null,F.current=null,Y(),B.dataTransfer.dropEffect="none";return}if(B.dataTransfer.dropEffect=Te===bt?"move":"copy",Te!==bt){let vt=q.getAttribute("data-tag");vt?J("tag",vt):Y()}else Y()}else le==="property"&&(Y(),B.dataTransfer.dropEffect="move");if(le==="tag-root"){if(k.current!==W.TAG){h.current===q&&(q.classList.remove("nn-drag-over"),h.current=null,F.current=null),Y(),B.dataTransfer.dropEffect="none";return}B.dataTransfer.dropEffect="move",Y()}}B.defaultPrevented&&(h.current!==q&&q.classList.add("nn-drag-over"),h.current=q,F.current=B.dataTransfer?.dropEffect??null)},[Y,J]),oe=(0,hn.useCallback)(async(B,q)=>{let{files:ie,hasNonMarkdown:le}=z(B);if(ie.length!==0){if(le){de(d.fileSystem.notifications.tagsRequireMarkdown,{variant:"warning"});return}if(q===bt)try{let Te=await i.clearAllTagsFromFiles(ie);if(Te>0){let ke=Te===1?d.fileSystem.notifications.tagsClearedFromNote:d.fileSystem.notifications.tagsClearedFromNotes.replace("{count}",Te.toString());de(ke,{variant:"success"})}else de(d.dragDrop.notifications.noTagsToClear,{variant:"warning"})}catch(Te){console.error("Error clearing tags:",Te),de(d.dragDrop.errors.failedToClearTags,{variant:"warning"})}else try{let{added:Te,skipped:ke}=await i.addTagToFiles(q,ie);if(Te>0){let Fe=Te===1?d.fileSystem.notifications.tagAddedToNote:d.fileSystem.notifications.tagAddedToNotes.replace("{count}",Te.toString());de(Fe,{variant:"success"})}ke>0&&de(d.dragDrop.notifications.filesAlreadyHaveTag.replace("{count}",ke.toString()),{timeout:Lt.NOTICE_ERROR,variant:"warning"})}catch(Te){console.error("Error adding tag:",Te),de(d.dragDrop.errors.failedToAddTag.replace("{tag}",q),{variant:"warning"})}}},[z,i]),Z=(0,hn.useCallback)(async(B,q)=>{let{files:ie,hasNonMarkdown:le}=z(B);if(ie.length!==0){if(le){de(d.fileSystem.notifications.propertiesRequireMarkdown,{variant:"warning"});return}await a.applyPropertyNodeToFiles(q,ie)}},[a,z]),ce=(0,hn.useCallback)(async(B,q)=>{let ie={success:0,failed:0},le=[];for(let Te=0;Te0){let Te=ie.success===1?d.dragDrop.notifications.fileImported:d.dragDrop.notifications.filesImported.replace("{count}",ie.success.toString());de(Te,{variant:"success"})}if(ie.failed>0){let Te=d.dragDrop.errors.failedToImportFiles.replace("{names}",le.join(", "));de(Te,{timeout:Lt.NOTICE_ERROR,variant:"warning"})}},[e]),ae=(0,hn.useCallback)(async B=>{I.current=Date.now()+_Se;try{let q=h.current;if(q&&q.classList.remove("nn-drag-over"),h.current=null,F.current=null,!q&&X(B.target)){let Ke=B.target.closest("[data-drop-zone]");q=Ke instanceof HTMLElement?Ke:null}if(!!B.dataTransfer?.types?.includes(Gv)){Y();return}if(k.current===W.PROPERTY){Y();return}if(!q){Y();return}let le=q.getAttribute("data-drop-zone"),Te=xC(q,"data-drop-path");if(!le||!Te){Y();return}Y();let ke=q.dataset.allowInternalDrop!=="false",Fe=q.dataset.allowExternalDrop!=="false",te=B.dataTransfer?.types,pe=B.dataTransfer?.files??null,ve=xF(B.dataTransfer??null,{getPathType:C,vaultName:e.vault.getName()}),Ie=aH(te)||!!(ve&&ve.length>0),qe=!!te?.includes(Jg),xe=IF(te)||!!(pe&&pe.length>0),Ce=Ie||qe,vt=xe&&!Ce;if(Ce&&!ke||vt&&!Fe||!C9(le,{hasObsidianData:Ie,hasTagPayload:qe,isExternalOnly:vt}))return;if(B.preventDefault(),le==="tag-root"){if(k.current===W.TAG){let Ke=P.current;if(!Ke)return;await i.promoteTagToRoot(Ke)}return}if(le==="tag"){if(k.current===W.TAG){let Ke=P.current,Be=T.current;if(!Ke||!Be)return;let wt=q.getAttribute("data-tag")??"";if(Te===bt||wt===zt||Te===zt||wt===Be)return;if(wt.startsWith(`${Be}/`)){de(d.modals.tagOperation.descendantRenameError,{variant:"warning"});return}await i.renameTagByDrag(Ke,Te);return}if(k.current===W.FOLDER)return;await oe(B,Te);return}if(le==="property"){if(!Ie||vt||k.current===W.TAG||k.current===W.FOLDER)return;await Z(B,Te);return}if(le==="folder"&&k.current===W.TAG)return;let Rt=e.vault.getFolderByPath(Te);if(!Rt)return;if(pe&&pe.length>0&&!Ie){await ce(pe,Rt);return}if(ve&&ve.length>0){let Ke=M(ve);if(Ke.length>0){await x(Ke,Rt);return}}let Ve=B.dataTransfer?.getData("obsidian/file");if(!Ve)return;let Ae=e.vault.getAbstractFileByPath(Ve);if(!Ae)return;if(Ae instanceof Ap.TFile)await x([Ae],Rt);else if(Ae instanceof Ap.TFolder){if(Rt.path===Ae.path||Rt.path.startsWith(`${Ae.path}/`)){de(d.dragDrop.errors.cannotMoveIntoSelf,{variant:"warning"});return}if(Ae.parent?.path===Rt.path)return;try{await a.moveFolderToTarget(Ae,Rt),de(d.fileSystem.notifications.folderMoved.replace("{name}",Ae.name),{variant:"success"})}catch(Ke){if(Ke instanceof au){if(Ke.code==="destination-exists"){de(d.fileSystem.errors.folderAlreadyExists.replace("{name}",Ae.name),{variant:"warning"});return}if(Ke.code==="invalid-target"){de(d.dragDrop.errors.cannotMoveIntoSelf,{variant:"warning"});return}}console.error("Error moving folder:",Ke),de(d.dragDrop.errors.failedToMoveFolder.replace("{name}",Ae.name),{variant:"warning"})}}}finally{D(),G(null),k.current=null,P.current=null,T.current=null,y.current=0}},[e,Z,oe,ce,x,M,C,Y,D,G,i,a]),se=(0,hn.useCallback)(B=>{let q=B.target;if(!(q instanceof HTMLElement))return;let ie=q.closest("[data-drop-zone]");if(ie instanceof HTMLElement&&ie===h.current){let le=B.relatedTarget;(!(le instanceof Node)||!ie.contains(le))&&(ie.classList.remove("nn-drag-over"),h.current=null,F.current=null,Y())}},[Y]),ne=(0,hn.useCallback)(()=>{y.current=0,D(),h.current&&(h.current.classList.remove("nn-drag-over"),h.current=null),F.current=null,G(null),Y(),k.current=null,P.current=null,T.current=null},[D,Y,G]);(0,hn.useEffect)(()=>{let B=t.current;if(!B||n)return;let q=le=>{Q(()=>ae(le))};B.addEventListener("dragstart",H),B.addEventListener("dragover",re),B.addEventListener("dragleave",se),B.addEventListener("drop",q),B.addEventListener("dragend",ne);let ie=le=>{Date.now()>I.current||(le.preventDefault(),le.stopPropagation(),le.stopImmediatePropagation())};return B.addEventListener("click",ie,!0),()=>{B.removeEventListener("dragstart",H),B.removeEventListener("dragover",re),B.removeEventListener("dragleave",se),B.removeEventListener("drop",q),B.removeEventListener("dragend",ne),B.removeEventListener("click",ie,!0),D(),G(null),Y(),k.current=null,F.current=null}},[t,H,re,se,ae,ne,n,D,Y,G])}var hn,Ap,GM,_Se,HSe,VSe,C9,I9,USe,KSe,WSe,jSe,GSe,qSe,N9,sH=U(()=>{hn=ue(ze()),Ap=require("obsidian");Ur();mn();on();Tr();Qs();Ee();Fn();Ue();Ia();jr();os();Nm();cL();Dr();ot();jM();Rz();ai();hu();Ha();GM=500,_Se=100,HSe="text/plain",VSe="text/uri-list",C9=(t,{hasObsidianData:e,hasTagPayload:n,isExternalOnly:r})=>t==="folder"?e||r:t==="tag"?n||e:t==="tag-root"?n:t==="property"?e:!1,I9=t=>t.startsWith("emoji:")?t.slice(6):/\p{Extended_Pictographic}/u.test(t)?t:null,USe=t=>{if(I9(t))return!0;let e=t.startsWith("lucide-")?t.slice(7):t;return yn().isValidIcon(e)},KSe=(t,e)=>e||(t===W.FOLDER?"folder-closed":t===W.TAG?"tags":t===W.FILE?"file":t===W.PROPERTY?"align-left":null),WSe=(t,e,n,r)=>{let o=[];e&&o.push(e),n&&o.push(n);let a=KSe(t,r);return a&&o.push(a),Array.from(new Set(o))},jSe=(t,e)=>{if(!USe(e))return!1;t.innerHTML="";try{if(yn().renderIcon(t,e),t.childNodes.length>0||t.innerHTML.trim()!=="")return!0}catch(r){}let n=I9(e);if(n)return t.textContent=n,!0;try{return(0,Ap.setIcon)(t,e),t.childNodes.length>0}catch(r){}return!1},GSe=t=>t.extension==="md"&&t.path.endsWith(".md")?t.path.slice(0,-3):t.path,qSe=(t,e)=>{let n=encodeURIComponent(t),r=encodeURIComponent(GSe(e));return`obsidian://open?vault=${n}&file=${r}`},N9=(t,e,n)=>{let r=n.map(o=>qSe(e,o)).join(`
`);r&&(t.setData(HSe,r),t.setData(VSe,r))}});function XSe(t,e){return e?t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom:!1}function E9(t){let e=t.dataTransfer?.types;return Vb(e)||IF(e)}function M9({containerRef:t,isMobile:e,isSinglePane:n,isFilesView:r,onActivateNavigation:o,onRestoreFiles:a}){let i=(0,Ub.useRef)(null),s=(0,Ub.useRef)(!1),l=(0,Ub.useRef)(!1);(0,Ub.useEffect)(()=>{let c=t.current;if(!c||e)return;let u=c.ownerDocument,p=()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null)},m=()=>{i.current!==null||s.current||(i.current=window.setTimeout(()=>{i.current=null,l.current&&(!n||!r||(s.current=!0,o()))},GM))},g=S=>{let k=c.getBoundingClientRect().left+YSe;if(S.clientX<=k)return!0;let F=c.querySelector($Se);return F?XSe(S,F.getBoundingClientRect()):!1},f=()=>{l.current=!0,s.current=!1,p()},h=S=>{if(E9(S)){if(l.current=!0,!n||!r){p();return}g(S)?m():s.current||p()}},b=S=>{if(!E9(S))return;let w=S.relatedTarget;if(w instanceof Node&&c.contains(w))return;let k=c.getBoundingClientRect();S.clientX>=k.left&&S.clientX<=k.right&&S.clientY>=k.top&&S.clientY<=k.bottom||(l.current=!1,p(),s.current&&(s.current=!1,a()))},v=()=>{l.current=!1,p(),s.current&&(s.current=!1,a())},y=()=>{v()};return c.addEventListener("dragstart",f),c.addEventListener("dragover",h),c.addEventListener("dragleave",b),c.addEventListener("dragend",v),c.addEventListener("drop",y),u.addEventListener("dragend",v),u.addEventListener("drop",v),()=>{p(),c.removeEventListener("dragstart",f),c.removeEventListener("dragover",h),c.removeEventListener("dragleave",b),c.removeEventListener("dragend",v),c.removeEventListener("drop",y),u.removeEventListener("dragend",v),u.removeEventListener("drop",v)}},[t,e,n,r,o,a])}var Ub,YSe,$Se,R9=U(()=>{Ub=ue(ze());sH();jM();YSe=32,$Se='[data-pane-toggle="navigation"]'});function D9({hasNavigatorFocus:t,isOpeningVersionHistory:e,isOpeningInNewContext:n,isNavigatorOpeningSelectedFile:r}){return!t||e||n?!1:r}function A9(t,e){if(!t||e.length===0)return!1;let n=t.getContainer().win;return e.some(r=>r.getContainer().win===n)}var O9=U(()=>{});function L9(t,e,n){if(e==="navigation"){if(t.focusNavigationPane){t.focusNavigationPane(n);return}}else if(t.focusFilesPane){t.focusFilesPane(n);return}t.uiState.singlePane&&n?.updateSinglePaneView&&t.uiState.currentSinglePaneView!==e&&t.uiDispatch({type:"SET_SINGLE_PANE_VIEW",view:e}),t.uiState.focusedPane!==e&&t.uiDispatch({type:"SET_FOCUSED_PANE",pane:e})}function z9(t,e,n){if(t.selectionDispatch({type:"SET_SELECTED_TAG",tag:e,source:n?.source,historyIndex:n?.historyIndex}),n?.skipFocus)return;let r=n?.preserveNavigationFocus??!0;t.uiState.singlePane?L9(t,r?"navigation":"files",{updateSinglePaneView:!0}):L9(t,r?"navigation":"files")}function QSe(t){if(!t.includes("/"))return[];let e=t.split("/"),n=[];for(let r=1;r!t.expandedTags.has(l))&&ys({type:"tag",ids:i,collapseOtherBranches:!!t.collapseOtherBranchesOnExpand,dispatch:t.expansionDispatch})}return z9(t,r,n),!n?.skipScroll&&t.requestScroll&&t.requestScroll(r,{align:"auto",itemType:W.TAG}),r}var lH=U(()=>{Ue();Sn();Jm();hu()});function B9(t,e,n){if(e==="navigation"){if(t.focusNavigationPane){t.focusNavigationPane(n);return}}else if(t.focusFilesPane){t.focusFilesPane(n);return}t.uiState.singlePane&&n?.updateSinglePaneView&&t.uiState.currentSinglePaneView!==e&&t.uiDispatch({type:"SET_SINGLE_PANE_VIEW",view:e}),t.uiState.focusedPane!==e&&t.uiDispatch({type:"SET_FOCUSED_PANE",pane:e})}function ZSe(t,e,n){if(e===Oe)return e;let r=t.resolveSelectionNodeId?t.resolveSelectionNodeId(e):EN(t.propertyTree,e);return r===Oe?n?.requirePropertyInTree??!0?null:e:r}function JSe(t,e,n){if(t.selectionDispatch({type:"SET_SELECTED_PROPERTY",nodeId:e,source:n?.source,historyIndex:n?.historyIndex}),n?.skipFocus)return;let r=n?.preserveNavigationFocus??!0;t.uiState.singlePane?B9(t,r?"navigation":"files",{updateSinglePaneView:!0}):B9(t,r?"navigation":"files")}function RF(t,e,n){let r=e===Oe?Oe:Gt(e);if(!r)return null;let o=ZSe(t,r,n);if(!o)return null;if(t.showProperties&&t.showAllPropertiesFolder&&!t.expandedVirtualFolders.has(Oe)){let l=new Set(t.expandedVirtualFolders);l.add(Oe),t.expansionDispatch({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:l})}let a=o!==Oe?zi(o):Oe;return a&&a!==Oe&&a!==o&&!t.expandedProperties.has(a)&&ys({type:"property",ids:[a],collapseOtherBranches:!!t.collapseOtherBranchesOnExpand,dispatch:t.expansionDispatch}),JSe(t,o,n),!n?.skipScroll&&t.requestScroll&&t.requestScroll(o,{align:"auto",itemType:W.PROPERTY}),o}var dH=U(()=>{Ue();cn();hu()});function Kb({workspace:t,commandQueue:e,onChange:n}){let r=null,o,a,i=()=>{r!==null&&typeof window<"u"&&window.clearTimeout(r),r=null,o=void 0,a=void 0},s=()=>{o===void 0&&i()},l=()=>{a!==void 0&&e?.consumeBackgroundActiveLeafChange(a)===!0&&s()},c=(f,h)=>{if(f!==void 0&&(o=f),h!==void 0&&(a=h),typeof window>"u"){n({candidateFile:f,activeLeaf:h??t.activeLeaf});return}r!==null&&window.clearTimeout(r),r=window.setTimeout(()=>{r=null;let b=o,v=a??t.activeLeaf;o=void 0,a=void 0,n({candidateFile:b,activeLeaf:v})},Lt.YIELD_TO_EVENT_LOOP)},u=f=>{if(e?.consumeBackgroundActiveLeafChange(f)===!0){s();return}c(void 0,f)},p=f=>{if(f instanceof _9.TFile&&e?.consumeBackgroundFileOpen(f.path,t.activeLeaf)===!0){l();return}c(f,t.activeLeaf)},m=t.on("active-leaf-change",u),g=t.on("file-open",p);return()=>{i(),t.offref(m),t.offref(g)}}var _9,qM=U(()=>{_9=require("obsidian");jr()});function H9({app:t,navigationPaneRef:e,focusNavigationPane:n,focusFilesPane:r}){let o=pt(),a=Xt(),i=a.includeDescendantNotes,s=ta(),l=Ra(),c=ar(),u=gr(),p=Yn(),m=Vr(),{getDB:g,getPropertyTree:f,findTagInTree:h}=xo(),b=qs(),[v,y]=(0,ao.useState)(null),[S,w]=(0,ao.useState)(!1),k=(0,ao.useRef)(null),F=(0,ao.useRef)(!1),P=(0,ao.useRef)(null);(0,ao.useEffect)(()=>{P.current=c.selectedFile?.path??null},[c.selectedFile]);let T=(0,ao.useCallback)(R=>{if(!o.autoRevealIgnoreOtherWindows||!R)return!1;let M=t.workspace.getLeavesOfType(wa);return M.length===0?!1:!A9(R,M)},[t,o.autoRevealIgnoreOtherWindows]),I=(0,ao.useCallback)((R,M)=>q3(R,o,t,a.showHiddenItems)?(u({type:"SET_SELECTED_FILE",file:R}),M?.showHiddenFileNotice&&de(d.fileSystem.notifications.hiddenFileReveal,{variant:"warning"}),!0):!1,[u,o,t,a.showHiddenItems]),N=(0,ao.useCallback)(R=>{if(!R)return{target:null,expandAncestors:!1};if(!i)return{target:R,expandAncestors:!0};let M=t.vault.getRoot(),C=M?.path??"/",x=H=>{if(!o.showRootFolder&&M&&H===M)return!1;let Y=H;for(;Y;){let ee=Y.parent;if(!ee)break;if(M&&ee.path===C&&!o.showRootFolder){Y=ee;continue}if(!s.expandedFolders.has(ee.path))return!1;Y=ee}return!0},z=R;for(;z&&!x(z);)z=z.parent;return z?!o.showRootFolder&&M&&z===M?{target:R,expandAncestors:!1}:{target:z,expandAncestors:!1}:{target:o.showRootFolder?M??R:R,expandAncestors:!1}},[i,o.showRootFolder,s.expandedFolders,t]),O=(0,ao.useCallback)(R=>{ys({type:"folder",ids:R,collapseOtherBranches:o.collapseOtherBranchesOnExpand,dispatch:l})},[l,o.collapseOtherBranchesOnExpand]),K=(0,ao.useCallback)(R=>{ys({type:"tag",ids:R,collapseOtherBranches:o.collapseOtherBranchesOnExpand,dispatch:l})},[l,o.collapseOtherBranchesOnExpand]),G=(0,ao.useCallback)(R=>{ys({type:"property",ids:R,collapseOtherBranches:o.collapseOtherBranchesOnExpand,dispatch:l})},[l,o.collapseOtherBranchesOnExpand]),X=(0,ao.useCallback)((R,M)=>{if(!R?.parent||I(R,M))return!1;let C=R.parent,{target:x,expandAncestors:z}=N(C),H=i?C:x??C,Y=[],ee=C.parent;for(;ee&&(Y.unshift(ee.path),ee.path!=="/");)ee=ee.parent;return Y.length>0&&(z||Y.some(j=>!s.expandedFolders.has(j)))&&O(Y),u({type:"REVEAL_FILE",file:R,preserveFolder:!1,isManualReveal:!0,targetFolder:H??void 0,source:M?.source}),p.singlePane&&p.currentSinglePaneView==="navigation"&&m({type:"SET_SINGLE_PANE_VIEW",view:"files"}),p.focusedPane!=="files"&&m({type:"SET_FOCUSED_PANE",pane:"files"}),e.current&&H&&e.current.requestScroll(H.path,{align:"auto",itemType:W.FOLDER}),!0},[s.expandedFolders,O,u,p,m,e,N,i,I]),L=(0,ao.useCallback)((R,M)=>{let C=!!M?.skipSinglePaneSwitch,x=MF({showTags:o.showTags,showAllTagsFolder:o.showAllTagsFolder,expandedTags:s.expandedTags,expandedVirtualFolders:s.expandedVirtualFolders,collapseOtherBranchesOnExpand:o.collapseOtherBranchesOnExpand,expansionDispatch:l,selectionDispatch:u,uiState:{singlePane:p.singlePane,currentSinglePaneView:p.currentSinglePaneView,focusedPane:p.focusedPane},uiDispatch:m,findTagInTree:h,focusNavigationPane:n,focusFilesPane:r,requestScroll:(z,H)=>{e.current?.requestScroll(z,H)}},R,{preserveNavigationFocus:C,skipScroll:M?.skipScroll,source:M?.source});x&&c.selectedFile&&u({type:"REVEAL_FILE",file:c.selectedFile,preserveFolder:!0,isManualReveal:!1,targetTag:x,source:M?.source})},[s.expandedTags,s.expandedVirtualFolders,l,u,r,n,h,p,m,c.selectedFile,e,o.showAllTagsFolder,o.collapseOtherBranchesOnExpand,o.showTags]),V=(0,ao.useCallback)((R,M)=>{let C=!!M?.skipSinglePaneSwitch,x=RF({showProperties:o.showProperties,showAllPropertiesFolder:o.showAllPropertiesFolder,propertyTree:f(),expandedProperties:s.expandedProperties,expandedVirtualFolders:s.expandedVirtualFolders,collapseOtherBranchesOnExpand:o.collapseOtherBranchesOnExpand,expansionDispatch:l,selectionDispatch:u,uiState:{singlePane:p.singlePane,currentSinglePaneView:p.currentSinglePaneView,focusedPane:p.focusedPane},uiDispatch:m,focusNavigationPane:n,focusFilesPane:r,requestScroll:(z,H)=>{e.current?.requestScroll(z,H)}},R,{preserveNavigationFocus:C,skipScroll:M?.skipScroll,source:M?.source});return x?(c.selectedFile&&u({type:"REVEAL_FILE",file:c.selectedFile,preserveFolder:!0,isManualReveal:!1,targetProperty:x,source:M?.source}),!0):!1},[s.expandedProperties,s.expandedVirtualFolders,l,u,r,n,p,m,c.selectedFile,e,o.showAllPropertiesFolder,o.collapseOtherBranchesOnExpand,o.showProperties,f]),D=(0,ao.useCallback)((R,M)=>{if(!R?.parent||I(R,M))return;let C,x,z=null,H=!1,Y=M?.isStartupReveal?"startup":M?.source,$=!(Y==="auto"||Y==="startup")||o.autoRevealShortestPath,J=!!(M?.isStartupReveal&&o.startView==="navigation")?"center":"auto";if(c.selectionType==="tag"){let Z=jW(R,c.selectedTag,o,g(),i,$);if(C=Z,Z){let ce=Ze(Z);if(ce)if(i&&$)if(o.showTags&&o.showAllTagsFolder&&!s.expandedVirtualFolders.has(_n))if(ce===bt){let se=new Set(s.expandedVirtualFolders);se.add(_n),l({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:se}),C=bt}else C=zt;else C=GW(ce,s.expandedTags);else{if(o.showTags&&o.showAllTagsFolder&&!s.expandedVirtualFolders.has(_n)){let ae=new Set(s.expandedVirtualFolders);ae.add(_n),l({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:ae})}if(ce.includes("/")){let ae=ce.split("/"),se=[];for(let ne=1;ne!s.expandedTags.has(ne))&&K(se)}C=ce}}}if(c.selectionType==="property"){let Z=g().getFile(R.path),ce=o.showProperties?Sj(Z?.properties??null,c.selectedProperty,o,i):null;if(x=ce,ce){let ae=o.showProperties&&o.showAllPropertiesFolder&&!s.expandedVirtualFolders.has(Oe);if(i&&ae)x=Oe;else{let se=ce,ne=se!==Oe?zi(se):null,B=ne&&fT(ne)?ne:null,q=!!(B&&B!==se&&!s.expandedProperties.has(B));if(i&&q)x=B;else{if(!i&&o.showProperties&&o.showAllPropertiesFolder&&!s.expandedVirtualFolders.has(Oe)){let ie=new Set(s.expandedVirtualFolders);ie.add(Oe),l({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:ie})}!i&&q&&B&&G([B])}}}}let re=null;if(C==null&&x==null&&R.parent)if($){let{target:Z,expandAncestors:ce}=N(R.parent);re=Z;let ae=c.selectedFolder,se=i&&c.selectionType==="folder"&&ae!==null&&kK(ae.path,R.parent.path);if(Z?ae&&ae.path===Z.path||se?H=!0:z=Z:se&&(H=!0),ce){let ne=[],B=R.parent;if(B&&B.parent)for(B=B.parent;B&&(ne.unshift(B.path),B.path!=="/");)B=B.parent;ne.some(q=>!s.expandedFolders.has(q))&&O(ne)}}else{re=R.parent,z=R.parent;let Z=[],ce=R.parent.parent;for(;ce&&(Z.unshift(ce.path),ce.path!=="/");)ce=ce.parent;Z.some(ae=>!s.expandedFolders.has(ae))&&O(Z)}if(u({type:"REVEAL_FILE",file:R,preserveFolder:H,isManualReveal:!1,targetTag:C,targetProperty:x,targetFolder:z??void 0,source:Y}),!!!(o.skipAutoScroll&&Y==="shortcut")){if(C&&e.current)e.current.requestScroll(C,{align:J,itemType:W.TAG});else if(!C&&x&&e.current)e.current.requestScroll(x,{align:J,itemType:W.PROPERTY});else if(!C&&!x&&e.current){let Z=z??(H&&c.selectedFolder?c.selectedFolder:re??R.parent);Z&&e.current.requestScroll(Z.path,{align:J,itemType:W.FOLDER})}}},[o,i,c.selectedFolder,c.selectionType,c.selectedTag,c.selectedProperty,s.expandedFolders,s.expandedTags,s.expandedProperties,s.expandedVirtualFolders,l,O,G,K,u,g,N,e,I]),A=(0,ao.useCallback)((R,M)=>{let C=typeof R=="string"?t.vault.getFolderByPath(R):R;if(!C)return!1;let x=[],z=C.parent;for(;z&&(x.unshift(z.path),z.path!=="/");)z=z.parent;x.some($=>!s.expandedFolders.has($))&&O(x);let Y=!!M?.suppressAutoSelect;return u({type:"SET_SELECTED_FOLDER",folder:C,source:M?.source,autoSelectedFile:Y?null:void 0,historyIndex:M?.historyIndex}),M?.skipFocus||(p.singlePane?M?.preserveNavigationFocus?n({updateSinglePaneView:!0}):r({updateSinglePaneView:!0}):n()),!M?.skipScroll&&e.current&&e.current.requestScroll(C.path,{align:"auto",itemType:W.FOLDER}),!0},[t,s.expandedFolders,O,u,p,e,n,r]),_=(0,ao.useCallback)((R,M)=>MF({showTags:o.showTags,showAllTagsFolder:o.showAllTagsFolder,expandedTags:s.expandedTags,expandedVirtualFolders:s.expandedVirtualFolders,collapseOtherBranchesOnExpand:o.collapseOtherBranchesOnExpand,expansionDispatch:l,selectionDispatch:u,uiState:{singlePane:p.singlePane,currentSinglePaneView:p.currentSinglePaneView,focusedPane:p.focusedPane},uiDispatch:m,findTagInTree:h,focusNavigationPane:n,focusFilesPane:r,requestScroll:(C,x)=>{e.current?.requestScroll(C,x)}},R,M),[l,s.expandedTags,s.expandedVirtualFolders,h,r,n,e,u,o.showAllTagsFolder,o.collapseOtherBranchesOnExpand,o.showTags,m,p.currentSinglePaneView,p.focusedPane,p.singlePane]),E=(0,ao.useCallback)((R,M)=>RF({showProperties:o.showProperties,showAllPropertiesFolder:o.showAllPropertiesFolder,propertyTree:f(),expandedProperties:s.expandedProperties,expandedVirtualFolders:s.expandedVirtualFolders,collapseOtherBranchesOnExpand:o.collapseOtherBranchesOnExpand,expansionDispatch:l,selectionDispatch:u,uiState:{singlePane:p.singlePane,currentSinglePaneView:p.currentSinglePaneView,focusedPane:p.focusedPane},uiDispatch:m,focusNavigationPane:n,focusFilesPane:r,requestScroll:(C,x)=>{e.current?.requestScroll(C,x)}},R,M),[l,s.expandedProperties,s.expandedVirtualFolders,r,n,e,u,o.showAllPropertiesFolder,o.collapseOtherBranchesOnExpand,o.showProperties,m,p.currentSinglePaneView,p.focusedPane,p.singlePane,f]);return(0,ao.useEffect)(()=>{if(v){let R=window.setTimeout(()=>{y(null),w(!1)},Lt.DEBOUNCE_KEYBOARD);return()=>window.clearTimeout(R)}},[v]),(0,ao.useEffect)(()=>{if(!o.autoRevealActiveFile)return;let R=(C,x)=>{let z=t.workspace.getActiveViewOfType(Wb.FileView),H=z?.file instanceof Wb.TFile?z.file:null,Y=x?.activeLeaf??z?.leaf??null,ee=C instanceof Wb.TFile?C:H;if(!ee)return;let $=ee.stat.ctime===ee.stat.mtime&&Date.now()-ee.stat.ctime{R(C,{activeLeaf:x})}});if(!F.current){let C=t.workspace.getActiveFile();if(C){let x=t.workspace.getActiveViewOfType(Wb.FileView)?.leaf??null,z=md(t,x);!(o.autoRevealIgnoreRightSidebar&&z==="right-sidebar")&&!T(x)&&(k.current=C.path,w(!0),y(C))}F.current=!0}return()=>{M()}},[t,t.workspace,o.autoRevealActiveFile,o.autoRevealIgnoreOtherWindows,o.autoRevealIgnoreRightSidebar,o.startView,b,T]),(0,ao.useEffect)(()=>{if(v)if(S){if(o.autoRevealShortestPath&&c.selectionType===W.TAG&&c.selectedTag&&c.selectedFile?.path===v.path){let R=p.singlePane&&o.startView==="navigation";L(c.selectedTag,{skipSinglePaneSwitch:R});return}if(c.selectionType===W.PROPERTY&&c.selectedProperty&&c.selectedFile?.path===v.path){let R=p.singlePane&&o.startView==="navigation";if(V(c.selectedProperty,{skipSinglePaneSwitch:R}))return}D(v,{source:"auto",isStartupReveal:!0})}else D(v,{source:"auto"})},[v,S,X,D,c.selectionType,c.selectedTag,c.selectedProperty,c.selectedFile,L,V,o.autoRevealShortestPath,o.startView,p.singlePane]),{revealFileInActualFolder:X,revealFileInNearestFolder:D,navigateToFolder:A,navigateToTag:_,navigateToProperty:E,revealTag:L,revealProperty:V}}var ao,Wb,V9=U(()=>{ao=ue(ze()),Wb=require("obsidian");dk();O9();Qs();Ur();on();Tr();pa();Xi();mn();Sn();Ue();jr();$o();lH();dH();qy();Ee();Fn();qM();cn();hu()});function U9({app:t,containerRef:e,setIsNavigatorFocused:n}){let r=Yn(),o=Ra(),a=gr(),i=qs(),s=Op.Platform.isMobile;(0,YM.useEffect)(()=>{let l=u=>{if(u instanceof Op.TFolder){let p=new Set,m=g=>{p.add(g.path),g.children.forEach(f=>{f instanceof Op.TFolder&&m(f)})};m(t.vault.getRoot()),o({type:"CLEANUP_DELETED_FOLDERS",existingPaths:p}),a({type:"CLEANUP_DELETED_FOLDER",deletedPath:u.path})}else u instanceof Op.TFile&&a({type:"CLEANUP_DELETED_FILE",deletedPath:u.path,nextFileToSelect:null})},c=t.vault.on("delete",l);return()=>{t.vault.offref(c)}},[t.vault,o,a]),(0,YM.useEffect)(()=>{if(s){n(!0);return}let l=e.current;if(!l)return;let c=(0,Op.debounce)(m=>{n(m)},Lt.DEBOUNCE_KEYBOARD),u=()=>{c(!0)},p=m=>{m.relatedTarget&&l.contains(m.relatedTarget)||c(!1)};return l.addEventListener("focusin",u),l.addEventListener("focusout",p),Di(l),()=>{c.cancel(),l.removeEventListener("focusin",u),l.removeEventListener("focusout",p)}},[e,n,s]),(0,YM.useEffect)(()=>{if(r.focusedPane==="search")return;let l=i.isOpeningVersionHistory(),c=i.isOpeningInNewContext();if(r.focusedPane&&!l&&!c){let u=e.current;if(!u)return;Di(u)}},[r.focusedPane,e,i])}var YM,Op,K9=U(()=>{YM=ue(ze()),Op=require("obsidian");jr();Qs();Ur();pa();mn();os()});function $M(){let t=(0,jb.useRef)(null),e=(0,jb.useCallback)(({event:n,onMove:r,onEnd:o,onCancel:a})=>{if(t.current)return;let i=n.currentTarget,s=n.pointerId;function l(m){m.pointerId===s&&r(m)}function c(m){m.pointerId===s&&(p(),o(m))}function u(m){if(m.pointerId===s){if(p(),a){a(m);return}o(m)}}function p(){window.removeEventListener("pointermove",l),window.removeEventListener("pointerup",c),window.removeEventListener("pointercancel",u),i.hasPointerCapture(s)&&i.releasePointerCapture(s),t.current=null}i.setPointerCapture(s),window.addEventListener("pointermove",l),window.addEventListener("pointerup",c),window.addEventListener("pointercancel",u),t.current=p},[]);return(0,jb.useEffect)(()=>()=>{t.current&&(t.current(),t.current=null)},[]),{startPointerDrag:e}}var jb,cH=U(()=>{jb=ue(ze())});function uH({orientation:t="horizontal",initialSize:e,min:n,storageKey:r,scale:o}={}){let a=Yd(t),i=typeof e=="number"?e:a.defaultSize,s=typeof n=="number"?n:a.minSize,[l,c]=(0,vf.useState)(()=>{if(r){let h=ye.get(r);if(typeof h=="number")return Math.max(s,h)}return i}),[u,p]=(0,vf.useState)(!1),{startPointerDrag:m}=$M(),g=typeof o=="number"&&Number.isFinite(o)&&o>0?o:1,f=(0,vf.useCallback)(h=>{if(h.pointerType==="mouse"&&h.button!==0)return;let b=t==="horizontal"?h.clientX:h.clientY,v=l,y=v,S=t==="horizontal"&&activeDocument.body.classList.contains("mod-rtl");p(!0),h.preventDefault(),h.stopPropagation(),m({event:h,onMove:w=>{let F=(t==="horizontal"?w.clientX:w.clientY)-b;S&&(F=-F);let P=F/g;y=Math.max(s,v+P),c(y)},onEnd:()=>{r&&ye.set(r,y),p(!1)}})},[t,l,s,g,r,m]);return(0,vf.useEffect)(()=>{if(!r){c(i);return}let h=ye.get(r);if(typeof h=="number"){c(Math.max(s,h));return}c(i)},[t,i,s,r]),{paneSize:l,isResizing:u,resizeHandleProps:{onPointerDown:f}}}var vf,W9=U(()=>{vf=ue(ze());Jr();Jv();cH()});function gH(t){switch(t){case"folders-only":return{affectFolders:!0,affectTags:!1,affectProperties:!1};case"tags-only":return{affectFolders:!1,affectTags:!0,affectProperties:!1};case"properties-only":return{affectFolders:!1,affectTags:!1,affectProperties:!0};default:return{affectFolders:!0,affectTags:!0,affectProperties:!0}}}function ewe(t,e){if(!e)return t.size>0;for(let n of t)if(n!==XM)return!0;return!1}function twe(t,e){let n=new Set,r=o=>{o.children.forEach(a=>{a instanceof j9.TFolder&&(n.add(a.path),r(a))})};return e&&n.add(t.path),r(t),n}function G9(t,e){let n=new Set(t);return e.keepTagsRoot!==void 0&&(e.keepTagsRoot?n.add(_n):n.delete(_n)),e.keepPropertiesRoot!==void 0&&(e.keepPropertiesRoot?n.add(Oe):n.delete(Oe)),n}function nwe(t){let e=gH(t.behavior),n=new Set,r=new Set,o=new Set,a=t.preserveRootFolder===!0,i=t.rootFolderExpanded===!0;if(e.affectFolders&&t.selectedFolderParentPaths)for(let l of t.selectedFolderParentPaths)a&&l===XM&&!i||n.add(l);if(e.affectFolders&&a&&i&&n.add(XM),e.affectTags&&t.selectedTagParentPaths)for(let l of t.selectedTagParentPaths)r.add(l);e.affectProperties&&t.selectedPropertyKeyNodeId&&o.add(t.selectedPropertyKeyNodeId);let s=G9(t.currentExpandedVirtualFolders,{keepTagsRoot:e.affectTags?!!t.revealTagsRoot:void 0,keepPropertiesRoot:e.affectProperties?!!t.revealPropertiesRoot:void 0});return{folders:n,tags:r,properties:o,virtualFolders:s}}function pH(t,e){let n=e?.includeSelection??!1;return nwe({behavior:t.behavior,currentExpandedVirtualFolders:t.currentExpandedVirtualFolders,selectedFolderParentPaths:n?rwe(t.selectedFolder??null):void 0,selectedTagParentPaths:n?owe(t.selectedTag??null):void 0,selectedPropertyKeyNodeId:n?awe(t.selectedPropertyNodeId??null):void 0,revealTagsRoot:n?iwe(t.selectedTag??null,t.showAllTagsFolder):void 0,revealPropertiesRoot:n?swe(t.selectedPropertyNodeId??null,t.showAllPropertiesFolder):void 0,preserveRootFolder:t.preserveRootFolder,rootFolderExpanded:t.rootFolderExpanded})}function rwe(t){let e=[],n=t?.parent??null;for(;n&&(e.push(n.path),n.path!=="/");)n=n.parent;return e}function owe(t){if(!t)return[];let e=[],n=t.split("/"),r="";for(let o=0;oe.has(n))}function Gb(){let{app:t}=gt(),e=pt(),r=Xt().showHiddenItems,{setShowHiddenItems:o}=wd(),a=ta(),i=Ra(),s=ar(),l=li(),{fileData:c}=xo(),u=(0,DF.useCallback)(()=>{let f=e.collapseBehavior,h=gH(f),b=h.affectFolders&&ewe(a.expandedFolders,e.excludeVaultRootFromCollapse),v=h.affectTags&&(a.expandedTags.size>0||e.showAllTagsFolder&&a.expandedVirtualFolders.has(_n)),y=h.affectProperties&&(a.expandedProperties.size>0||e.showAllPropertiesFolder&&a.expandedVirtualFolders.has(Oe)),S=b||v||y;if(e.smartCollapse&&S){let w=pH({behavior:f,currentExpandedVirtualFolders:a.expandedVirtualFolders,selectedFolder:s.selectedFolder,selectedTag:s.selectedTag,selectedPropertyNodeId:s.selectedProperty,showAllTagsFolder:e.showAllTagsFolder,showAllPropertiesFolder:e.showAllPropertiesFolder,preserveRootFolder:e.excludeVaultRootFromCollapse,rootFolderExpanded:a.expandedFolders.has(XM)},{includeSelection:!0}),k=!h.affectFolders||mH(a.expandedFolders,w.folders),F=!h.affectTags||mH(a.expandedTags,w.tags),P=!h.affectProperties||mH(a.expandedProperties,w.properties),T=(!h.affectTags||w.virtualFolders.has(_n)===a.expandedVirtualFolders.has(_n))&&(!h.affectProperties||w.virtualFolders.has(Oe)===a.expandedVirtualFolders.has(Oe));if(k&&F&&P&&T)return!1}return S},[e.collapseBehavior,e.excludeVaultRootFromCollapse,e.showAllPropertiesFolder,e.showAllTagsFolder,e.smartCollapse,a.expandedFolders,a.expandedProperties,a.expandedTags,a.expandedVirtualFolders,s.selectedFolder,s.selectedProperty,s.selectedTag]),p=(0,DF.useCallback)(()=>{let f=e.collapseBehavior,h=t.vault.getRoot(),b=u(),v=gH(f);if(b)if(e.smartCollapse&&(s.selectedFolder||s.selectedTag||s.selectedProperty)){let y=pH({behavior:f,currentExpandedVirtualFolders:a.expandedVirtualFolders,selectedFolder:s.selectedFolder,selectedTag:s.selectedTag,selectedPropertyNodeId:s.selectedProperty,showAllTagsFolder:e.showAllTagsFolder,showAllPropertiesFolder:e.showAllPropertiesFolder,preserveRootFolder:e.excludeVaultRootFromCollapse,rootFolderExpanded:a.expandedFolders.has(h.path)},{includeSelection:!0});v.affectFolders&&i({type:"SET_EXPANDED_FOLDERS",folders:y.folders}),v.affectTags&&i({type:"SET_EXPANDED_TAGS",tags:y.tags}),v.affectProperties&&i({type:"SET_EXPANDED_PROPERTIES",properties:y.properties}),(v.affectTags||v.affectProperties)&&i({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:y.virtualFolders})}else{let y=pH({behavior:f,currentExpandedVirtualFolders:a.expandedVirtualFolders,showAllTagsFolder:e.showAllTagsFolder,showAllPropertiesFolder:e.showAllPropertiesFolder,preserveRootFolder:e.excludeVaultRootFromCollapse,rootFolderExpanded:a.expandedFolders.has(h.path)});v.affectFolders&&i({type:"SET_EXPANDED_FOLDERS",folders:y.folders}),v.affectTags&&i({type:"SET_EXPANDED_TAGS",tags:y.tags}),v.affectProperties&&i({type:"SET_EXPANDED_PROPERTIES",properties:y.properties}),(v.affectTags||v.affectProperties)&&i({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:y.virtualFolders})}else if(v.affectFolders&&i({type:"SET_EXPANDED_FOLDERS",folders:twe(h,e.showRootFolder)}),v.affectTags||v.affectProperties){let y=new Set,S=new Set,w=k=>{k.children.size!==0&&(S.add(k.id),k.children.forEach(F=>{w(F)}))};if(v.affectTags){for(let k of c.tagTree.values())ml(k,y);i({type:"SET_EXPANDED_TAGS",tags:y})}if(v.affectProperties){for(let k of c.propertyTree.values())w(k);i({type:"SET_EXPANDED_PROPERTIES",properties:S})}i({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:G9(a.expandedVirtualFolders,{keepTagsRoot:v.affectTags?e.showAllTagsFolder:void 0,keepPropertiesRoot:v.affectProperties?e.showAllPropertiesFolder:void 0})})}},[t,i,a.expandedFolders,a.expandedVirtualFolders,e.collapseBehavior,e.excludeVaultRootFromCollapse,e.showAllPropertiesFolder,e.showAllTagsFolder,e.showRootFolder,e.smartCollapse,s.selectedFolder,s.selectedProperty,s.selectedTag,c.propertyTree,c.tagTree,u]),m=(0,DF.useCallback)(async()=>{if(s.selectedFolder)try{await l.createNewFolder(s.selectedFolder,()=>{if(s.selectedFolder&&!a.expandedFolders.has(s.selectedFolder.path)){let f=e.collapseOtherBranchesOnExpand?[...Dp(s.selectedFolder),s.selectedFolder.path]:[s.selectedFolder.path];ys({type:"folder",ids:f,collapseOtherBranches:e.collapseOtherBranchesOnExpand,dispatch:i})}})}catch{}},[s.selectedFolder,a.expandedFolders,l,i,e.collapseOtherBranchesOnExpand]),g=(0,DF.useCallback)(()=>{o(!r)},[o,r]);return{shouldCollapseItems:u,handleExpandCollapseAll:p,handleNewFolder:m,handleToggleShowExcludedFolders:g}}var DF,j9,XM,QM=U(()=>{DF=ue(ze()),j9=require("obsidian");Qs();Ur();mn();on();Tr();Xi();Ue();cn();Ba();hu();XM="/"});function lwe(t,e){let{onSwipeRight:n,onSwipeLeft:r,threshold:o=50,edgeThreshold:a=25,enabled:i=!0,allowAnywhereSwipe:s=!1,isRTL:l,shouldIgnoreTouchStart:c}=e,u=l??!1,p=(0,fu.useRef)(null),m=(0,fu.useRef)(null),g=(0,fu.useRef)(!1);(0,fu.useEffect)(()=>{if(!i||!t.current)return;let f=t.current,h=y=>{let S=y.touches[0];p.current=S.clientX,m.current=S.clientY;let w=c?.(y)??!1,k=s?!0:u?S.clientX>=window.innerWidth-a:S.clientX<=a;g.current=k&&!w},b=y=>{if(!g.current||p.current===null||m.current===null)return;let S=y.touches[0],w=S.clientX-p.current,k=S.clientY-m.current;Math.abs(w)>Math.abs(k)+5&&y.preventDefault()},v=y=>{if(p.current===null||m.current===null)return;if(!g.current){p.current=null,m.current=null,g.current=!1;return}let S=y.changedTouches[0].clientX,w=y.changedTouches[0].clientY,k=S-p.current,F=w-m.current;Math.abs(k)>Math.abs(F)&&Math.abs(k)>o&&(k>0&&n?n():k<0&&r&&r()),p.current=null,m.current=null,g.current=!1};return f.addEventListener("touchstart",h),f.addEventListener("touchmove",b,{passive:!1}),f.addEventListener("touchend",v),()=>{f.removeEventListener("touchstart",h),f.removeEventListener("touchmove",b),f.removeEventListener("touchend",v)}},[s,t,n,r,o,a,i,u,c])}function q9(t,e){let n=Yn(),r=Vr(),o=activeDocument.body.classList.contains("mod-rtl"),a=!0,i=(0,fu.useCallback)(u=>{let p=u.target;return p instanceof Element?p.closest(".nn-breadcrumb-scroll")!==null:!1},[]),s=(0,fu.useCallback)(()=>{o||(r({type:"SET_SINGLE_PANE_VIEW",view:"navigation"}),r({type:"SET_FOCUSED_PANE",pane:"navigation"}))},[o,r]),l=(0,fu.useCallback)(()=>{o&&(r({type:"SET_SINGLE_PANE_VIEW",view:"navigation"}),r({type:"SET_FOCUSED_PANE",pane:"navigation"}))},[o,r]),c=e&&n.singlePane&&n.currentSinglePaneView==="files";lwe(t,{onSwipeRight:s,onSwipeLeft:l,enabled:c,allowAnywhereSwipe:a,shouldIgnoreTouchStart:i,isRTL:o})}var fu,Y9=U(()=>{fu=ue(ze());pa()});function $9(){let{plugin:t}=gt(),[e,n]=(0,qb.useState)(()=>t.getPendingUpdateNotice());(0,qb.useEffect)(()=>{let o=`update-notice-${Date.now()}-${Math.random().toString(36).slice(2)}`,a=i=>{n(i)};return t.registerUpdateNoticeListener(o,a),()=>{t.unregisterUpdateNoticeListener(o)}},[t]);let r=(0,qb.useCallback)(o=>{t.markUpdateNoticeAsDisplayed(o)},[t]);return{bannerNotice:e,markAsDisplayed:r}}var qb,X9=U(()=>{qb=ue(ze());mn()});function Q9(t){let e=[];return Array.from(t.values()).sort((r,o)=>Mt(r.displayPath,o.displayPath)).forEach(r=>{e.push({nodeId:r.id,label:r.displayPath,searchText:r.displayPath,noteCount:jc(r)}),Array.from(r.children.values()).sort((a,i)=>Mt(a.displayPath,i.displayPath)).forEach(a=>{e.push({nodeId:a.id,label:`${r.displayPath}: ${a.displayPath}`,searchText:`${r.displayPath} ${a.displayPath}`,noteCount:a.notesWithValue.size})})}),e}var AF,Z9=U(()=>{Ee();cn();Rn();Nh();AF=class extends Ls{constructor(n,r,o,a,i){super(n,s=>o(s.nodeId),a,{navigate:d.modals.propertySuggest.instructions.navigate,action:i,dismiss:d.modals.propertySuggest.instructions.dismiss});this.suggestions=r}getItems(){return[...this.suggestions]}getItemText(n){return n.searchText}getDisplayPath(n){return n.label}getItemClass(){return"nn-property-suggest-item"}renderAdditionalContent(n,r){n.noteCount<=0||r.createSpan({text:` (${n.noteCount.toLocaleString()})`,cls:"nn-tag-suggest-count"})}}});function dwe(t,e){let n=It(t);return n?e.some(r=>r.item.path===n):!1}var Yb,hH=U(()=>{Ee();Nh();Sn();Dr();Yb=class extends Ls{constructor(n,r,o,a,i,s=!0){super(n,l=>{l.path==="__create_new__"&&this.currentInput?o(this.currentInput):o(l.displayPath)},a,{navigate:d.modals.tagSuggest.instructions.navigate,action:i,dismiss:d.modals.tagSuggest.instructions.dismiss});this.currentInput="";this.createNewNode=null;this.plugin=r,this.allowTagCreation=s}getSuggestions(n){this.currentInput=n.trim();let r=super.getSuggestions(n);return!this.allowTagCreation||!gN(this.currentInput)||dwe(this.currentInput,r)?r:(this.createNewNode={name:d.modals.tagSuggest.createNewTag.replace("{tag}",this.currentInput),path:"__create_new__",displayPath:"__create_new__",children:new Map,notesWithTag:new Set},[{item:this.createNewNode,match:{score:-1,matches:[]}},...r])}getItems(){return[...this.plugin.tagTreeService?.getFlattenedTagNodes()??[]]}getItemText(n){return n.path==="__create_new__"?this.currentInput:`#${n.displayPath}`}getDisplayPath(n){return n.path==="__create_new__"?n.name:`#${n.displayPath}`}getItemClass(){return"nn-tag-suggest-item"}resolveTagNoteCount(n){return n.path==="__create_new__"?null:n.notesWithTag.size}renderAdditionalContent(n,r){let o=this.resolveTagNoteCount(n);o===null||o<=0||r.createSpan({text:` (${o.toLocaleString()})`,cls:"nn-tag-suggest-count"})}}});function vc(t){return`${t.type}:${t.key}`}function Lp(t,e){return t===W.TAG?Ze(e)??e.toLowerCase():e}function J9(t,e){let n=Lp(t,e);return`${t}:${n}`}function Rl(t,e,n){return t.get(J9(e,n))}function OF(t,e,n,r){t.set(J9(e,n),r)}function eZ(t){let e=new Map;return t.forEach((n,r)=>{n.type===he.FOLDER?OF(e,W.FOLDER,n.data.path,r):n.type===he.TAG||n.type===he.UNTAGGED?OF(e,W.TAG,n.data.path,r):n.type===he.VIRTUAL_FOLDER&&n.tagCollectionId?OF(e,W.TAG,n.tagCollectionId,r):n.type===he.VIRTUAL_FOLDER&&n.propertyCollectionId?OF(e,W.PROPERTY,n.key,r):(n.type===he.PROPERTY_KEY||n.type===he.PROPERTY_VALUE)&&OF(e,W.PROPERTY,n.data.id,r)}),e}function cwe(t){return typeof t.level!="number"?!1:t.type===he.FOLDER||t.type===he.TAG||t.type===he.UNTAGGED||t.type===he.PROPERTY_KEY||t.type===he.PROPERTY_VALUE||t.type===he.VIRTUAL_FOLDER}function tZ(t,e=n=>n.key){let n=new Map,r=t.filter(cwe),o=[],a=[],i=new Map;return r.forEach((s,l)=>{let c=e(s);for(;o.length>0&&o[o.length-1]>=s.level;)o.pop(),a.pop();if(o.length>0){let p=a[a.length-1],m=i.get(p);if(m)n.set(c,m);else{let g=[...o];i.set(p,g),n.set(c,g)}}let u=r[l+1]?.level;if(typeof u=="number"&&u>s.level){o.push(s.level);let p=a[a.length-1];a.push(p?`${p}/${s.level}`:`${s.level}`)}}),n}var Mg=U(()=>{Ue();Sn()});async function ZM({app:t,fileSystemOps:e,settings:n,visibility:r,selectionState:o,selectionDispatch:a,tagTreeService:i,propertyTreeService:s,orderedFiles:l}){let c=u=>l?.some(p=>u.has(p.path))?l:ca({selectionType:o.selectionType,selectedFolder:o.selectedFolder,selectedTag:o.selectedTag,selectedProperty:o.selectedProperty},n,r,t,i,s);if(o.selectedFiles.size>1){let u=c(o.selectedFiles);await e.deleteFilesWithSmartSelection(o.selectedFiles,u,a,n.confirmBeforeDelete)}else o.selectedFile&&await e.deleteSelectedFile(o.selectedFile,n,{selectionType:o.selectionType,selectedFolder:o.selectedFolder||void 0,selectedTag:o.selectedTag||void 0,selectedProperty:o.selectedProperty??void 0},a,n.confirmBeforeDelete,c(new Set([o.selectedFile.path])))}async function nZ({app:t,fileSystemOps:e,settings:n,selectionState:r,selectionDispatch:o}){if(!r.selectedFolder)return;let a=r.selectedFolder;if(a.path==="/")return;let i=null,s=a.parent;if(s){let l=s.children.filter(u=>u instanceof fH.TFolder).sort((u,p)=>Mt(u.name,p.name)),c=l.findIndex(u=>u.path===a.path);c!==-1&&(c0?i=l[c-1]:i=s)}else{let c=t.vault.getRoot().children.filter(u=>u instanceof fH.TFolder&&u.path!==a.path).sort((u,p)=>Mt(u.name,p.name));c.length>0&&(i=c[0])}await e.deleteFolder(a,n.confirmBeforeDelete,()=>{i&&o({type:"SET_SELECTED_FOLDER",folder:i})})}var fH,JM=U(()=>{fH=require("obsidian");Rn();ai()});function eR({compactItemHeight:t,scaleText:e,titleLineHeight:n}){let{defaultCompactItemHeight:r,defaultCompactFontSize:o,mobileHeightIncrement:a,mobileFontSizeIncrement:i,minCompactPaddingVerticalMobile:s}=qP,l=Math.max((t-n)/2,0),c=Math.max(t-n,0),u=o;e&&(t<=r-6?u=o-2:t<=r-4&&(u=o-1));let p=t+a,m=Math.max((p-n)/2,0),g=Math.max(s,m),f=g*2,h=u+i;return{fontSize:u,mobileFontSize:h,desktopPadding:l,desktopPaddingTotal:c,mobilePadding:g,mobilePaddingTotal:f}}var vH=U(()=>{Ue()});function uwe(t){let e=t.ownerDocument.createElement("div");return e.style.cssText=`
position: absolute;
visibility: hidden;
pointer-events: none;
width: auto;
height: auto;
line-height: 1;
white-space: nowrap;
`,e.textContent="M",t.appendChild(e),e}function yH(t){let e=Number.parseFloat(t);return!Number.isFinite(e)||e<=0?null:e}function pwe(t){let e=uwe(t);try{e.classList.add("nn-mobile"),e.style.fontSize="16px";let n=getComputedStyle(e),r=e.getBoundingClientRect().height,o=r>0?r:yH(n.fontSize),a=o?o/16:1,i={};for(let s of tR){let l=n.getPropertyValue(s),c=yH(l.trim());if(c!==null){i[s]=c;continue}e.style.fontSize=`var(${s})`;let u=yH(getComputedStyle(e).fontSize);u!==null&&(i[s]=u/a)}return{scaleFactor:a,fontSizeValues:i}}finally{e.remove()}}function bH(t){t.style.removeProperty("--nn-android-font-scale");for(let e of tR)t.style.removeProperty(e)}function rZ(t){bH(t);let{scaleFactor:e,fontSizeValues:n}=pwe(t),r=Math.round(e*1e3)/1e3;if(!(Math.abs(r-1)<=.02)){t.style.setProperty("--nn-android-font-scale",String(r));for(let o of tR){let a=n[o];if(a===void 0)continue;let i=a/r;t.style.setProperty(o,`${i}px`)}}}function oZ(t){if(!(t instanceof HTMLElement))return 1;let e=t.style.getPropertyValue("--nn-android-font-scale");if(!e)return 1;let n=parseFloat(e);return Number.isFinite(n)?n:1}function mwe(t,e){let n=t.style.getPropertyValue("--nn-android-font-scale");n&&e.style.setProperty("--nn-android-font-scale",n.trim());for(let r of tR){let o=t.style.getPropertyValue(r);o&&e.style.setProperty(r,o.trim())}}function aZ(t){let e=t.querySelector(".nn-split-container.nn-mobile");e instanceof HTMLElement&&mwe(t,e)}var tR,SH=U(()=>{tR=["--nn-file-name-size","--nn-file-name-size-mobile","--nn-file-small-size","--nn-file-small-size-mobile","--nn-list-title-font-size","--nn-desktop-header-font-size","--nn-mobile-header-font-size","--nn-compact-font-size","--nn-compact-font-size-mobile"]});function nR(t){return t==="primary"?["nn-bg-primary"]:t==="secondary"?["nn-bg-secondary"]:[]}var wH=U(()=>{});var iZ,rR,sZ=U(()=>{iZ=require("obsidian");Ee();rR=class extends iZ.FuzzySuggestModal{constructor(e,n,r){super(e),this.tags=n,this.onChooseTag=r,this.setPlaceholder(d.modals.tagSuggest.removePlaceholder),this.setInstructions([{command:"↑↓",purpose:d.modals.tagSuggest.instructions.navigate},{command:"↵",purpose:d.modals.tagSuggest.instructions.remove},{command:"esc",purpose:d.modals.tagSuggest.instructions.dismiss}])}getItems(){return this.tags}getItemText(e){return`#${e}`}onChooseItem(e,n){this.onChooseTag(e)}}});function $b({app:t,plugin:e,tagOperations:n,files:r,options:o}){if(r.length===0)return;if(r.some(u=>u.extension!=="md")){de(d.fileSystem.notifications.tagsRequireMarkdown,{variant:"warning"});return}let i=o?.allowTagCreation??!0,s=o?.placeholderText??d.modals.tagSuggest.addPlaceholder,l=o?.actionText??d.modals.tagSuggest.instructions.add;new Yb(t,e,u=>{Q(async()=>{let p=await n.addTagToFiles(u,r);if(p.added>0){let m=p.added===1?d.fileSystem.notifications.tagAddedToNote:d.fileSystem.notifications.tagAddedToNotes.replace("{count}",p.added.toString());de(m,{variant:"success"})}else{let m=p.skipped>0?p.skipped:r.length,g=d.dragDrop.notifications.filesAlreadyHaveTag.replace("{count}",m.toString());de(g,{variant:"warning"})}o?.onComplete?.(p)})},s,l,i).open()}async function oR({app:t,tagOperations:e,files:n,options:r}){if(n.length===0)return;if(!n.every(s=>s.extension==="md")){de(d.fileSystem.notifications.tagsRequireMarkdown,{variant:"warning"});return}let o=e.getTagsFromFiles(n);if(o.length===0){de(d.fileSystem.notifications.noTagsToRemove,{variant:"warning"});return}let a=s=>{if(s<=0)return;let l=s===1?d.fileSystem.notifications.tagRemovedFromNote:d.fileSystem.notifications.tagRemovedFromNotes.replace("{count}",s.toString());de(l,{variant:"success"}),r?.onComplete?.(s)};if(o.length===1){let s=await e.removeTagFromFiles(o[0],n);a(s);return}new rR(t,o,s=>{Q(async()=>{let l=await e.removeTagFromFiles(s,n);a(l)})}).open()}function aR({app:t,tagOperations:e,files:n,options:r}){if(n.length===0)return;if(!n.every(i=>i.extension==="md")){de(d.fileSystem.notifications.tagsRequireMarkdown,{variant:"warning"});return}if(e.getTagsFromFiles(n).length===0){de(d.fileSystem.notifications.noTagsToRemove,{variant:"warning"});return}new En(t,d.modals.fileSystem.removeAllTagsTitle,n.length===1?d.modals.fileSystem.removeAllTagsFromNote:d.modals.fileSystem.removeAllTagsFromNotes.replace("{count}",n.length.toString()),()=>{Q(async()=>{let i=await e.clearAllTagsFromFiles(n);if(i<=0)return;let s=i===1?d.fileSystem.notifications.tagsClearedFromNote:d.fileSystem.notifications.tagsClearedFromNotes.replace("{count}",i.toString());de(s,{variant:"success"}),r?.onComplete?.(i)})},r?.confirmActionLabel??d.common.remove).open()}var iR=U(()=>{hH();sZ();Ai();Ee();ot();Fn()});function gwe(t){let e=LF.get(t);if(e!==void 0)return e;let n=bj(t);if(n.size===0)return LF.set(t,!1),!1;let r=Sr();if(!r)return LF.set(t,!1),!1;let o=t.key;for(let a of n){let s=r.getFile(a)?.properties;if(s){for(let l of s)if(Me(l.fieldKey)===o&&!(l.valueKind!==void 0&&l.valueKind!=="boolean")&&rr(l.value)==="true")return LF.set(t,!0),!0}}return LF.set(t,!1),!1}function sR(t,e){let n=nn(t),r=Array.isArray(n.propertyKeys)?n.propertyKeys:[],o=[],a=new Set;if(r.forEach(c=>{if(!c.showInFileMenu)return;let u=c.key.trim(),p=Me(u);!u||!p||a.has(p)||(a.add(p),o.push({normalizedKey:p,displayKey:u}))}),o.length===0)return[];let i=[];o.forEach(({normalizedKey:c,displayKey:u})=>{let p=e?.getKeyNode(c)??null;if(!p)return;let m=(p.name.trim()||u).trim(),g=gwe(p),f=Array.from(p.children.values()).filter(h=>h.kind==="value"&&h.name.trim().length>0);!g&&f.length===0||(g&&i.push({nodeId:p.id,keyNodeId:p.id,label:`${m}: true`}),f.sort((h,b)=>{let v=Mt(h.name,b.name);return v!==0?v:h.name.localeCompare(b.name)}),f.forEach(h=>{let b=h.name.trim();i.push({nodeId:h.id,keyNodeId:p.id,label:`${m}: ${b}`})}))});let s=[],l=new Set;return i.forEach(c=>{l.has(c.nodeId)||(l.add(c.nodeId),s.push(c))}),s}var LF,TH=U(()=>{zn();cn();Ot();Rn();dn();LF=new WeakMap});function lZ(t,e){let n=t.indexOf(`
`,e);return n===-1?t.length:n}function kH(t,e){return e>=t.length?t.length:e+1}function hwe(t){let e=lZ(t,0);if(t.slice(0,e).trim()!=="---")return t;let r=kH(t,e);for(;r{n+=Swe(r,o,e)}),`${FH(n)}
`}function Swe(t,e,n){let r=e===0?t.content:hwe(t.content),o=e===0?FH(r):vwe(r);return`${e>0?ywe(n,t.file):""}${o}`}function lR(t){let e=t.trim().replace(/\.md$/iu,"").trim(),n=hC(e),r=vC(n);return(dZ.Platform.isWin?bC(r):r).trim()}function zp(t){let e=[],n=new Set;return t.forEach(r=>{r.extension!=="md"||n.has(r.path)||(n.add(r.path),e.push(r))}),e}async function wwe(t,e){let n=await Promise.allSettled(e.map(o=>t.fileManager.trashFile(o))),r=0;return n.forEach((o,a)=>{o.status!=="fulfilled"&&(r+=1,console.error("Error moving merged source note to trash:",e[a].path,o.reason))}),r}async function Twe(t,e){let n=[];for(let r of e)n.push({file:r,content:await t.vault.read(r)});return n}function kwe(t){if(t instanceof Error)return t;if(typeof t=="string"){let e=t.trim();if(e)return new Error(e)}return new Error("Failed to open merged note.")}async function Fwe(t,e,n){if(n)try{return await n(e)}catch(r){return console.error("Error moving merged source notes to trash:",r),e.length}return wwe(t,e)}async function cZ({app:t,files:e,outputFolder:n,outputName:r,separator:o,moveSourcesToTrash:a,openOutputFile:i,trashSourceFiles:s}){let l=zp(e);if(l.length<2)throw new Error("At least two markdown notes are required.");let c=lR(r);if(!c)throw new Error("Output name is required.");let u=await Twe(t,l),p=bwe(u,o),m=hl(n.path,c,"md",t),g=od(n.path,m,"md"),f=await t.vault.create(g,p),h=0,b=null;if(i)try{await i(f)}catch(v){b=kwe(v)}return a&&b===null&&(h=await Fwe(t,l,s)),{file:f,sourceCount:l.length,failedSourceTrashCount:h,outputOpenError:b}}var dZ,Xb=U(()=>{dZ=require("obsidian");Nm();rs()});var mZ={};In(mZ,{MergeNotesModal:()=>PH});function Cwe(){let t=ye.get(ut.mergeNotesSeparatorKey);return pZ(t)?t:uZ}function Nwe(){let t=ye.get(ut.mergeNotesMoveSourcesToTrashKey);return typeof t=="boolean"?t:Pwe}function Iwe(t,e){ye.set(ut.mergeNotesSeparatorKey,t),ye.set(ut.mergeNotesMoveSourcesToTrashKey,e)}function pZ(t){return t==="none"||t==="blank-line"||t==="horizontal-rule"||t==="heading"}var Qb,uZ,Pwe,PH,gZ=U(()=>{Qb=require("obsidian");Ee();Ue();ot();Jr();Xb();uZ="blank-line",Pwe=!1,PH=class extends Qb.Modal{constructor(n,r){super(n);this.isSubmitting=!1;this.moveSourcesToTrash=Nwe();this.outputName="";this.separator=Cwe();this.defaultOutputName=r.defaultOutputName,this.destinationFolder=r.destinationFolder,this.noteCount=r.noteCount,this.showCrossFolderLinkWarning=r.showCrossFolderLinkWarning,this.onSubmit=r.onSubmit,this.outputName=r.defaultOutputName}onOpen(){this.titleEl.setText(d.modals.mergeNotes.title),this.contentEl.createDiv({cls:"nn-input-description nn-merge-notes-summary",text:d.modals.mergeNotes.summary.replace("{count}",this.noteCount.toString()).replace("{folder}",this.getDestinationFolderLabel())}),new Qb.Setting(this.contentEl).setName(d.modals.mergeNotes.outputName).setDesc(d.modals.mergeNotes.outputNameDesc).addText(o=>{o.setPlaceholder(d.modals.mergeNotes.outputNamePlaceholder).setValue(this.defaultOutputName).onChange(a=>{this.outputName=a,this.updateSubmitState()})}),new Qb.Setting(this.contentEl).setName(d.modals.mergeNotes.separator).setDesc(d.modals.mergeNotes.separatorDesc).addDropdown(o=>{o.addOption("none",d.modals.mergeNotes.separatorOptions.none).addOption("blank-line",d.modals.mergeNotes.separatorOptions.blankLine).addOption("horizontal-rule",d.modals.mergeNotes.separatorOptions.horizontalRule).addOption("heading",d.modals.mergeNotes.separatorOptions.heading).setValue(this.separator).onChange(a=>{this.separator=this.parseSeparator(a)})}),new Qb.Setting(this.contentEl).setName(d.modals.mergeNotes.moveSourcesToTrash).addToggle(o=>{o.setValue(this.moveSourcesToTrash).onChange(a=>{this.moveSourcesToTrash=a})}),this.renderMergeNotesDetails();let n=this.contentEl.createDiv("nn-button-container");n.createEl("button",{text:d.common.cancel}).addEventListener("click",()=>this.close()),this.submitBtn=n.createEl("button",{text:d.modals.mergeNotes.mergeButton,cls:"mod-cta"}),this.submitBtn.addEventListener("click",()=>this.submit()),this.scope.register([],"Enter",o=>{let a=activeDocument.activeElement;!(a instanceof HTMLElement)||!this.contentEl.contains(a)||(o.preventDefault(),this.submit())}),this.updateSubmitState()}onClose(){this.contentEl.empty()}getDestinationFolderLabel(){return this.destinationFolder.path==="/"?d.navigationPane.vaultRootLabel:this.destinationFolder.path}parseSeparator(n){return pZ(n)?n:uZ}renderMergeNotesDetails(){let n=this.contentEl.createEl("p",{cls:"nn-merge-notes-details",attr:{dir:"auto"}});n.createSpan({text:d.modals.mergeNotes.frontmatterRule}),this.showCrossFolderLinkWarning&&(n.appendText(" "),n.createSpan({cls:"nn-merge-notes-warning",text:d.modals.mergeNotes.crossFolderWarning,attr:{dir:"auto"}}))}updateSubmitState(){if(!this.submitBtn)return;let n=lR(this.outputName).length===0||this.isSubmitting;this.submitBtn.disabled=n,this.submitBtn.toggleClass("mod-disabled",n)}submit(){this.isSubmitting||lR(this.outputName).length===0||(this.isSubmitting=!0,this.updateSubmitState(),Q(async()=>{try{await this.onSubmit({outputName:this.outputName,separator:this.separator,moveSourcesToTrash:this.moveSourcesToTrash})&&(Iwe(this.separator,this.moveSourcesToTrash),this.close())}finally{this.isSubmitting=!1,this.updateSubmitState()}}))}}});function xwe(t){let e=new Set;return t.forEach(n=>{e.add(n.parent instanceof hZ.TFolder?n.parent.path:"/")}),e.size>1}async function Ewe(t,e,n){let r=()=>t.workspace.getLeaf(!1),o=async a=>{if(!a)throw new Error("Unable to open merged note: leaf not available");await a.openFile(n,{active:!0})};if(e){let a=await e.executeOpenActiveFile(n,o,{active:!0,getLeaf:r});if(!a.success)throw a.error??new Error("Failed to open merged note.");if(a.data?.skipped===!0)throw new Error(d.fileSystem.errors.mergeNotesOpenSkipped);return}await o(r())}async function dR({app:t,commandQueue:e,fileSystemOps:n,files:r,outputFolder:o,defaultOutputName:a}){let i=zp(r);if(i.length<2)return;let{MergeNotesModal:s}=await Promise.resolve().then(()=>(gZ(),mZ));new s(t,{defaultOutputName:a,destinationFolder:o,noteCount:i.length,showCrossFolderLinkWarning:xwe(i),onSubmit:async c=>{try{let u=await cZ({app:t,files:i,outputFolder:o,outputName:c.outputName,separator:c.separator,moveSourcesToTrash:c.moveSourcesToTrash,openOutputFile:p=>Ewe(t,e,p),trashSourceFiles:async p=>(await n.trashFilesWithOpenLeafCleanup(p)).failedCount});return u.outputOpenError!==null?(de(d.fileSystem.errors.mergeNotesOpenOutput.replace("{name}",u.file.name).replace("{error}",to(u.outputOpenError,d.common.unknownError)),{variant:"warning"}),!0):(de(d.fileSystem.notices.mergeNotes.replace("{count}",u.sourceCount.toString()).replace("{name}",u.file.name),{variant:"success"}),u.failedSourceTrashCount>0&&de(d.fileSystem.errors.mergeNotesTrashSources.replace("{count}",u.failedSourceTrashCount.toString()),{variant:"warning"}),!0)}catch(u){return de(d.fileSystem.errors.mergeNotes.replace("{error}",to(u,d.common.unknownError)),{variant:"warning"}),!1}}}).open()}var hZ,CH=U(()=>{hZ=require("obsidian");Ee();tp();Xb();Fn()});function cR({isMobile:t,desktopScale:e,mobileScale:n}){return(0,fZ.useMemo)(()=>{let r=Za(t?n:e);if(r===1)return{scale:r};let o=r.toString();return{scale:r,style:{"--nn-ui-scale":o},dataAttr:o}},[e,t,n])}var fZ,NH=U(()=>{fZ=ue(ze());dm()});function pR({items:t,virtualizer:e,focusedPane:n,containerRef:r,isSelectable:o,onKeyDown:a,onKeyUp:i}){let s=Yn(),l=(0,Zb.useCallback)(()=>({findNextIndex:(p,m=!1)=>Mwe(t,p,o,m),findPreviousIndex:(p,m=!1)=>Rwe(t,p,o,m),getPageSize:()=>Dwe(e),scrollToIndex:p=>{e.scrollToIndex(p,{align:"auto"})},getItemAt:p=>uR(t,p),isRTL:()=>activeDocument.body.classList.contains("mod-rtl")}),[t,o,e]),c=(0,Zb.useCallback)(p=>{r.current?.getAttribute("data-navigator-focused")==="true"&&(_u(p)||s.focusedPane===n&&a(p,l()))},[r,s.focusedPane,n,a,l]),u=(0,Zb.useCallback)(p=>{!i||r.current?.getAttribute("data-navigator-focused")!=="true"||_u(p)||s.focusedPane===n&&i(p,l())},[r,s.focusedPane,n,i,l]);(0,Zb.useEffect)(()=>{let p=r.current;if(p)return p.addEventListener("keydown",c),p.addEventListener("keyup",u),()=>{p.removeEventListener("keydown",c),p.removeEventListener("keyup",u)}},[c,u,r])}var Zb,uR,Mwe,Rwe,Dwe,IH=U(()=>{Zb=ue(ze());pa();os();uR=(t,e)=>e>=0&&e{if(t.length===0)return-1;if(e<0){for(let a=0;a{if(t.length===0||e<0)return-1;let o=r?e:e-1;for(let a=o;a>=0;a--){let i=uR(t,a);if(i&&n(i))return a}return e},Dwe=t=>{let e=t.getVirtualItems();if(e.length===0||!t.scrollElement)return 10;let n=t.scrollElement.offsetHeight;if(e.length===0)return 10;let r=e[0],o=e[e.length-1],a=o.start+o.size-r.start;if(a<=0)return 10;let i=a/e.length;if(i<=0)return 10;let s=Math.floor(n/i);return Math.max(1,s>1?s-1:1)}});function vu(){let{app:t,commandQueue:e}=gt();return(0,vZ.useCallback)((n,r)=>{if(!n)return;let o=r?.active??!1,a=()=>r?.leaf??t.workspace.getLeaf(!1),i=async s=>{s&&await s.openFile(n,{active:o})};if(e){Q(()=>e.executeOpenActiveFile(n,i,{active:o,getLeaf:a}));return}Q(()=>i(a()))},[t.workspace,e])}var vZ,Jb=U(()=>{vZ=ue(ze());mn();ot()});function eS(){let t=CF(),e=(0,Rg.useRef)(t);e.current=t;let n=gr(),{app:r}=gt(),o=pt(),a=r.workspace,i=vu(),s=(0,Rg.useCallback)((m,g,f)=>{let h=e.current,b=h.selectedFiles.has(m.path);if(b&&h.selectedFiles.size===1)return;let v=a.getActiveFile();if(b)if(n({type:"TOGGLE_FILE_SELECTION",file:m}),h.selectedFile&&h.selectedFile.path===m.path&&f){let y=f.find(S=>h.selectedFiles.has(S.path)&&S.path!==m.path);y&&(n({type:"UPDATE_CURRENT_FILE",file:y}),i(y))}else v&&v.path===m.path&&h.selectedFile&&i(h.selectedFile);else n({type:"TOGGLE_WITH_CURSOR",file:m,anchorIndex:g}),i(m)},[n,i,a]),l=(0,Rg.useCallback)((m,g,f)=>{let h=e.current,b=Iz(f,h.selectedFile);if(b===-1){n({type:"SET_SELECTED_FILE",file:m});return}let v=Ky(f,b,g),{selectedFiles:y,changed:S}=Wy(h.selectedFiles,v);n({type:"APPLY_FILE_SELECTION",selectedFiles:y,selectedFile:m,lastMovementDirection:S?null:h.lastMovementDirection}),i(m)},[n,i]),c=(0,Rg.useCallback)((m,g,f,h)=>{let b=e.current;if(g===-1||!b.selectedFile)return-1;let v=b.selectedFile,y=new Set(b.selectedFiles),S=m==="down"?Math.min(g+1,f.length-1):Math.max(g-1,0);if(S===g)return-1;let w=f[S],k=!0,F=a.getActiveFile(),P=!1;b.selectedFiles.has(v.path)&&b.selectedFiles.has(w.path)&&(y.delete(v.path),k=!1,F&&F.path===v.path&&(P=!0)),b.selectedFiles.has(w.path)||y.add(w.path);let I=S;if(k){let O=m==="down"?S+1:S-1;for(;O>=0&&O{if(m.length===0)return;let f=e.current.selectedFile||m[0];n({type:"SET_FILE_SELECTION",files:m,selectedFile:f})},[n]),p=(0,Rg.useCallback)(m=>e.current.selectedFiles.has(m.path),[]);return{handleMultiSelectClick:s,handleRangeSelectClick:l,handleShiftArrowSelection:c,selectAll:u,isFileSelected:p}}var Rg,mR=U(()=>{Rg=ue(ze());Ur();mn();on();Jb();ai()});function yZ({enabled:t=!0,items:e,virtualizer:n,containerRef:r,pathToIndex:o,orderedFiles:a,orderedFileIndexMap:i,onSelectFile:s,scrollToIndexSafely:l,onScheduleKeyboardOpen:c,onScheduleKeyboardOpenForFile:u,onCommitKeyboardOpen:p,onReorderPropertySort:m,onStartRename:g}){let{app:f,commandQueue:h,isMobile:b,tagTreeService:v,propertyTreeService:y}=gt(),S=vu(),w=li(),k=pt(),F=Xt(),P=F.includeDescendantNotes,T=F.showHiddenItems,I=CF(),N=(0,Bp.useRef)(I);N.current=I;let O=Ml(),K=(0,Bp.useRef)(O);K.current=O;let G=gr(),X=Yn(),L=Vr(),{handleShiftArrowSelection:V,selectAll:D}=eS(),A=(0,Bp.useCallback)(()=>{let C=N.current.selectedFile;return C?.path?o.get(C.path)??-1:-1},[o]),_=(0,Bp.useCallback)((C,x)=>{if(C.type===en.FILE){let z=C.data instanceof zF.TFile?C.data:null;if(!z)return;s(z,{markKeyboardNavigation:!0,suppressOpen:x?.suppressOpen,debounceOpen:x?.debounceOpen})}},[s]),E=(0,Bp.useCallback)((C,x)=>{let z=C==="home"?0:a.length-1,H=a[z];if(!H)return;let Y=Ky(a,C==="home"?0:x,C==="home"?x:a.length-1),ee=N.current,{selectedFiles:$,changed:j}=Wy(ee.selectedFiles,Y);if(G({type:"APPLY_FILE_SELECTION",selectedFiles:$,selectedFile:H,lastMovementDirection:j?null:ee.lastMovementDirection}),k.enterToOpenFiles||S(H),C==="home"){n.scrollToIndex(0,{align:"start"});return}let J=o.get(H.path);J!==void 0&&l(J,"auto")},[a,G,k.enterToOpenFiles,S,n,o,l]),R=(0,Bp.useCallback)((C,x)=>{if(!t)return;let z=A(),H=N.current,Y=k.keyboardShortcuts,ee=x.isRTL(),$=-1,j=!1,J=!1,re=()=>x.findNextIndex(-1),oe=()=>{let ae=n.getVirtualItems(),se=n.scrollElement;if(ae.length===0||!se)return x.getPageSize();let ne=n.scrollOffset??se.scrollTop,B=ne+se.clientHeight,q=0;for(let ie of ae){let le=x.getItemAt(ie.index);if(!le||!gR(le))continue;let Te=ie.start;Te+ie.size>ne&&Te{let ne=oe(),B=ae;for(let q=ne;q>0;q-=1){let ie=se==="down"?x.findNextIndex(B):x.findPreviousIndex(B);if(ie<0||ie===B)break;B=ie}return B};if(k.enterToOpenFiles&&Mv(C)){let ae=Rv(C,k);if(ae==="rename"){C.preventDefault(),g?.();return}let se=fc(f,H);if(!se)return;if(C.preventDefault(),ae){Q(()=>no({app:f,commandQueue:h,file:se,context:ae,active:!1}));return}S(se);return}if(un(C,Y,Ft.PANE_RENAME)&&g?.()){C.preventDefault();return}let ce=(ae,se)=>{if(se&&u){u(ae);return}S(ae)};if(un(C,Y,Ft.LIST_MANUAL_SORT_DOWN)&&m?.("down")===!0){C.preventDefault();return}if(un(C,Y,Ft.LIST_MANUAL_SORT_UP)&&m?.("up")===!0){C.preventDefault();return}if(un(C,Y,Ft.LIST_EXTEND_SELECTION_DOWN)){if(C.preventDefault(),!b&&H.selectedFile?.path){let ae=i.get(H.selectedFile.path);if(ae!==void 0&&ae!==-1){let se=C.key==="ArrowDown",ne=V("down",ae,a,{openFile:B=>ce(B,se)});if(ne===-1&&se&&c?.(),ne>=0){let B=a[ne],q=o.get(B.path);q!==void 0&&l(q,"auto")}}}return}if(un(C,Y,Ft.LIST_EXTEND_SELECTION_UP)){if(C.preventDefault(),!b&&H.selectedFile?.path){let ae=i.get(H.selectedFile.path);if(ae!==void 0&&ae!==-1){let se=C.key==="ArrowUp",ne=V("up",ae,a,{openFile:B=>ce(B,se)});if(ne===-1&&se&&c?.(),ne>=0){let B=a[ne],q=o.get(B.path);q!==void 0&&l(q,"auto")}}}return}if(un(C,Y,Ft.PANE_MOVE_DOWN)){if(C.preventDefault(),$=x.findNextIndex(z),$===z&&z>=0){C.key==="ArrowDown"&&c?.();return}J=C.key==="ArrowDown"}else if(un(C,Y,Ft.PANE_MOVE_UP)){if(C.preventDefault(),z===-1)$=x.findNextIndex(-1);else if($=x.findPreviousIndex(z),$===z&&z>=0){C.key==="ArrowUp"&&c?.();return}J=C.key==="ArrowUp"}else if(un(C,Y,Ft.PANE_PAGE_DOWN))C.preventDefault(),z!==-1&&($=Z(z,"down")),J=C.key==="PageDown";else if(un(C,Y,Ft.PANE_PAGE_UP)){C.preventDefault();let ae=re();if(z===-1)$=ae,ae>=0&&(j=!0);else{let se=Z(z,"up");se>=0?($=se,ae>=0&&se===ae&&(j=!0)):($=ae,ae>=0&&(j=!0))}J=C.key==="PageUp"}else if(un(C,Y,Ft.LIST_FOCUS_EDITOR,{isRTL:ee,directional:"horizontal"})){if(H.selectedFile){C.preventDefault();let se=sh(f).find(ne=>{let B=ne.view;return B instanceof zF.FileView&&B.file?.path===H.selectedFile?.path});se&&f.workspace.setActiveLeaf(se,{focus:!0})}}else if(un(C,Y,Ft.LIST_FOCUS_NAVIGATION,{isRTL:ee,directional:"horizontal"}))C.preventDefault(),X.singlePane&&!b?(L({type:"SET_SINGLE_PANE_VIEW",view:"navigation"}),L({type:"SET_FOCUSED_PANE",pane:"navigation"})):X.singlePane||L({type:"SET_FOCUSED_PANE",pane:"navigation"});else if(un(C,Y,Ft.DELETE_SELECTED)){if(H.selectedFile||H.selectedFiles.size>0){C.preventDefault();let ae={...K.current,selectedFiles:H.selectedFiles,selectedFile:H.selectedFile};Q(()=>ZM({app:f,fileSystemOps:w,settings:k,visibility:{includeDescendantNotes:P,showHiddenItems:T},selectionState:ae,selectionDispatch:G,tagTreeService:v,propertyTreeService:y,orderedFiles:a}))}}else if(un(C,Y,Ft.LIST_SELECT_ALL)){C.preventDefault();let ae=e.filter(se=>se.type===en.FILE).map(se=>{let ne=se;return ne.data instanceof zF.TFile?ne.data:null}).filter(se=>se!==null);D(ae)}else if(un(C,Y,Ft.LIST_RANGE_TO_START)){if(C.preventDefault(),!b&&H.selectedFile?.path){let ae=i.get(H.selectedFile.path);ae!==void 0&&ae!==-1&&E("home",ae)}return}else if(un(C,Y,Ft.LIST_RANGE_TO_END)){if(C.preventDefault(),!b&&H.selectedFile?.path){let ae=i.get(H.selectedFile.path);ae!==void 0&&ae!==-1&&E("end",ae)}return}else if(un(C,Y,Ft.PANE_HOME)){C.preventDefault();let ae=re();$=ae,ae>=0&&(j=!0)}else if(un(C,Y,Ft.PANE_END)){C.preventDefault();for(let ae=e.length-1;ae>=0;ae--){let se=x.getItemAt(ae);if(se&&gR(se)){$=ae;break}}}if($>=0&&${t&&p&&(C.ctrlKey||C.metaKey||C.altKey||C.key!=="ArrowUp"&&C.key!=="ArrowDown"&&C.key!=="PageUp"&&C.key!=="PageDown"||p())},[t,p]);pR({items:e,virtualizer:n,focusedPane:"files",containerRef:r,isSelectable:gR,_getCurrentIndex:A,onKeyDown:R,onKeyUp:M})}var Bp,zF,gR,bZ=U(()=>{Bp=ue(ze()),zF=require("obsidian");Ur();mn();on();Tr();pa();Ue();JM();ai();IH();mR();Jb();rh();ot();Zc();td();gR=t=>t.type===en.FILE});function SZ(t){return String(t).padStart(2,"0")}function wZ(t){let e=t.getFullYear(),n=SZ(t.getMonth()+1),r=SZ(t.getDate());return`${e}-${n}-${r}`}function Owe(t){let n=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1,0,0,0,0).getTime()-t.getTime();return n>0?n:0}function hR(){let[t,e]=(0,yf.useState)(()=>wZ(new Date)),n=(0,yf.useRef)(null),r=(0,yf.useRef)(0);return(0,yf.useEffect)(()=>{if(typeof window>"u")return;let o=()=>{let c=n.current;c!==null&&(window.clearTimeout(c),n.current=null)},a=()=>{let c=wZ(new Date);e(u=>u===c?u:c)},i=()=>{o();let c=Owe(new Date);n.current=window.setTimeout(()=>{a(),i()},c+100)},s=()=>{let c=Date.now();c-r.current{window.removeEventListener("focus",s),window.removeEventListener("pageshow",s),l.removeEventListener("visibilitychange",s),o()}},[]),t}var yf,Awe,xH=U(()=>{yf=ue(ze()),Awe=120});function vR(t,e){if(e.dateRanges.length===0&&e.excludeDateRanges.length===0)return!0;let n=r=>r.field==="created"?t.created:r.field==="modified"?t.modified:t.defaultField==="created"?t.created:t.modified;for(let r of e.dateRanges){let o=n(r);if(!PZ(o,r))return!1}for(let r of e.excludeDateRanges){let o=n(r);if(PZ(o,r))return!1}return!0}var nS,Lwe,zwe,Bwe,rS,_p,TZ,BF,tS,_we,fR,kZ,Hwe,Vwe,MH,Uwe,Kwe,FZ,Wwe,EH,jwe,RH,DH,PZ,AH=U(()=>{nS=["today","yesterday","last7d","last30d","thisweek","thismonth"],Lwe=new Set(nS),zwe=1,Bwe=9999,rS=t=>Number.isFinite(t)&&t>=zwe&&t<=Bwe,_p=(t,e,n)=>{let r=new Date(0);return r.setFullYear(t,e,n),r.setHours(0,0,0,0),r},TZ=(t,e,n)=>{let r=new Date(0);return r.setUTCFullYear(t,e,n),r.setUTCHours(0,0,0,0),r.getTime()},BF=t=>{if(!t)return{field:"default",prefix:"",remainder:""};let e=t.toLowerCase();return e.startsWith("c:")?{field:"created",prefix:"c:",remainder:t.slice(2)}:e.startsWith("m:")?{field:"modified",prefix:"m:",remainder:t.slice(2)}:e.startsWith("created:")?{field:"created",prefix:"created:",remainder:t.slice(8)}:e.startsWith("modified:")?{field:"modified",prefix:"modified:",remainder:t.slice(9)}:{field:"default",prefix:"",remainder:t}},tS=null,_we=()=>{if(tS)return tS;try{let t=new Intl.DateTimeFormat(void 0,{year:"numeric",month:"numeric",day:"numeric"}).formatToParts(new Date(2020,11,31)),e=t.findIndex(a=>a.type==="year"),n=t.findIndex(a=>a.type==="month"),r=t.findIndex(a=>a.type==="day");if(e!==-1&&n!==-1&&r!==-1&&e>n&&e>r&&n{if(!Number.isFinite(t)||!Number.isFinite(e)||!Number.isFinite(n)||!rS(t)||e<1||e>12||n<1||n>31)return null;let r=_p(t,e-1,n);if(r.getFullYear()!==t||r.getMonth()!==e-1||r.getDate()!==n||Number.isNaN(r.getTime()))return null;let o=_p(t,e-1,n+1);return Number.isNaN(o.getTime())?null:{startMs:r.getTime(),endMs:o.getTime()}},kZ=(t,e)=>{if(!Number.isFinite(t)||!Number.isFinite(e)||!rS(t)||e<1||e>12)return null;let n=_p(t,e-1,1);if(n.getFullYear()!==t||n.getMonth()!==e-1||n.getDate()!==1||Number.isNaN(n.getTime()))return null;let r=_p(t,e,1);return Number.isNaN(r.getTime())?null:{startMs:n.getTime(),endMs:r.getTime()}},Hwe=(t,e)=>{if(!Number.isFinite(t)||!Number.isFinite(e)||!rS(t)||e<1||e>4)return null;let n=(e-1)*3,r=_p(t,n,1);if(r.getFullYear()!==t||r.getMonth()!==n||r.getDate()!==1||Number.isNaN(r.getTime()))return null;let o=_p(t,n+3,1);return Number.isNaN(o.getTime())?null:{startMs:r.getTime(),endMs:o.getTime()}},Vwe=t=>{if(!Number.isFinite(t)||!rS(t))return null;let e=_p(t,0,1);if(e.getFullYear()!==t||e.getMonth()!==0||e.getDate()!==1||Number.isNaN(e.getTime()))return null;let n=_p(t+1,0,1);return Number.isNaN(n.getTime())?null:{startMs:e.getTime(),endMs:n.getTime()}},MH=t=>{if(!Number.isFinite(t)||!rS(t))return null;let e=_p(t,0,4);if(Number.isNaN(e.getTime()))return null;let n=(e.getDay()+6)%7,r=new Date(e);return r.setDate(r.getDate()-n),Number.isNaN(r.getTime())?null:r},Uwe=t=>{let e=MH(t),n=MH(t+1);if(!e||!n)return null;let r=TZ(e.getFullYear(),e.getMonth(),e.getDate()),o=TZ(n.getFullYear(),n.getMonth(),n.getDate()),a=Math.round((o-r)/(1440*60*1e3));if(a<=0||a%7!==0)return null;let i=a/7;return i>=52&&i<=53?i:null},Kwe=(t,e)=>{if(!Number.isFinite(t)||!Number.isFinite(e)||!rS(t)||e<1||e>53)return null;let n=Uwe(t);if(!n||e>n)return null;let r=MH(t);if(!r)return null;let o=new Date(r);if(o.setDate(o.getDate()+(e-1)*7),Number.isNaN(o.getTime()))return null;let a=new Date(o);return a.setDate(a.getDate()+7),Number.isNaN(a.getTime())?null:{startMs:o.getTime(),endMs:a.getTime()}},FZ=(t,e,n)=>{let r=fR(n,e,t),o=fR(n,t,e);return r&&!o?r:o&&!r?o:!r||!o?null:_we()==="MDY"?o:r},Wwe=t=>{let e=t.trim();if(!e)return null;let n=e.match(/^(\d{3,4})[-/.](\d{1,2})[-/.](\d{1,2})$/);if(n){let i=Number(n[1]),s=Number(n[2]),l=Number(n[3]);return fR(i,s,l)}let r=e.match(/^(\d{4})(\d{2})(\d{2})$/);if(r){let i=Number(r[1]),s=Number(r[2]),l=Number(r[3]);return fR(i,s,l)}let o=e.match(/^(\d{1,2})[-/.](\d{1,2})[-/.](\d{3,4})$/);if(o){let i=Number(o[1]),s=Number(o[2]),l=Number(o[3]);return FZ(i,s,l)}let a=e.match(/^(\d{2})(\d{2})(\d{4})$/);if(a){let i=Number(a[1]),s=Number(a[2]),l=Number(a[3]);return FZ(i,s,l)}return null},EH=t=>{let e=t.trim();if(!e)return null;let n=e.match(/^(\d{3,4})$/);if(n){let s=Number(n[1]);return Vwe(s)}let r=e.match(/^(\d{3,4})[-/.](\d{1,2})$/);if(r){let s=Number(r[1]),l=Number(r[2]);return kZ(s,l)}let o=e.match(/^(\d{4})(\d{2})$/);if(o){let s=Number(o[1]),l=Number(o[2]);return kZ(s,l)}let a=e.match(/^(\d{3,4})[-/.]?q([1-4])$/);if(a){let s=Number(a[1]),l=Number(a[2]);return Hwe(s,l)}let i=e.match(/^(\d{3,4})[-/.]?w(\d{1,2})$/);if(i){let s=Number(i[1]),l=Number(i[2]);return Kwe(s,l)}return Wwe(e)},jwe=t=>{if(!t)return null;let e=new Date,n=new Date(e.getFullYear(),e.getMonth(),e.getDate()),r=new Date(n);switch(r.setDate(r.getDate()+1),t){case"today":return{startMs:n.getTime(),endMs:r.getTime()};case"yesterday":{let o=new Date(n);return o.setDate(o.getDate()-1),{startMs:o.getTime(),endMs:n.getTime()}}case"last7d":{let o=new Date(n);return o.setDate(o.getDate()-6),{startMs:o.getTime(),endMs:r.getTime()}}case"last30d":{let o=new Date(n);return o.setDate(o.getDate()-29),{startMs:o.getTime(),endMs:r.getTime()}}case"thisweek":{let o=new Date(n),i=(o.getDay()+6)%7;o.setDate(o.getDate()-i);let s=new Date(o);return s.setDate(s.getDate()+7),{startMs:o.getTime(),endMs:s.getTime()}}case"thismonth":{let o=new Date(n.getFullYear(),n.getMonth(),1),a=new Date(n.getFullYear(),n.getMonth()+1,1);return{startMs:o.getTime(),endMs:a.getTime()}}}return null},RH=t=>{if(!t.startsWith("@"))return null;let e=t.slice(1),{field:n,remainder:r}=BF(e),o=r.trim().toLowerCase();if(!o)return null;if(Lwe.has(o)){let s=jwe(o);return s?{field:n,startMs:s.startMs,endMs:s.endMs}:null}let a=o.indexOf("..");if(a!==-1){let s=o.slice(0,a).trim(),l=o.slice(a+2).trim();if(!s&&!l)return null;let c=s?EH(s):null,u=l?EH(l):null;if(s&&!c||l&&!u)return null;let p=c?c.startMs:null,m=u?u.endMs:null;return p!==null&&m!==null&&p>=m?null:{field:n,startMs:p,endMs:m}}let i=EH(o);return i?{field:n,startMs:i.startMs,endMs:i.endMs}:null},DH=t=>{if(!t.startsWith("@"))return!1;let e=t.slice(1),{remainder:n}=BF(e),r=n.trim().toLowerCase();if(!r)return!0;let o=r.charAt(0);if(o==="."||o>="0"&&o<="9")return!0;for(let a of nS)if(a.startsWith(r))return!0;return!1},PZ=(t,e)=>!(!Number.isFinite(t)||e.startMs!==null&&t=e.endMs)});var CZ,HF,_F,Gwe,qwe,NZ,IZ,Ywe,xZ,$we,EZ,MZ=U(()=>{CZ={AND:2,OR:1},HF=(t,e)=>!t||!e?!1:t===e||t.startsWith(`${e}/`),_F=(t,e)=>{let n=t.get(e.key);if(!n)return!1;if(e.value===null)return!0;let r=e.value;return n.some(o=>o.includes(r))},Gwe=t=>typeof t!="object"||t===null||!("key"in t)||typeof t.key!="string"||!("value"in t)?!1:typeof t.value=="string"||t.value===null,qwe=t=>t.kind==="operator"&&(t.operator==="AND"||t.operator==="OR"),NZ=(t,e)=>t.kind===e&&(typeof t.value=="string"||t.value===null),IZ=(t,e)=>t.kind===e&&Gwe(t.value),Ywe=t=>{let e=[],n=[],r=new Set,o=new Map,a=!0,i=!1,s=!1,l=!1,c=m=>{if(a)return!1;for(;n.length>0;){let g=n[n.length-1];if(CZ[g]>=CZ[m]){let f=n.pop();if(!f)return!1;e.push({kind:"operator",operator:f})}else break}return n.push(m),a=!0,!0},u=m=>!a&&!c("AND")?!1:(e.push(m),a=!1,l=!0,!0);for(let m of t){if(m.kind==="operator"){if(!c(m.operator))return null;continue}if(m.kind==="tag"){if(m.value===null){if(!u({kind:"requireTagged"}))return null;s=!0}else{if(!u({kind:"tag",value:m.value}))return null;r.add(m.value)}continue}if(m.kind==="tagNegation"){if(m.value===null){if(!u({kind:"untagged"}))return null;i=!0}else if(!u({kind:"notTag",value:m.value}))return null;continue}if(m.kind==="property"){if(!u({kind:"property",value:m.value}))return null;let g=m.value.value?`${m.value.key}=${m.value.value}`:m.value.key;o.has(g)||o.set(g,m.value);continue}if(m.kind==="propertyNegation"){if(!u({kind:"notProperty",value:m.value}))return null;continue}return null}if(a)return null;for(;n.length>0;){let m=n.pop();if(!m)break;e.push({kind:"operator",operator:m})}if(!l)return null;let p=0;for(let m of e)if(m.kind==="operator"){if(p<2)return null;p-=1}else p+=1;return p!==1?null:{expression:e,includeUntagged:i,requireTagged:s,includedTagTokens:Array.from(r),includedPropertyTokens:Array.from(o.values())}},xZ=(t,e,n)=>{if(t.length===0)return!0;let r=[],o=a=>{for(let i of e)if(HF(i,a))return!0;return!1};for(let a of t){if(a.kind==="operator"){let s=r.pop(),l=r.pop();if(l===void 0||s===void 0)return!1;r.push(a.operator==="AND"?l&&s:l||s);continue}let i=!1;a.kind==="tag"?i=o(a.value):a.kind==="notTag"?i=!o(a.value):a.kind==="requireTagged"?i=e.length>0:a.kind==="untagged"?i=e.length===0:a.kind==="property"?i=_F(n,a.value):a.kind==="notProperty"&&(i=!_F(n,a.value)),r.push(i)}return r.length===0?!0:!!r[r.length-1]},$we=(t,e)=>{if(t.length===0)return!0;let n=[],r=o=>{for(let a of e)if(HF(a,o))return!0;return!1};for(let o of t){if(o.kind==="operator"){let i=n.pop(),s=n.pop();if(s===void 0||i===void 0)return!1;n.push(o.operator==="AND"?s&&i:s||i);continue}let a=!1;o.kind==="tag"?a=r(o.value):o.kind==="notTag"?a=!r(o.value):o.kind==="requireTagged"?a=e.length>0:o.kind==="untagged"?a=e.length===0:(o.kind==="property"||o.kind==="notProperty")&&(a=!0),n.push(a)}return n.length===0?!0:!!n[n.length-1]},EZ=(t,e,n)=>{let r=[];for(let f of t){if(qwe(f)){r.push(f);continue}if(NZ(f,"tag")||NZ(f,"tagNegation")){r.push(f);continue}if(IZ(f,"property")||IZ(f,"propertyNegation")){r.push(f);continue}return null}let o=Ywe(r);if(!o)return null;let{expression:a,includeUntagged:i,requireTagged:s,includedTagTokens:l,includedPropertyTokens:c}=o,u=a.length>0,p=a.some(f=>f.kind!=="operator"&&(f.kind==="tag"||f.kind==="notTag"||f.kind==="requireTagged"||f.kind==="untagged")),m=a.some(f=>f.kind!=="operator"&&(f.kind==="property"||f.kind==="notProperty")),g=u?!$we(a,[]):!1;return{mode:"tag",expression:a,hasInclusions:u,requiresTags:p,allRequireTags:g,requireUnfinishedTasks:!1,excludeUnfinishedTasks:!1,includedTagTokens:l,propertyTokens:c,excludePropertyTokens:n,requiresProperties:m,nameTokens:[],tagTokens:l.slice(),dateRanges:[],requireTagged:s,includeUntagged:i,excludeNameTokens:[],excludeTagTokens:e,folderTokens:[],excludeFolderTokens:[],extensionTokens:[],excludeExtensionTokens:[],excludeDateRanges:[],excludeTagged:!1}}});var oS,yR=U(()=>{oS={tags:{include:[],exclude:[],includeOperators:{},excludeTagged:!1,includeUntagged:!1,requireTagged:!1},properties:{include:[],exclude:[],includeOperators:{}}}});function UF(t){let e=[],n=t.trim();if(!n)return e;let r="",o=!1,a=0;for(;a0&&(e.push(r),r=""),a+=1;continue}r+=i,a+=1}return r.length>0&&e.push(r),e}function Sf(t){let e=t.trim();if(!e)return RZ;let n=UF(e).filter(Boolean);if(n.length===0)return RZ;let r=jZ(n),{tokens:o}=r,a=[],i=[],s=!1;for(let l of o){if(l.kind==="tagNegation"){l.value===null?s=!0:a.push(l.value);continue}l.kind==="propertyNegation"&&i.push(l.value)}if(eTe(r)){let l=EZ(o,a,i);if(l)return l}return oTe(o,a,i,s)}function GZ(t){let e=t.trim();if(!e)return oS;let n=Sf(e),r=new Set,o=new Set,a=new Set,i=new Set;n.includedTagTokens.forEach(c=>{c&&r.add(c)}),n.excludeTagTokens.forEach(c=>{c&&o.add(c)}),n.propertyTokens.forEach(c=>{a.add(zH(c))}),n.excludePropertyTokens.forEach(c=>{i.add(zH(c))});let s={},l={};if(n.mode==="tag"){let c=UF(e).filter(Boolean),u=jZ(c),p=!1,m=null;for(let g of u.tokens){if(g.kind==="operator"){m=g.operator;continue}if(!aTe(g))continue;let f=p?m??"AND":null;g.kind==="tag"&&g.value&&f?s[g.value]=f:g.kind==="property"&&f&&(l[zH(g.value)]=f),p=!0,m=null}}return{tags:{include:Array.from(r),exclude:Array.from(o),includeOperators:s,excludeTagged:n.excludeTagged,includeUntagged:n.includeUntagged,requireTagged:n.requireTagged},properties:{include:Array.from(a),exclude:Array.from(i),includeOperators:l}}}function QZ(t,e,n){let r=t.trim();if(!e)return{query:r,action:"removed",changed:!1};let o=`#${e}`,a=r.length>0?UF(r):[],i=qZ(r),s=To(o),l=a.findIndex(p=>To(p)===s);if(l!==-1){let p=$Z(a,l,i),m=bR(p);return{query:m,action:"removed",changed:m!==r}}let c=XZ(a,o,n,i),u=bR(c);return{query:u,action:"added",changed:u!==r}}function ZZ(t,e,n,r){let o=t.trim(),a=BH(e);if(!a)return{query:o,action:"removed",changed:!1};let i=null;if(typeof n=="string"){let b=rr(n);if(!b)return{query:o,action:"removed",changed:!1};i=b}let s={key:a,value:i},l=YZ(s),c=o.length>0?UF(o):[],u=qZ(o),p=To(s.key),m=To(s.value??""),g=c.findIndex(b=>{if(b.startsWith("-"))return!1;let v=VF(b);if(!v)return!1;let y=To(v.key),S=To(v.value??"");return y===p&&S===m});if(g!==-1){let b=$Z(c,g,u),v=bR(b);return{query:v,action:"removed",changed:v!==o}}let f=XZ(c,l,r,u),h=bR(f);return{query:h,action:"added",changed:h!==o}}function JZ(t,e){let n=e.trim();if(!n||!n.startsWith("@"))return{query:t.trim(),changed:!1};let r=t.trim(),o=n;return{query:o,changed:o!==r}}function SR(t){return t.hasInclusions||t.excludeNameTokens.length>0||t.excludeTagTokens.length>0||t.excludePropertyTokens.length>0||t.excludeFolderTokens.length>0||t.excludeExtensionTokens.length>0||t.excludeDateRanges.length>0||t.excludeUnfinishedTasks||t.excludeTagged}function eJ(t){return t.requiresTags||t.excludeTagged||t.excludeTagTokens.length>0}function tJ(t){return t.requiresProperties||t.excludePropertyTokens.length>0}function nJ(t){return t.hasInclusions&&t.allRequireTags}function HH(t,e,n,r){let o=r?.hasUnfinishedTasks??!1,a=r?.foldedFolderPath??"",i=r?.foldedExtension??"",s=r?.propertyValuesByKey??Xwe;if(n.excludeUnfinishedTasks&&o||n.requireUnfinishedTasks&&!o)return!1;if(n.mode==="filter"){let l=n.excludeFolderTokens.length>0||n.folderTokens.length>0,c=l?rTe(a):"",p=l&&(n.excludeFolderTokens.some(m=>m.mode==="segment")||n.folderTokens.some(m=>m.mode==="segment"))?c.split("/").filter(Boolean):null;if(n.excludeNameTokens.length>0&&n.excludeNameTokens.some(g=>t.includes(g))||n.excludeFolderTokens.length>0&&n.excludeFolderTokens.some(g=>_Z(c,p,g))||n.excludeExtensionTokens.length>0&&n.excludeExtensionTokens.some(g=>HZ(i,g)))return!1;if(n.excludeTagged){if(e.length>0)return!1}else if(n.excludeTagTokens.length>0&&e.length>0&&n.excludeTagTokens.some(g=>e.some(f=>HF(f,g))))return!1;return!(n.excludePropertyTokens.length>0&&n.excludePropertyTokens.some(g=>_F(s,g))||n.nameTokens.length>0&&!n.nameTokens.every(g=>t.includes(g))||n.folderTokens.length>0&&!n.folderTokens.every(g=>_Z(c,p,g))||n.extensionTokens.length>0&&!n.extensionTokens.every(g=>HZ(i,g))||n.propertyTokens.length>0&&!n.propertyTokens.every(g=>_F(s,g))||(n.requireTagged||n.tagTokens.length>0)&&(e.length===0||n.tagTokens.length>0&&!n.tagTokens.every(g=>e.some(f=>HF(f,g)))))}return n.excludeTagged&&e.length>0?!1:n.expression.length===0?!0:xZ(n.expression,e,s)}var RZ,Xwe,Qwe,Zwe,UZ,BH,_H,Jwe,OH,LH,VF,DZ,eTe,tTe,AZ,KZ,WZ,nTe,OZ,LZ,zZ,BZ,rTe,_Z,HZ,jZ,oTe,aTe,zH,bf,qZ,iTe,sTe,lTe,VZ,YZ,dTe,bR,$Z,XZ,KF=U(()=>{AH();MZ();yR();Ot();cn();AH();RZ={mode:"filter",expression:[],hasInclusions:!1,requiresTags:!1,allRequireTags:!1,requireUnfinishedTasks:!1,excludeUnfinishedTasks:!1,includedTagTokens:[],nameTokens:[],tagTokens:[],dateRanges:[],requireTagged:!1,includeUntagged:!1,propertyTokens:[],excludePropertyTokens:[],requiresProperties:!1,excludeNameTokens:[],excludeTagTokens:[],folderTokens:[],excludeFolderTokens:[],extensionTokens:[],excludeExtensionTokens:[],excludeDateRanges:[],excludeTagged:!1},Xwe=new Map,Qwe=new Set(["and","or"]),Zwe=new Set(["has:task","has:tasks"]),UZ=".",BH=t=>Me(t.trim()),_H=t=>t.startsWith(UZ),Jwe=t=>{let e=!1,n=!1;for(let r=0;r{let e=t.trim();if(e.length<2||!e.startsWith('"')||!e.endsWith('"'))return t;let n="";for(let r=1;r{let e="";for(let n=0;n=t.length){e+=r;continue}let o=t[n+1];if(o==="="||o==="\\"||o==='"'){e+=o,n+=1;continue}e+=r}return e},VF=t=>{if(!_H(t))return null;let e=t.slice(UZ.length);if(!e)return null;let n=Jwe(e);if(n===-1){let s=BH(LH(OH(e)));return s?{key:s,value:null}:null}let r=LH(OH(e.slice(0,n))),o=LH(OH(e.slice(n+1))),a=BH(r);if(!a)return null;let i=rr(o);return i?{key:a,value:i}:{key:a,value:null}},DZ=t=>({key:To(t.key),value:t.value===null?null:To(t.value)});eTe=t=>t.hasTagOperand&&!t.hasNonTagOperand&&!t.hasInvalidToken,tTe=t=>t&&t.charAt(0)==="-"?"-":null,AZ=t=>Zwe.has(t),KZ="folder:",WZ="ext:",nTe=t=>{if(!t)return null;let e=t.trim().replace(/\\/g,"/").replace(/\/+/g,"/");if(!e)return null;if(e.startsWith("/")){let r=e.replace(/\/+$/u,"");if(!r)return{mode:"exact",value:""};let o=r.replace(/^\/+/u,"");return o?{mode:"exact",value:o}:{mode:"exact",value:""}}let n=e.replace(/^\/+/u,"").replace(/\/+$/u,"");return!n||n.includes("/")?null:{mode:"segment",value:n}},OZ=t=>t.startsWith(KZ),LZ=t=>nTe(t.slice(KZ.length)),zZ=t=>t.startsWith(WZ),BZ=t=>{let e=t.slice(WZ.length).trim();if(!e)return null;let n=e.replace(/^\.+/u,"");if(!n||n.includes("/")||n.includes("\\"))return null;let r=n.split(".").filter(Boolean),o=r.length>0?r[r.length-1]:"";return o||null},rTe=t=>{if(!t)return"";let e=t;return e.includes("\\")&&(e=e.replace(/\\/g,"/")),e.startsWith("/")&&(e=e.replace(/^\/+/u,"")),e.endsWith("/")&&(e=e.replace(/\/+$/u,"")),e},_Z=(t,e,n)=>n.mode==="exact"?t===n.value:!n.value||!t?!1:(e??t.split("/").filter(Boolean)).some(o=>o.includes(n.value)),HZ=(t,e)=>!t||!e?!1:t===e,jZ=t=>{let e=[],n=!1,r=!1,o=!1;for(let a of t){if(!a)continue;let i=a.toLowerCase(),s=null,l=()=>(s!==null||(s=Lu(i)),s);if(i==="and"){e.push({kind:"operator",operator:"AND"});continue}if(i==="or"){e.push({kind:"operator",operator:"OR"});continue}if(tTe(i)!==null){let u=i.slice(1),p=null,m=()=>(p!==null||(p=Lu(u)),p);if(!u){o=!0;continue}if(AZ(u)){e.push({kind:"unfinishedTaskNegation"}),r=!0;continue}if(u.startsWith("@")){if(DH(u)){let g=RH(u);g&&(e.push({kind:"dateNegation",range:g}),r=!0);continue}r=!0,e.push({kind:"nameNegation",value:m()});continue}if(OZ(u)){let g=LZ(u);g&&(e.push({kind:"folderNegation",value:{...g,value:Lu(g.value)}}),r=!0);continue}if(zZ(u)){let g=BZ(u);g&&(e.push({kind:"extensionNegation",value:Lu(g)}),r=!0);continue}if(_H(u)){let g=VF(u);g&&(e.push({kind:"propertyNegation",value:DZ(g)}),n=!0);continue}if(u.startsWith("#")){let g=u.slice(1);e.push({kind:"tagNegation",value:g.length>0?Lu(g):null}),n=!0;continue}r=!0,e.push({kind:"nameNegation",value:m()});continue}if(AZ(i)){e.push({kind:"unfinishedTask"}),r=!0;continue}if(i.startsWith("@")){if(DH(i)){let u=RH(i);u&&(e.push({kind:"date",range:u}),r=!0);continue}r=!0,e.push({kind:"name",value:l()});continue}if(OZ(i)){let u=LZ(i);u&&(e.push({kind:"folder",value:{...u,value:Lu(u.value)}}),r=!0);continue}if(zZ(i)){let u=BZ(i);u&&(e.push({kind:"extension",value:Lu(u)}),r=!0);continue}if(_H(i)){let u=VF(i);u&&(e.push({kind:"property",value:DZ(u)}),n=!0);continue}if(i.startsWith("#")){let u=i.slice(1);e.push({kind:"tag",value:u.length>0?Lu(u):null}),n=!0;continue}r=!0,e.push({kind:"name",value:l()})}return{tokens:e,hasTagOperand:n,hasNonTagOperand:r,hasInvalidToken:o}},oTe=(t,e,n,r)=>{let o=[],a=[],i=[],s=[],l=[],c=[],u=[],p=[],m=[],g=[],f=[],h=!1,b=!1,v=!1;for(let P of t)switch(P.kind){case"name":o.push(P.value);break;case"nameNegation":p.push(P.value);break;case"tag":P.value&&a.push(P.value),v=!0;break;case"property":i.push(P.value);break;case"folder":s.push(P.value);break;case"extension":l.push(P.value);break;case"date":c.push(P.range);break;case"unfinishedTask":h=!0;break;case"unfinishedTaskNegation":b=!0;break;case"operator":u.push(P.operator.toLowerCase());break;case"tagNegation":break;case"propertyNegation":break;case"folderNegation":m.push(P.value);break;case"extensionNegation":g.push(P.value);break;case"dateNegation":f.push(P.range);break}u.length>0&&o.push(...u);let y=o.length>0||a.length>0||i.length>0||s.length>0||l.length>0||c.length>0||v||h,S=v||a.length>0,w=i.length>0,k=y?S:!1,F=a.slice();return{mode:"filter",expression:[],hasInclusions:y,requiresTags:S,allRequireTags:k,requireUnfinishedTasks:h,excludeUnfinishedTasks:b,includedTagTokens:F,propertyTokens:i,excludePropertyTokens:n,requiresProperties:w,nameTokens:o,tagTokens:a,dateRanges:c,requireTagged:v,includeUntagged:r,excludeNameTokens:p,excludeTagTokens:e,folderTokens:s,excludeFolderTokens:m,extensionTokens:l,excludeExtensionTokens:g,excludeDateRanges:f,excludeTagged:r}};aTe=t=>t.kind==="tag"||t.kind==="tagNegation"||t.kind==="property"||t.kind==="propertyNegation",zH=t=>t.value===null?Gn(t.key):sa(t.key,t.value);bf=t=>t?Qwe.has(t.toLowerCase()):!1,qZ=t=>{let e=t.trim();if(!e)return!0;let n=UF(e),r=!1;for(let o of n){let a=o.toLowerCase();if(bf(a))continue;let i=a.startsWith("-")?a.slice(1):a;if(!i)return!1;if(i.startsWith("#")){r=!0;continue}if(VF(i)){r=!0;continue}return!1}return r},iTe=t=>t.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),sTe=t=>/\s/.test(t)||t.includes('"')||t.includes("\\")||t.includes("="),lTe=(t,e=!1)=>{let n="";for(let r of t)(r==="\\"||r==="="||e&&r==='"')&&(n+="\\"),n+=r;return n},VZ=t=>{let e=sTe(t),n=lTe(t,e);return e?`"${n}"`:n},YZ=(t,e=!1)=>{let n=e?"-.":".",r=VZ(t.key);if(t.value===null)return`${n}${r}`;let o=VZ(t.value);return`${n}${r}=${o}`},dTe=t=>{let e=t.toLowerCase();if(e.startsWith("-.")||e.startsWith(".")){let n=e.startsWith("-."),r=n?e.slice(1):e,o=VF(r);if(o)return YZ(o,n)}return/\s/.test(t)||t.includes('"')||t.includes("\\")?`"${iTe(t)}"`:t},bR=t=>t.map(e=>dTe(e)).join(" ").trim(),$Z=(t,e,n)=>{let r=t.slice();if(r.splice(e,1),!n)return r;let o=e-1;for(o>=0&&bf(r[o])&&r.splice(o,1);r.length>0&&bf(r[0]);)r.shift();for(let a=0;a0&&bf(r[r.length-1]);)r.pop();return r},XZ=(t,e,n,r)=>{let o=t.slice();if(!r)return o.push(e),o;let a=n==="OR"?"OR":"AND";return o.length===0?o.push(e):bf(o[o.length-1])?(o[o.length-1]=a,o.push(e)):o.push(a,e),o}});function UH(t){return t.trim().toLowerCase()}function KH(t){return t.normalize("NFD").replace(pTe,"")}function iJ(t){return cTe.test(t)}function oJ(t,e){return e.startsWith(t)||t.startsWith(e)}function vTe(t){return uTe.test(t)}function yTe(t,e,n,r){return n.length===0?!1:t.length===1?n.some(o=>o===t)?!0:vTe(t)?n.some(o=>o.includes(t)):!1:n.some(o=>o===t||oJ(t,o))?!0:r.some(o=>o===e||oJ(e,o))}function aJ(t,e,n,r){return!t||!iJ(t)?!1:yTe(t,e,n,r)}function bTe(t){return t.replace(mTe,(e,n)=>typeof n=="string"&&n.length>0?n:" ")}function STe(t){return UH(t).replace(hTe,"").replace(fTe,"").trim()}function VH(t,e,n){let r=STe(n);!r||!iJ(r)||r==="path"||r==="ext"||r.startsWith("path:")||r.startsWith("ext:")||e.has(r)||(e.add(r),t.push(r))}function wTe(t){let e=[],n=new Set;return bTe(t).replace(gTe,(a,i,s)=>{let l=typeof i=="string"?i:s;return typeof l=="string"&&l.length>0&&(VH(e,n,l),l.split(rJ).forEach(c=>VH(e,n,c)))," "}).split(rJ).forEach(a=>VH(e,n,a)),e}function sJ(t){let e=wTe(t);return{queryTokens:e,foldedQueryTokens:e.map(n=>KH(n))}}function lJ(t,e,n){let{queryTokens:r,foldedQueryTokens:o}=n;if(r.length===0)return{matches:[],terms:[]};let a=[],i=[],s=new Set,l=new Set,c=new Set,u=new Set;for(let p of t){let m=UH(p.text);if(!m)continue;let g=KH(m);!(Number.isFinite(p.offset)&&Number.isFinite(p.length)&&p.offset>=0&&p.length>0)||!aJ(m,g,r,o)||(a.push(p),s.add(m),l.add(g))}for(let p of e){let m=UH(p);if(!m)continue;let g=KH(m);aJ(m,g,r,o)&&(s.has(m)||l.has(g)||c.has(m)||u.has(g)||(c.add(m),u.add(g),i.push(p)))}return{matches:a,terms:i}}var rJ,cTe,uTe,pTe,mTe,gTe,hTe,fTe,dJ=U(()=>{rJ=/\s+/,cTe=/[\p{L}\p{N}]/u,uTe=/^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]$/u,pTe=/\p{M}+/gu,mTe=/(^|\s)-?(?:path|ext)\s*:\s*(?:"[^"]*"|'[^']*'|[^\s]+)/gi,gTe=/"([^"]+)"|'([^']+)'/g,hTe=/^["'`]+|["'`]+$/g,fTe=/^[-+]+/});function PTe(t){return t.map(e=>To(It(e))).filter(e=>e.length>0)}function CTe(t){if(!t||t.length===0)return TTe;let e=new Map;t.forEach(r=>{let o=To(r.fieldKey.trim());if(!o)return;let a=e.get(o);a||(a=new Set,e.set(o,a));let i=rr(r.value);i&&a.add(To(i))});let n=new Map;return e.forEach((r,o)=>{n.set(o,Array.from(r))}),n}function cJ({basePathSet:t,omnisearchPathScope:e,omnisearchService:n,trimmedQuery:r,useOmnisearch:o}){let[a,i]=(0,yu.useState)(null),s=(0,yu.useRef)(0);return(0,yu.useEffect)(()=>{o||i(null)},[o]),(0,yu.useEffect)(()=>{if(!o)return;if(!n){i(null);return}let l=++s.current,c=!1;return Q(async()=>{try{let u=await n.search(r,{pathScope:e});if(c||s.current!==l)return;let p=new Map,m=[],g=sJ(r);u.forEach(f=>{if(!t.has(f.path))return;m.push(f.file);let{matches:h,terms:b}=lJ(f.matches,f.foundWords,g),v=typeof f.excerpt=="string"?Ab.normalizeExcerpt(f.excerpt,{stripHtml:!1}):void 0;p.set(f.path,{score:f.score,terms:b,matches:h,excerpt:v})}),i({query:r,files:m,meta:p})}catch{s.current===l&&i({query:r,files:[],meta:new Map})}}),()=>{c=!0}},[t,e,n,r,o]),a}function uJ({app:t,baseFiles:e,getFileDisplayName:n}){let[r,o]=(0,yu.useState)(new Map);return(0,yu.useEffect)(()=>{let a=new Map;e.forEach(i=>{a.set(i.path,To(n(i)))}),o(a)},[e,n]),(0,yu.useEffect)(()=>{let a=new Set(e.map(s=>s.path)),i=t.metadataCache.on("changed",s=>{if(!s||!a.has(s.path))return;let l=To(n(s));o(c=>{if(c.get(s.path)===l)return c;let u=new Map(c);return u.set(s.path,l),u})});return()=>{t.metadataCache.offref(i)}},[t.metadataCache,e,n]),r}function pJ({app:t,baseFiles:e,getDB:n,getFileTimestamps:r,omnisearchResult:o,searchTokens:a,searchableNames:i,settings:s,sortOption:l,trimmedQuery:c,useOmnisearch:u}){if(!c)return e;if(u){if(!o||o.query!==c)return[];let P=new Set(o.files.map(T=>T.path));return P.size===0?[]:e.filter(T=>P.has(T.path))}let p=a??Sf(c);if(!SR(p))return e;let m=p.dateRanges.length>0||p.excludeDateRanges.length>0,g=p.requireUnfinishedTasks||p.excludeUnfinishedTasks,f=p.folderTokens.length>0||p.excludeFolderTokens.length>0,h=p.extensionTokens.length>0||p.excludeExtensionTokens.length>0,b=qC(l,s.alphabeticalDateMode??"modified"),v=eJ(p),y=tJ(p),S=nJ(p),w=p.mode==="tag"||p.tagTokens.length>0||p.excludeTagTokens.length>0,k=n(),F=[];return e.filter(P=>{let T=i.get(P.path)??"",I=g||v||y?k.getFile(P.path):null,N=g&&typeof I?.taskUnfinished=="number"&&I.taskUnfinished>0,O=g||f||h,K;if(O&&(K={hasUnfinishedTasks:N},f&&(K.foldedFolderPath=To(P.parent?.path??"")),h&&(K.foldedExtension=To(P.extension))),y){let D=CTe(I?.properties??null);K?K={...K,propertyValuesByKey:D}:K={hasUnfinishedTasks:N,propertyValuesByKey:D}}if(!v){if(!HH(T,F,p,K))return!1;if(!m)return!0;let D=r(P);return vR({created:D.created,modified:D.modified,defaultField:b},p)}let G=Pr({app:t,file:P,db:k,fileData:I}),X=G.length>0;if(S&&!X)return!1;let L;if(X?w?L=PTe(G):L=kTe:L=F,!HH(T,L,p,K))return!1;if(!m)return!0;let V=r(P);return vR({created:V.created,modified:V.modified,defaultField:b},p)})}function mJ({app:t,files:e,getDB:n,hiddenFileNames:r,hiddenFilePropertyMatcher:o,hiddenFileTags:a,hiddenFolders:i,hideDrawingPreviewImages:s,showHiddenItems:l}){if(!l||e.length===0)return FTe;let c=n(),u=c.getFiles(e.map(w=>w.path)),p=i.length>0,m=o.hasCriteria,g=r.length>0,f=a.length>0,h=g?FN(r):null,b=f?Br(a,!1):null,v=p?new Map:null,y=new Map,S=w=>{if(!v||!w)return!1;if(v.has(w.path))return v.get(w.path)??!1;let k=ei(w,i);return v.set(w.path,k),k};return e.forEach(w=>{let k=u.get(w.path),F=!1;m&&w.extension==="md"&&(F=k?.metadata?.hidden===void 0?Xo(w,o,t):!!k.metadata?.hidden);let P=h?h.matches(w):!1,T=p?S(w.parent??null):!1,I=Qu(t,w,{hideDrawingPreviewImages:s}),N=b!==null&&b.hasHiddenRules&&w.extension==="md"&&Pr({app:t,file:w,db:c,fileData:k??null}).some(O=>!b.isTagVisible(O));(F||P||T||I||N)&&y.set(w.path,!0)}),y}var yu,TTe,kTe,FTe,gJ=U(()=>{yu=ue(ze());KF();Rn();L_();Sn();dJ();Ot();cn();Yr();Dr();ot();gl();TTe=new Map,kTe=["__nn_tag_present__"],FTe=new Map});function WH(t){return t.split("/").filter(Boolean)}function hJ(t,e){let n=WH(t);return n.length>0?n[n.length-1]:e}function fJ(t,e){let n=WH(t),r=WH(e);if(n.length===0||r.length===0)return[];let o=Math.max(0,n.length-r.length);return r.map((a,i)=>({label:a,path:n.slice(0,o+i+1).join("/")}))}function vJ({app:t,dayKey:e,fileVisibility:n,files:r,getDB:o,getFileTimestamps:a,hiddenFileState:i,hiddenTags:s,listConfig:l,collapsedListGroups:c,searchMetaMap:u,selectedFolder:p,selectedTag:m=null,selectedProperty:g=null,selectionType:f,showHiddenItems:h,sortOption:b,propertySortKey:v="",isManualSortActive:y=!1,manualSortGroupHeaderPropertyKey:S=null,wordCountTargetProperty:w=""}){let k=[{type:en.TOP_SPACER,data:"",key:"top-spacer"}],F=f===W.TAG?W.TAG:f===W.FOLDER?W.FOLDER:f===W.PROPERTY?W.PROPERTY:void 0,P=o(),T=l.filterPinnedByFolder&&f===W.FOLDER&&p?{restrictToFolderPath:p.path}:void 0,{pinnedFiles:I,unpinnedFiles:N}=Cz(r,l.pinnedNotes,F,T),O=l.showTags&&l.showFileTags,K=O?Br(s,h):null,G=O?Z=>{let ce=Pr({app:t,file:Z,db:P});return K?K.hasVisibleTags(ce):ce.length>0}:()=>!1,X=l.groupBy,L=p?.path??null,V=Z=>H7({selectionType:f,selectedFolderPath:L,selectedTag:m,selectedProperty:g,groupingMode:X,groupId:Z}),D=!1,A=null,_=null,E=0,R=Z=>gI(P.getFile(Z.path)?.wordCount),M=Z=>ET(P.getFile(Z.path)?.properties,w)??sI(t,Z,w),C=new Map,x=Z=>{if(X!=="custom"||!S||Z.extension!=="md")return null;if(C.has(Z.path))return C.get(Z.path)??null;let ce=zm(t,Z,S);return C.set(Z.path,ce),ce},z=null,H=()=>{z&&(z.item.data=GG(z.header,z.wordCount,z.targetWordCount),z.item.manualSortHeaderWordCount=z.wordCount,z.item.manualSortHeaderTargetWordCount=z.targetWordCount)},Y=(Z,ce={})=>{if(_?.groupFilePaths?.push(Z.path),z&&lp(z.header)&&Z.extension==="md"){if(z.wordCount+=R(Z),z.header.targetWordCount===null){let se=M(Z);se!==null&&(z.targetWordCount=(z.targetWordCount??0)+se)}H()}if(D)return;let ae={type:en.FILE,data:Z,parentFolder:p?.path,key:Z.path,fileIndex:E++,searchMeta:u.get(Z.path),hasTags:G(Z),isHidden:i.get(Z.path)??!1};k.push({...ae,...ce})},ee=({data:Z,key:ce,headerFolderPath:ae,headerFolderSegments:se,headerKind:ne,collapseKey:B,manualSortHeader:q,manualSortHeaderFilePath:ie,groupFiles:le})=>{if(D&&A!=="manual-sort-custom"&&ne==="manual-sort-custom")return;let Te=B?c?.has(B)===!0:!1;D=Te,A=Te?ne??null:null,k.length>1&&k.push({type:en.HEADER_SPACER,data:"",key:`${ce}-spacer-before`});let Fe={type:en.HEADER,data:Z,headerFolderPath:ae,headerFolderSegments:se,manualSortHeaderFilePath:ie,groupFilePaths:le?le.map(te=>te.path):[],manualSortHeaderShowsWordCount:q?lp(q):void 0,manualSortHeader:q,manualSortHeaderWordCount:q?0:void 0,manualSortHeaderTargetWordCount:q?q.targetWordCount:void 0,headerKind:ne,collapseKey:B,isCollapsed:Te,key:ce};k.push(Fe),_=le?null:Fe,z=null,ne==="manual-sort-custom"&&q&&(z={item:Fe,header:q,wordCount:0,targetWordCount:q.targetWordCount},H())},$=Z=>{let ce=x(Z);ce&&ee({data:ce.title,manualSortHeader:ce,manualSortHeaderFilePath:Z.path,headerKind:"manual-sort-custom",collapseKey:V(`manual-sort-custom:${Z.path}`),key:`manual-sort-custom-header-${Z.path}`})},j=(Z,ce={})=>{$(Z),Y(Z,ce)};I.length>0&&(ee({data:d.listPane.pinnedSection,key:gw,headerKind:"pinned",groupFiles:I}),l.pinnedGroupExpanded&&I.forEach(Z=>{j(Z,{isPinned:!0})}));let J=X==="date"&&bh(b),re=X==="folder"&&f===W.FOLDER,oe=Jl(b)&&y&&v.trim().length>0;if(!J&&!re){let Z=[],ce=[];oe?N.forEach(ne=>{if(ne.extension==="md"&&RT(t,ne,v)===null){ce.push(ne);return}Z.push(ne)}):Z.push(...N);let ae=Z[0]??null,se=X==="custom"&&ae!==null&&x(ae)!==null;if(I.length>0&&Z.length>0&&!se){let ne=n===Er.DOCUMENTS?d.listPane.notesSection:d.listPane.filesSection;ee({data:ne,key:`header-${ne}`,headerKind:"section",groupFiles:Z})}Z.forEach(ne=>{j(ne)}),ce.length>0&&(ee({data:d.listPane.unsortedSection,collapseKey:V("section:unsorted"),key:"header-unsorted",headerKind:"section",groupFiles:ce}),ce.forEach(ne=>{j(ne)}))}else if(J){let Z=zr.parseLocalDayKey(e)??new Date,ce=$A(b),ae=null;N.forEach(se=>{let ne=a(se),B=ce==="ctime"?ne.created:ne.modified,q=zr.getDateGroupInfo(B,Z),ie=q.key;ie!==ae&&(ae=ie,ee({data:q.label,collapseKey:V(`date:${ce}:${ie}`),key:`header-${q.label}`,headerKind:"date"})),Y(se)})}else{let Z=p?.path??null,ce=p?.name??null,ae=Z&&Z!=="/"?`${Z}/`:null,se=d.navigationPane.vaultRootLabel,ne=l.folderGroupSortOrder,B=l.showFolderGroupPaths,q=new Map,ie=(ve,Ie,qe)=>{let xe=(0,wf.normalizePath)(ve);return{label:B?Ie:hJ(Ie,qe),sortLabel:Ie,folderPath:xe,folderSegments:B?fJ(xe,Ie):void 0}},le=ve=>{let Ie=ve.parent;if(!(Ie instanceof wf.TFolder))return{key:"folder:/",label:se,sortLabel:se,isCurrentFolder:!1,folderPath:null};if(f===W.FOLDER&&Z){if(Ie.path===Z){let Ce=ce??Ie.name;return{key:`folder:${Z}`,label:Ce,sortLabel:Ce,isCurrentFolder:!0,folderPath:Z==="/"?null:Z}}if(Z==="/"&&Ie.path!=="/"){let Ce=ie(Ie.path,Ie.path,Ie.name);return{key:`folder:/${Ie.path}`,label:Ce.label,sortLabel:Ce.sortLabel,isCurrentFolder:!1,folderPath:Ce.folderPath,folderSegments:Ce.folderSegments}}if(ae&&Ie.path.startsWith(ae)){let Ce=Ie.path.slice(ae.length);if(Ce.length>0){let vt=ie(Ie.path,Ce,Ie.name);return{key:`folder:${Ie.path}`,label:vt.label,sortLabel:vt.sortLabel,isCurrentFolder:!1,folderPath:vt.folderPath,folderSegments:vt.folderSegments}}}}let qe=Ie.path==="/"?"":Ie.path,[xe]=qe.split("/");return xe&&xe.length>0?{key:`folder:/${xe}`,label:B?xe:hJ(xe,xe),sortLabel:xe,isCurrentFolder:!1,folderPath:xe,folderSegments:B?fJ(xe,xe):void 0}:{key:"folder:/",label:se,sortLabel:se,isCurrentFolder:!1,folderPath:null}};N.forEach(ve=>{let Ie=le(ve),qe=q.get(Ie.key);if(qe){qe.files.push(ve);return}q.set(Ie.key,{label:Ie.label,sortLabel:Ie.sortLabel,files:[ve],isCurrentFolder:Ie.isCurrentFolder,folderPath:Ie.folderPath,folderSegments:Ie.folderSegments})});let Te=Array.from(q.entries()).map(([ve,Ie])=>({key:ve,...Ie})).sort((ve,Ie)=>{let qe=ju(ve.sortLabel,Ie.sortLabel,ne);return qe!==0?qe:ve.key===Ie.key?0:ve.keyve.isCurrentFolder)??null,Fe=Te.filter(ve=>!ve.isCurrentFolder),te=ke!==null&&(l.showCurrentFolderFilesAtBottom&&(I.length>0||Fe.length>0)||!l.showCurrentFolderFilesAtBottom&&I.length>0),pe=ve=>{ve.files.length!==0&&(ve.isCurrentFolder?te&&ee({data:d.listPane.filesSection,key:`header-${ve.key}-current-folder-boundary`,headerKind:"section",groupFiles:ve.files}):ee({data:ve.label,collapseKey:V(ve.key),headerFolderPath:ve.folderPath,headerFolderSegments:ve.folderSegments,key:`header-${ve.key}`,headerKind:"folder",groupFiles:ve.files}),ve.files.forEach(Ie=>{Y(Ie)}))};ke&&!l.showCurrentFolderFilesAtBottom&&pe(ke),Fe.forEach(pe),ke&&l.showCurrentFolderFilesAtBottom&&pe(ke)}return k.push({type:en.BOTTOM_SPACER,data:"",key:"bottom-spacer"}),k}function yJ(t){let e=new Map;return t.forEach((n,r)=>{n.type===en.FILE&&n.data instanceof wf.TFile&&e.set(n.data.path,r)}),e}function bJ(t){let e=new Map;return t.forEach((n,r)=>{e.set(n.path,r)}),e}function SJ(t){let e=[],n=new Map;return t.forEach(r=>{r.type===en.FILE&&r.data instanceof wf.TFile&&(n.set(r.data.path,e.length),e.push(r.data))}),{orderedFiles:e,orderedFileIndexMap:n}}function wJ(t,e,n){for(let r of t)if(!(r.type!==en.HEADER||!r.groupFilePaths?.includes(e))){if(r.key===gw){if(!n)return{type:"pinned"};continue}if(r.collapseKey&&r.isCollapsed===!0)return{type:"list-group",collapseKey:r.collapseKey}}return null}var wf,jH=U(()=>{wf=require("obsidian");Ue();Ee();Mr();Rn();ak();wi();Am();Dr();Sn();Zl();Z_()});function TJ(t){let{dayKey:e,file:n,files:r,groupBy:o,sortOption:a}=t;if(r.length===0)return null;let i;if(a==="modified-desc")i=r[0];else if(a==="modified-asc")i=r[r.length-1];else return null;if(i?.path!==n.path)return null;let s=o==="date"?zr.getDateGroupInfo(n.stat.mtime,zr.parseLocalDayKey(e)??void 0).key:"ungrouped";return`${a}\0${o}\0${s}\0${r.length}`}function NTe(t){return!t.hasDateSearchFilters&&!t.showFileDate&&!t.showTooltips&&t.boundaryRefreshKey!==null&&t.previousBoundaryRefreshKey===t.boundaryRefreshKey}function ITe(t,e,n){if(!n)return!1;let r=t.parent,o=n.path;return r?.path===o?!0:e?o==="/"?!0:!!(r?.path&&r.path.startsWith(`${o}/`)):!1}function FJ({app:t,basePathSet:e,commandQueue:n,customGroupHeaderFilePaths:r,dayKey:o,files:a,getDB:i,groupBy:s,hasDateSearchFilters:l,hasManualSortWordCountGroupHeaders:c,hasTaskSearchFilters:u,hiddenFilePropertyMatcher:p,hiddenFileTags:m,includeDescendantNotes:g,manualSortGroupHeaderPropertyKey:f,onRefresh:h,propertyTreeService:b,selectedFolder:v,selectedProperty:y,selectedTag:S,selectionType:w,settings:k,shouldRefreshOnCustomGroupHeaderMetadataChange:F,showHiddenItems:P,sortOption:T,propertySortKey:I,propertySortSecondary:N}){let O=(0,bu.useRef)(h),K=(0,bu.useRef)(!1),G=(0,bu.useRef)(!1),X=(0,bu.useRef)(!1),L=(0,bu.useRef)(new Map);(0,bu.useEffect)(()=>{O.current=h},[h]),(0,bu.useEffect)(()=>{if(L.current.clear(),a.length===0||T!=="modified-desc"&&T!=="modified-asc")return;let V=T==="modified-desc"?a[0]:a[a.length-1];if(!V)return;let D=TJ({dayKey:o,file:V,files:a,groupBy:s,sortOption:T});D!==null&&L.current.set(V.path,D)},[o,a,s,T]),(0,bu.useEffect)(()=>{let V=()=>{G.current=!1,X.current=!1,O.current()},D=(0,kJ.debounce)(V,Lt.FILE_OPERATION_DELAY,!0),A=()=>!!n?.hasActiveOperation("delete-files"),_=()=>!!(n?.hasActiveOperation("move-file")||A());K.current=_();let E=()=>K.current||_(),R=()=>{if(!(!G.current||E())){if(X.current){D.cancel(),V();return}D()}},M=()=>{L.current.clear()},C=re=>{if(G.current=!0,re?.immediateWhenIdle&&(X.current=!0),!E()){if(X.current){D.cancel(),V();return}D()}},x=null;n&&(x=n.onOperationChange((re,oe)=>{(re==="move-file"||re==="delete-files")&&(K.current=oe,oe||R())})),R();let z=null;w===W.PROPERTY&&y&&b&&(z=b.addTreeUpdateListener(()=>{C()}));let H=XK(T,N),Y=QK({sortOption:T,propertySortKey:I,propertySortSecondary:N,useFrontmatterMetadata:k.useFrontmatterMetadata,frontmatterNameField:k.frontmatterNameField,frontmatterCreatedField:k.frontmatterCreatedField,frontmatterModifiedField:k.frontmatterModifiedField}),ee=[t.vault.on("create",()=>{M(),C()}),t.vault.on("delete",()=>{M(),C({immediateWhenIdle:A()})}),t.vault.on("rename",()=>{M(),C()}),t.vault.on("modify",re=>{if(!H||!(re instanceof GH.TFile)||!e.has(re.path))return;let oe=TJ({dayKey:o,file:re,files:a,groupBy:s,sortOption:T});if(oe!==null){let Z=L.current.get(re.path);if(L.current.set(re.path,oe),NTe({previousBoundaryRefreshKey:Z,boundaryRefreshKey:oe,hasDateSearchFilters:l,showFileDate:k.showFileDate,showTooltips:k.showTooltips}))return}else L.current.delete(re.path);C()})],$=t.metadataCache.on("changed",re=>{if(!(re instanceof GH.TFile))return;let oe=()=>{if(!p.hasCriteria||re.extension!=="md")return!1;let ae=!!i().getFile(re.path)?.metadata?.hidden;return Xo(re,p,t)!==ae};if(w===W.TAG&&S){if(re.extension!=="md")return;if(!P&&oe()){C();return}Y&&e.has(re.path)&&C();return}if(w===W.PROPERTY&&y){if(re.extension!=="md")return;if(!P&&oe()){C();return}Y&&e.has(re.path)&&C();return}if(!(w!==W.FOLDER||!ITe(re,g,v))){if(F&&re.extension==="md"&&e.has(re.path)){let Z=r.has(re.path),ce=f!==null&&zm(t,re,f)!==null;if(Z||ce){C();return}}if(p.hasCriteria&&re.extension==="md"&&oe()){C();return}if(c&&k.wordCountTargetProperty.trim().length>0&&re.extension==="md"&&e.has(re.path)){C();return}Y&&re.extension==="md"&&e.has(re.path)&&C()}}),J=i().onContentChange(re=>{let oe=!1,Z=w===W.PROPERTY&&y,ce=re.some(se=>se.changes.tags!==void 0),ae=re.some(se=>se.changes.properties!==void 0);if(ce||ae){let se=w===W.TAG&&S,ne=w===W.FOLDER&&v;if(se&&ce)oe=!0;else if(ne&&ce&&v){let B=v.path,q=B==="/",ie=m.length>0;oe=re.some(le=>{if(!ie)return e.has(le.path);if(q)return!0;if(!g){let Te=le.path.lastIndexOf("/");return(Te===-1?"/":le.path.slice(0,Te))===B}return le.path.startsWith(`${B}/`)})}else if(Z){if(ae)oe=!0;else if(ce){let B=re.some(ie=>e.has(ie.path)),q=m.length>0&&!P;oe=B||q}}}!oe&&p.hasCriteria&&(oe=re.some(se=>se.metadataHiddenChanged===!0&&e.has(se.path))),!oe&&(u||k.showFileBackgroundUnfinishedTask)&&(oe=re.some(se=>se.changes.taskUnfinished!==void 0&&e.has(se.path))),!oe&&c&&(oe=re.some(se=>(se.changes.wordCount!==void 0||se.changes.properties!==void 0)&&e.has(se.path))),oe&&C()});return()=>{ee.forEach(re=>t.vault.offref(re)),t.metadataCache.offref($),J(),x?.(),z?.(),D.cancel()}},[t,e,n,r,o,a,i,s,l,c,u,p,m,g,f,b,v,y,S,w,F,k.frontmatterCreatedField,k.frontmatterModifiedField,k.frontmatterNameField,I,N,k.showFileBackgroundUnfinishedTask,k.showFileDate,k.showTooltips,k.useFrontmatterMetadata,k.wordCountTargetProperty,P,T])}var bu,GH,kJ,PJ=U(()=>{bu=ue(ze()),GH=require("obsidian"),kJ=require("obsidian");jr();yz();Yr();Rn();Ue();wi();Zl()});function CJ({selectionType:t,selectedFolder:e,selectedTag:n,selectedProperty:r,settings:o,activeProfile:a,groupBy:i,pinnedGroupExpanded:s,collapsedListGroups:l,searchProvider:c,searchQuery:u,searchTokens:p,visibility:m,propertySortOrderOverride:g}){let{app:f,tagTreeService:h,propertyTreeService:b,commandQueue:v,omnisearchService:y}=gt(),{getFileTimestamps:S,getDB:w,getFileDisplayName:k}=xo(),{includeDescendantNotes:F,showHiddenItems:P}=m,T=hR(),[I,N]=(0,na.useState)(0),O=u?.trim()??"",K=O.length>0,G=y?.isAvailable()??!1,X=c==="omnisearch"&&G&&K,L=(0,na.useMemo)(()=>{if(!O||X)return null;let xe=p??Sf(O);return SR(xe)?xe:null},[O,X,p]),V=L!==null&&(L.requireUnfinishedTasks||L.excludeUnfinishedTasks),D=L!==null&&(L.dateRanges.length>0||L.excludeDateRanges.length>0),A=(0,na.useMemo)(()=>{if(!(t!==W.FOLDER||!e))return e.path},[t,e]),{hiddenFolders:_,hiddenFileProperties:E,hiddenFileNames:R,hiddenTags:M,hiddenFileTags:C,fileVisibility:x}=a,z=(0,na.useMemo)(()=>po(E),[E]),H=t===W.FOLDER?e?.path??null:null,Y=Sh(o,t,e,n,r),ee=o.folderTreeSortOverrides?.[H??"/"]??o.folderSortOrder,$=(0,na.useMemo)(()=>({pinnedNotes:o.pinnedNotes,filterPinnedByFolder:o.filterPinnedByFolder,pinnedGroupExpanded:s,showTags:o.showTags,showFileTags:o.showFileTags,showFolderGroupPaths:o.showFolderGroupPaths,showCurrentFolderFilesAtBottom:o.showCurrentFolderFilesAtBottom,groupBy:i,folderGroupSortOrder:ee}),[o.filterPinnedByFolder,ee,i,s,o.pinnedNotes,o.showCurrentFolderFilesAtBottom,o.showFolderGroupPaths,o.showFileTags,o.showTags]),j=(0,na.useMemo)(()=>pl(o,Y),[o,Y]),J=j.option,re=(0,na.useMemo)(()=>ST(a.propertyKeys),[a.propertyKeys]),oe=(0,na.useMemo)(()=>ca({selectionType:t,selectedFolder:e,selectedTag:n,selectedProperty:r},o,m,f,h,b),[t,e,n,r,a.profile.id,a.hiddenFolders,a.hiddenFileProperties,a.hiddenFileNames,a.hiddenTags,a.hiddenFileTags,a.fileVisibility,o.enableFolderNotes,o.hideFolderNoteInList,o.hideDrawingPreviewImages,o.folderNoteName,o.folderNoteNamePattern,o.useFrontmatterMetadata,o.frontmatterNameField,o.frontmatterCreatedField,o.frontmatterModifiedField,o.frontmatterDateFormat,o.filterPinnedByFolder,o.pinnedNotes,o.defaultFolderSort,o.propertySortKey,o.manualSortPropertyKey,o.propertySortSecondary,re,o.showProperties,Y,b,F,P,f,h,I]),Z=(0,na.useMemo)(()=>new Set(oe.map(xe=>xe.path)),[oe]),ce=cJ({basePathSet:Z,omnisearchPathScope:A,omnisearchService:y,trimmedQuery:O,useOmnisearch:X}),ae=uJ({app:f,baseFiles:oe,getFileDisplayName:k}),se=(0,na.useMemo)(()=>({alphabeticalDateMode:o.alphabeticalDateMode}),[o.alphabeticalDateMode]),ne=(0,na.useMemo)(()=>pJ({app:f,baseFiles:oe,getDB:w,getFileTimestamps:S,omnisearchResult:ce,searchTokens:p,searchableNames:ae,settings:se,sortOption:J,trimmedQuery:O,useOmnisearch:X}),[f,oe,w,S,se,ce,p,ae,J,O,X]),B=(0,na.useMemo)(()=>!g||g.length===0?ne:lI(ne,g),[ne,g]),q=(0,na.useMemo)(()=>mJ({app:f,files:B,getDB:w,hiddenFileNames:R,hiddenFilePropertyMatcher:z,hiddenFileTags:C,hiddenFolders:_,hideDrawingPreviewImages:o.hideDrawingPreviewImages,showHiddenItems:P}),[B,w,_,z,R,C,o.hideDrawingPreviewImages,P,f]),ie=(0,na.useMemo)(()=>X&&ce?ce.meta:xTe,[X,ce]),le=(0,na.useMemo)(()=>as({manualSortPropertyKey:o.manualSortPropertyKey},j.propertyKey),[o.manualSortPropertyKey,j.propertyKey]),Te=sd(o),ke=i==="custom"&&Te!==null,Fe=(0,na.useMemo)(()=>vJ({app:f,dayKey:T,fileVisibility:x,files:B,getDB:w,getFileTimestamps:S,hiddenFileState:q,hiddenTags:M,listConfig:$,collapsedListGroups:l,searchMetaMap:ie,selectedFolder:e,selectedTag:n,selectedProperty:r,selectionType:t,showHiddenItems:P,sortOption:J,propertySortKey:j.propertyKey,isManualSortActive:le,manualSortGroupHeaderPropertyKey:Te,wordCountTargetProperty:o.wordCountTargetProperty}),[f,T,x,B,w,S,q,M,$,l,e,n,r,t,ie,P,J,j.propertyKey,le,Te,o.wordCountTargetProperty]),te=(0,na.useMemo)(()=>yJ(Fe),[Fe]),pe=(0,na.useMemo)(()=>bJ(B),[B]),{orderedFiles:ve,orderedFileIndexMap:Ie}=(0,na.useMemo)(()=>SJ(Fe),[Fe]),qe=(0,na.useMemo)(()=>{let xe=new Set,Ce=!1;return Fe.forEach(vt=>{vt.type!==en.HEADER||vt.headerKind!=="manual-sort-custom"||(vt.manualSortHeaderFilePath&&xe.add(vt.manualSortHeaderFilePath),vt.manualSortHeaderShowsWordCount===!0&&(Ce=!0))}),{filePaths:xe,hasWordCountGroupHeaders:Ce}},[Fe]);return FJ({app:f,basePathSet:Z,commandQueue:v,customGroupHeaderFilePaths:qe.filePaths,dayKey:T,files:B,getDB:w,groupBy:i,hasDateSearchFilters:D,hasManualSortWordCountGroupHeaders:qe.hasWordCountGroupHeaders,hasTaskSearchFilters:V,hiddenFilePropertyMatcher:z,hiddenFileTags:C,includeDescendantNotes:F,manualSortGroupHeaderPropertyKey:Te,onRefresh:()=>N(xe=>xe+1),propertyTreeService:b,selectedFolder:e,selectedProperty:r,selectedTag:n,selectionType:t,settings:o,shouldRefreshOnCustomGroupHeaderMetadataChange:ke,showHiddenItems:P,sortOption:J,propertySortKey:j.propertyKey,propertySortSecondary:j.propertySortSecondary}),{listItems:Fe,orderedFiles:ve,orderedFileIndexMap:Ie,filePathToIndex:te,fileIndexMap:pe,files:B,hiddenFileState:q,searchMeta:ie,localDayKey:T}}var na,xTe,NJ=U(()=>{na=ue(ze());mn();Xi();xH();Ue();Yr();KF();ai();Rn();wi();dn();gJ();jH();PJ();xTe=new Map});function IJ(t,e,n){let r=new Array(t);return new Proxy(r,{get(o,a,i){if(typeof a=="string"){let s=a.charCodeAt(0);if(s>=48&&s<=57){let l=+a;if(Number.isInteger(l)&&l>=0&&l{});function Tf(t,e,n){let r=n.initialDeps??[],o,a=!0;function i(){var s;let c=0,u=t();if(!(u.length!==r.length||u.some((g,f)=>r[f]!==g)))return o;r=u;let m=0;return o=e(...u),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(o),a=!1,o}return i.updateDeps=s=>{r=s},i}function qH(t,e){if(t===void 0)throw new Error(`Unexpected undefined${e?`: ${e}`:""}`);return t}var EJ,MJ,RJ=U(()=>{EJ=(t,e)=>Math.abs(t-e)<1.01,MJ=(t,e,n)=>{let r;return function(...o){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,o),n)}}});function LTe({measurements:t,outerSize:e,scrollOffset:n,lanes:r,flat:o}){let a=t.length-1,i=o?u=>o[u*2]:u=>t[u].start,s=o?u=>o[u*2]+o[u*2+1]:u=>t[u].end;if(t.length<=r)return{startIndex:0,endIndex:a};let l=zJ(0,a,i,n),c=l;if(r===1)for(;c1){let u=Array(r).fill(0);for(;cm=0&&p.some(m=>m>=n);){let m=t[l];p[m.lane]=m.start,l--}l=Math.max(0,l-l%r),c=Math.min(a,c+(r-1-c%r))}return{startIndex:l,endIndex:c}}var WF,YH,DJ,ETe,MTe,AJ,wR,RTe,DTe,OJ,ATe,OTe,LJ,TR,zJ,$H=U(()=>{xJ();RJ();YH=()=>{if(WF!==void 0)return WF;if(typeof navigator>"u")return WF=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return WF=!0;let t=navigator.maxTouchPoints;return WF=navigator.platform==="MacIntel"&&t!==void 0&&t>0},DJ=t=>{let{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},ETe=t=>t,MTe=t=>{let e=Math.max(t.startIndex-t.overscan,0),r=Math.min(t.endIndex+t.overscan,t.count-1)-e+1,o=new Array(r);for(let a=0;a{let n=t.scrollElement;if(!n)return;let r=t.targetWindow;if(!r)return;let o=i=>{let{width:s,height:l}=i;e({width:Math.round(s),height:Math.round(l)})};if(o(DJ(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(i=>{let s=()=>{let l=i[0];if(l?.borderBoxSize){let c=l.borderBoxSize[0];if(c){o({width:c.inlineSize,height:c.blockSize});return}}o(DJ(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},wR={passive:!0},RTe=typeof window>"u"?!0:"onscrollend"in window,DTe=(t,e,n)=>{let r=t.scrollElement;if(!r)return;let o=t.targetWindow;if(!o)return;let a=t.options.useScrollendEvent&&RTe,i=0,s=a?null:MJ(o,()=>e(i,!1),t.options.isScrollingResetDelay),l=p=>()=>{i=n(r),s?.(),e(i,p)},c=l(!0),u=l(!1);return r.addEventListener("scroll",c,wR),a&&r.addEventListener("scrollend",u,wR),()=>{r.removeEventListener("scroll",c),a&&r.removeEventListener("scrollend",u)}},OJ=(t,e)=>DTe(t,e,n=>{let{horizontal:r,isRtl:o}=t.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),ATe=(t,e,n)=>{if(n.options.useCachedMeasurements){let r=n.indexFromElement(t),o=n.options.getItemKey(r);return n.itemSizeCache.get(o)??n.options.estimateSize(r)}if(e?.borderBoxSize){let r=e.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}if(!e){let r=n.indexFromElement(t),o=n.options.getItemKey(r),a=n.itemSizeCache.get(o);if(a!==void 0)return a}return t[n.options.horizontal?"offsetWidth":"offsetHeight"]},OTe=(t,{adjustments:e=0,behavior:n},r)=>{var o,a;(a=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||a.call(o,{[r.options.horizontal?"left":"top"]:t+e,behavior:n})},LJ=OTe,TR=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var n,r,o;return((o=(r=(n=this.targetWindow)==null?void 0:n.performance)==null?void 0:r.now)==null?void 0:o.call(r))??Date.now()},this.observer=(()=>{let n=null,r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(a=>{let i=()=>{let s=a.target,l=this.indexFromElement(s);if(!s.isConnected){this.observer.unobserve(s);for(let[c,u]of this.elementsCache)if(u===s){this.elementsCache.delete(c);break}return}this.shouldMeasureDuringScroll(l)&&this.resizeItem(l,this.options.measureElement(s,a,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(i):i()})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var a;return(a=r())==null?void 0:a.observe(o,{box:"border-box"})},unobserve:o=>{var a;return(a=r())==null?void 0:a.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{var r,o;let a={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:ETe,rangeExtractor:MTe,onChange:()=>{},measureElement:ATe,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,anchorTo:"start",followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:"estimate",useCachedMeasurements:!1};for(let m in n){let g=n[m];g!==void 0&&(a[m]=g)}let i=this.options,s=null,l=null,c=!1;if(i!==void 0&&i.enabled&&a.enabled&&a.anchorTo==="end"&&this.scrollElement!==null){let m=i.count,g=a.count,f=this.getMeasurements(),h=m>0?((r=f[0])==null?void 0:r.key)??i.getItemKey(0):null,b=m>0?((o=f[m-1])==null?void 0:o.key)??i.getItemKey(m-1):null;if(g!==m||m>0&&g>0&&(a.getItemKey(0)!==h||a.getItemKey(g-1)!==b)){c=!0;let S=m>0?this.getVirtualItemForOffset(this.getScrollOffset())??f[0]:null;S&&(s=[S.key,this.getScrollOffset()-S.start]);let w=a.followOnAppend===!0?"auto":a.followOnAppend||null;w&&g>m&&this.isAtEnd(i.scrollEndThreshold)&&(m===0||a.getItemKey(g-1)!==b)&&(l=w)}}this.options=a,c&&(this.pendingMin=0,this.itemSizeCacheVersion++);let u=!1,p=0;if(s&&this.scrollOffset!==null){let[m,g]=s,f=this.getMeasurements(),{count:h,getItemKey:b}=this.options,v=0;for(;v{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=Tf(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;let r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}if(this.scrollElement=r,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(a=>{this.observer.observe(a)}),this.unsubs.push(this.options.observeElementRect(this,a=>{this.scrollRect=a,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(a,i)=>{this._intendedScrollOffset!==null&&Math.abs(a-this._intendedScrollOffset)<1.5&&(a=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0,this.scrollDirection=i?this.getScrollOffset(){this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},s=()=>{this._iosTouching=!1,!(!YH()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};a.addEventListener("touchstart",i,wR),a.addEventListener("touchend",s,wR),this.unsubs.push(()=>{a.removeEventListener("touchstart",i),a.removeEventListener("touchend",s),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let o=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,o&&this.scrollElement&&this.options.enabled){let[a,i,s,l]=o;a!==null&&!s&&(YH()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?l!==0&&(this._iosDeferredAdjustment+=l):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),s&&this.scrollToEnd({behavior:s})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let n=this.getScrollOffset(),r=this.getMaxScrollOffset();if(n<0||n>r)return;let o=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(n,{adjustments:this.scrollAdjustments+=o,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{let o=new Map,a=new Map;for(let i=r-1;i>=0;i--){let s=n[i];if(o.has(s.lane))continue;let l=a.get(s.lane);if(l==null||s.end>l.end?a.set(s.lane,s):s.endi.end===s.end?i.index-s.index:i.end-s.end)[0]:void 0},this.getMeasurementOptions=Tf(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(n,r,o,a,i,s,l)=>(this.prevLanes!==void 0&&this.prevLanes!==s&&(this.lanesChangedFlag=!0),this.prevLanes=s,this.pendingMin=null,{count:n,paddingStart:r,scrollMargin:o,getItemKey:a,enabled:i,lanes:s,laneAssignmentMode:l}),{key:!1}),this.getMeasurements=Tf(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:a,enabled:i,lanes:s,laneAssignmentMode:l},c)=>{let u=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(let f of this.laneAssignments.keys())f>=n&&this.laneAssignments.delete(f);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(f=>{this.itemSizeCache.set(f.key,f.size)}));let p=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),s===1){let f=this.options.gap,h=n*2,b=this._flatMeasurements;if(!b||b.length0&&S.set(b.subarray(0,p*2)),b=S,this._flatMeasurements=b}let v;if(p===0)v=r+o;else{let S=p-1;v=b[S*2]+b[S*2+1]+f}for(let S=p;S1){v=b;let P=g[v],T=P!==void 0?m[P]:void 0;y=T?T.end+this.options.gap:r+o}else{let P=this.options.lanes===1?m[f-1]:this.getFurthestMeasurement(m,f);y=P?P.end+this.options.gap:r+o,v=P?P.lane:f%this.options.lanes,this.options.lanes>1&&S&&this.laneAssignments.set(f,v)}let w=u.get(h),k=typeof w=="number"?w:this.options.estimateSize(f),F=y+k;m[f]={index:f,start:y,size:k,end:F,key:h,lane:v},g[v]=f}return this.measurementsCache=m,m},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Tf(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,a)=>this.range=n.length>0&&r>0?LTe({measurements:n,outerSize:r,scrollOffset:o,lanes:a,flat:a===1&&this._flatMeasurements!=null?this._flatMeasurements:null}):null,{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=Tf(()=>{let n=null,r=null,o=this.calculateRange();return o&&(n=o.startIndex,r=o.endIndex),this.maybeNotify.updateDeps([this.isScrolling,n,r]),[this.options.rangeExtractor,this.options.overscan,this.options.count,n,r]},(n,r,o,a,i)=>a===null||i===null?[]:n({startIndex:a,endIndex:i,overscan:r,count:o}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=n=>{let r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=n=>{var r;if(!this.scrollState||this.scrollState.behavior!=="smooth")return!0;let o=this.scrollState.index??((r=this.getVirtualItemForOffset(this.scrollState.lastTargetOffset))==null?void 0:r.index);if(o!==void 0&&this.range){let a=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),i=Math.max(0,o-a),s=Math.min(this.options.count-1,o+a);return n>=i&&n<=s}return!0},this.measureElement=n=>{if(!n){this.elementsCache.forEach((i,s)=>{i.isConnected||(this.observer.unobserve(i),this.elementsCache.delete(s))});return}let r=this.indexFromElement(n),o=this.options.getItemKey(r),a=this.elementsCache.get(o);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(o,n)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(r)&&this.resizeItem(r,this.options.measureElement(n,void 0,this))},this.resizeItem=(n,r)=>{var o,a;if(n<0||n>=this.options.count)return;let i,s,l,c=this._flatMeasurements;if(this.options.lanes===1&&c!==null)l=this.options.getItemKey(n),s=c[n*2],i=c[n*2+1];else{let m=this.measurementsCache[n];if(!m)return;l=m.key,s=m.start,i=m.size}let u=this.itemSizeCache.get(l)??i,p=r-u;if(p!==0){let m=this.options.anchorTo==="end"&&((o=this.scrollState)==null?void 0:o.behavior)!=="smooth"&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,g=m?this.getTotalSize():0,f=((a=this.scrollState)==null?void 0:a.behavior)!=="smooth"&&(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[n]??{index:n,key:l,start:s,size:i,end:s+i,lane:0},p,this):s[this.getVirtualIndexes(),this.getMeasurements()],(n,r)=>{let o=[];for(let a=0,i=n.length;athis.options.debug}),this.getVirtualItemForOffset=n=>{let r=this.getMeasurements();if(r.length===0)return;let o=this._flatMeasurements,a=this.options.lanes===1&&o!=null,i=zJ(0,r.length-1,a?s=>o[s*2]:s=>qH(r[s]).start,n);return qH(r[i])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if("scrollHeight"in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let n=this.scrollElement.document.documentElement;return this.options.horizontal?n.scrollWidth-this.scrollElement.innerWidth:n.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(n=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=n,this.getOffsetForAlignment=(n,r,o=0)=>{if(!this.scrollElement)return 0;let a=this.getSize(),i=this.getScrollOffset();r==="auto"&&(r=n>=i+a?"end":"start"),r==="center"?n+=(o-a)/2:r==="end"&&(n-=a);let s=this.getMaxScrollOffset();return Math.max(Math.min(s,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));let o=this.getSize(),a=this.getScrollOffset(),i=this.measurementsCache[n];if(!i)return;if(r==="auto")if(i.end>=a+o-this.options.scrollPaddingEnd)r="end";else if(i.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];if(r==="end"&&n===this.options.count-1)return[this.getMaxScrollOffset(),r];let s=r==="end"?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(s,r,i.size),r]},this.scrollToOffset=(n,{align:r="start",behavior:o="auto"}={})=>{let a=this.getOffsetForAlignment(n,r),i=this.now();this.scrollState={index:null,align:r,behavior:o,startedAt:i,lastTargetOffset:a,stableFrames:0},this._scrollToOffset(a,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollToIndex=(n,{align:r="auto",behavior:o="auto"}={})=>{n=Math.max(0,Math.min(n,this.options.count-1));let a=this.getOffsetForIndex(n,r);if(!a)return;let[i,s]=a,l=this.now();this.scrollState={index:n,align:s,behavior:o,startedAt:l,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:o}),this.scheduleScrollReconcile()},this.scrollBy=(n,{behavior:r="auto"}={})=>{let o=this.getScrollOffset()+n,a=this.now();this.scrollState={index:null,align:"start",behavior:r,startedAt:a,lastTargetOffset:o,stableFrames:0},this._scrollToOffset(o,{adjustments:void 0,behavior:r}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:n="auto"}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:"end",behavior:n});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:n})},this.getTotalSize=()=>{var n;let r=this.getMeasurements(),o;if(r.length===0)o=this.options.paddingStart;else if(this.options.lanes===1){let a=r.length-1,i=this._flatMeasurements;i!=null?o=i[a*2]+i[a*2+1]:o=((n=r[a])==null?void 0:n.end)??0}else{let a=Array(this.options.lanes).fill(null),i=r.length-1;for(;i>=0&&a.some(s=>s===null);){let s=r[i];a[s.lane]===null&&(a[s.lane]=s.end),i--}o=Math.max(...a.filter(s=>s!==null))}return Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let n=[];if(this.itemSizeCache.size===0)return n;let r=this.getMeasurements();for(let o of r)o&&this.itemSizeCache.has(o.key)&&n.push({index:o.index,key:o.key,start:o.start,size:o.size,end:o.end,lane:o.lane});return n},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this._intendedScrollOffset=n+(r??0),this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,n){e!==0&&(YH()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:n}))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId==null&&(this.rafId=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()}))}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let r=this.scrollState.index!=null?this.getOffsetForIndex(this.scrollState.index,this.scrollState.align):void 0,o=r?r[0]:this.scrollState.lastTargetOffset,a=1,i=o!==this.scrollState.lastTargetOffset;if(!i&&EJ(o,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=a){this.getScrollOffset()!==o&&this._scrollToOffset(o,{adjustments:void 0,behavior:"auto"}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,i){let s=this.getSize()||600,l=Math.abs(o-this.getScrollOffset()),c=this.scrollState.behavior==="smooth"&&l>s;this.scrollState.lastTargetOffset=o,c||(this.scrollState.behavior="auto"),this._scrollToOffset(o,{adjustments:void 0,behavior:c?"smooth":"auto"})}this.scheduleScrollReconcile()}},zJ=(t,e,n,r)=>{for(;t<=e;){let o=(t+e)/2|0,a=n(o);if(ar)e=o-1;else return o}return t>0?t-1:0}});function zTe({useFlushSync:t=!0,directDomUpdates:e=!1,directDomUpdatesMode:n="transform",...r}){let o=Su.useReducer(c=>c+1,0)[1],a=Su.useRef({enabled:e,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=e,a.current.mode=n;let i=c=>{let u=a.current;if(!u.enabled||!u.container)return;let p=c.getTotalSize();if(p!==u.lastSize){u.lastSize=p;let v=c.options.horizontal?"width":"height";u.container.style[v]=`${p}px`}let m=!!c.options.horizontal,g=u.mode==="transform",f=m?"left":"top",h=c.options.scrollMargin,b=c.getVirtualItems();for(let v of b){let y=v.start-h,S=c.elementsCache.get(v.key);S&&u.lastPositions.get(S)!==y&&(u.lastPositions.set(S,y),g?S.style.transform=m?`translate3d(${y}px, 0, 0)`:`translate3d(0, ${y}px, 0)`:S.style[f]=`${y}px`)}},s={...r,onChange:(c,u)=>{var p;let m=a.current,g=!0;if(m.enabled){i(c);let f=c.range,h=m.prevRange;g=!h||h.isScrolling!==c.isScrolling||h.startIndex!==f?.startIndex||h.endIndex!==f?.endIndex,g&&(m.prevRange=f?{startIndex:f.startIndex,endIndex:f.endIndex,isScrolling:c.isScrolling}:null)}g&&(t&&u?(0,BJ.flushSync)(o):o()),(p=r.onChange)==null||p.call(r,c,u)}},[l]=Su.useState(()=>{let c=new TR(s);return Object.assign(c,{containerRef:u=>{let p=a.current;if(p.container=u,p.lastSize=null,u&&p.enabled){let m=c.getTotalSize();p.lastSize=m;let g=c.options.horizontal?"width":"height";u.style[g]=`${m}px`}}})});return l.setOptions(s),XH(()=>l._didMount(),[]),XH(()=>l._willUpdate()),XH(()=>{i(l)}),l}function kR(t){return zTe({observeElementRect:AJ,observeElementOffset:OJ,scrollToFn:LJ,...t})}var Su,BJ,XH,QH=U(()=>{Su=ue(ze(),1),BJ=ue(pF(),1);$H();$H();XH=typeof document<"u"?Su.useLayoutEffect:Su.useEffect});function FR(t){switch(t){case"visibilityToggle":case"mobile-visibility":return"auto";case"selection":return ZH.Platform.isMobile?"center":"auto";case"reveal":case"external":return"auto";default:return"center"}}function _J(t){switch(t){case"folder-navigation":return ZH.Platform.isMobile?"center":"auto";case"visibility-change":return"auto";case"list-structure-change":return"auto";default:return"auto"}}function jF(t){if(!t)return-1;if(t.type==="top")return 0;switch(t.reason){case"list-structure-change":return 1;case"visibility-change":return 2;case"folder-navigation":return 3;case"reveal":return 4;default:return 1}}var ZH,JH=U(()=>{ZH=require("obsidian")});function VJ(t){return BTe[t]}function aS(t){return t?HTe:_Te}function eV(t,e){return t?.type===en.HEADER&&t.headerKind==="manual-sort-custom"&&t.manualSortHeader!==void 0&&Bh(t.manualSortHeader,t.manualSortHeaderTargetWordCount)?e.manualSortGoalHeaderHeight:e.groupHeaderHeight}function PR({selectionType:t,selectedTag:e,showSelectedNavigationPills:n}){return n||t!==W.TAG?null:Ze(e)}function CR({selectionType:t,selectedProperty:e,showSelectedNavigationPills:n}){return n||t!==W.PROPERTY||!e||!kn(e)?.valuePath?null:Gt(e)??e}function UJ({tags:t,hiddenTagVisibility:e,selectedTagToHide:n}){for(let r of t)if(!(e?.shouldFilterHiddenTags&&!e.isTagVisible(r))&&!(n&&Ze(r)===n))return!0;return!1}function tV({properties:t,visiblePropertyKeys:e,hiddenPropertyValueNodeId:n,visitor:r}){if(!(!t||t.length===0))for(let o of t){let a=Me(o.fieldKey);if(e&&!e.has(a))continue;let i=o.value;if(i.trim().length===0)continue;let s=rr(i),l=o.valueKind==="boolean"?!1:NN(s,o.valueKind);if(o.valueKind===void 0&&l)continue;let c=o.fieldKey.trim(),u=c.length===0?void 0:l?Gn(c):sa(c,s),p=u?Gt(u)??u:void 0;if(n&&p===n)continue;if(r({entry:o,trimmedFieldKey:c,rawValue:i,normalizedValuePath:s,isKeyOnlyValue:l,propertyNodeId:p})===!1)return}}function KJ(t,e){if(e)return t;let n=t.split("/").filter(r=>r.length>0);return n.length===0?t:n[n.length-1]}function nV({isCompactMode:t=!1,showDate:e,showPreview:n,isPinned:r,hasPreviewContent:o,showFeatureImageArea:a,showExtensionBadgeThumbnail:i=!1,hasVisiblePillRows:s}){let l=a&&!i,c=r&&l,u=!o&&s;return{isCompactMode:t,shouldShowMultilinePreview:n&&!u&&(o||l),shouldReplaceEmptyPreviewWithPills:u,shouldShowDateForItem:e&&!r,isPinnedImageRow:c}}function VTe({heights:t,titleRows:e,previewRows:n,layoutState:r,showFeatureImageArea:o,showExtensionBadgeThumbnail:a,showParentFolderLine:i,visiblePillRowCount:s}){let l=t.titleLineHeight*e,c=Math.max(0,s),u=c>0,p=r.shouldShowMultilinePreview,m=p?t.multilineTextLineHeight*n:0,g=r.shouldShowDateForItem||i?t.singleTextLineHeight:0,f=g>0?1:0,h=f+c,b=o&&!a,y=r.shouldReplaceEmptyPreviewWithPills&&b?t.multilineTextLineHeight*n:0,S=!p&&!b,w=G=>o?Math.max(G,t.featureImageMinHeight):G;if(S&&h===0)return t.basePadding+w(l);if(S&&h<=1){let G=Math.max(f>0?t.singleTextLineHeight:0,u?t.tagRowHeight:0);return t.basePadding+w(l+G)}let k=Math.max(m,y),F=b&&!r.isPinnedImageRow,P=F?t.singleTextLineHeight:g,T=F&&g===0?P:0,I=l+k+P,N=t.tagRowHeight*c,O=y+T,K=Math.max(0,N-O);return t.basePadding+w(I+K)}function WJ(t,e){let{heights:n,titleRows:r,previewRows:o,compactPaddingTotal:a}=e,i=Math.max(0,t.visiblePillRowCount),s=nV({isCompactMode:e.isCompactMode,showDate:e.showDate,showPreview:e.showPreview,isPinned:t.isPinned,hasPreviewContent:t.hasPreviewContent,showFeatureImageArea:t.showFeatureImageArea,showExtensionBadgeThumbnail:t.showExtensionBadgeThumbnail,hasVisiblePillRows:i>0});if(s.isCompactMode){let l=n.titleLineHeight*r+n.tagRowHeight*i;return a+l}return VTe({heights:n,titleRows:r,previewRows:t.isPinned?1:o,layoutState:s,showFeatureImageArea:t.showFeatureImageArea,showExtensionBadgeThumbnail:t.showExtensionBadgeThumbnail,showParentFolderLine:t.showParentFolderLine,visiblePillRowCount:i})}function NR({showParentFolder:t,isPinned:e,selectionType:n,includeDescendantNotes:r,parentFolder:o,fileParentPath:a}){return!t||e||!a||a==="/"?!1:n==="tag"||n==="property"?!0:r&&!!o&&a!==o}function IR({showImage:t,file:e,featureImageStatus:n,hasFeatureImageUrl:r,showDrawingFeatureImage:o}){return!t||!e?!1:r||e.extension==="canvas"||e.extension==="base"||Ms(e)||o?!0:n==="has"}function xR({showFeatureImageArea:t,file:e,hasFeatureImageUrl:n,showDrawingMissingFeatureImage:r}){return!t||!e||n?!1:r?!0:e.extension==="canvas"||e.extension==="base"}function UTe({properties:t,visiblePropertyKeys:e,hiddenPropertyValueNodeId:n}){if(!t||t.length===0)return jJ;let r=HJ.get(t);r||(r={unfiltered:new Map,filtered:new WeakMap},HJ.set(t,r));let o;if(!e)o=r.unfiltered;else{let p=r.filtered.get(e);p?o=p:(o=new Map,r.filtered.set(e,o))}let a=n??"",i=o.get(a);if(i)return i;let s=!1,l=!1,c=new Set;tV({properties:t,visiblePropertyKeys:e,hiddenPropertyValueNodeId:n,visitor:({trimmedFieldKey:p})=>{if(s=!0,p.length===0){l=!0;return}c.add(p)}});let u={hasVisiblePills:s,separateRowCount:c.size+(l?1:0)};return o.set(a,u),u}function GJ({showTextCountProperty:t,showFileProperties:e,showPropertiesOnSeparateRows:n,showFilePropertiesInCompactMode:r,isCompactMode:o,file:a,wordCount:i,characterCount:s,properties:l,visiblePropertyKeys:c,hiddenPropertyValueNodeId:u}){if(!a||a.extension!=="md"||o&&!r)return 0;let p=t&&typeof i=="number"&&Number.isFinite(i)&&i>0,m=t&&typeof s=="number"&&Number.isFinite(s)&&s>0,g=e?UTe({properties:l,visiblePropertyKeys:c,hiddenPropertyValueNodeId:u}):jJ;if(!p&&!m&&!g.hasVisiblePills)return 0;let f=p||m?1:0,h=0;return n?g.hasVisiblePills&&(h=g.separateRowCount):h=g.hasVisiblePills?1:0,h===0?f:n?h+f:1+f}var BTe,_Te,HTe,jJ,HJ,iS=U(()=>{Ue();Mr();cn();Ot();Sn();wi();BTe=Object.freeze({64:{listMaxSize:64},96:{listMaxSize:96},128:{listMaxSize:128}}),_Te=Object.freeze({basePadding:16,titleLineHeight:20,singleTextLineHeight:19,multilineTextLineHeight:18,tagRowHeight:26,featureImageMinHeight:42,groupHeaderHeight:27,manualSortGoalHeaderHeight:32,groupHeaderSpacerBefore:20,fileIconSize:16,topSpacer:8,bottomSpacer:20}),HTe=Object.freeze({basePadding:24,titleLineHeight:21,singleTextLineHeight:20,multilineTextLineHeight:19,tagRowHeight:26,featureImageMinHeight:42,groupHeaderHeight:35,manualSortGoalHeaderHeight:40,groupHeaderSpacerBefore:20,fileIconSize:20,topSpacer:8,bottomSpacer:20});jJ={hasVisiblePills:!1,separateRowCount:0},HJ=new WeakMap});function sS(t,e=!0){let[n,r]=(0,ER.useState)(()=>sT());return(0,ER.useEffect)(()=>{if(!e)return;let o=()=>{r(i=>{let s=sT();return i===s?i:s})},a=$W(t,o);return o(),a},[t,e]),n}var ER,MR=U(()=>{ER=ue(ze());lO()});function KTe(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function WTe(t){let{matcher:e}=t;return JSON.stringify({shouldFilterHiddenTags:t.shouldFilterHiddenTags,matcher:{prefixes:e.prefixes,startsWithNames:e.startsWithNames,endsWithNames:e.endsWithNames,pathPatterns:e.pathPatterns}})}function jTe({topSpacerHeight:t,folderSettings:e,settings:n,themeMode:r,selectionType:o,selectedTagToHide:a,selectedPropertyValueNodeIdToHide:i,includeDescendantNotes:s,hiddenTagVisibilitySignature:l,visiblePropertyKeySignature:c,listMeasurements:u}){return JSON.stringify({spacers:{topSpacerHeight:t},environment:{themeMode:r},appearance:{mode:e.mode,titleRows:e.titleRows,previewRows:e.previewRows,groupBy:e.groupBy,showDate:e.showDate,showPreview:e.showPreview,showImage:e.showImage},rowContent:{showFileProperties:n.showFileProperties,showFilePropertiesInCompactMode:n.showFilePropertiesInCompactMode,showPropertiesOnSeparateRows:n.showPropertiesOnSeparateRows,textCountDisplay:n.textCountDisplay,textCountPlacement:n.textCountPlacement,characterCountSpaces:n.characterCountSpaces,showSelectedNavigationPills:n.showSelectedNavigationPills,visiblePropertyKeySignature:c,showParentFolder:n.showParentFolder,showTags:n.showTags,showFileTags:n.showFileTags,showFileTagsInCompactMode:n.showFileTagsInCompactMode,selectionType:o??null,selectedTagToHide:a,selectedPropertyValueNodeIdToHide:i,includeDescendantNotes:s,hiddenTagVisibilitySignature:l},rowSizing:{compactItemHeight:n.compactItemHeight,compactItemHeightScaleText:n.compactItemHeightScaleText},measurements:u})}function GTe({includeDescendantNotes:t,listLayoutSignature:e,groupBy:n,noteGrouping:r,stickyGroupHeaders:o,effectiveSort:a,propertySortKey:i,propertySortSecondary:s}){return JSON.stringify({includeDescendantNotes:t,listLayoutSignature:e,groupBy:n,noteGrouping:r,stickyGroupHeaders:o,effectiveSort:a,propertySortKey:i??null,propertySortSecondary:s})}function qTe(t,e){let{changes:n}=t;return!!(n.previewStatus!==void 0&&e.showPreview||(n.featureImageKey!==void 0||n.featureImageStatus!==void 0)&&e.showImage||n.tags!==void 0&&e.tagsBaseEnabled||n.properties!==void 0&&e.frontmatterPropertyRowsPossible||n.wordCount!==void 0&&e.showWordCountProperty||n.characterCountWithSpaces!==void 0&&e.showCharacterCountProperty&&e.characterCountSpaces==="include"||n.characterCountWithoutSpaces!==void 0&&e.showCharacterCountProperty&&e.characterCountSpaces==="exclude")}function YTe(t){let e=null;return{schedule(){e===null&&(e=window.requestAnimationFrame(()=>{e=null,t()}))},cancel(){e!==null&&(window.cancelAnimationFrame(e),e=null)}}}function $Te(t,e,n){let r=t[e];if(r?.type!==en.FILE||!(r.data instanceof rV.TFile))return 0;for(let o=e-1;o>=0;o-=1){let a=t[o];if(a?.type===en.HEADER)return eV(a,n)}return 0}function XTe(t,e){return e.showImage||e.propertyRowsPossible?!0:e.tagsBaseEnabled&&!!t.hasTags&&e.selectedTagToHide!==null}function QTe({app:t,db:e,hasPreview:n,item:r,file:o,config:a}){let i=null;XTe(r,a)&&(i=e.getFile(o.path));let s=!1,l=!1;if(a.showPreview){o.extension==="md"&&(s=n(o.path));let v=r.searchMeta?.excerpt;l=typeof v=="string"&&v.length>0}let c=s||l,u=!1,p=!1;if(a.showImage){let v=jd(t,o);u=v?.showsFeatureImageBox??!1,p=u&&!v?.supportsCompanionImages?!0:u&&v?SN(t,o,v.providerId,a.themeMode)===null:!1}let m=IR({showImage:a.showImage,file:o,featureImageStatus:i?.featureImageStatus??null,showDrawingFeatureImage:u}),g=xR({showFeatureImageArea:m,file:o,showDrawingMissingFeatureImage:p}),f=!1;!p&&a.tagsBaseEnabled&&r.hasTags&&(a.selectedTagToHide?f=UJ({tags:Pr({app:t,file:o,db:e,fileData:i}),hiddenTagVisibility:a.hiddenTagVisibility,selectedTagToHide:a.selectedTagToHide}):f=!0);let h=NR({showParentFolder:a.showParentFolder,isPinned:!!r.isPinned,selectionType:a.selectionType,includeDescendantNotes:a.includeDescendantNotes,parentFolder:r.parentFolder,fileParentPath:o.parent?.path??null}),b=!p&&a.propertyRowsPossible?GJ({showTextCountProperty:a.showTextCountProperty,showFileProperties:a.showFileProperties,showPropertiesOnSeparateRows:a.showPropertiesOnSeparateRows,showFilePropertiesInCompactMode:a.showFilePropertiesInCompactMode,isCompactMode:a.isCompactMode,file:o,wordCount:a.showWordCountProperty?i?.wordCount??void 0:void 0,characterCount:a.showCharacterCountProperty?a.characterCountSpaces==="include"?i?.characterCountWithSpaces??void 0:i?.characterCountWithoutSpaces??void 0:void 0,properties:i?.properties??void 0,visiblePropertyKeys:a.visiblePropertyKeys,hiddenPropertyValueNodeId:a.selectedPropertyValueNodeIdToHide}):0;return{isPinned:!!r.isPinned,hasPreviewContent:c,showFeatureImageArea:m,showExtensionBadgeThumbnail:g,showParentFolderLine:h,visiblePillRowCount:(f?1:0)+b}}function qJ({enabled:t=!0,listItems:e,filePathToIndex:n,selectedFile:r,selectedFolder:o,selectedTag:a,selectedProperty:i,settings:s,folderSettings:l,isVisible:c,selectionState:u,selectionDispatch:p,searchQuery:m,suppressSearchTopScrollRef:g,topSpacerHeight:f,includeDescendantNotes:h,groupCollapseStateSignature:b,visiblePropertyKeys:v,visiblePropertyKeySignature:y,hiddenTagVisibility:S,scrollMargin:w=0,scrollPaddingEnd:k=0,onVirtualizerScrollingChange:F,onScrollContainerVisibilityChange:P}){let{app:T,isMobile:I}=gt(),N=aS(I),{hasPreview:O,getDB:K,isStorageReady:G}=xo(),X=sS(T),L=K(),V=(0,Wt.useMemo)(()=>eR({compactItemHeight:s.compactItemHeight,scaleText:s.compactItemHeightScaleText,titleLineHeight:N.titleLineHeight}),[N.titleLineHeight,s.compactItemHeight,s.compactItemHeightScaleText]),D=(0,Wt.useRef)(null),[A,_]=(0,Wt.useState)(null),[E,R]=(0,Wt.useState)(!1),M=(0,Wt.useRef)(!1),C=(0,Wt.useRef)(F),x=(0,Wt.useRef)(P),z=(0,Wt.useRef)(""),H=(0,Wt.useRef)(null),Y=(0,Wt.useRef)(void 0),ee=(0,Wt.useRef)(b),$=(0,Wt.useRef)(null),[j,J]=(0,Wt.useState)(0),re=(0,Wt.useRef)(r?r.path:null);re.current=r?.path??null;let oe=(0,Wt.useRef)(0),Z=(0,Wt.useRef)(n.size),ce=(0,Wt.useRef)(null),ae=(0,Wt.useRef)(null),se=(0,Wt.useRef)(!1);(0,Wt.useEffect)(()=>{C.current=F},[F]),(0,Wt.useEffect)(()=>{x.current=P},[P]);let ne=(0,Wt.useCallback)((Pe,ge)=>{R(be=>be===Pe?be:Pe),M.current!==Pe&&(M.current=Pe,!Pe&&se.current&&(se.current=!1,C.current?.(!1,ge)),x.current?.(Pe,ge))},[]),B=l.mode==="compact",q=s.revealFileOnListChanges,ie=!!r,le=(0,Wt.useMemo)(()=>PR({selectionType:u.selectionType,selectedTag:u.selectedTag,showSelectedNavigationPills:s.showSelectedNavigationPills}),[u.selectedTag,u.selectionType,s.showSelectedNavigationPills]),Te=(0,Wt.useMemo)(()=>CR({selectionType:u.selectionType,selectedProperty:u.selectedProperty,showSelectedNavigationPills:s.showSelectedNavigationPills}),[u.selectedProperty,u.selectionType,s.showSelectedNavigationPills]),ke=(0,Wt.useMemo)(()=>{let Pe=s.textCountDisplay!=="none"&&s.textCountPlacement==="property",ge=Pe&&il(s.textCountDisplay),be=Pe&&Gl(s.textCountDisplay),me=!B||s.showFilePropertiesInCompactMode,fe=s.showFileProperties&&v.size>0,we=me&&fe;return{heights:N,titleRows:l.titleRows||1,previewRows:l.previewRows,showDate:l.showDate,showPreview:l.showPreview,showImage:l.showImage,compactPaddingTotal:I?V.mobilePaddingTotal:V.desktopPaddingTotal,isCompactMode:B,tagsBaseEnabled:s.showTags&&s.showFileTags&&(!B||s.showFileTagsInCompactMode),frontmatterPropertyRowsPossible:we,propertyRowsPossible:me&&(fe||Pe),showTextCountProperty:Pe,showWordCountProperty:ge,showCharacterCountProperty:be,showFileProperties:s.showFileProperties,showPropertiesOnSeparateRows:s.showPropertiesOnSeparateRows,showFilePropertiesInCompactMode:s.showFilePropertiesInCompactMode,characterCountSpaces:s.characterCountSpaces,showParentFolder:s.showParentFolder,selectionType:u.selectionType,includeDescendantNotes:h,selectedTagToHide:le,selectedPropertyValueNodeIdToHide:Te,hiddenTagVisibility:S,visiblePropertyKeys:v,themeMode:X}},[V.desktopPaddingTotal,V.mobilePaddingTotal,l.previewRows,l.showDate,l.showImage,l.showPreview,l.titleRows,S,h,B,I,N,Te,le,u.selectionType,s.characterCountSpaces,s.showFileProperties,s.showFilePropertiesInCompactMode,s.showFileTags,s.showFileTagsInCompactMode,s.showParentFolder,s.showPropertiesOnSeparateRows,s.showTags,s.textCountDisplay,s.textCountPlacement,X,v]),Fe=(0,Wt.useCallback)(Pe=>e[Pe]?.key??Pe,[e]),te=Number.isFinite(w)&&w>0?w:0,pe=Number.isFinite(k)&&k>0?k:0,ve=kR({count:t?e.length:0,getItemKey:Fe,getScrollElement:()=>{if(!t)return null;let Pe=D.current;return Pe},enabled:t,scrollMargin:te,scrollPaddingStart:te,estimateSize:Pe=>{let ge=e[Pe],be=ke.heights;return ge.type===en.HEADER?eV(ge,be):ge.type===en.HEADER_SPACER?be.groupHeaderSpacerBefore:ge.type===en.TOP_SPACER?f:ge.type===en.BOTTOM_SPACER?be.bottomSpacer:ge.type===en.FILE&&ge.data instanceof rV.TFile?WJ(QTe({app:T,db:L,hasPreview:O,item:ge,file:ge.data,config:ke}),ke):be.titleLineHeight},overscan:GP,scrollPaddingEnd:pe,useScrollendEvent:!0,onChange:Pe=>{if(!t)return;let ge=Pe.isScrolling;ge&&!M.current||se.current!==ge&&(se.current=ge,C.current?.(ge,Pe.scrollElement))}}),Ie=(0,Wt.useRef)(()=>{});Ie.current=()=>ve.measure();let qe=(0,Wt.useRef)(null);qe.current===null&&(qe.current=YTe(()=>Ie.current()));let xe=(0,Wt.useCallback)(Pe=>{D.current=Pe,_(Pe),Pe||ne(!1,null)},[ne]);(0,Wt.useLayoutEffect)(()=>{let Pe=A;if(!t){ne(!1,Pe);return}if(!Pe){ne(!1,null);return}let ge=()=>{let me=Pe.getBoundingClientRect(),fe=me.width>0&&me.height>0;ne(fe,Pe)};if(ge(),typeof ResizeObserver>"u"){let me=()=>ge();return window.addEventListener("resize",me),()=>{window.removeEventListener("resize",me)}}let be=new ResizeObserver(me=>{let fe=me[0];if(!fe)return;let{width:we,height:Re}=fe.contentRect,nt=we>0&&Re>0;ne(nt,Pe)});return be.observe(Pe),()=>be.disconnect()},[t,ne,A]);let Ce=t&&c&&E,vt=(0,Wt.useMemo)(()=>WTe(S),[S]),Rt=(0,Wt.useMemo)(()=>({compactItemHeight:s.compactItemHeight,compactItemHeightScaleText:s.compactItemHeightScaleText,showFileProperties:s.showFileProperties,showFilePropertiesInCompactMode:s.showFilePropertiesInCompactMode,showPropertiesOnSeparateRows:s.showPropertiesOnSeparateRows,textCountDisplay:s.textCountDisplay,textCountPlacement:s.textCountPlacement,characterCountSpaces:s.characterCountSpaces,showFileTags:s.showFileTags,showFileTagsInCompactMode:s.showFileTagsInCompactMode,showParentFolder:s.showParentFolder,showSelectedNavigationPills:s.showSelectedNavigationPills,showTags:s.showTags}),[s.compactItemHeight,s.compactItemHeightScaleText,s.showFileProperties,s.showFilePropertiesInCompactMode,s.showPropertiesOnSeparateRows,s.textCountDisplay,s.textCountPlacement,s.characterCountSpaces,s.showFileTags,s.showFileTagsInCompactMode,s.showParentFolder,s.showSelectedNavigationPills,s.showTags]),Ve=(0,Wt.useMemo)(()=>jTe({topSpacerHeight:f,folderSettings:l,settings:Rt,themeMode:X,selectionType:u.selectionType,selectedTagToHide:le,selectedPropertyValueNodeIdToHide:Te,includeDescendantNotes:h,hiddenTagVisibilitySignature:vt,visiblePropertyKeySignature:y,listMeasurements:N}),[f,l,Rt,X,u.selectionType,le,Te,h,vt,y,N]),Ae=(0,Wt.useCallback)(()=>{t&&I&&D.current&&D.current.scrollTo({top:0,behavior:"smooth"})},[t,I]),Ke=(0,Wt.useCallback)(Pe=>{let ge=D.current;if(!ge)return;let be=ge.querySelector(`[data-index="${Pe}"]`);if(!(be instanceof HTMLElement))return;let me=ge.getBoundingClientRect(),fe=be.getBoundingClientRect(),we=s.stickyGroupHeaders?$Te(e,Pe,N):0,Re=me.top+we,nt=me.bottom-pe;if(we>0&&fe.top0&&fe.bottom>nt&&(ge.scrollTop+=Math.round(fe.bottom-nt))},[pe,e,N,s.stickyGroupHeaders]),Be=(0,Wt.useCallback)((Pe,ge)=>{ve.scrollToIndex(Pe,{align:ge});let be=0,me=()=>{be+=1,Ke(Pe),be<3&&window.requestAnimationFrame(me)};window.requestAnimationFrame(me)},[Ke,ve]),wt=(0,Wt.useCallback)(Pe=>{let ge=n.get(Pe);if(ge===void 0||ge===-1)return-1;let be=-1;for(let fe=ge-1;fe>=0;fe-=1){let we=e[fe];if(we?.type!==en.HEADER_SPACER){we?.type===en.HEADER&&(be=fe);break}}return be===-1?ge:be===1?be:ge},[n,e]);(0,Wt.useLayoutEffect)(()=>{let Pe=ce.current;if(Pe===null||!KTe(Pe,n)){Z.current=n.size,ce.current=n,oe.current=oe.current+1;return}(Z.current!==n.size||ce.current!==n)&&(Z.current=n.size,ce.current=n)},[n,n.size]);let Ct=(0,Wt.useCallback)(()=>{$.current&&($.current=null,J(Pe=>Pe+1))},[]),qt=(0,Wt.useCallback)(Pe=>{let ge=$.current;if(!ge){$.current=Pe,J(fe=>fe+1);return}let be=jF(Pe),me=jF(ge);be>=me&&($.current=Pe,J(fe=>fe+1))},[]),lt=(0,Wt.useCallback)(Pe=>{if(!ve||!Ce)return!1;let ge=Pe.minIndexVersion??oe.current;if(oe.current{let nt=Re?wt(Re):-1;Re&&nt>=0&&nt!==we&&q&&qt({type:"file",filePath:Re,reason:"list-structure-change",minIndexVersion:oe.current})})}return!0}return ve.scrollToOffset(0,{align:"start",behavior:"auto"}),!0},[wt,Ce,q,ve,Be,u.revealSource,qt]),Zt=(0,Wt.useCallback)(Pe=>{let ge=$.current;if(ge&&jF(ge)>jF(Pe)){lt(ge)&&($.current=null);return}if(lt(Pe)){ge&&($.current=null);return}qt(Pe)},[lt,qt]);(0,Wt.useLayoutEffect)(()=>{if(!ve||!$.current||!Ce)return;let Pe=$.current;lt(Pe)&&($.current=null)},[lt,ve,Ce,j]),(0,Wt.useEffect)(()=>{if(!t||!ve)return;let Pe=K(),ge=qe.current,be=Pe.onContentChange(me=>{me.some(we=>n.has(we.path)&&qTe(we,ke))&&ge?.schedule()});return()=>{be(),ge?.cancel()}},[t,n,K,ke,ve]),(0,Wt.useEffect)(()=>{if(!t||!I)return;let Pe=()=>{r&&ve&&qt({type:"file",filePath:r.path,reason:"visibility-change",minIndexVersion:oe.current})};return window.addEventListener("notebook-navigator-visible",Pe),()=>window.removeEventListener("notebook-navigator-visible",Pe)},[t,I,r,ve,n,qt]),(0,Wt.useEffect)(()=>{!t||!ve||ve.measure()},[t,Ve,ve]),(0,Wt.useLayoutEffect)(()=>{t&&G&&ve&&ve.measure()},[t,G,ve]);let Kt=Sh(s,u.selectionType,o,a,i),gn=(0,Wt.useMemo)(()=>pl(s,Kt),[s,Kt]),fn=gn.option,an=(0,Wt.useMemo)(()=>GTe({includeDescendantNotes:h,listLayoutSignature:Ve,groupBy:l.groupBy,noteGrouping:s.noteGrouping,stickyGroupHeaders:s.stickyGroupHeaders,effectiveSort:fn,propertySortKey:gn.propertyKey,propertySortSecondary:gn.propertySortSecondary}),[h,Ve,l.groupBy,s.noteGrouping,s.stickyGroupHeaders,fn,gn.propertyKey,gn.propertySortSecondary]);return(0,Wt.useLayoutEffect)(()=>{if(!ve||!Ce)return;let Pe=H.current;if(Pe===null){H.current={signature:an,includeDescendantNotes:h};return}if(Pe.signature===an)return;let ge=Pe.includeDescendantNotes,be=h;H.current={signature:an,includeDescendantNotes:h},q&&r?Zt({type:"file",filePath:r.path,reason:"list-structure-change",minIndexVersion:oe.current}):ge&&!be&&Zt({type:"top",reason:"list-structure-change",minIndexVersion:oe.current})},[Ce,ve,r,h,q,an,Zt]),(0,Wt.useLayoutEffect)(()=>{if(!ve||!Ce)return;let Pe=i??"",ge=`${o?.path||""}_${a||""}_${Pe}`,be=ae.current,me=ee.current!==b;if(ee.current=b,!be||be.key!==ge){ae.current={key:ge,version:oe.current};return}if(oe.current>be.version){if(ae.current={key:ge,version:oe.current},me)return;let fe=!!(r&&n.has(r.path));q&&fe&&r&&Zt({type:"file",filePath:r.path,reason:"list-structure-change",minIndexVersion:oe.current})}},[ve,Ce,o?.path,a,i,b,n,n.size,r,Zt,q]),(0,Wt.useLayoutEffect)(()=>{if(!t||!ve)return;let Pe=i??"",ge=`${o?.path||""}_${a||""}_${Pe}`,be=z.current!==ge;be&&Ct();let me=u.isFolderNavigation;if(!(be||me&&ie)){me&&p({type:"SET_FOLDER_NAVIGATION",isFolderNavigation:!1});return}if(be&&e.length===0)return;let we=r?{type:"file",filePath:r.path,reason:"folder-navigation",minIndexVersion:oe.current}:{type:"top",reason:"folder-navigation",minIndexVersion:oe.current};if(!Ce&&(me||be)){be&&(z.current=ge),me&&p({type:"SET_FOLDER_NAVIGATION",isFolderNavigation:!1}),Zt(we);return}me&&e.length>0&&Ce?(be&&(z.current=ge),p({type:"SET_FOLDER_NAVIGATION",isFolderNavigation:!1}),Zt(we)):(be&&(z.current=ge),Zt(we))},[Ce,t,ve,o?.path,a,i,r,u.isFolderNavigation,p,n.size,e.length,Ct,Zt,ie]),(0,Wt.useLayoutEffect)(()=>{u.isRevealOperation&&r&&Ce&&(Zt({type:"file",filePath:r.path,reason:"reveal",minIndexVersion:oe.current}),p({type:"CLEAR_REVEAL_OPERATION"}))},[u.isRevealOperation,r,Ce,p,n,Zt]),(0,Wt.useLayoutEffect)(()=>{if(m===void 0){Y.current=m;return}if(!r){Y.current=m;return}if(!Ce||!ve)return;let Pe=n.has(r.path),ge=Y.current!==m;Y.current=m;let be=g?.current??!1;if(!Pe&&e.length>0){if(be&&g){g.current=!1;return}Zt({type:"top",reason:"list-structure-change",minIndexVersion:oe.current});return}be&&g&&(g.current=!1)},[m,r,n,Ce,ve,e.length,Zt,g]),{rowVirtualizer:ve,scrollContainerRef:D,scrollContainerRefCallback:xe,handleScrollToTop:Ae,scrollToIndexSafely:Be}}var Wt,rV,YJ=U(()=>{Wt=ue(ze()),rV=require("obsidian");QH();mn();Xi();Ue();JH();xn();vH();iS();Sn();gl();MR();Rn()});function $J(t,e,n,r){let o=Xd(n,r);if(!o||o.includes("/"))return;let a=e==="/"?"":`${e}/`;for(let i of ZTe)t.add(`${a}${o}.${i}`);t.add(`${a}${o}${Fa}.md`)}function QJ(){let{app:t}=gt(),e=pt(),r=Xt().showHiddenItems,o=(0,Pd.useMemo)(()=>ti(e),[e]),a=ar(),i=a.selectedFolder?.path??null,s=a.selectedFolder?.name??null,{getTagDisplayPath:l,getPropertyTree:c}=xo(),u=ta(),p=Ho(),[m,g]=(0,Pd.useState)(0),f=(0,Pd.useMemo)(()=>{if(!e.enableFolderNotes||a.selectionType!==W.FOLDER||!i)return new Set;let w={folderNoteName:e.folderNoteName,folderNoteNamePattern:e.folderNoteNamePattern},k=new Set;if(i==="/"){let T=a.selectedFolder,I=T?uy(T,t.vault):s??"";return $J(k,"/",I,w),k}let F=i.split("/").filter(Boolean),P="";return F.forEach(T=>{P=P?`${P}/${T}`:T,$J(k,P,T,w)}),k},[s,i,t.vault,a.selectedFolder,a.selectionType,e.enableFolderNotes,e.folderNoteName,e.folderNoteNamePattern]);(0,Pd.useEffect)(()=>{if(f.size===0)return;let w=kt(),k=Array.from(f).map(F=>w.onFileContentChange(F,P=>{P.metadata!==void 0&&g(T=>T+1)}));return()=>{k.forEach(F=>{F()})}},[f]),(0,Pd.useEffect)(()=>{if(f.size===0)return;let w=(T,I)=>{T instanceof XJ.TFile&&(f.has(T.path)||typeof I=="string"&&f.has(I))&&g(N=>N+1)},k=t.vault.on("create",T=>{w(T)}),F=t.vault.on("delete",T=>{w(T)}),P=t.vault.on("rename",(T,I)=>{w(T,I)});return()=>{t.vault.offref(k),t.vault.offref(F),t.vault.offref(P)}},[t.vault,f]);let h=(0,Pd.useMemo)(()=>JSON.stringify({folderIcons:e.folderIcons||{},tagIcons:e.tagIcons||{},propertyIcons:e.propertyIcons||{},enableFolderNotes:e.enableFolderNotes,folderNoteName:e.folderNoteName,folderNoteNamePattern:e.folderNoteNamePattern,useFrontmatterMetadata:e.useFrontmatterMetadata,frontmatterNameField:e.frontmatterNameField}),[e]),b=(0,Pd.useMemo)(()=>`${h}::${m}`,[m,h]),v=(0,Pd.useMemo)(()=>{if(a.selectionType===W.FOLDER&&a.selectedFolder){if(!e.showFolderIcons)return"";let w=a.selectedFolder,k=p.getFolderDisplayData(w.path,{includeDisplayName:!1,includeColor:!1,includeBackgroundColor:!1,includeIcon:!0}).icon;if(k)return k;let T=zv(w,o,r),I=u.expandedFolders.has(w.path);return T&&I?Qe(e.interfaceIcons,"nav-folder-open"):Qe(e.interfaceIcons,"nav-folder-closed")}if(a.selectionType===W.TAG&&a.selectedTag)return e.showTagIcons?p.getTagIcon(a.selectedTag)||Qe(e.interfaceIcons,"nav-tag"):"";if(a.selectionType===W.PROPERTY&&a.selectedProperty){if(!e.showPropertyIcons)return"";let w=a.selectedProperty;if(w===Oe)return Qe(e.interfaceIcons,"nav-properties");let k=p.getPropertyIcon(w);return k||(kn(w)?.valuePath?Qe(e.interfaceIcons,"nav-property-value"):Qe(e.interfaceIcons,"nav-property"))}return""},[u.expandedFolders,p,a.selectedFolder,a.selectedTag,a.selectedProperty,a.selectionType,o,r,e.interfaceIcons,e.showFolderIcons,e.showPropertyIcons,e.showTagIcons,b]),{desktopTitle:y,breadcrumbSegments:S}=(0,Pd.useMemo)(()=>{if(a.selectionType===W.FOLDER&&a.selectedFolder){let k=a.selectedFolder;if(k.path==="/"){let T=_s({app:t,metadataService:p,settings:{customVaultName:e.customVaultName},folderPath:k.path,fallbackName:k.name});return{desktopTitle:T,breadcrumbSegments:[{label:T,targetType:"none",isLast:!0}]}}let F=DL({metadataService:p,folderPath:k.path}),P=F.map((T,I)=>I===F.length-1?{label:T.label,targetType:"none",isLast:!0}:{label:T.label,targetType:"folder",targetPath:T.path,isLast:!1});return{desktopTitle:F[F.length-1]?.label??k.name,breadcrumbSegments:P}}if(a.selectionType===W.TAG&&a.selectedTag){let k=a.selectedTag;if(k===zt){let I=rc(Tl.TAGGED).getLabel();return{desktopTitle:I,breadcrumbSegments:[{label:I,targetType:"none",isLast:!0}]}}if(k===bt){let I=[{label:d.common.untagged,targetType:"none",isLast:!0}];return{desktopTitle:d.common.untagged,breadcrumbSegments:I}}let F=l(k),P=F.split("/").filter(Boolean),T=P.map((I,N)=>N===P.length-1?{label:I,targetType:"none",isLast:!0}:{label:I,targetType:"tag",targetPath:P.slice(0,N+1).join("/"),isLast:!1});return{desktopTitle:P[P.length-1]||F,breadcrumbSegments:T}}if(a.selectionType===W.PROPERTY&&a.selectedProperty){let k=a.selectedProperty;if(k===Oe){let K=[{label:d.navigationPane.properties,targetType:"none",isLast:!0}];return{desktopTitle:d.navigationPane.properties,breadcrumbSegments:K}}let F=kn(k);if(!F)return{desktopTitle:d.navigationPane.properties,breadcrumbSegments:[{label:d.navigationPane.properties,targetType:"none",isLast:!0}]};let T=c().get(F.key)??null,I=T?.name??F.key,N=F.valuePath?T?.children.get(k)??null:null,O=Gn(F.key);return{desktopTitle:F.valuePath?N?.displayPath??F.valuePath:I,breadcrumbSegments:F.valuePath?[{label:I,targetType:"property",targetPath:O,isLast:!1},{label:N?.displayPath??F.valuePath,targetType:"none",isLast:!0}]:[{label:I,targetType:"none",isLast:!0}]}}let w=[{label:d.common.noSelection,targetType:"none",isLast:!0}];return{desktopTitle:d.common.noSelection,breadcrumbSegments:w}},[t,l,c,p,a.selectedFolder,a.selectedTag,a.selectedProperty,a.selectionType,e.customVaultName,b]);return{desktopTitle:y,breadcrumbSegments:S,iconName:v,showIcon:a.selectionType===W.FOLDER&&e.showFolderIcons&&v.length>0||a.selectionType===W.TAG&&e.showTagIcons&&v.length>0||a.selectionType===W.PROPERTY&&e.showPropertyIcons&&v.length>0,selectionType:a.selectionType}}var Pd,XJ,ZTe,ZJ=U(()=>{Pd=ue(ze()),XJ=require("obsidian");mn();on();Tr();Ur();Xi();Qs();Ee();zn();Ue();cy();Yr();ap();rs();Jm();dn();pr();cn();Vm();_a();ZTe=Object.values(Qd)});function kf({groupBy:t,sortOption:e,selectionType:n,isManualSortActive:r=!1,isManualSortEditActive:o=!1}){return r||o?"custom":Kd(e)==="property"?n===W.FOLDER&&t==="folder"?"folder":"custom":t==="date"&&!bh(e)?"custom":t}function GF({noteGrouping:t,selectionType:e,groupBy:n}){let r=t??"custom";if(e===W.FOLDER)return{defaultGrouping:r,effectiveGrouping:n??r,normalizedOverride:n,hasCustomOverride:n!==void 0};if(e===W.TAG||e===W.PROPERTY){let o=r==="folder"?"date":r;return n===void 0||n==="folder"?{defaultGrouping:o,effectiveGrouping:o,normalizedOverride:void 0,hasCustomOverride:!1}:{defaultGrouping:o,effectiveGrouping:n,normalizedOverride:n,hasCustomOverride:!0}}return{defaultGrouping:r,effectiveGrouping:r,normalizedOverride:void 0,hasCustomOverride:!1}}function RR({settings:t,selectionType:e,folderPath:n,tag:r,propertyNodeId:o}){let a=t.noteGrouping??"custom";return e===W.FOLDER&&n?GF({noteGrouping:a,selectionType:e,groupBy:t.folderAppearances?.[n]?.groupBy}):e===W.TAG&&r?GF({noteGrouping:a,selectionType:e,groupBy:t.tagAppearances?.[r]?.groupBy}):e===W.PROPERTY&&o?GF({noteGrouping:a,selectionType:e,groupBy:t.propertyAppearances?.[o]?.groupBy}):{defaultGrouping:a,effectiveGrouping:a,normalizedOverride:void 0,hasCustomOverride:!1}}var qF=U(()=>{Ue();Rn()});function DR(t){return t.defaultListMode==="compact"?"compact":"standard"}function oV({appearance:t,defaultMode:e}){return t?.mode==="compact"||t?.mode==="standard"?t.mode:e}function JTe(t,e){return t==="compact"?{showDate:!1,showPreview:!1,showImage:!1}:{showDate:e.showFileDate,showPreview:e.showFilePreview,showImage:e.showFeatureImage}}function eee(){let t=pt(),{selectedFolder:e,selectedTag:n,selectedProperty:r,selectionType:o}=Ml(),a=o===W.FOLDER?e?.path??null:null,i=o===W.TAG?n:null,s=o===W.PROPERTY?r:null,l=a!==null?t.folderAppearances?.[a]:i!==null?t.tagAppearances?.[i]:s!==null?t.propertyAppearances?.[s]:void 0,c=l?.mode,u=l?.titleRows,p=l?.previewRows,m=l?.groupBy,{defaultListMode:g,fileNameRows:f,noteGrouping:h,previewRows:b,showFeatureImage:v,showFileDate:y,showFilePreview:S}=t;return(0,JJ.useMemo)(()=>{let F=oV({appearance:{mode:c,titleRows:u,previewRows:p},defaultMode:g==="compact"?"compact":"standard"}),P=JTe(F,{showFileDate:y,showFilePreview:S,showFeatureImage:v}),T=GF({noteGrouping:h,selectionType:o,groupBy:m});return{mode:F,titleRows:u??f,previewRows:p??b,showDate:P.showDate,showPreview:P.showPreview,showImage:P.showImage,groupBy:T.effectiveGrouping}},[g,f,h,b,c,u,p,m,v,y,S,o])}var JJ,AR=U(()=>{JJ=ue(ze());on();Ur();Ue();qF()});function eke(t){return t==="/"||t.startsWith("/")?t:`/${t}`}function tke(t){return t===zt?d.tagList.tags:t===bt?d.common.untagged:t.startsWith("#")?t:`#${t}`}function nke(t){if(t===Oe)return d.navigationPane.properties;let e=kn(t);return e?e.valuePath?e.valuePath:e.key:t}function rke(t){switch(t.type){case ni.FOLDER:return eke(t.path);case ni.TAG:return tke(t.tagPath);case ni.PROPERTY:return nke(t.nodeId)}}function oke(t,e){if(!RN(e))return null;let n=LC(e.path);return n?T$(t,n)?.path??null:null}function tee({rootContainerRef:t,onSearchTokensChange:e,onNavigateToFolder:n,onRevealTag:r,onRevealProperty:o,ensureSelectionForCurrentFilterRef:a}){let{app:i,isMobile:s,plugin:l}=gt(),c=pt(),u=ar(),p=Td(),m=Yn(),g=Vr(),f=Xt(),{setSearchActive:h}=wd(),{addSearchShortcut:b,removeSearchShortcut:v,searchShortcutsByName:y}=p,S=(0,ir.useMemo)(()=>Array.from(y.values()),[y]),w=f.searchActive,k=c.searchProvider??"internal",[F,P]=(0,ir.useState)(""),[T,I]=(0,ir.useState)(""),[N,O]=(0,ir.useState)(!1),[K,G]=(0,ir.useState)(!1),X=(0,ir.useRef)(!1),L=(0,ir.useMemo)(()=>Sf(w?T:""),[T,w]),V=L.mode,D=(0,ir.useMemo)(()=>{if(!(!w||V==="tag"))return F},[V,w,F]),A=(0,ir.useMemo)(()=>{let ae=F.trim();if(!ae)return null;let se=k??"internal",ne=null;for(let B of S){if(B.query!==ae)continue;if(ne||(ne=B),(B.provider??"internal")===se)return B}return ne},[k,F,S]);(0,ir.useEffect)(()=>{!w&&F&&P("")},[w,F]),(0,ir.useEffect)(()=>{if(!w){T&&I("");return}if(T===F)return;let ae=window.setTimeout(()=>{I(F)},Lt.DEBOUNCE_KEYBOARD);return()=>{window.clearTimeout(ae)}},[T,w,F]),(0,ir.useEffect)(()=>{if(!e)return;let ae=F.trim()?GZ(F):oS;e(ae)},[e,F]);let _=(0,ir.useMemo)(()=>{if(u.selectionType==="folder"&&u.selectedFolder)return{type:ni.FOLDER,path:u.selectedFolder.path};if(u.selectionType==="tag"&&u.selectedTag)return{type:ni.TAG,tagPath:u.selectedTag};if(u.selectionType==="property"&&u.selectedProperty)return{type:ni.PROPERTY,nodeId:u.selectedProperty}},[u.selectedFolder,u.selectedProperty,u.selectedTag,u.selectionType]),E=(0,ir.useMemo)(()=>_?d.searchInput.shortcutStartIn.replace("{path}",rke(_)):null,[_]),R=(0,ir.useCallback)(ae=>{let se=ae?.focusPane??"search";w||(h(!0),m.singlePane&&ae?.preserveSinglePaneView!==!0&&g({type:"SET_SINGLE_PANE_VIEW",view:"files"})),se&&g({type:"SET_FOCUSED_PANE",pane:se})},[w,h,g,m.singlePane]),M=(0,ir.useCallback)(()=>{h(!1),g({type:"SET_FOCUSED_PANE",pane:"files"})},[h,g]),C=(0,ir.useCallback)(()=>{if(!w){O(!0),R();return}M()},[R,M,w]),x=(0,ir.useCallback)(()=>{let ae=F.trim();if(!ae||K)return;let se=_,ne=E,B=null;B=new dl(i,d.searchInput.shortcutModalTitle,d.searchInput.shortcutNamePlaceholder,async(q,ie)=>{let le=q.trim();if(le.length===0){de(d.shortcuts.emptySearchName,{variant:"warning"});return}G(!0);try{let Te=ie?.checkboxValue?se:void 0;await b({name:le,query:ae,provider:k,startTarget:Te})&&B?.close()}finally{G(!1)}},ae,{closeOnSubmit:!1,checkbox:ne?{label:ne,defaultChecked:!1}:void 0}),B.open()},[_,E,b,i,K,k,F]),z=(0,ir.useCallback)(async()=>{if(!(!A||K)){G(!0);try{await v(A.name)}finally{G(!1)}}},[A,K,v]),H=(0,ir.useCallback)((ae,se)=>{let ne=se?.focusSearch!==!1;ne&&O(!0),R({focusPane:ne?"search":null,preserveSinglePaneView:se?.preserveSinglePaneView});let B=null;P(q=>{let ie=ae(q);return B=ie,ie}),B!==null&&I(B)},[R]),Y=(0,ir.useCallback)((ae,se,ne)=>{let B=Ze(ae);!B||B===bt||H(q=>QZ(q,B,se).query,ne)},[H]),ee=(0,ir.useCallback)((ae,se,ne,B)=>{let q=ae.trim();q&&H(ie=>ZZ(ie,q,se,ne).query,B)},[H]),$=(0,ir.useCallback)((ae,se)=>{let ne=ae.trim();ne&&(k!=="internal"&&l.setSearchProvider("internal"),H(B=>JZ(B,ne).query,se))},[l,k,H]),j=(0,ir.useCallback)(()=>new Promise(ae=>{window.requestAnimationFrame(()=>ae())}),[]),J=(0,ir.useCallback)(async()=>{if(!s)return;let ae=t.current;if(!ae)return;let se=c.paneTransitionDuration,ne=performance.now()+se+20;for(;performance.now(){let se=(t.current??activeDocument).querySelector(".nn-list-pane-scroller");se instanceof HTMLElement&&Di(se)},[t]),oe=(0,ir.useCallback)(()=>{window.setTimeout(()=>{let se=(t.current??activeDocument).querySelector(".nn-search-input");se instanceof HTMLInputElement&&(se.focus(),g({type:"SET_FOCUSED_PANE",pane:"search"}))},0)},[t,g]),Z=(0,ir.useCallback)(()=>{if(w){oe();return}O(!0),R()},[R,oe,w]),ce=(0,ir.useCallback)(async({searchShortcut:ae})=>{let se=ae.query.trim(),ne=ae.provider??"internal",B=ae.startTarget;if(l.setSearchProvider(ne),B)if(RN(B)){let q=oke(i,B);q&&n(q,{source:"shortcut",suppressAutoSelect:!0,skipScroll:c.skipAutoScroll})}else TO(B)?r(B.tagPath,{source:"shortcut",skipScroll:c.skipAutoScroll}):kO(B)&&o(B.nodeId,{source:"shortcut",skipScroll:c.skipAutoScroll});m.singlePane&&g({type:"SET_SINGLE_PANE_VIEW",view:"files"}),g({type:"SET_FOCUSED_PANE",pane:"files"}),s&&(X.current=!0,await J()),w||h(!0),O(!1),P(se),I(se),await j(),await j(),s||a.current?.({openInEditor:!1,clearIfEmpty:!0,selectFallback:!0}),re()},[i,a,re,s,w,n,o,r,l,h,c.skipAutoScroll,g,m.singlePane,J,j]);return{isSearchActive:w,searchProvider:k,searchQuery:F,debouncedSearchQuery:T,debouncedSearchTokens:L,searchHighlightQuery:D,shouldFocusSearch:N,activeSearchShortcut:A,isSavingSearchShortcut:K,suppressSearchTopScrollRef:X,setSearchQuery:P,setShouldFocusSearch:O,handleSearchToggle:C,closeSearch:M,focusSearchComplete:()=>O(!1),handleSaveSearchShortcut:x,handleRemoveSearchShortcut:z,modifySearchWithTag:Y,modifySearchWithProperty:ee,modifySearchWithDateToken:$,toggleSearch:Z,executeSearchShortcut:ce}}var ir,nee=U(()=>{ir=ue(ze());Ur();mn();on();xg();pa();Tr();Ee();fh();Ue();jr();Ia();yR();os();KF();Fn();$o();cn();Ay();Sn()});function oee({rootContainerRef:t,orderedFiles:e,filePathToIndex:n,scrollToIndexSafely:r}){let{app:o,commandQueue:a,isMobile:i}=gt(),s=vu(),l=ar(),c=gr(),u=pt(),p=Yn(),m=Vr(),f=Xt().searchActive,{handleMultiSelectClick:h,handleRangeSelectClick:b,isFileSelected:v}=eS(),y=(0,sr.useRef)(!1),S=(0,sr.useRef)(!1),w=(0,sr.useRef)(0),k=(0,sr.useRef)(null),F=(0,sr.useRef)(!1),P=(0,sr.useRef)(()=>{}),T=(0,sr.useRef)(p.focusedPane),I=(0,sr.useRef)(null),N=(0,sr.useMemo)(()=>(0,ree.debounce)((M,C)=>{C===w.current&&(S.current=!1,k.current=null,s(M))},Lt.DEBOUNCE_KEYBOARD_FILE_OPEN,!0),[s]);(0,sr.useEffect)(()=>()=>{N.cancel()},[N]);let O=(0,sr.useCallback)(()=>{w.current+=1,S.current=!1,k.current=null,N.cancel()},[N]),K=(0,sr.useCallback)((M,C)=>{if(y.current=C?.markUserSelection??!1,c({type:"SET_SELECTED_FILE",file:M}),C?.markKeyboardNavigation&&c({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!0}),C?.suppressOpen){O();return}if(C?.debounceOpen){w.current+=1;let x=w.current;S.current=!0,k.current=M,N(M,x);return}O(),s(M)},[O,N,s,c]),G=(0,sr.useCallback)(M=>{w.current+=1;let C=w.current;S.current=!0,k.current=M,N(M,C)},[N]),X=(0,sr.useCallback)(()=>{if(u.enterToOpenFiles)return;let C=fc(o,l)??k.current;C&&G(C)},[o,G,l,u.enterToOpenFiles]),L=(0,sr.useCallback)(M=>{u.enterToOpenFiles||G(M)},[G,u.enterToOpenFiles]),V=(0,sr.useCallback)(()=>{if(u.enterToOpenFiles||!S.current)return;let M=k.current??fc(o,l);M&&(O(),s(M))},[o,O,s,l,u.enterToOpenFiles]),D=(0,sr.useMemo)(()=>{if(l.selectedFile)return l.selectedFile.path;let M=l.selectedFiles.values().next();return M.done?null:M.value},[l.selectedFile,l.selectedFiles]);(0,sr.useEffect)(()=>{P.current=V},[V]),(0,sr.useEffect)(()=>{if(!S.current)return;let M=k.current?.path??null;(!M||M!==D)&&O()},[O,D]),(0,sr.useEffect)(()=>{!u.enterToOpenFiles||!S.current||O()},[O,u.enterToOpenFiles]),(0,sr.useEffect)(()=>{T.current=p.focusedPane,p.focusedPane!=="navigation"&&(F.current=!1)},[p.focusedPane]),(0,sr.useEffect)(()=>{let M=()=>{F.current=!1};return window.addEventListener("blur",M),()=>{window.removeEventListener("blur",M)}},[]),(0,sr.useEffect)(()=>{let M=t.current;if(!M)return;let C=Y=>Y.key==="ArrowUp"||Y.key==="ArrowDown"||Y.key==="PageUp"||Y.key==="PageDown",x=Y=>Y.ctrlKey||Y.metaKey||Y.altKey,z=Y=>{if(T.current!=="navigation"||_u(Y)||x(Y)){F.current=!1;return}F.current=C(Y)},H=Y=>{if(T.current!=="navigation"||_u(Y)||x(Y)){F.current=!1;return}if(!C(Y)){F.current=!1;return}P.current(),F.current=!1};return M.addEventListener("keydown",z,!0),M.addEventListener("keyup",H),()=>{M.removeEventListener("keydown",z,!0),M.removeEventListener("keyup",H)}},[t]);let A=(0,sr.useCallback)(M=>{let x=(M?.openInEditor??!1)&&!u.enterToOpenFiles,z=M?.debounceOpen??!1,H=M?.clearIfEmpty??!1,Y=M?.selectFallback??!0,ee=l.selectedFile,$=!ee,j=ee?n.has(ee.path):!1;if($||!j){if(Y&&e.length>0){let re=e[0];return K(re,{suppressOpen:!x,debounceOpen:x&&z}),{selectionStateChanged:!0}}return!Y&&H&&e.length===0?(c({type:"SET_SELECTED_FILE",file:null}),{selectionStateChanged:!0}):{selectionStateChanged:!1}}if(x&&ee&&j){if(z)return G(ee),{selectionStateChanged:!1};s(ee)}return{selectionStateChanged:!1}},[n,s,e,G,K,c,l.selectedFile,u.enterToOpenFiles]),_=(0,sr.useCallback)(M=>{let C=fc(o,l),x=Tx(e,C,M);if(!x)return!1;K(x,{markKeyboardNavigation:!0,markUserSelection:!0,suppressOpen:u.enterToOpenFiles});let z=n.get(x.path);return z!==void 0&&r(z,"auto"),!0},[o,n,e,r,K,l,u.enterToOpenFiles]),E=(0,sr.useCallback)((M,C,x,z)=>{if(C.button===1)return;y.current=!0;let H=z??e,Y=C.shiftKey,ee=sN(C),$=!i&&Dv(C,u.multiSelectModifier),j=!i&&!$&&u.multiSelectModifier==="optionAlt"&ⅇ$?h(M,x,H):!i&&Y&&x!==void 0?b(M,x,H):K(M,{markUserSelection:!0,suppressOpen:j}),m({type:"SET_FOCUSED_PANE",pane:"files"}),!$&&!Y&&j&&Q(()=>no({app:o,commandQueue:a,file:M,context:"tab"})),i&&o.workspace.leftSplit&&!$&&!Y&&o.workspace.leftSplit.collapse()},[o,a,h,b,i,e,K,u.multiSelectModifier,m]),R=(0,sr.useCallback)((M,C,x,z)=>{E(M,x,C,z)},[E]);return(0,sr.useEffect)(()=>{l.selectedFile&&(I.current=l.selectedFile.path)},[l.selectedFile]),(0,sr.useEffect)(()=>{let{selectedFile:M}=l,C=l.isRevealOperation,x=l.isFolderChangeWithAutoSelect,z=l.isKeyboardNavigation;if(C||z){z&&c({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!1});return}let H=x&&F.current,Y=!1,ee=!1;f&&u.autoSelectFirstFileOnFocusChange&&!i&&x&&(Y=A({openInEditor:!0,clearIfEmpty:!0,debounceOpen:H}).selectionStateChanged,ee=!0),!ee&&!Y&&M&&!y.current&&u.autoSelectFirstFileOnFocusChange&&!i&&x&&!u.enterToOpenFiles&&(H?G(M):s(M)),x&&(Y||c({type:"SET_FOLDER_CHANGE_WITH_AUTO_SELECT",isFolderChangeWithAutoSelect:!1}),F.current=!1),y.current=!1},[A,i,f,s,G,c,l,u.autoSelectFirstFileOnFocusChange,u.enterToOpenFiles]),(0,sr.useEffect)(()=>{if(!(p.singlePane||i)&&p.focusedPane==="files"&&l.isKeyboardNavigation){c({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!1});let M=l.selectedFile,C=!M,x=M?!e.some(H=>H.path===M.path):!1;if((C||x)&&e.length>0){let H=o.workspace.getActiveFile(),Y=H?e.some(ee=>ee.path===H.path):!1;H&&Y?c({type:"SET_SELECTED_FILE",file:H}):A({openInEditor:!0})}}},[o.workspace,A,i,e,c,l.isKeyboardNavigation,l.selectedFile,p.focusedPane,p.singlePane]),{selectFileFromList:K,selectAdjacentFile:_,ensureSelectionForCurrentFilter:A,handleFileItemClick:R,lastSelectedFilePath:I.current,isFileSelected:v,scheduleKeyboardSelectionOpen:X,scheduleKeyboardSelectionOpenForFile:L,commitPendingKeyboardSelectionOpen:V}}var sr,ree,aee=U(()=>{sr=ue(ze()),ree=require("obsidian");Ur();mn();on();pa();Tr();Jb();mR();jr();ot();os();td();Zc();ai()});var YF,iee=U(()=>{YF="empty-list"});function $e(t,e){return t.onClick(()=>{Q(e)})}function Dl(t){if(typeof t.setSubmenu!="function")return null;if(t.setSubmenu.length>0){let e=new lS.Menu;try{return t.setSubmenu(e),e}catch{}}try{let e=t.setSubmenu();if(e instanceof lS.Menu)return e}catch{}try{let e=new lS.Menu;return t.setSubmenu(e),e}catch{return null}}function OR(t){if(typeof lS.MenuItem.prototype.setSubmenu!="function")return!1;let e=!1;return t.menu.addItem(n=>{let r=Dl(n);if(!r){n.setTitle(d.contextMenu.copyPath.title).setIcon("lucide-copy").setDisabled(!0);return}n.setTitle(d.contextMenu.copyPath.title).setIcon("lucide-copy"),e=!0,t.getObsidianUrl&&r.addItem(o=>{$e(o.setTitle(d.contextMenu.copyPath.asObsidianUrl).setIcon("lucide-link"),async()=>{let a=t.getObsidianUrl?.();a&&await aV(a)&&de(d.fileSystem.notifications.deepLinkCopied,{variant:"success"})})}),r.addItem(o=>{$e(o.setTitle(d.contextMenu.copyPath.fromVaultFolder).setIcon("vault"),async()=>{let a=t.getVaultPath();await aV(a)&&de(d.fileSystem.notifications.relativePathCopied,{variant:"success"})})}),t.getSystemPath&&r.addItem(o=>{$e(o.setTitle(d.contextMenu.copyPath.fromSystemRoot).setIcon("lucide-hard-drive"),async()=>{let a=t.getSystemPath?.();a&&await aV(a)&&de(d.fileSystem.notifications.pathCopied,{variant:"success"})})})}),e}async function aV(t){try{return await navigator.clipboard.writeText(t),!0}catch{return de(d.common.clipboardWriteError,{variant:"warning"}),!1}}var lS,wu=U(()=>{lS=require("obsidian");Ee();Fn();ot()});function ake(t,e){if(!t)return e;if(Zo(t)||Po(t)||Co(t)||la(t)){let n=t.alias;if(n&&n.length>0)return n}return Bi(t)?t.name:e}function Tu(t){let{app:e,menu:n,shortcutKey:r,defaultLabel:o,existingShortcut:a,title:i,placeholder:s,renameShortcut:l,closeOnSubmit:c}=t;n.addItem(u=>{$e(u.setTitle(i).setIcon("lucide-pencil"),async()=>{let p=ake(a,o),{InputModal:m}=await Promise.resolve().then(()=>(fh(),LA)),g=null;g=new m(e,i,s,async f=>{let h=await l(r,f,o);c===!1&&(h||f.trim()===p.trim())&&g?.close()},p,{closeOnSubmit:c}),g.open()})})}var dS=U(()=>{Ia();wu()});function $F(t){return!!(t.icon||t.color||t.background)}function lee(t){$F(t)&&(see={data:t})}function iV(){return see}var see,dee=U(()=>{see=null});var uee,ike,cee,cS,Ff,LR,pee=U(()=>{uee=require("obsidian");Ee();Ha();FI();wL();KT();jr();ot();Ql();ike=5,cee=50,cS="all",Ff="vault",LR=class t{constructor(e){this.iconService=yn();this.currentProvider=cS;this.selectedIconForRecent=null;this.providerTabs=[];this.providerLinkContainer=null;this.providerLinkEl=null;this.searchDebounceTimer=null;this.domDisposers=[];this.app=e.app,this.rootEl=e.rootEl,this.scope=e.scope,this.settingsProvider=e.settingsProvider,this.currentIcon=e.currentIconId??void 0,this.saveRecentOnSelect=e.saveRecentOnSelect!==!1,this.isKeyboardActive=e.isKeyboardActive??(()=>!0),this.onSelect=e.onSelect}static{this.lastUsedProvider=null}static getLastUsedProvider(){return t.lastUsedProvider}static setLastUsedProvider(e){t.lastUsedProvider=e}build(){this.cleanupVaultRecentIcons(),this.createProviderTabs(),this.createSearchInput(),this.resultsContainer=this.rootEl.createDiv("nn-icon-results-container"),this.domDisposers.push(St(this.resultsContainer,"click",e=>this.handleResultsClick(e))),this.createProviderLinkRow(),this.updateProviderLink(this.currentProvider),this.setupKeyboardNavigation(),this.updateResults()}focusSearch(){this.searchInput.focus(),window.requestAnimationFrame(()=>{this.searchInput.focus()})}getIcon(){return this.currentIcon??null}clearSelection(){this.currentIcon=void 0,this.selectedIconForRecent=null,this.resultsContainer&&this.updateResults()}commitRecentIcon(){this.selectedIconForRecent&&(this.saveToRecentIcons(this.selectedIconForRecent),this.selectedIconForRecent=null)}dispose(){this.searchDebounceTimer&&(window.clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=null),this.providerLinkContainer=null,this.providerLinkEl=null,this.domDisposers.forEach(e=>{try{e()}catch(n){console.error("Error disposing icon picker surface listener:",n)}}),this.domDisposers=[]}async handleResultsClick(e){let n=e.target;if(!(n instanceof Element))return;let r=n.closest(".nn-icon-recent-remove-button");if(r){e.stopPropagation(),e.preventDefault();let i=r.getAttribute("data-recent-icon-id");i&&this.removeRecentIcon(i);return}let o=n.closest(".nn-icon-item");if(!o)return;let a=o.getAttribute("data-icon-id");a&&await this.selectIcon(a)}createProviderTabs(){this.tabContainer=this.rootEl.createDiv("nn-icon-provider-tabs"),this.tabContainer.setAttribute("role","tablist"),this.providerTabs=[];let e=this.sortProvidersForDisplay(this.iconService.getAllProviders().slice()),n=this.resolveInitialProvider(e);this.currentProvider=n,t.setLastUsedProvider(n),this.addProviderTab(cS,d.modals.iconPicker.allTabLabel),e.forEach(r=>{this.addProviderTab(r.id,r.name)}),this.setActiveProviderTab(n)}addProviderTab(e,n){let r=this.tabContainer.createDiv({cls:"nn-icon-provider-tab",text:n});r.setAttribute("role","tab"),r.setAttribute("tabindex","-1"),r.dataset.providerId=e,this.providerTabs.push(r),this.domDisposers.push(St(r,"click",()=>{this.setActiveProviderTab(e),this.currentProvider=e,t.setLastUsedProvider(e),this.updateResults(),this.resetResultsScroll()}))}createSearchInput(){let e=this.rootEl.createDiv("nn-icon-search-container");this.searchInput=e.createEl("input",{type:"text",placeholder:d.modals.iconPicker.searchPlaceholder,cls:"nn-icon-search-input"}),this.searchInput.setAttribute("enterkeyhint","done"),this.domDisposers.push(St(this.searchInput,"input",()=>{this.searchDebounceTimer&&window.clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=window.setTimeout(()=>{this.updateResults()},Lt.DEBOUNCE_KEYBOARD)}))}createProviderLinkRow(){this.providerLinkContainer=this.rootEl.createDiv("nn-icon-provider-link-row"),this.providerLinkEl=this.providerLinkContainer.createEl("a",{cls:"nn-icon-provider-link"}),this.providerLinkEl.setAttribute("target","_blank"),this.providerLinkEl.setAttribute("rel","noopener noreferrer"),this.providerLinkContainer.addClass("nn-icon-provider-link-row-hidden")}sortProvidersForDisplay(e){let n=[Ff,"emoji","lucide"];return e.sort((r,o)=>{let a=n.indexOf(r.id),i=n.indexOf(o.id);return a!==-1&&i!==-1?a-i:a!==-1?-1:i!==-1?1:r.name.localeCompare(o.name)})}cleanupVaultRecentIcons(){let e=this.settingsProvider.getRecentIcons(),n=e[Ff],r=Array.isArray(n)?n:[],o=n!==void 0&&!Array.isArray(n);if(r.length===0&&!o)return;if(o){delete e[Ff],this.settingsProvider.setRecentIcons(e);return}let a=[],i=!1;r.forEach(s=>{if(typeof s!="string"){i=!0;return}let l=this.iconService.parseIconId(s);if(l.provider!==Ff){i=!0;return}let c=this.app.vault.getAbstractFileByPath(l.identifier);if(c instanceof uee.TFile&&dd(c)){a.push(s);return}i=!0}),i&&(a.length===0?delete e[Ff]:e[Ff]=a,this.settingsProvider.setRecentIcons(e))}resolveInitialProvider(e){if(!e.length)return cS;let n=new Set(e.map(o=>o.id)),r=[t.getLastUsedProvider(),this.currentProvider];for(let o of r)if(o&&(o===cS||n.has(o)))return o;return cS}searchAllProvidersExcludingVault(e){let n=[];return this.iconService.getAllProviders().forEach(r=>{if(r.id===Ff)return;let o=r.search(e);n.push(...o.map(a=>({...a,id:this.iconService.formatIconId(r.id,a.id)})))}),n}updateResults(){this.resultsContainer.empty();let e=this.searchInput.value.toLowerCase().trim(),n=this.currentProvider===cS,r=n?void 0:this.iconService.getProvider(this.currentProvider);if(e===""){!n&&this.renderRecentIcons()||(this.currentProvider==="emoji"?this.resultsContainer.createDiv("nn-icon-empty-message").setText(d.modals.iconPicker.emojiInstructions):this.showEmptyState());return}let o=n?this.searchAllProvidersExcludingVault(e):this.iconService.search(e,this.currentProvider);if(o.length>0&&(n||r)){let a=this.resultsContainer.createDiv("nn-icon-grid");o.slice(0,cee).forEach(i=>{this.createIconItem(i,a,r)}),o.length>cee&&this.resultsContainer.createDiv("nn-icon-more-message").setText(d.modals.iconPicker.showingResultsInfo.replace("{count}",o.length.toString()));return}this.showEmptyState(!0)}renderRecentIcons(){let n=this.settingsProvider.getRecentIcons()[this.currentProvider]||[];if(!n.length)return!1;let r=this.resultsContainer.createDiv("nn-icon-section-header");r.setText(d.modals.iconPicker.recentlyUsedHeader);let o=this.resultsContainer.createDiv("nn-icon-grid"),a=0,i=new Map;return n.forEach(s=>{let l=this.iconService.parseIconId(s),c=this.iconService.getProvider(l.provider);if(!c)return;if(c.id==="emoji"){let g={id:l.identifier,displayName:kI(l.identifier),preview:l.identifier},f=this.createIconItem(g,o,c);f&&this.addRecentIconRemoveButton(f,s),a+=1;return}let u=i.get(c.id);u||(u=c.getAll(),i.set(c.id,u));let p=u.find(g=>g.id===l.identifier);if(!p)return;let m=this.createIconItem(p,o,c);m&&this.addRecentIconRemoveButton(m,s),a+=1}),a===0?(r.remove(),o.remove(),!1):!0}addRecentIconRemoveButton(e,n){e.createEl("button",{cls:"nn-icon-recent-remove-button",attr:{type:"button","aria-label":d.modals.iconPicker.removeFromRecents,title:d.modals.iconPicker.removeFromRecents,"data-recent-icon-id":n}}).createSpan({text:"×",cls:"nn-icon-recent-remove-glyph",attr:{"aria-hidden":"true"}})}removeRecentIcon(e){let r=this.iconService.parseIconId(e).provider,o=this.settingsProvider.getRecentIcons(),a=o[r];if(a!==void 0&&!Array.isArray(a)){delete o[r],this.settingsProvider.setRecentIcons(o),this.updateResults();return}let s=Array.isArray(a)?a:[],l=s.indexOf(e);if(l<0)return;let c=[...s];c.splice(l,1),c.length===0?delete o[r]:o[r]=c,this.settingsProvider.setRecentIcons(o),this.updateResults()}resetResultsScroll(){this.resultsContainer.scrollTop=0}showEmptyState(e=!1){this.resultsContainer.createDiv("nn-icon-empty-message").setText(e?d.modals.iconPicker.emptyStateNoResults:d.modals.iconPicker.emptyStateSearch)}createIconItem(e,n,r){let o=r,a;if(o)a=this.iconService.formatIconId(o.id,e.id);else{let c=this.iconService.parseIconId(e.id);if(o=this.iconService.getProvider(c.provider),!o)return null;a=e.id}let i=n.createDiv("nn-icon-item");i.setAttribute("data-icon-id",a),i.toggleClass("nn-icon-item-selected",a===this.currentIcon);let s=i.createDiv("nn-icon-item-preview");return this.iconService.renderIcon(s,a),o.id==="emoji"&&e.preview&&s.addClass("nn-emoji-preview"),i.createDiv("nn-icon-item-name").setText(e.displayName),i.setAttribute("tabindex","0"),i}saveToRecentIcons(e){let r=this.iconService.parseIconId(e).provider,o=this.settingsProvider.getRecentIcons(),a=[...o[r]??[]],i=a.indexOf(e);i>-1&&a.splice(i,1),a.unshift(e),a.length>15&&(a.length=15),o[r]=a,this.settingsProvider.setRecentIcons(o)}async selectIcon(e){this.saveRecentOnSelect?this.saveToRecentIcons(e):this.selectedIconForRecent=e,this.currentIcon=e,await this.onSelect(e),this.updateResults()}setupKeyboardNavigation(){this.scope.register(["Shift"],"Tab",e=>{if(!this.isKeyboardActive())return;let n=activeDocument.activeElement instanceof HTMLElement?activeDocument.activeElement:null;if(n?.classList.contains("nn-icon-provider-tab")){e.preventDefault();return}e.preventDefault();let r=this.getActiveProviderTab();if(n?.classList.contains("nn-icon-item")){this.searchInput.focus();return}if(n===this.searchInput){r?.focus();return}this.searchInput.focus()}),this.scope.register([],"Tab",e=>{if(!this.isKeyboardActive())return;let n=activeDocument.activeElement,r=n instanceof HTMLElement?n:null;if(r?.classList.contains("nn-icon-provider-tab")){e.preventDefault(),this.searchInput.focus();return}if(!r?.classList.contains("nn-icon-item")){e.preventDefault();let a=this.resultsContainer.querySelector(".nn-icon-item");a&&a.focus()}}),this.scope.register([],"ArrowLeft",e=>this.handleArrowKey(e,-1,0)),this.scope.register([],"ArrowRight",e=>this.handleArrowKey(e,1,0)),this.scope.register([],"ArrowUp",e=>this.handleArrowKey(e,0,-1)),this.scope.register([],"ArrowDown",e=>this.handleArrowKey(e,0,1)),this.scope.register([],"Enter",e=>{if(!this.isKeyboardActive())return;let n=activeDocument.activeElement instanceof HTMLElement?activeDocument.activeElement:null;if(n===this.searchInput){e.preventDefault(),window.setTimeout(()=>{this.searchInput.blur()});return}if(n?.classList.contains("nn-icon-item")){e.preventDefault();let r=n.getAttribute("data-icon-id");r&&Q(()=>this.selectIcon(r))}})}handleArrowKey(e,n,r){if(!this.isKeyboardActive())return;let o=activeDocument.activeElement;if(!(o instanceof HTMLElement))return;let a=o;if(a.classList.contains("nn-icon-provider-tab")){if(n===0)return;e.preventDefault(),this.focusAdjacentTab(a,n);return}if(!a.classList.contains("nn-icon-item"))return;e.preventDefault();let i=Array.from(this.resultsContainer.querySelectorAll(".nn-icon-item")),s=i.indexOf(a),l=n!==0?s+n:s+r*ike;l>=0&&l=this.providerTabs.length)return;let a=this.providerTabs[o],i=a.dataset.providerId;i&&(this.setActiveProviderTab(i),a.focus(),a.click())}ensureIconVisible(e){let n=this.resultsContainer,r=n.getBoundingClientRect(),o=e.getBoundingClientRect(),a=8;o.topr.bottom-a&&(n.scrollTop+=o.bottom-r.bottom+a)}setActiveProviderTab(e){this.providerTabs.forEach(n=>{n.dataset.providerId===e?(n.addClass("nn-active"),n.setAttribute("tabindex","0")):(n.removeClass("nn-active"),n.setAttribute("tabindex","-1"))}),this.updateProviderLink(e)}updateProviderLink(e){if(!this.providerLinkContainer||!this.providerLinkEl)return;let n=CI(e);if(!n){this.providerLinkContainer.addClass("nn-icon-provider-link-row-hidden"),this.providerLinkEl.removeAttribute("href"),this.providerLinkEl.setText(""),this.providerLinkEl.removeAttribute("title");return}this.providerLinkContainer.removeClass("nn-icon-provider-link-row-hidden"),this.providerLinkEl.setAttribute("href",n),this.providerLinkEl.setAttribute("title",n);let r=this.iconService.getProvider(e);this.providerLinkEl.setText(this.buildProviderLinkLabel(r,n))}formatCatalogLinkText(e){let n=e.trim();return n?n.replace(/^https?:\/\//,"").replace(/\/$/,""):""}buildProviderLinkLabel(e,n){let r=this.resolveProviderVersion(e),o=this.formatCatalogLinkText(n);return r?`${r}, ${o}`:o}resolveProviderVersion(e){if(!e||typeof e.getVersion!="function")return null;let n=e.getVersion();if(!n)return null;let r=n.trim();return r?/^v/i.test(r)?r:`v${r}`:null}getActiveProviderTab(){return this.providerTabs.find(e=>e.dataset.providerId===this.currentProvider)??null}}});var uS={};In(uS,{AppearanceModal:()=>sV});var zR,sV,pS=U(()=>{zR=require("obsidian");Ee();Ha();Ql();uL();pee();sV=class extends zR.Modal{constructor(n,r){super(n);this.iconService=yn();this.tabs=[];this.activeTabId=null;this.domDisposers=[];this.clearButton=null;this.iconSurface=null;this.colorSurface=null;this.backgroundSurface=null;this.resetButton=null;this.iconTouched=!1;this.colorTouched=!1;this.backgroundTouched=!1;this.params=r,this.stagedIcon=r.icon?.initial??null,this.stagedColor=r.color?.initial??null,this.stagedBackground=r.background?.initial??null,this.colorSharedState=cp.createSharedState(r.metadataService.getSettingsProvider())}onOpen(){let{contentEl:n}=this;n.empty(),this.modalEl.addClass("nn-appearance-modal");let r=n.createDiv("nn-appearance-header");this.previewItem=r.createDiv("nn-appearance-preview-item"),this.previewIconEl=this.previewItem.createSpan("nn-appearance-preview-icon"),this.previewItem.createSpan({cls:"nn-appearance-preview-name",text:this.params.title}),this.clearButton=this.previewItem.createEl("button",{cls:"nn-recent-remove-button nn-appearance-clear-button",attr:{type:"button","aria-label":d.modals.appearance.clear,title:d.modals.appearance.clear}}),this.clearButton.createSpan({text:"×",cls:"nn-recent-remove-glyph",attr:{"aria-hidden":"true"}}),this.domDisposers.push(St(this.clearButton,"click",()=>this.clearAll()));let o=n.createDiv("nn-appearance-tabs");o.setAttribute("role","tablist");let a=n.createDiv("nn-appearance-body");this.params.icon&&this.addIconTab(o,a),this.params.color&&this.addColorTab(o,a,"color"),this.params.background&&this.addColorTab(o,a,"background");let i=n.createDiv("nn-appearance-footer");this.resetButton=i.createEl("button",{cls:"nn-appearance-reset-button"}),this.domDisposers.push(St(this.resetButton,"click",()=>this.resetActiveTab()));let s=i.createDiv("nn-appearance-footer-actions"),l=s.createEl("button",{text:d.common.cancel});this.domDisposers.push(St(l,"click",()=>this.close()));let c=s.createEl("button",{text:d.modals.appearance.apply,cls:"mod-cta"});if(this.domDisposers.push(St(c,"click",()=>this.applyAll())),this.tabs.length>0){let u=this.params.initialTab&&this.tabs.some(p=>p.id===this.params.initialTab)?this.params.initialTab:this.tabs[0].id;this.setActiveTab(u)}this.renderState()}onClose(){let{contentEl:n}=this;this.iconSurface?.dispose(),this.colorSurface?.dispose(),this.backgroundSurface?.dispose(),this.iconSurface=null,this.colorSurface=null,this.backgroundSurface=null,this.resetButton=null,this.clearButton=null,this.tabs=[],this.activeTabId=null,this.domDisposers.forEach(r=>{try{r()}catch(o){console.error("Error disposing appearance modal listener:",o)}}),this.domDisposers=[],n.empty(),this.modalEl.removeClass("nn-appearance-modal")}addIconTab(n,r){let o=this.createTab(n,r,"icon",d.modals.appearance.tabIcon,a=>this.mountIconTab(a));this.tabs.push(o)}addColorTab(n,r,o){let a=o==="color"?d.modals.appearance.tabColor:d.modals.appearance.tabBackground,i=this.createTab(n,r,o,a,s=>this.mountColorTab(s,o));this.tabs.push(i)}createTab(n,r,o,a,i){let s=n.createEl("button",{cls:"nn-appearance-tab",attr:{type:"button",role:"tab"}}),l=s.createSpan("nn-appearance-tab-chip");s.createSpan({cls:"nn-appearance-tab-label",text:a});let c=r.createDiv("nn-appearance-panel nn-appearance-panel-hidden");c.setAttribute("role","tabpanel");let u={id:o,button:s,chip:l,panel:c,mounted:!1,mount:()=>i(c)};return this.domDisposers.push(St(s,"click",()=>this.setActiveTab(o))),u}mountIconTab(n){let r=n.createDiv("nn-appearance-picker-host");this.iconSurface=new LR({app:this.app,rootEl:r,scope:this.scope,settingsProvider:this.params.metadataService.getSettingsProvider(),currentIconId:this.stagedIcon,saveRecentOnSelect:!1,isKeyboardActive:()=>this.activeTabId==="icon",onSelect:o=>{this.iconTouched=!0,this.stagedIcon=o,this.renderState()}}),this.iconSurface.build(),this.iconSurface.focusSearch()}mountColorTab(n,r){let o=n.createDiv("nn-appearance-picker-host"),a=new cp({app:this.app,rootEl:o,scope:this.scope,initialColor:r==="color"?this.stagedColor:this.stagedBackground,settingsProvider:this.params.metadataService.getSettingsProvider(),sharedState:this.colorSharedState,showPreview:!1,recentInLeftColumn:!0,onChange:i=>{r==="color"?(this.colorTouched=!0,this.stagedColor=i):(this.backgroundTouched=!0,this.stagedBackground=i),this.renderState()}});a.build(),r==="color"?(this.colorSurface=a,this.colorTouched&&this.stagedColor===null&&a.markCleared()):(this.backgroundSurface=a,this.backgroundTouched&&this.stagedBackground===null&&a.markCleared())}setActiveTab(n){this.activeTabId=n,this.tabs.forEach(r=>{let o=r.id===n;r.button.toggleClass("nn-active",o),r.button.setAttribute("aria-selected",o?"true":"false"),r.panel.toggleClass("nn-appearance-panel-hidden",!o),o&&!r.mounted&&(r.mounted=!0,r.mount())}),this.renderResetButton()}renderState(){this.renderPreview(),this.renderTabChips(),this.renderResetButton(),this.renderClearButton()}clearAll(){this.params.icon&&(this.iconTouched=!0,this.stagedIcon=null,this.iconSurface?.clearSelection()),this.params.color&&(this.colorTouched=!0,this.stagedColor=null,this.colorSurface?.markCleared()),this.params.background&&(this.backgroundTouched=!0,this.stagedBackground=null,this.backgroundSurface?.markCleared()),this.renderState()}resetActiveTab(){switch(this.activeTabId){case"icon":this.iconTouched=!0,this.stagedIcon=null,this.iconSurface?.clearSelection();break;case"color":this.colorTouched=!0,this.stagedColor=null,this.colorSurface?.markCleared();break;case"background":this.backgroundTouched=!0,this.stagedBackground=null,this.backgroundSurface?.markCleared();break}this.renderState()}renderPreview(){this.previewIconEl.empty(),this.stagedIcon?(this.iconService.renderIcon(this.previewIconEl,this.stagedIcon),this.previewIconEl.removeClass("nn-appearance-preview-icon-empty")):this.previewIconEl.addClass("nn-appearance-preview-icon-empty"),this.stagedColor?this.previewItem.style.setProperty("--nn-preview-fg",this.stagedColor):this.previewItem.style.removeProperty("--nn-preview-fg"),this.stagedBackground?this.previewItem.style.setProperty("--nn-preview-bg",this.stagedBackground):this.previewItem.style.removeProperty("--nn-preview-bg")}renderTabChips(){this.tabs.forEach(n=>{if(n.chip.empty(),n.chip.removeClass("nn-appearance-tab-chip-empty"),n.chip.removeClass("nn-appearance-tab-color-chip"),n.chip.removeClass("nn-checkerboard"),n.chip.removeClass("nn-color-swatch"),n.chip.style.removeProperty("--nn-color-swatch-color"),n.id==="icon"){this.renderIconChip(n.chip);return}let r=n.id==="color"?this.stagedColor:this.stagedBackground;this.renderColorChip(n.chip,r)})}renderIconChip(n){if(n.addClass("nn-appearance-tab-icon-chip"),this.stagedIcon){this.iconService.renderIcon(n,this.stagedIcon);return}n.addClass("nn-appearance-tab-chip-empty"),(0,zR.setIcon)(n,"lucide-image")}renderColorChip(n,r){if(n.addClass("nn-appearance-tab-color-chip"),n.addClass("nn-checkerboard"),!r){n.addClass("nn-appearance-tab-chip-empty");return}n.addClass("nn-color-swatch"),n.style.setProperty("--nn-color-swatch-color",r)}renderResetButton(){if(!this.resetButton)return;let n="",r=!1;switch(this.activeTabId){case"icon":n=d.modals.appearance.resetIcon,r=this.iconTouched&&this.stagedIcon===null;break;case"color":n=d.modals.appearance.resetColor,r=this.colorTouched&&this.stagedColor===null;break;case"background":n=d.modals.appearance.resetBackground,r=this.backgroundTouched&&this.stagedBackground===null;break}this.resetButton.setText(n),this.resetButton.toggleClass("nn-appearance-reset-active",r)}renderClearButton(){if(!this.clearButton)return;let n=this.stagedIcon!==null||this.stagedColor!==null||this.stagedBackground!==null;this.clearButton.toggleClass("nn-appearance-clear-hidden",!n)}async applyAll(){this.params.icon&&this.hasChanged(this.params.icon.initial,this.stagedIcon,this.iconTouched)&&(this.stagedIcon&&this.iconSurface?.commitRecentIcon(),await this.params.icon.apply(this.stagedIcon)),this.params.color&&this.hasChanged(this.params.color.initial,this.stagedColor,this.colorTouched)&&(this.stagedColor&&this.colorSurface?.commitRecentColor(),await this.params.color.apply(this.stagedColor)),this.params.background&&this.hasChanged(this.params.background.initial,this.stagedBackground,this.backgroundTouched)&&(this.stagedBackground&&this.backgroundSurface?.commitRecentColor(),await this.params.background.apply(this.stagedBackground)),this.colorSurface?.persistCustomColors(),this.backgroundSurface?.persistCustomColors(),this.close()}hasChanged(n,r,o){return o&&(n??null)!==(r??null)}}});function BR(t){let{menu:e,app:n,metadataService:r,folderPath:o,showFolderIcons:a}=t,i=o.split("/").pop()||o,s=async l=>{let{AppearanceModal:c}=await Promise.resolve().then(()=>(pS(),uS));new c(n,{title:i,metadataService:r,initialTab:l,icon:a?{initial:r.getFolderIcon(o)??null,apply:async p=>{if(p===null){await r.removeFolderIcon(o);return}await r.setFolderIcon(o,p)}}:void 0,color:{initial:r.getFolderColor(o)??null,apply:async p=>{if(p===null){await r.removeFolderColor(o);return}await r.setFolderColor(o,p)}},background:{initial:r.getFolderBackgroundColor(o)??null,apply:async p=>{if(p===null){await r.removeFolderBackgroundColor(o);return}await r.setFolderBackgroundColor(o,p)}}}).open()};a&&e.addItem(l=>{$e(l.setTitle(d.contextMenu.folder.changeIcon).setIcon("lucide-image"),()=>s("icon"))}),e.addItem(l=>{$e(l.setTitle(d.contextMenu.folder.changeColor).setIcon("lucide-palette"),()=>s("color"))}),e.addItem(l=>{$e(l.setTitle(d.contextMenu.folder.changeBackground).setIcon("lucide-paint-bucket"),()=>s("background"))})}function ske(t){let{metadataService:e,folderPath:n,inheritFolderColors:r}=t,o=e.getFolderDisplayData(n,{includeDisplayName:!1,includeColor:!0,includeBackgroundColor:!0,includeIcon:!0,includeInheritedColors:!1}),a=r&&!o.color,i=r&&!o.backgroundColor,s=a||i?e.getFolderDisplayData(n,{includeDisplayName:!1,includeColor:a,includeBackgroundColor:i,includeIcon:!1,includeInheritedColors:!0}):null,l=!!o.icon,c=!!o.color,u=!!o.backgroundColor,p=Number(l)+Number(c)+Number(u);return{styleData:{icon:o.icon,color:o.color??s?.color,background:o.backgroundColor??s?.backgroundColor},hasRemovableIcon:l,hasRemovableColor:c,hasRemovableBackground:u,hasRemovableStyle:l||c||u,showClearAction:p>=2}}function _R(t){let{menu:e,metadataService:n,folderPath:r,inheritFolderColors:o,showFolderIcons:a}=t,i=ske({metadataService:n,folderPath:r,inheritFolderColors:o});Hp({menu:e,styleData:i.styleData,hasIcon:a,hasColor:!0,hasBackground:!0,showClearAction:i.showClearAction,applyStyle:async s=>{let{icon:l,color:c,background:u}=s;await n.setFolderStyle(r,{icon:l??void 0,color:c??void 0,backgroundColor:u??void 0})},removeIcon:i.hasRemovableIcon?async()=>n.removeFolderIcon(r):void 0,removeColor:i.hasRemovableColor?async()=>n.removeFolderColor(r):void 0,removeBackground:i.hasRemovableBackground?async()=>n.removeFolderBackgroundColor(r):void 0,clearStyle:i.hasRemovableStyle?async()=>n.setFolderStyle(r,{icon:null,color:null,backgroundColor:null}):void 0})}function Hp(t){if(typeof mee.MenuItem.prototype.setSubmenu!="function")return;let e=!!t.hasIcon,n=!!t.hasColor,r=!!t.hasBackground,a=iV()?.data,i=!!(e&&a?.icon||n&&a?.color||r&&a?.background),s=!!(t.removeIcon&&e),l=!!(t.removeColor&&n),c=!!(t.removeBackground&&r),u=Number(s)+Number(l)+Number(c),p=!!t.clearStyle||u>0,m=$F(t.styleData),g=!!(t.applyStyle&&i),f=u>0,h=(t.showIndividualRemovers??!0)&&f,b=t.showClearAction??(!!t.clearStyle||u>=2);!m&&!g&&!p||t.menu.addItem(v=>{let y=Dl(v);if(!y){v.setTitle(d.contextMenu.style.title).setIcon("lucide-brush").setDisabled(!0);return}v.setTitle(d.contextMenu.style.title).setIcon("lucide-brush"),m&&y.addItem(S=>{$e(S.setTitle(d.contextMenu.style.copy).setIcon("lucide-copy"),async()=>{lee(t.styleData)})}),g&&y.addItem(S=>{$e(S.setTitle(d.contextMenu.style.paste).setIcon("lucide-clipboard-check"),async()=>{let w=iV();if(!w||!$F(w.data)||!t.applyStyle)return;let k={icon:e?w.data.icon:void 0,color:n?w.data.color:void 0,background:r?w.data.background:void 0};$F(k)&&await t.applyStyle(k)})}),h&&s&&y.addItem(S=>{$e(S.setTitle(d.contextMenu.style.removeIcon).setIcon("lucide-image-off"),async()=>{await t.removeIcon?.()})}),h&&l&&y.addItem(S=>{$e(S.setTitle(d.contextMenu.style.removeColor).setIcon("lucide-palette"),async()=>{await t.removeColor?.()})}),h&&c&&y.addItem(S=>{$e(S.setTitle(d.contextMenu.style.removeBackground).setIcon("lucide-paint-bucket"),async()=>{await t.removeBackground?.()})}),b&&p&&y.addItem(S=>{$e(S.setTitle(d.contextMenu.style.clear).setIcon("lucide-eraser"),async()=>{if(t.clearStyle){await t.clearStyle();return}let w=[];s&&t.removeIcon&&w.push(t.removeIcon()),l&&t.removeColor&&w.push(t.removeColor()),c&&t.removeBackground&&w.push(t.removeBackground()),await Promise.all(w)})})})}var mee,mS=U(()=>{mee=require("obsidian");Ee();wu();dee()});function lV(t,e){let{folder:n,menu:r,services:o,state:a,dispatchers:i,settings:s}=t,{app:l,fileSystemOps:c,metadataService:u,plugin:p}=o,{selectionState:m,expandedFolders:g}=a,{selectionDispatch:f,expansionDispatch:h,uiDispatch:b}=i,v=e??_s({app:l,metadataService:u,settings:s,folderPath:n.path,fallbackName:n.name}),y=()=>m.selectionType===W.FOLDER&&m.selectedFolder&&m.selectedFolder.path===n.path?!1:(f({type:"SET_SELECTED_FOLDER",folder:n}),!0),S=I=>{I&&(f({type:"SET_SELECTED_FILE",file:I}),b({type:"SET_FOCUSED_PANE",pane:"files"}))};r.addItem(I=>{$e(I.setTitle(d.contextMenu.folder.newNote).setIcon("lucide-pen-box"),async()=>{let N=y(),O=await c.getManualSortNewFileContextForTarget("folder",n.path,{waitForSelectionUpdate:N}),K=await c.createNewFile(n,t.settings.createNewNotesInNewTab,O);S(K)})});let w=ty(l);w&&r.addItem(I=>{$e(I.setTitle(d.contextMenu.folder.newNoteFromTemplate).setIcon("templater-icon"),()=>(y(),w(n)))}),r.addItem(I=>{$e(I.setTitle(d.contextMenu.folder.newFolder).setIcon("lucide-folder-plus"),async()=>{y(),await c.createNewFolder(n,()=>{if(!g.has(n.path)){let N=s.collapseOtherBranchesOnExpand?[...Dp(n),n.path]:[n.path];ys({type:"folder",ids:N,collapseOtherBranches:s.collapseOtherBranchesOnExpand,dispatch:h})}})})}),r.addItem(I=>{$e(I.setTitle(d.contextMenu.folder.newCanvas).setIcon("lucide-layout-grid"),async()=>{y();let N=await c.createCanvas(n);S(N)})}),nh(l,"bases")?.enabled&&r.addItem(I=>{$e(I.setTitle(d.contextMenu.folder.newBase).setIcon("lucide-database"),async()=>{y();let N=await c.createBase(n);S(N)})});let F=ev(l,Ih),P=ev(l,xh),T=F&&P;if(F&&r.addItem(I=>{let N=T?d.contextMenu.folder.newExcalidrawDrawing:d.contextMenu.folder.newDrawing;$e(I.setTitle(N).setIcon("excalidraw-icon"),async()=>{y();let O=await c.createNewDrawing(n,"excalidraw");S(O)})}),P&&r.addItem(I=>{let N=T?d.contextMenu.folder.newTldrawDrawing:d.contextMenu.folder.newDrawing;$e(I.setTitle(N).setIcon("lucide-pencil"),async()=>{y();let O=await c.createNewDrawing(n,"tldraw");S(O)})}),s.enableFolderNotes){let I=Pn(n,s),N=!!I,O=!I;(N||O)&&r.addSeparator(),I?(r.addItem(K=>{$e(K.setTitle(d.contextMenu.folder.detachFolderNote).setIcon("lucide-unlink"),async()=>{await c.renameFile(I)})}),r.addItem(K=>{$e(K.setTitle(d.contextMenu.folder.deleteFolderNote).setIcon("lucide-trash").setWarning(!0),async()=>{await c.deleteFile(I,s.confirmBeforeDelete)})})):O&&r.addItem(K=>{$e(K.setTitle(d.contextMenu.folder.createFolderNote).setIcon("lucide-pen-box"),async()=>{y();let G=await q2(l,n,{folderNoteType:s.folderNoteType,folderNoteName:s.folderNoteName,folderNoteNamePattern:s.folderNoteNamePattern,folderNoteTemplate:s.folderNoteTemplate},o.commandQueue,{folderDisplayName:v,openContext:s.folderNoteOpenLocation==="right-sidebar"?"right-sidebar":null,openInRightSidebar:X=>p.openFolderNoteInRightSidebar(X)});if(S(G),G&&s.pinCreatedFolderNote)try{u.isFilePinned(G.path,"folder")||await u.togglePin(G.path,"folder")}catch(X){console.error("Failed to pin created folder note",{path:G.path,error:X})}})})}}function XF(t){let{folder:e,menu:n,services:r,settings:o,state:a,dispatchers:i,options:s}=t,{app:l,fileSystemOps:c,metadataService:u,plugin:p}=r,{selectionState:m,expandedFolders:g}=a,{selectionDispatch:f,expansionDispatch:h}=i,b=_s({app:l,metadataService:u,settings:o,folderPath:e.path,fallbackName:e.name});r.isMobile&&n.addItem(T=>{T.setTitle(b).setIsLabel(!0)}),lV(t,b),n.addSeparator(),BR({menu:n,app:l,metadataService:u,folderPath:e.path,showFolderIcons:o.showFolderIcons}),_R({menu:n,metadataService:u,folderPath:e.path,inheritFolderColors:o.inheritFolderColors,showFolderIcons:o.showFolderIcons}),typeof Dg.MenuItem.prototype.setSubmenu=="function"&&(n.addSeparator(),n.addItem(T=>{let I=u.getFolderChildSortOrderOverride(e.path),N=I??o.folderSortOrder,O=I?N==="alpha-desc"?"lucide-sort-desc":"lucide-sort-asc":"lucide-sliders-horizontal",K=Dl(T);if(!K){T.setTitle(d.paneHeader.changeChildSortOrder).setIcon(O).setDisabled(!0);return}let G=o.folderSortOrder==="alpha-desc"?d.settings.items.folderSortOrder.options.alphaDesc:d.settings.items.folderSortOrder.options.alphaAsc;T.setTitle(d.paneHeader.changeChildSortOrder).setIcon(O),K.addItem(X=>{X.setTitle(`${d.folderAppearance.defaultLabel} (${G})`).setChecked(!I),$e(X,async()=>{await u.removeFolderChildSortOrderOverride(e.path),l.workspace.requestSaveLayout()})}),K.addSeparator(),K.addItem(X=>{X.setTitle(d.settings.items.folderSortOrder.options.alphaAsc).setChecked(I==="alpha-asc"),$e(X,async()=>{await u.setFolderChildSortOrderOverride(e.path,"alpha-asc"),l.workspace.requestSaveLayout()})}),K.addItem(X=>{X.setTitle(d.settings.items.folderSortOrder.options.alphaDesc).setChecked(I==="alpha-desc"),$e(X,async()=>{await u.setFolderChildSortOrderOverride(e.path,"alpha-desc"),l.workspace.requestSaveLayout()})})}));let v={type:"folder",path:e.path},y=u.hasNavigationSeparator(v),S=!!s?.disableNavigationSeparatorActions;if(n.addSeparator(),r.shortcuts){let{folderShortcutKeysByPath:T,addFolderShortcut:I,removeShortcut:N,renameShortcut:O,shortcutMap:K}=r.shortcuts,G=T.get(e.path);if(G){let X=K.get(G);Tu({app:l,menu:n,shortcutKey:G,defaultLabel:b,existingShortcut:X,title:d.shortcuts.rename,placeholder:d.searchInput.shortcutNamePlaceholder,renameShortcut:O})}n.addItem(X=>{G?$e(X.setTitle(d.shortcuts.remove).setIcon(Hr(o.interfaceIcons,"nav-shortcuts","lucide-star-off")),async()=>{await N(G)}):$e(X.setTitle(d.shortcuts.add).setIcon(Hr(o.interfaceIcons,"nav-shortcuts","lucide-star")),async()=>{await I(e.path)})})}S||n.addItem(T=>{let I=y?d.contextMenu.navigation.removeSeparator:d.contextMenu.navigation.addSeparator;$e(T.setTitle(I).setIcon("lucide-separator-horizontal"),async()=>{if(y){await u.removeNavigationSeparator(v);return}await u.addNavigationSeparator(v)})}),n.addSeparator(),n.addItem(T=>{T.setTitle(d.contextMenu.folder.searchInFolder).setIcon("lucide-search").onClick(()=>{let I=nh(l,"global-search");I?.instance&&I.instance.openGlobalSearch(`path:"${e.path}"`)})}),e.path==="/"&&n.addItem(T=>{T.setTitle(d.commands.navigateToFolder).setIcon("lucide-folder").onClick(()=>{Rc(l,`${p.manifest.id}:navigate-to-folder`)})}),n.addSeparator();let w=l.vault.adapter,k=w instanceof Dg.FileSystemAdapter?w:null;if(OR({menu:n,getVaultPath:()=>e.path,getSystemPath:k?()=>k.getFullPath(e.path):void 0})&&n.addSeparator(),r.isMobile||(n.addItem(T=>{$e(T.setTitle(c.getRevealInSystemExplorerText()).setIcon(Dg.Platform.isMacOS?"lucide-app-window-mac":"lucide-app-window"),async()=>{await c.revealInSystemExplorer(e)})}),n.addSeparator()),(r.plugin.api?.[Ea].menus.applyFolderMenuExtensions({menu:n,folder:e})??0)>0&&n.addSeparator(),e.path!=="/"){let T=nn(r.plugin.settings),I=T.hiddenFolders,N=ei(e,I),O=Me(_i(e.path)),K=I.find(G=>{let X=zj(G);return!!(X&&Me(X.normalizedPrefix)===O)});K?n.addItem(G=>{$e(G.setTitle(d.contextMenu.folder.unhideFolder).setIcon("lucide-eye"),async()=>{let X=T.hiddenFolders;T.hiddenFolders=X.filter(L=>L!==K),await r.plugin.saveSettingsAndUpdate(),de(d.fileSystem.notices.showFolder.replace("{name}",b),{variant:"success"})})}):N||n.addItem(G=>{$e(G.setTitle(d.contextMenu.folder.excludeFolder).setIcon("lucide-eye-off"),async()=>{let X=T.hiddenFolders,L=e.path.startsWith("/")?e.path:`/${e.path}`,V=PN(X,L);T.hiddenFolders=V,await r.plugin.saveSettingsAndUpdate(),de(d.fileSystem.notices.hideFolder.replace("{name}",b),{variant:"success"})})})}n.addItem(T=>{$e(T.setTitle(d.contextMenu.folder.renameFolder).setIcon("lucide-pencil"),async()=>{if(e.path==="/"){let{InputModal:I}=await Promise.resolve().then(()=>(fh(),LA));new I(l,d.modals.fileSystem.renameVaultTitle,d.modals.fileSystem.renameVaultPrompt,O=>{Q(async()=>{r.plugin.settings.customVaultName=O,await r.plugin.saveSettingsAndUpdate()})},o.customVaultName).open()}else await c.renameFolder(e,o)})}),e.path!=="/"&&n.addItem(T=>{$e(T.setTitle(d.contextMenu.folder.moveFolder).setIcon("lucide-folder-input"),async()=>{let I=await c.moveFolderWithModal(e);if(I.status!=="success")return;let{oldPath:N,newPath:O,targetFolder:K}=I.data,G=l.vault.getAbstractFileByPath(O);if(!G||!(G instanceof Dg.TFolder))return;m.selectedFolder===e&&f({type:"SET_SELECTED_FOLDER",folder:G});let L=new Set,V=`${N}/`;g.forEach(A=>{if(A===N){L.add(O);return}if(A.startsWith(V)){let _=A.substring(V.length),E=_.length>0?`${O}/${_}`:O;L.add(E);return}L.add(A)});let D=K.path;D!=="/"&&!L.has(D)&&L.add(D),h({type:"SET_EXPANDED_FOLDERS",folders:L})})}),n.addItem(T=>{$e(T.setTitle(d.contextMenu.folder.duplicateFolder).setIcon("lucide-copy"),async()=>{await c.duplicateFolder(e)})}),e.path!=="/"&&n.addItem(T=>{$e(T.setTitle(d.contextMenu.folder.deleteFolder).setIcon("lucide-trash").setWarning(!0),async()=>{let I=e.parent;await c.deleteFolder(e,o.confirmBeforeDelete,()=>{if(m.selectedFolder){let N=e.path===m.selectedFolder.path,O=kU(e,m.selectedFolder);(N||O)&&(I&&(I.path!=="/"||o.showRootFolder)?f({type:"SET_SELECTED_FOLDER",folder:I}):f({type:"SET_SELECTED_FOLDER",folder:null}))}})})})}var Dg,dV=U(()=>{Dg=require("obsidian");Ee();Fn();Zr();Jc();Yr();Ue();ot();wu();dS();pr();dn();Ot();PT();mS();Xc();Vm();eg();hu()});function QF(t){let{tagPath:e,menu:n,services:r,settings:o,state:a,dispatchers:i,options:s}=t,{app:l,metadataService:c,plugin:u,fileSystemOps:p,isMobile:m}=r,{selectionState:g}=a,{selectionDispatch:f,uiDispatch:h}=i;m&&(n.addItem(R=>{let M=Vs(e)?rc(e).getLabel():`#${e}`;R.setTitle(M).setIsLabel(!0)}),n.addSeparator());let b=e===bt||e===zt,v=()=>g.selectionType===W.TAG&&g.selectedTag===e?!1:(f({type:"SET_SELECTED_TAG",tag:e}),!0),y=R=>{R&&(f({type:"SET_SELECTED_FILE",file:R}),h({type:"SET_FOCUSED_PANE",pane:"files"}))};b||(n.addItem(R=>{$e(R.setTitle(d.contextMenu.folder.newNote).setIcon("lucide-pen-box"),async()=>{let M=v(),C=g.selectedFile?.path??l.workspace.getActiveFile()?.path??"",x=Ze(e),z=x?await p.getManualSortNewFileContextForTarget("tag",x,{waitForSelectionUpdate:M}):null,H=await p.createNewFileForTag(e,C,o.createNewNotesInNewTab,z);y(H)})}),n.addSeparator());let S=async R=>{let{AppearanceModal:M}=await Promise.resolve().then(()=>(pS(),uS));new M(l,{title:`#${e}`,metadataService:c,initialTab:R,icon:o.showTagIcons?{initial:c.getTagIcon(e)??null,apply:async x=>{if(x===null){await c.removeTagIcon(e);return}await c.setTagIcon(e,x)}}:void 0,color:{initial:c.getTagColor(e)??null,apply:async x=>{if(x===null){await c.removeTagColor(e);return}await c.setTagColor(e,x)}},background:{initial:c.getTagBackgroundColor(e)??null,apply:async x=>{if(x===null){await c.removeTagBackgroundColor(e);return}await c.setTagBackgroundColor(e,x)}}}).open()};o.showTagIcons&&n.addItem(R=>{$e(R.setTitle(d.contextMenu.tag.changeIcon).setIcon("lucide-image"),()=>S("icon"))}),n.addItem(R=>{$e(R.setTitle(d.contextMenu.tag.changeColor).setIcon("lucide-palette"),()=>S("color"))}),n.addItem(R=>{$e(R.setTitle(d.contextMenu.tag.changeBackground).setIcon("lucide-paint-bucket"),()=>S("background"))});let w=c.getTagIcon(e),k=c.getTagColorData(e),F=k.color,P=k.background,T=Ze(e),I=T?o.tagColors?.[T]:void 0,N=T?o.tagBackgroundColors?.[T]:void 0,O=!!w,K=!!I,G=!!N;Hp({menu:n,styleData:{icon:w,color:F,background:P},hasIcon:o.showTagIcons,hasColor:!0,hasBackground:!0,applyStyle:async R=>{let{icon:M,color:C,background:x}=R,z=[];M&&z.push(c.setTagIcon(e,M)),C&&z.push(c.setTagColor(e,C)),x&&z.push(c.setTagBackgroundColor(e,x)),await Promise.all(z)},removeIcon:O?async()=>c.removeTagIcon(e):void 0,removeColor:K?async()=>c.removeTagColor(e):void 0,removeBackground:G?async()=>c.removeTagBackgroundColor(e):void 0}),typeof gee.MenuItem.prototype.setSubmenu=="function"&&(n.addSeparator(),n.addItem(R=>{let M=c.getTagChildSortOrderOverride(e),C=M??o.tagSortOrder,x=M?C.endsWith("-desc")?"lucide-sort-desc":"lucide-sort-asc":"lucide-sliders-horizontal",z=Dl(R);if(!z){R.setTitle(d.paneHeader.changeChildSortOrder).setIcon(x).setDisabled(!0);return}let H=(()=>{switch(o.tagSortOrder){case"alpha-desc":return d.settings.items.tagSortOrder.options.alphaDesc;case"frequency-asc":return d.settings.items.tagSortOrder.options.lowToHigh;case"frequency-desc":return d.settings.items.tagSortOrder.options.highToLow;default:return d.settings.items.tagSortOrder.options.alphaAsc}})();R.setTitle(d.paneHeader.changeChildSortOrder).setIcon(x),z.addItem(Y=>{Y.setTitle(`${d.folderAppearance.defaultLabel} (${H})`).setChecked(!M),$e(Y,async()=>{await c.removeTagChildSortOrderOverride(e),l.workspace.requestSaveLayout()})}),z.addSeparator(),z.addItem(Y=>{Y.setTitle(d.settings.items.tagSortOrder.options.alphaAsc).setChecked(M==="alpha-asc"),$e(Y,async()=>{await c.setTagChildSortOrderOverride(e,"alpha-asc"),l.workspace.requestSaveLayout()})}),z.addItem(Y=>{Y.setTitle(d.settings.items.tagSortOrder.options.alphaDesc).setChecked(M==="alpha-desc"),$e(Y,async()=>{await c.setTagChildSortOrderOverride(e,"alpha-desc"),l.workspace.requestSaveLayout()})})}));let X=!!s?.disableNavigationSeparatorActions;if((r.shortcuts||!X)&&n.addSeparator(),r.shortcuts){let{tagShortcutKeysByPath:R,addTagShortcut:M,removeShortcut:C,renameShortcut:x,shortcutMap:z}=r.shortcuts,H=Ze(e),Y=H?R.get(H):void 0;if(Y){let ee=z.get(Y),$=Vs(e)?rc(e).getLabel():rx(e,r.tagTreeService);Tu({app:l,menu:n,shortcutKey:Y,defaultLabel:$,existingShortcut:ee,title:d.shortcuts.rename,placeholder:d.searchInput.shortcutNamePlaceholder,renameShortcut:x})}n.addItem(ee=>{Y?$e(ee.setTitle(d.shortcuts.remove).setIcon(Hr(o.interfaceIcons,"nav-shortcuts","lucide-star-off")),async()=>{await C(Y)}):$e(ee.setTitle(d.shortcuts.add).setIcon(Hr(o.interfaceIcons,"nav-shortcuts","lucide-star")),async()=>{await M(e)})})}if(!X){let R={type:"tag",path:e},M=c.hasNavigationSeparator(R);n.addItem(C=>{let x=M?d.contextMenu.navigation.removeSeparator:d.contextMenu.navigation.addSeparator;$e(C.setTitle(x).setIcon("lucide-separator-horizontal"),async()=>{if(M){await c.removeNavigationSeparator(R);return}await c.addNavigationSeparator(R)})})}let V=e!==bt,D=nn(u.settings),A=VN(u.settings),_=V||!b,E=r.plugin.api?.[Ea].menus.applyTagMenuExtensions({menu:n,tag:T??e})??0;if(E>0&&_&&n.addSeparator(),V||!b){if(E===0&&n.addSeparator(),V){let R=Fm(A),M=R.pathPatterns.length>0||R.prefixes.length>0||R.startsWithNames.length>0||R.endsWithNames.length>0,C=e.split("/").pop()??e,x=M&&ss(e,C,R),z=Ze(e),H=z!==null&&A.some(Y=>{let ee=Ze(Y);return ee!==null&&!ee.includes("*")&&ee===z});x?H&&z&&n.addItem(Y=>{$e(Y.setTitle(d.contextMenu.tag.showTag).setIcon("lucide-eye"),async()=>{D.hiddenTags=A.filter(ee=>{let $=Ze(ee);return!($&&!$.includes("*")&&$===z)}),await u.saveSettingsAndUpdate()})}):n.addItem(Y=>{$e(Y.setTitle(d.contextMenu.tag.hideTag).setIcon("lucide-eye-off"),async()=>{let ee=_W(A,e);D.hiddenTags=ee,await u.saveSettingsAndUpdate()})})}b||(n.addItem(R=>{$e(R.setTitle(d.modals.tagOperation.confirmRename).setIcon("lucide-pencil"),async()=>{await r.tagOperations.promptRenameTag(e)})}),n.addItem(R=>{$e(R.setTitle(d.modals.tagOperation.confirmDelete).setIcon("lucide-trash").setWarning(!0),async()=>{await r.tagOperations.promptDeleteTag(e)})}))}}var gee,hee=U(()=>{gee=require("obsidian");Ee();Dr();Ue();Sn();wu();dS();mS();pr();Jm();dn();tk();eg()});function lke(t){let{propertyNodeId:e,propertyNodeName:n,keyNodeName:r}=t,o=kn(e);if(!o)return n??e;if(!o.valuePath)return n??o.key;let a=r??o.key,i=n??o.valuePath;return`${a} = ${i}`}function fee(t){let{app:e,menu:n,settings:r,shortcuts:o,nodeId:a,label:i}=t,{addPropertyShortcut:s,propertyShortcutKeysByNodeId:l,removeShortcut:c,renameShortcut:u,shortcutMap:p}=o,m=l.get(a);if(m){let g=p.get(m);Tu({app:e,menu:n,shortcutKey:m,defaultLabel:i,existingShortcut:g,title:d.shortcuts.rename,placeholder:d.searchInput.shortcutNamePlaceholder,renameShortcut:u})}n.addItem(g=>{if(m){$e(g.setTitle(d.shortcuts.remove).setIcon(Hr(r.interfaceIcons,"nav-shortcuts","lucide-star-off")),async()=>{await c(m)});return}$e(g.setTitle(d.shortcuts.add).setIcon(Hr(r.interfaceIcons,"nav-shortcuts","lucide-star")),async()=>{await s(a)})})}function ZF(t){let{propertyNodeId:e,menu:n,services:r,settings:o,state:a,dispatchers:i,options:s}=t,{app:l,metadataService:c,propertyOperations:u,propertyTreeService:p,fileSystemOps:m,isMobile:g}=r,{selectionState:f}=a,{selectionDispatch:h,uiDispatch:b}=i;if(e===Oe){let E=d.navigationPane.properties;g&&(n.addItem(M=>{M.setTitle(E).setIsLabel(!0)}),n.addSeparator()),(r.plugin.api?.[Ea].menus.applyPropertyMenuExtensions({menu:n,nodeId:Oe})??0)>0&&r.shortcuts&&n.addSeparator(),r.shortcuts&&fee({app:l,menu:n,settings:o,shortcuts:r.shortcuts,nodeId:Oe,label:E});return}let v=Gt(e);if(!v)return;let y=p?.findNode(v),S=y?.kind==="key"?y.key:null,w=y?.kind==="key"?y:y?p?.getKeyNode(y.key):null,k=lke({propertyNodeId:v,propertyNodeName:y?.name,keyNodeName:w?.name});g&&(n.addItem(E=>{E.setTitle(k).setIsLabel(!0)}),n.addSeparator());let F=()=>f.selectionType===W.PROPERTY&&f.selectedProperty===v?!1:(h({type:"SET_SELECTED_PROPERTY",nodeId:v}),!0),P=E=>{E&&(h({type:"SET_SELECTED_FILE",file:E}),b({type:"SET_FOCUSED_PANE",pane:"files"}))};n.addItem(E=>{$e(E.setTitle(d.contextMenu.folder.newNote).setIcon("lucide-pen-box"),async()=>{let R=F(),M=f.selectedFile?.path??l.workspace.getActiveFile()?.path??"",C=await m.getManualSortNewFileContextForTarget("property",v,{waitForSelectionUpdate:R}),x=await m.createNewFileForProperty(v,M,o.createNewNotesInNewTab,C);P(x)})}),n.addSeparator();let T=async E=>{let{AppearanceModal:R}=await Promise.resolve().then(()=>(pS(),uS));new R(l,{title:k,metadataService:c,initialTab:E,icon:o.showPropertyIcons?{initial:c.getPropertyIcon(v)??null,apply:async C=>{if(C===null){await c.removePropertyIcon(v);return}await c.setPropertyIcon(v,C)}}:void 0,color:{initial:c.getPropertyColor(v)??null,apply:async C=>{if(C===null){await c.removePropertyColor(v);return}await c.setPropertyColor(v,C)}},background:{initial:c.getPropertyBackgroundColor(v)??null,apply:async C=>{if(C===null){await c.removePropertyBackgroundColor(v);return}await c.setPropertyBackgroundColor(v,C)}}}).open()};o.showPropertyIcons&&n.addItem(E=>{$e(E.setTitle(d.contextMenu.tag.changeIcon).setIcon("lucide-image"),()=>T("icon"))}),n.addItem(E=>{$e(E.setTitle(d.contextMenu.tag.changeColor).setIcon("lucide-palette"),()=>T("color"))}),n.addItem(E=>{$e(E.setTitle(d.contextMenu.tag.changeBackground).setIcon("lucide-paint-bucket"),()=>T("background"))});let I=c.getPropertyIcon(v),N=c.getPropertyColorData(v),O=N.color,K=N.background,G=o.propertyIcons?.[v],X=o.propertyColors?.[v],L=o.propertyBackgroundColors?.[v];Hp({menu:n,styleData:{icon:I,color:O,background:K},hasIcon:o.showPropertyIcons,hasColor:!0,hasBackground:!0,applyStyle:async E=>{let{icon:R,color:M,background:C}=E,x=[];R&&x.push(c.setPropertyIcon(v,R)),M&&x.push(c.setPropertyColor(v,M)),C&&x.push(c.setPropertyBackgroundColor(v,C)),await Promise.all(x)},removeIcon:G?async()=>c.removePropertyIcon(v):void 0,removeColor:X?async()=>c.removePropertyColor(v):void 0,removeBackground:L?async()=>c.removePropertyBackgroundColor(v):void 0}),typeof vee.MenuItem.prototype.setSubmenu=="function"&&(n.addSeparator(),n.addItem(E=>{let R=c.getPropertyChildSortOrderOverride(v),M=R??o.propertySortOrder,C=R?M.endsWith("-desc")?"lucide-sort-desc":"lucide-sort-asc":"lucide-sliders-horizontal",x=Dl(E);if(!x){E.setTitle(d.paneHeader.changeChildSortOrder).setIcon(C).setDisabled(!0);return}let z=(()=>{switch(o.propertySortOrder){case"alpha-desc":return d.settings.items.propertySortOrder.options.alphaDesc;case"frequency-asc":return d.settings.items.propertySortOrder.options.lowToHigh;case"frequency-desc":return d.settings.items.propertySortOrder.options.highToLow;default:return d.settings.items.propertySortOrder.options.alphaAsc}})();E.setTitle(d.paneHeader.changeChildSortOrder).setIcon(C),x.addItem(H=>{H.setTitle(`${d.folderAppearance.defaultLabel} (${z})`).setChecked(!R),$e(H,async()=>{await c.removePropertyChildSortOrderOverride(v),l.workspace.requestSaveLayout()})}),x.addSeparator(),x.addItem(H=>{H.setTitle(d.settings.items.propertySortOrder.options.alphaAsc).setChecked(R==="alpha-asc"),$e(H,async()=>{await c.setPropertyChildSortOrderOverride(v,"alpha-asc"),l.workspace.requestSaveLayout()})}),x.addItem(H=>{H.setTitle(d.settings.items.propertySortOrder.options.alphaDesc).setChecked(R==="alpha-desc"),$e(H,async()=>{await c.setPropertyChildSortOrderOverride(v,"alpha-desc"),l.workspace.requestSaveLayout()})})}));let V=!!s?.disableNavigationSeparatorActions;if((r.shortcuts||!V)&&n.addSeparator(),r.shortcuts&&fee({app:l,menu:n,settings:o,shortcuts:r.shortcuts,nodeId:v,label:k}),!V){let E={type:"property",nodeId:v},R=c.hasNavigationSeparator(E);n.addItem(M=>{let C=R?d.contextMenu.navigation.removeSeparator:d.contextMenu.navigation.addSeparator;$e(M.setTitle(C).setIcon("lucide-separator-horizontal"),async()=>{if(R){await c.removeNavigationSeparator(E);return}await c.addNavigationSeparator(E)})})}let A=y?.kind==="key"&&y.notesWithValue.size>0,_=r.plugin.api?.[Ea].menus.applyPropertyMenuExtensions({menu:n,nodeId:v})??0;_>0&&A&&n.addSeparator(),S&&A&&(_===0&&n.addSeparator(),n.addItem(E=>{$e(E.setTitle(d.contextMenu.property.renameKey).setIcon("lucide-pencil"),async()=>{await u.promptRenamePropertyKey(S)})}),n.addItem(E=>{$e(E.setTitle(d.contextMenu.property.deleteKey).setIcon("lucide-trash").setWarning(!0),async()=>{await u.promptDeletePropertyKey(S)})}))}var vee,yee=U(()=>{vee=require("obsidian");Ee();Ue();wu();dS();mS();pr();cn();eg()});var uV={};In(uV,{ManualSortGroupHeaderModal:()=>cV});var gS,cV,pV=U(()=>{gS=require("obsidian");Ee();Ue();ot();Ha();wi();_T();cV=class extends gS.Modal{constructor(n,r,o,a){super(n);this.initialValue=r;this.onSubmit=o;this.options=a;this.headerInputEl=null;this.targetInputEl=null;this.iconPreviewEl=null;this.iconButtonTextEl=null;this.colorPreviewEl=null;this.colorButtonTextEl=null;this.showWordCount=!1;this.iconId=null;this.color=null;this.isSubmitting=!1;this.openIconPicker=()=>{Q(async()=>{let{IconPickerModal:n}=await Promise.resolve().then(()=>(RI(),MI)),r=new n(this.app,this.options.metadataService,"",W.FILE,{titleOverride:d.modals.manualSortGroupHeader.icon,currentIconId:this.iconId,disableMetadataUpdates:!0});r.onChooseIcon=async o=>(this.iconId=o,this.updateIconControls(),{handled:!0}),r.open()})};this.openColorPicker=()=>{new BT(this.app,{title:d.modals.manualSortGroupHeader.color,initialColor:this.color,settingsProvider:this.options.metadataService.getSettingsProvider(),onChooseColor:r=>{this.color=r,this.updateColorControls()}}).open()};this.filterTargetInput=()=>{this.targetInputEl&&(this.targetInputEl.value=this.targetInputEl.value.replace(/[^\d,]/g,""))};this.handleCancelClick=()=>{this.close()};this.handleSubmitClick=()=>{this.handleSubmit()};this.showWordCount=r?.showWordCount??!1,this.iconId=r?.iconId??null,this.color=r?.color??null}onOpen(){let{contentEl:n}=this;n.empty(),this.modalEl.addClass("nn-manual-sort-group-header-modal"),this.titleEl.setText(d.modals.manualSortGroupHeader.title),n.createDiv({cls:"nn-input-description nn-manual-sort-header-description",text:d.modals.manualSortGroupHeader.description});let o=this.createSection(n).createDiv({cls:"nn-manual-sort-header-field"});o.createDiv({cls:"nn-manual-sort-header-field-label",text:d.modals.manualSortGroupHeader.titleLabel}),this.headerInputEl=o.createEl("input",{cls:"nn-manual-sort-header-input"}),this.headerInputEl.type="text",this.headerInputEl.placeholder=d.modals.manualSortGroupHeader.placeholder,this.headerInputEl.value=this.initialValue?.title??"";let i=this.createSection(n).createDiv({cls:"nn-manual-sort-header-appearance-actions"}),l=i.createDiv({cls:"nn-manual-sort-header-action-row"}).createEl("button",{cls:"nn-manual-sort-header-style-button"});l.type="button",l.addEventListener("click",this.openIconPicker),this.iconPreviewEl=l.createSpan({cls:"nn-manual-sort-header-style-preview"}),this.iconButtonTextEl=l.createSpan({cls:"nn-manual-sort-header-style-text"}),this.updateIconControls();let u=i.createDiv({cls:"nn-manual-sort-header-action-row"}).createEl("button",{cls:"nn-manual-sort-header-style-button"});u.type="button",u.addEventListener("click",this.openColorPicker),this.colorPreviewEl=u.createSpan({cls:"nn-manual-sort-header-style-preview nn-color-swatch"}),this.colorButtonTextEl=u.createSpan({cls:"nn-manual-sort-header-style-text"}),this.updateColorControls();let p=this.createSection(n);new gS.Setting(p).setName(d.modals.manualSortGroupHeader.wordCount).addToggle(v=>v.setValue(this.showWordCount).onChange(y=>{this.showWordCount=y,!y&&this.targetInputEl&&(this.targetInputEl.value=""),this.updateWordCountTargetControl()})).settingEl.addClass("nn-manual-sort-header-toggle-setting");let g=p.createDiv({cls:"nn-manual-sort-header-field nn-manual-sort-header-target-field"});g.createDiv({cls:"nn-manual-sort-header-field-label",text:d.modals.manualSortGroupHeader.wordCountTarget}),this.targetInputEl=g.createEl("input",{cls:"nn-manual-sort-header-input"}),this.targetInputEl.type="text",this.targetInputEl.inputMode="numeric",this.targetInputEl.placeholder=d.modals.manualSortGroupHeader.wordCountTargetPlaceholder,this.targetInputEl.value=this.showWordCount?this.initialValue?.targetWordCount?.toString()??"":"",this.targetInputEl.addEventListener("input",this.filterTargetInput),g.createDiv({cls:"nn-input-description nn-manual-sort-header-target-description",text:d.modals.manualSortGroupHeader.wordCountTargetDescription}),this.updateWordCountTargetControl();let f=n.createDiv("nn-button-container");f.createEl("button",{text:d.common.cancel}).addEventListener("click",this.handleCancelClick),f.createEl("button",{text:d.common.save,cls:"mod-cta"}).addEventListener("click",this.handleSubmitClick),this.scope.register([],"Enter",v=>{let y=activeDocument.activeElement;!(y instanceof HTMLElement)||!this.contentEl.contains(y)||(v.preventDefault(),this.handleSubmit())}),this.headerInputEl?.focus(),this.initialValue?.title&&this.headerInputEl?.select()}onClose(){this.targetInputEl?.removeEventListener("input",this.filterTargetInput),this.modalEl.removeClass("nn-manual-sort-group-header-modal"),this.contentEl.empty()}createSection(n){return n.createDiv({cls:"nn-manual-sort-header-section"})}updateIconControls(){this.iconButtonTextEl&&this.iconButtonTextEl.setText(d.modals.manualSortGroupHeader.icon),this.iconPreviewEl&&(this.iconPreviewEl.empty(),this.iconPreviewEl.toggleClass("is-empty",!this.iconId),this.iconId?yn().renderIcon(this.iconPreviewEl,this.iconId,16):(0,gS.setIcon)(this.iconPreviewEl,"lucide-square-dashed"))}updateColorControls(){this.colorButtonTextEl&&this.colorButtonTextEl.setText(d.modals.manualSortGroupHeader.color),this.colorPreviewEl&&(this.colorPreviewEl.toggleClass("is-empty",!this.color),this.color?this.colorPreviewEl.style.setProperty("--nn-manual-sort-header-preview-color",this.color):this.colorPreviewEl.style.removeProperty("--nn-manual-sort-header-preview-color"))}updateWordCountTargetControl(){this.targetInputEl&&(this.targetInputEl.disabled=!this.showWordCount)}handleSubmit(){if(this.isSubmitting)return;let n=this.showWordCount?pI(this.targetInputEl?.value??""):null,r={title:this.headerInputEl?.value??"",showWordCount:this.showWordCount,targetWordCount:n,iconId:this.iconId,color:this.color};this.isSubmitting=!0,this.close(),Q(async()=>{try{await this.onSubmit(r)}finally{this.isSubmitting=!1}})}}});function dke(t){Tee={showWordCount:t.showWordCount,targetWordCount:t.showWordCount?t.targetWordCount:null,iconId:t.iconId,color:t.color}}function bee(){return Tee}function cke(t,e){return{title:t,showWordCount:e.showWordCount,targetWordCount:e.showWordCount?e.targetWordCount:null,iconId:e.iconId,color:e.color}}function See(t,e,n,r,o,a,i){t.addItem(s=>{$e(s.setTitle(a).setIcon("lucide-pencil"),async()=>{let{ManualSortGroupHeaderModal:l}=await Promise.resolve().then(()=>(pV(),uV));new l(e,i,async u=>{await OT(e,n,r,u)},{metadataService:o}).open()})})}async function uke(t,e,n,r,o){let{ManualSortGroupHeaderModal:a}=await Promise.resolve().then(()=>(pV(),uV));new a(t,{title:"",showWordCount:o.showWordCount,targetWordCount:o.showWordCount?o.targetWordCount:null,iconId:o.iconId,color:o.color},async s=>{await OT(t,e,n,s)},{metadataService:r}).open()}async function pke(t,e,n,r,o,a){if(!o){await uke(t,e,n,r,a);return}await OT(t,e,n,cke(o.title,a))}function wee(t,e,n,r,o,a){let i=bee();if(!a&&!i)return!1;let s=!1;return t.addItem(l=>{let c=Dl(l);if(!c){l.setTitle(d.contextMenu.file.manualSortGroupHeader.title).setIcon("lucide-heading").setDisabled(!0);return}l.setTitle(d.contextMenu.file.manualSortGroupHeader.title).setIcon("lucide-heading"),s=!0,a&&c.addItem(u=>{u.setTitle(d.contextMenu.file.manualSortGroupHeader.copyStyle).setIcon("lucide-copy").onClick(()=>{dke(a)})}),i&&c.addItem(u=>{$e(u.setTitle(d.contextMenu.file.manualSortGroupHeader.pasteStyle).setIcon("lucide-clipboard-check"),async()=>{let p=bee();p&&await pke(e,n,r,o,a,p)})}),a&&c.addItem(u=>{$e(u.setTitle(d.contextMenu.file.manualSortGroupHeader.remove).setIcon("lucide-eraser"),async()=>{await OT(e,n,r,"")})})}),s}function hS({menu:t,app:e,file:n,propertyKey:r,metadataService:o}){if(n.extension!=="md")return!1;let a=zm(e,n,r);return a?(See(t,e,n,r,o,d.contextMenu.file.changeManualSortGroupHeader,a),wee(t,e,n,r,o,a),!0):(See(t,e,n,r,o,d.contextMenu.file.setManualSortGroupHeader,a),wee(t,e,n,r,o,a),!0)}var Tee,HR=U(()=>{Ee();wi();wu();Tee=null});function VR({menu:t,app:e,commandQueue:n,fileSystemOps:r,files:o,outputFolder:a,defaultOutputName:i,title:s}){let l=zp(o);return l.length<2?!1:(t.addItem(c=>{$e(c.setTitle(s).setIcon("lucide-git-merge"),async()=>{await dR({app:e,commandQueue:n,fileSystemOps:r,files:l,outputFolder:a,defaultOutputName:i})})}),!0)}var mV=U(()=>{Xb();CH();wu()});function mke(t,e,n){let r=e.getPropertyIcon(n.nodeId),o=Kh(r);if(o)return o;let a=e.getPropertyIcon(n.keyNodeId),i=Kh(a);return i||Hr(t.interfaceIcons,"nav-property-value","lucide-equal")}function fS(t){let{file:e,menu:n,services:r,settings:o,state:a,dispatchers:i,options:s}=t,{app:l,isMobile:c,fileSystemOps:u,metadataService:p,tagTreeService:m,propertyTreeService:g,commandQueue:f,visibility:h}=r,{selectionState:b}=a,{selectionDispatch:v}=i;c&&n.addItem(L=>{L.setTitle(e.basename).setIsLabel(!0)});let S=b.selectedFiles.size>1,w=b.selectedFiles.has(e.path),k=e.extension==="md",F=S&&w,P=!F&&o.enableFolderNotes&&e.parent instanceof Ag.TFolder&&zs(e,e.parent,o),T=null,I=()=>T||(s?.orderedFiles?.some(L=>L.path===e.path||b.selectedFiles.has(L.path))?(T=[...s.orderedFiles],T):(T=ca({selectionType:b.selectionType,selectedFolder:b.selectedFolder,selectedTag:b.selectedTag,selectedProperty:b.selectedProperty},o,h,l,m,g),T)),N=F?fke(b.selectedFiles,l,s?.orderedFiles):[],O=N.length;F?Tke(n,N,l,c,f):wke(n,e,l,c,f),n.addSeparator();let K=hke({file:e,isFolderNoteFile:P,shouldShowMultiOptions:F,selectedFiles:N});vke({menu:n,app:l,metadataService:p,settings:o,file:e,styleTarget:K}),n.addSeparator(),gke({menu:n,app:l,metadataService:p,settings:o,file:e,source:s?.source,selectionState:b,shouldShowMultiOptions:F})&&n.addSeparator();let G=F?N:[e];if(G.length>0&&G.every(L=>L.extension==="md")){let L=r.tagOperations.getTagsFromFiles(G),V=L.length>0,D=L.length>1;n.addItem(_=>{$e(_.setTitle(d.contextMenu.file.addTag).setIcon("lucide-tag"),()=>{$b({app:l,plugin:r.plugin,tagOperations:r.tagOperations,files:G})})});let A=sR(o,g);A.length>0&&n.addItem(_=>{let E=Dl(_);if(_.setTitle(d.contextMenu.file.addPropertyKey).setIcon(Hr(o.interfaceIcons,"nav-property","lucide-align-left")),!E){_.setDisabled(!0);return}A.forEach(R=>{E.addItem(M=>{let C=M.setTitle(R.label);C.setIcon(mke(o,p,R)),$e(C,async()=>{await u.applyPropertyNodeToFiles(R.nodeId,G)})})})}),V&&(n.addItem(_=>{$e(_.setTitle(d.contextMenu.file.removeTag).setIcon("lucide-minus"),async()=>{await oR({app:l,tagOperations:r.tagOperations,files:G})})}),D&&n.addItem(_=>{$e(_.setTitle(d.contextMenu.file.removeAllTags).setIcon("lucide-x"),()=>{aR({app:l,tagOperations:r.tagOperations,files:G})})})),n.addSeparator()}if(!F){if(r.shortcuts){let{noteShortcutKeysByPath:V,addNoteShortcut:D,removeShortcut:A,renameShortcut:_,shortcutMap:E}=r.shortcuts,R=V.get(e.path);if(R){let M=E.get(R),C=tv(e)?`${bm(e)}${ah(e)}`:bm(e);Tu({app:l,menu:n,shortcutKey:R,defaultLabel:C,existingShortcut:M,title:d.shortcuts.rename,placeholder:d.searchInput.shortcutNamePlaceholder,renameShortcut:_})}n.addItem(M=>{R?$e(M.setTitle(d.shortcuts.remove).setIcon(Hr(o.interfaceIcons,"nav-shortcuts","lucide-star-off")),async()=>{await A(R)}):$e(M.setTitle(d.shortcuts.add).setIcon(Hr(o.interfaceIcons,"nav-shortcuts","lucide-star")),async()=>{await D(e.path)})})}let L=ik(b.selectionType);kke(n,e,p,L),n.addSeparator()}if(F){r.shortcuts&&Fke(n,N,b,l,o,r.shortcuts);let L=ik(b.selectionType);Pke(n,N,p,L),n.addSeparator(),(r.plugin.api?.[Ea].menus.applyFileMenuExtensions({menu:n,file:e,selection:{mode:"multiple",files:[...N]}})??0)>0&&n.addSeparator(),Cke(n,N,l,f,u);let D=N.every(A=>A.extension==="md");n.addItem(A=>{$e(A.setTitle(D?d.contextMenu.file.moveMultipleNotesToFolder.replace("{count}",O.toString()):d.contextMenu.file.moveMultipleFilesToFolder.replace("{count}",O.toString())).setIcon("lucide-folder-input"),async()=>{let _=Array.from(b.selectedFiles).map(E=>l.vault.getFileByPath(E)).filter(E=>!!E);await u.moveFilesWithModal(_,{selectedFile:b.selectedFile,dispatch:v,allFiles:I()})})}),Ike(n,N,b,l,u),Eke(n,N,b,o,u,v,I)}if(!F){let L=l.vault.adapter,V=L instanceof Ag.FileSystemAdapter?L:null;OR({menu:n,getObsidianUrl:()=>{let A=l.vault.getName(),_=encodeURIComponent(A),E=encodeURIComponent(e.path);return`obsidian://open?vault=${_}&file=${E}`},getVaultPath:()=>e.path,getSystemPath:V?()=>V.getFullPath(e.path):void 0})&&n.addSeparator()}if(!F){let V=!(b.selectedFolder&&e.parent&&e.parent.path===b.selectedFolder.path),D=!c;V&&n.addItem(A=>{$e(A.setTitle(d.contextMenu.file.revealInFolder).setIcon("lucide-folder-search"),async()=>{await r.plugin.activateView(),await r.plugin.revealFileInActualFolder(e,{showHiddenFileNotice:!0})})}),D&&(n.addItem(A=>{$e(A.setTitle(u.getRevealInSystemExplorerText()).setIcon(Ag.Platform.isMacOS?"lucide-app-window-mac":"lucide-app-window"),async()=>{await u.revealInSystemExplorer(e)})}),n.addItem(A=>{$e(A.setTitle(d.contextMenu.file.openInDefaultApp).setIcon("lucide-external-link"),async()=>{await u.openInDefaultApp(e)})})),(V||D)&&n.addSeparator()}if(F||(r.plugin.api?.[Ea].menus.applyFileMenuExtensions({menu:n,file:e,selection:{mode:"single",files:[e]}})??0)>0&&n.addSeparator(),!F){let L=nh(l,"sync");L&&"enabled"in L&&L.enabled&&n.addItem(V=>{$e(V.setTitle(d.contextMenu.file.openVersionHistory).setIcon("lucide-history"),async()=>{await u.openVersionHistory(e)})}),n.addItem(V=>{let D=P?d.contextMenu.folder.detachFolderNote:k?d.contextMenu.file.renameNote:d.contextMenu.file.renameFile,A=P?"lucide-unlink":"lucide-pencil";$e(V.setTitle(D).setIcon(A),async()=>{await u.renameFile(e)})}),n.addItem(V=>{$e(V.setTitle(k?d.contextMenu.file.moveNoteToFolder:d.contextMenu.file.moveFileToFolder).setIcon("lucide-folder-input"),async()=>{await u.moveFilesWithModal([e],{selectedFile:b.selectedFile,dispatch:v,allFiles:I()})})}),Nke(n,e,u),xke(n,e,b,o,u,v,P,I)}}function gke(t){let{menu:e,app:n,metadataService:r,settings:o,file:a,source:i,selectionState:s,shouldShowMultiOptions:l}=t,c=sd(o);if(i!=="list-pane"||l||a.extension!=="md"||!c)return!1;let u=Tm(o,s.selectionType,s.selectedFolder,s.selectedTag,s.selectedProperty),p=RR({settings:o,selectionType:s.selectionType,folderPath:s.selectedFolder?.path??null,tag:s.selectedTag??null,propertyNodeId:s.selectedProperty??null});return kf({groupBy:p.effectiveGrouping,sortOption:u.option,selectionType:s.selectionType,isManualSortActive:as(o,u.propertyKey)})!=="custom"?!1:hS({menu:e,app:n,file:a,propertyKey:c,metadataService:r})}function hke(t){let{file:e,isFolderNoteFile:n,shouldShowMultiOptions:r,selectedFiles:o}=t;return n&&e.parent instanceof Ag.TFolder?{type:"folder",folderPath:e.parent.path}:{type:"files",files:r?o:[e]}}function fke(t,e,n){let r=Array.from(t).map(o=>e.vault.getFileByPath(o)).filter(o=>o!==null);return wx(r,n)}function vke(t){let{menu:e,app:n,metadataService:r,settings:o,file:a,styleTarget:i}=t;if(i.type==="folder"){yke({menu:e,app:n,metadataService:r,settings:o,folderPath:i.folderPath});return}bke({menu:e,app:n,metadataService:r,settings:o,file:a,targetFiles:i.files})}function yke(t){let{menu:e,app:n,metadataService:r,settings:o,folderPath:a}=t;BR({menu:e,app:n,metadataService:r,folderPath:a,showFolderIcons:o.showFolderIcons}),_R({menu:e,metadataService:r,folderPath:a,inheritFolderColors:o.inheritFolderColors,showFolderIcons:o.showFolderIcons})}function bke(t){let{menu:e,app:n,metadataService:r,settings:o,file:a,targetFiles:i}=t,s=r.getFileIcon(a.path),l=r.getFileColor(a.path),c=r.getFileBackgroundColor(a.path),u=Ske(i,r),{hasRemovableIcon:p,hasRemovableColor:m,hasRemovableBackground:g}=u,f=async h=>{let{AppearanceModal:b}=await Promise.resolve().then(()=>(pS(),uS));new b(n,{title:a.basename,metadataService:r,initialTab:h,icon:o.showFileIcons?{initial:r.getFileIcon(a.path)??null,apply:async y=>{await Promise.all(i.map(S=>y===null?r.removeFileIcon(S.path):r.setFileIcon(S.path,y)))}}:void 0,color:{initial:r.getFileColor(a.path)??null,apply:async y=>{await Promise.all(i.map(S=>y===null?r.removeFileColor(S.path):r.setFileColor(S.path,y)))}},background:{initial:r.getFileBackgroundColor(a.path)??null,apply:async y=>{await Promise.all(i.map(S=>y===null?r.removeFileBackgroundColor(S.path):r.setFileBackgroundColor(S.path,y)))}}}).open()};o.showFileIcons&&e.addItem(h=>{$e(h.setTitle(d.contextMenu.file.changeIcon).setIcon("lucide-image"),()=>f("icon"))}),e.addItem(h=>{$e(h.setTitle(d.contextMenu.file.changeColor).setIcon("lucide-palette"),()=>f("color"))}),e.addItem(h=>{$e(h.setTitle(d.contextMenu.folder.changeBackground).setIcon("lucide-paint-bucket"),()=>f("background"))}),Hp({menu:e,styleData:{icon:s,color:l,background:c},hasIcon:o.showFileIcons,hasColor:!0,hasBackground:!0,applyStyle:async h=>{let{icon:b,color:v,background:y}=h,S=[];i.forEach(w=>{b&&S.push(r.setFileIcon(w.path,b)),v&&S.push(r.setFileColor(w.path,v)),y&&S.push(r.setFileBackgroundColor(w.path,y))}),await Promise.all(S)},removeIcon:p?async()=>{let h=i.filter(b=>r.getFileIcon(b.path)).map(b=>r.removeFileIcon(b.path));await Promise.all(h)}:void 0,removeColor:m?async()=>{let h=i.filter(b=>r.getFileColor(b.path)).map(b=>r.removeFileColor(b.path));await Promise.all(h)}:void 0,removeBackground:g?async()=>{let h=i.filter(b=>r.getFileBackgroundColor(b.path)).map(b=>r.removeFileBackgroundColor(b.path));await Promise.all(h)}:void 0})}function Ske(t,e){let n=!1,r=!1,o=!1;for(let a of t)if(!n&&e.getFileIcon(a.path)&&(n=!0),!r&&e.getFileColor(a.path)&&(r=!0),!o&&e.getFileBackgroundColor(a.path)&&(o=!0),n&&r&&o)break;return{hasRemovableIcon:n,hasRemovableColor:r,hasRemovableBackground:o}}function wke(t,e,n,r,o){t.addItem(a=>{$e(a.setTitle(d.contextMenu.file.openInNewTab).setIcon("lucide-file-plus"),async()=>{await no({app:n,commandQueue:o,file:e,context:"tab"})})}),t.addItem(a=>{$e(a.setTitle(d.contextMenu.file.openToRight).setIcon("lucide-separator-vertical"),async()=>{await no({app:n,commandQueue:o,file:e,context:"split"})})}),r||t.addItem(a=>{$e(a.setTitle(d.contextMenu.file.openInNewWindow).setIcon("lucide-external-link"),async()=>{await no({app:n,commandQueue:o,file:e,context:"window"})})})}function Tke(t,e,n,r,o){let a=e.length,i=e.every(s=>s.extension==="md");t.addItem(s=>{$e(s.setTitle(i?d.contextMenu.file.openMultipleInNewTabs.replace("{count}",a.toString()):d.contextMenu.file.openMultipleFilesInNewTabs.replace("{count}",a.toString())).setIcon("lucide-file-plus"),async()=>{for(let l of e)await no({app:n,commandQueue:o??null,file:l,context:"tab"})})}),t.addItem(s=>{$e(s.setTitle(i?d.contextMenu.file.openMultipleToRight.replace("{count}",a.toString()):d.contextMenu.file.openMultipleFilesToRight.replace("{count}",a.toString())).setIcon("lucide-separator-vertical"),async()=>{for(let l of e)await no({app:n,commandQueue:o??null,file:l,context:"split"})})}),r||t.addItem(s=>{$e(s.setTitle(i?d.contextMenu.file.openMultipleInNewWindows.replace("{count}",a.toString()):d.contextMenu.file.openMultipleFilesInNewWindows.replace("{count}",a.toString())).setIcon("lucide-external-link"),async()=>{for(let l of e)await no({app:n,commandQueue:o??null,file:l,context:"window"})})})}function kke(t,e,n,r){let o=n.isFilePinned(e.path,r);t.addItem(a=>{$e(a.setTitle(o?e.extension==="md"?d.contextMenu.file.unpinNote:d.contextMenu.file.unpinFile:e.extension==="md"?d.contextMenu.file.pinNote:d.contextMenu.file.pinFile).setIcon("lucide-pin"),async()=>{e.parent&&await n.togglePin(e.path,r)})})}function Fke(t,e,n,r,o,a){if(e.length===0)return;let l=(e.every(c=>c.extension==="md")?d.shortcuts.addNotesCount:d.shortcuts.addFilesCount).replace("{count}",e.length.toString());t.addItem(c=>{$e(c.setTitle(l).setIcon(Hr(o.interfaceIcons,"nav-shortcuts","lucide-star")),async()=>{let u=Array.from(n.selectedFiles).map(m=>r.vault.getFileByPath(m)).filter(m=>!!m);if(u.length===0)return;let p=u.map(m=>({type:Dn.NOTE,path:m.path}));await a.addShortcutsBatch(p)})})}function Pke(t,e,n,r){let o=e.some(s=>!n.isFilePinned(s.path,r)),a=e.every(s=>s.extension==="md"),i=e.length;t.addItem(s=>{$e(s.setTitle(o?a?d.contextMenu.file.pinMultipleNotes.replace("{count}",i.toString()):d.contextMenu.file.pinMultipleFiles.replace("{count}",i.toString()):a?d.contextMenu.file.unpinMultipleNotes.replace("{count}",i.toString()):d.contextMenu.file.unpinMultipleFiles.replace("{count}",i.toString())).setIcon("lucide-pin"),async()=>{for(let l of e)o?n.isFilePinned(l.path,r)||await n.togglePin(l.path,r):await n.togglePin(l.path,r)})})}function Cke(t,e,n,r,o){if(e.length<2||!e.every(s=>s.extension==="md"))return;let a=e[0],i=a.parent instanceof Ag.TFolder?a.parent:n.vault.getRoot();VR({menu:t,app:n,commandQueue:r,fileSystemOps:o,files:e,outputFolder:i,defaultOutputName:d.modals.mergeNotes.outputNamePlaceholder,title:d.contextMenu.file.mergeNotes.replace("{count}",e.length.toString())})}function Nke(t,e,n){t.addItem(r=>{$e(r.setTitle(e.extension==="md"?d.contextMenu.file.duplicateNote:d.contextMenu.file.duplicateFile).setIcon("lucide-copy"),async()=>{await n.duplicateNote(e)})})}function Ike(t,e,n,r,o){let a=e.every(s=>s.extension==="md"),i=e.length;t.addItem(s=>{$e(s.setTitle(a?d.contextMenu.file.duplicateMultipleNotes.replace("{count}",i.toString()):d.contextMenu.file.duplicateMultipleFiles.replace("{count}",i.toString())).setIcon("lucide-copy"),async()=>{let l=Array.from(n.selectedFiles).map(c=>r.vault.getFileByPath(c)).filter(c=>!!c);for(let c of l)await o.duplicateNote(c)})})}function xke(t,e,n,r,o,a,i,s){t.addItem(l=>{let c=i?d.contextMenu.folder.deleteFolderNote:e.extension==="md"?d.contextMenu.file.deleteNote:d.contextMenu.file.deleteFile;$e(l.setTitle(c).setIcon("lucide-trash").setWarning(!0),async()=>{n.selectedFile?.path===e.path?await o.deleteSelectedFile(e,r,{selectionType:n.selectionType,selectedFolder:n.selectedFolder||void 0,selectedTag:n.selectedTag||void 0,selectedProperty:n.selectedProperty??void 0},a,r.confirmBeforeDelete,s()):await o.deleteFile(e,r.confirmBeforeDelete)})})}function Eke(t,e,n,r,o,a,i){let s=e.every(c=>c.extension==="md"),l=e.length;t.addItem(c=>{$e(c.setTitle(s?d.contextMenu.file.deleteMultipleNotes.replace("{count}",l.toString()):d.contextMenu.file.deleteMultipleFiles.replace("{count}",l.toString())).setIcon("lucide-trash").setWarning(!0),async()=>{await o.deleteFilesWithSmartSelection(n.selectedFiles,i(),a,r.confirmBeforeDelete)})})}var Ag,kee=U(()=>{Ag=require("obsidian");Ee();Zr();rs();Mr();Ia();wu();dS();Zc();iR();mS();pr();_a();ai();TH();eg();wi();Rn();HR();mV();qF()});function gV(t){lV(t)}var Fee=U(()=>{dV()});function Mke(t){return t===Dt.SHORTCUTS?{uxIconId:"nav-shortcuts",title:d.navigationPane.shortcutsHeader}:t===Dt.RECENT?{uxIconId:"nav-recent-files",title:d.navigationPane.recentFilesHeader}:t===Dt.TAGS?{uxIconId:"nav-tags",title:d.tagList.tags}:t===Dt.PROPERTIES?{uxIconId:"nav-properties",title:d.navigationPane.properties}:null}function Rke(t){return t===Dt.SHORTCUTS?yi:t===Dt.RECENT?bi:t===Dt.TAGS?_n:t===Dt.PROPERTIES?Oe:null}function hV({app:t,event:e,sectionId:n,allowSeparator:r=!0,metadataService:o,settings:a,plugin:i,pinToggleLabel:s,isShortcutsPinned:l,onToggleShortcutsPin:c,onConfigurePropertyKeys:u,shortcutActions:p}){let m=n===Dt.SHORTCUTS,g=n===Dt.TAGS,f=n===Dt.PROPERTIES,h={type:"section",id:n},b=r?o.hasNavigationSeparator(h):!1,v=new Pee.Menu,y=!1,S=g?p.tagShortcutKeysByPath.get(zt):void 0,w=f?p.propertyShortcutKeysByNodeId.get(Oe):void 0,k=S??w;f&&(v.addItem(P=>{P.setTitle(d.contextMenu.property.addKey).setIcon("lucide-settings-2").onClick(()=>{u()})}),y=!0,v.addSeparator());let F=Rke(n);if(F){let P=o.getSettingsProvider(),T=Mke(n),I=P.settings.virtualFolderColors?.[F],N=P.settings.virtualFolderBackgroundColors?.[F],O=T?.title??"",K=(A,_,E)=>{let R=P.settings[A],M=ln(R,Ln);return E===null?Object.prototype.hasOwnProperty.call(M,_)?(delete M[_],P.settings[A]=M,!0):!1:Object.prototype.hasOwnProperty.call(M,_)&&M[_]===E?!1:(M[_]=E,P.settings[A]=M,!0)},G=async(A,_)=>{let E=!1;_.color!==void 0&&(E=K("virtualFolderColors",A,_.color)||E),_.background!==void 0&&(E=K("virtualFolderBackgroundColors",A,_.background)||E),E&&await P.saveSettingsAndUpdate()},X=async(A,_)=>{let E=De(P.settings.interfaceIcons,Ln),R=qn(Qe(void 0,A)),M=!1;if(!_)Object.prototype.hasOwnProperty.call(E,A)&&(delete E[A],M=!0);else{let C=qn(_),x=oi(C);!x||C===R?Object.prototype.hasOwnProperty.call(E,A)&&(delete E[A],M=!0):E[A]!==x&&(E[A]=x,M=!0)}M&&(P.settings.interfaceIcons=E,await P.saveSettingsAndUpdate())},L=async A=>{let{AppearanceModal:_}=await Promise.resolve().then(()=>(pS(),uS));new _(t,{title:O,metadataService:o,initialTab:A,icon:T?{initial:Qe(P.settings.interfaceIcons,T.uxIconId),apply:async R=>{await X(T.uxIconId,R)}}:void 0,color:{initial:I??null,apply:async R=>{await G(F,{color:R})}},background:{initial:N??null,apply:async R=>{await G(F,{background:R})}}}).open()};T&&v.addItem(A=>{A.setTitle(d.contextMenu.folder.changeIcon).setIcon("lucide-image").onClick(()=>{Q(()=>L("icon"))})}),v.addItem(A=>{A.setTitle(d.contextMenu.folder.changeColor).setIcon("lucide-palette").onClick(()=>{Q(()=>L("color"))})}),v.addItem(A=>{A.setTitle(d.contextMenu.folder.changeBackground).setIcon("lucide-paint-bucket").onClick(()=>{Q(()=>L("background"))})});let V=!!I,D=!!N;Hp({menu:v,styleData:{color:I,background:N},hasColor:!0,hasBackground:!0,applyStyle:async A=>{await G(F,{color:A.color??void 0,background:A.background??void 0})},removeColor:V?async()=>G(F,{color:null}):void 0,removeBackground:D?async()=>G(F,{background:null}):void 0,clearStyle:V&&D?async()=>G(F,{color:null,background:null}):void 0}),y=!0,v.addSeparator()}if((g||f)&&(v.addItem(P=>{if(k){P.setTitle(d.shortcuts.remove).setIcon(Hr(a.interfaceIcons,"nav-shortcuts","lucide-star-off")).onClick(()=>{Q(()=>p.removeShortcut(k))});return}P.setTitle(d.shortcuts.add).setIcon(Hr(a.interfaceIcons,"nav-shortcuts","lucide-star")).onClick(()=>{Q(async()=>{if(g){await p.addTagShortcut(zt);return}await p.addPropertyShortcut(Oe)})})}),y=!0),m){v.addItem(N=>{N.setTitle(s).setIcon(l?"lucide-pin-off":"lucide-pin").onClick(()=>{c()})}),y=!0;let P=r&&!l,T=p.shortcutsCount>0;(P||T)&&v.addSeparator(),P&&(v.addItem(N=>{N.setTitle(b?d.contextMenu.navigation.removeSeparator:d.contextMenu.navigation.addSeparator).setIcon("lucide-separator-horizontal").onClick(()=>{Q(async()=>{if(b){await o.removeNavigationSeparator(h);return}await o.addNavigationSeparator(h)})})}),y=!0),T&&(P&&v.addSeparator(),v.addItem(N=>{N.setTitle(d.shortcuts.removeAll).setIcon("lucide-trash-2").setWarning(!0).onClick(()=>{new En(t,d.shortcuts.removeAll,d.shortcuts.removeAllConfirm,()=>p.clearShortcuts(),d.common.remove).open()})}),y=!0)}else r&&(v.addItem(P=>{P.setTitle(b?d.contextMenu.navigation.removeSeparator:d.contextMenu.navigation.addSeparator).setIcon("lucide-separator-horizontal").onClick(()=>{Q(async()=>{if(b){await o.removeNavigationSeparator(h);return}await o.addNavigationSeparator(h)})})}),y=!0);if((g||f)&&(y&&v.addSeparator(),v.addItem(P=>{let T=g?d.settings.items.scopeTagsToCurrentContext.name:d.settings.items.scopePropertiesToCurrentContext.name,I=g?i.settings.scopeTagsToCurrentContext:i.settings.scopePropertiesToCurrentContext;P.setTitle(T).setIcon("lucide-filter").setChecked(I).onClick(()=>{Q(async()=>{g?i.settings.scopeTagsToCurrentContext=!i.settings.scopeTagsToCurrentContext:i.settings.scopePropertiesToCurrentContext=!i.settings.scopePropertiesToCurrentContext,await i.saveSettingsAndUpdate()})})}),y=!0),g||f){y&&v.addSeparator();let P=g?"navigate-to-tag":"navigate-to-property",T=g?d.commands.navigateToTag:d.commands.navigateToProperty,I=g?Hr(a.interfaceIcons,"nav-tag","lucide-hash"):Hr(a.interfaceIcons,"nav-property","lucide-list-filter");v.addItem(N=>{N.setTitle(T).setIcon(I).onClick(()=>{Rc(t,`${i.manifest.id}:${P}`)})}),y=!0}y&&(e.preventDefault(),e.stopPropagation(),v.showAtMouseEvent(e.nativeEvent))}var Pee,Cee=U(()=>{Pee=require("obsidian");Ai();Ue();Zr();Ot();pr();mS();Ee();Si();ot()});var JF=U(()=>{iee();dV();hee();yee();kee();Fee();Cee()});function fV(){vS&&(vS.hide(),vS=null)}function Og(t,e){let{app:n,plugin:r,isMobile:o,tagTreeService:a,propertyTreeService:i}=gt(),s=pt(),l=li(),c=Ho(),u=_b(),p=AM(),m=qs(),g=Td(),f=Xt(),h=f.includeDescendantNotes,b=f.showHiddenItems,v=ar(),{expandedFolders:y,expandedTags:S,expandedProperties:w}=ta(),k=gr(),F=Ra(),P=Vr(),[T,I]=(0,Pf.useState)(null),N=(0,Pf.useCallback)(O=>{if(!e||!t.current)return;let K=O.target;if(!(K instanceof Node)||!t.current.contains(K))return;let G=K.instanceOf(HTMLElement)?K:K.parentElement,X=t.current,L=e;if(L.type===YF){if(!G)return;let M=G.closest(".nn-file");if(M instanceof HTMLElement){let C=M.dataset.path,x=C?n.vault.getFileByPath(C):null;if(!(x instanceof yS.TFile))return;L={type:W.FILE,item:x,options:{source:"list-pane",orderedFiles:L.options?.orderedFiles}},X=M}}if(s.enableFolderNoteLinks&&L.type===W.FOLDER&&G?.closest(".nn-navitem-name")){let M=Pn(L.item,s);M&&(L={type:W.FILE,item:M})}let V=L.type===W.FILE,D=null;if(L.type===YF){let M=L.item;if(!(M instanceof yS.TFolder)||!G)return;let C=G.closest(".nn-file")!==null,x=G.closest(".nn-list-group-header")!==null;if(C||x)return;D=z=>{gV({folder:M,menu:z,services:_,settings:s,state:E,dispatchers:R})}}else L.type===W.FOLDER?D=M=>{XF({folder:L.item,menu:M,services:_,settings:s,state:E,dispatchers:R,options:L.options})}:L.type===W.TAG?D=M=>{QF({tagPath:L.item,menu:M,services:_,settings:s,state:E,dispatchers:R})}:L.type===W.PROPERTY?D=M=>{ZF({propertyNodeId:L.item,menu:M,services:_,settings:s,state:E,dispatchers:R})}:L.type===W.FILE&&(D=M=>{fS({file:L.item,menu:M,services:_,settings:s,state:E,dispatchers:R,options:L.options})});if(!D)return;O.preventDefault(),O.stopPropagation(),fV();let A=new yS.Menu;if(vS=A,X.classList.add("nn-context-menu-active"),V){let M=X.closest(".nn-virtual-file-item");if(M instanceof HTMLElement){M.classList.add("nn-hide-separator-context-menu");let C=M.previousElementSibling;C instanceof HTMLElement&&C.classList.contains("nn-virtual-file-item")&&C.classList.add("nn-hide-separator-context-menu")}}let _={app:n,plugin:r,isMobile:o,fileSystemOps:l,metadataService:c,tagOperations:u,propertyOperations:p,tagTreeService:a,propertyTreeService:i,commandQueue:m,shortcuts:g,visibility:{includeDescendantNotes:h,showHiddenItems:b}},E={selectionState:v,expandedFolders:y,expandedTags:S,expandedProperties:w},R={selectionDispatch:k,expansionDispatch:F,uiDispatch:P};D(A),A.showAtMouseEvent(O),A.onHide(()=>{if(vS===A&&(vS=null),X.classList.remove("nn-context-menu-active"),V){let M=X.closest(".nn-virtual-file-item");if(M instanceof HTMLElement){M.classList.remove("nn-hide-separator-context-menu");let C=M.previousElementSibling;C instanceof HTMLElement&&C.classList.contains("nn-virtual-file-item")&&C.classList.remove("nn-hide-separator-context-menu")}}})},[e,t,n,r,s,l,c,u,p,v,y,S,w,k,F,P,o,a,i,m,g,h,b]);(0,Pf.useEffect)(()=>{if(!e){T!==null&&I(null);return}let O=t.current;O!==T&&I(O)},[T,e,t]),(0,Pf.useEffect)(()=>{if(!(!e||!T))return T.addEventListener("contextmenu",N),()=>{T.removeEventListener("contextmenu",N)}},[T,N,e])}var Pf,yS,vS,eP=U(()=>{Pf=ue(ze()),yS=require("obsidian");Qs();Ur();mn();on();pa();xg();Tr();Ue();JF();_a();vS=null});function Qt({iconId:t,size:e,className:n,style:r,"data-has-color":o,"aria-label":a,"aria-hidden":i}){let s=(0,UR.useRef)(null),l=Ki();return(0,UR.useEffect)(()=>{s.current&&yn().renderIcon(s.current,t,e)},[t,l,e]),(0,Nee.jsx)("span",{ref:s,className:n,style:r,"data-has-color":o,"aria-label":a,"aria-hidden":i})}var UR,Nee,Al=U(()=>{UR=ue(ze());Ha();Nee=ue(Ge())});function xee({event:t,settings:e,selectedFolder:n,selectedTag:r,selectedProperty:o,selectionType:a,updateSettings:i,descendantAction:s,defaultSettingsAction:l}){let c=DR(e),p=a===W.TAG&&r?{key:r,getRecord:F=>F.tagAppearances,setRecord:(F,P)=>{F.tagAppearances=P}}:a===W.FOLDER&&n?{key:n.path,getRecord:F=>F.folderAppearances,setRecord:(F,P)=>{F.folderAppearances=P}}:a===W.PROPERTY&&o?{key:o,getRecord:F=>F.propertyAppearances,setRecord:(F,P)=>{F.propertyAppearances=P}}:null,m=F=>{let P=T=>{let I={...T};return Object.keys(I).forEach(N=>{I[N]===void 0&&delete I[N]}),I.mode===c&&delete I.mode,I};p&&Q(()=>i(T=>{let I=De(ln(p.getRecord(T))),N=I[p.key]||{},O=P({...N,...F});Object.keys(O).length===0?delete I[p.key]:I[p.key]=O,p.setRecord(T,I)}))},g=new Iee.Menu,f=p?p.getRecord(e)?.[p.key]:void 0,h=oV({appearance:f,defaultMode:c}),b=h==="standard",v=h==="compact",y=f?.mode,S=(y==="standard"||y==="compact")&&y!==c||f?.titleRows!==void 0||f?.previewRows!==void 0,w=(F,P)=>P?`${F} ${d.folderAppearance.defaultSuffix}`:F;g.addItem(F=>{F.setTitle(d.folderAppearance.appearance).setIcon("lucide-palette").setDisabled(!0)}),g.addItem(F=>{let P=w(d.folderAppearance.standardPreset,c==="standard");F.setTitle(P).setIcon("lucide-list").setChecked(b).onClick(()=>{m({mode:"standard"})})}),g.addItem(F=>{let P=w(d.folderAppearance.compactPreset,c==="compact");F.setTitle(P).setIcon("lucide-align-left").setChecked(v).onClick(()=>{m({mode:"compact",previewRows:void 0})})}),g.addSeparator(),g.addItem(F=>{F.setTitle(d.folderAppearance.titleRows).setIcon("lucide-text").setDisabled(!0)});let k=f?.titleRows??e.fileNameRows;if([1,2,3].forEach(F=>{let P=F===e.fileNameRows;g.addItem(T=>{T.setTitle(` ${w(d.folderAppearance.titleRowOption(F),P)}`).setIcon("lucide-text").setChecked(k===F).onClick(()=>{m({titleRows:P?void 0:F})})})}),e.showFilePreview&&!v){g.addSeparator(),g.addItem(P=>{P.setTitle(d.folderAppearance.previewRows).setIcon("lucide-file-text").setDisabled(!0)});let F=f?.previewRows??e.previewRows;[1,2,3,4,5].forEach(P=>{let T=P===e.previewRows;g.addItem(I=>{I.setTitle(` ${w(d.folderAppearance.previewRowOption(P),T)}`).setIcon("lucide-file-text").setChecked(F===P).onClick(()=>{m({previewRows:T?void 0:P})})})})}s&&(g.addSeparator(),g.addItem(F=>{F.setTitle(s.menuTitle).setIcon("lucide-squares-unite").setDisabled(!!s.disabled).onClick(()=>{s.onApply()})})),l&&(g.addSeparator(),g.addItem(F=>{F.setTitle(d.paneHeader.resetViewToDefaults).setIcon("lucide-rotate-ccw").setDisabled(!S).onClick(()=>{S&&m({mode:void 0,titleRows:void 0,previewRows:void 0})})}),g.addSeparator(),g.addItem(F=>{F.setTitle(l.menuTitle).setIcon("lucide-settings").setDisabled(!!l.disabled).onClick(()=>{l.onOpen()})})),g.showAtMouseEvent(t)}var Iee,Eee=U(()=>{Iee=require("obsidian");Ee();AR();Ue();ot();Ot()});function Oke(t){return`${Dke}${t}${Ake}`}function Lke(t,e,n){return e.reduce((r,o)=>o.extension!=="md"?r:iL(t,o,n)?r+1:r,0)}function zke(t,e,n){return e.reduce((r,o)=>{if(o.extension!=="md")return r;r.markdownCount+=1;let a=mI(t,o,n);return a.hasProperty&&(a.rank===null?r.invalidPropertyCount+=1:r.validRankCount+=1),r},{markdownCount:0,validRankCount:0,invalidPropertyCount:0})}function KR(t,e){return Me(t)===Me(e)}function Dee(t,e){return e.type===W.FOLDER?De(ln(t.folderSortOverrides)):e.type===W.TAG?De(ln(t.tagSortOverrides)):De(ln(t.propertySortOverrides))}function Aee(t,e,n){if(e.type===W.FOLDER){t.folderSortOverrides=n;return}if(e.type===W.TAG){t.tagSortOverrides=n;return}t.propertySortOverrides=n}function Mee(t,e,n){let r=Dee(t,e);r[e.key]=GA(n),Aee(t,e,r)}function Bke(t){let e=[],n=[];for(t.children.forEach(r=>{r instanceof Lg.TFolder&&n.push(r)});n.length>0;){let r=n.pop();r&&(e.push(r.path),r.children.forEach(o=>{o instanceof Lg.TFolder&&n.push(o)}))}return e}function _ke(t){let e=0,n=[];for(t.children.forEach(r=>{r instanceof Lg.TFolder&&n.push(r)});n.length>0;){let r=n.pop();r&&(e+=1,r.children.forEach(o=>{o instanceof Lg.TFolder&&n.push(o)}))}return e}function Hke(t,e){return e===t?!1:t==="/"?e!=="/":e.startsWith(`${t}/`)}function Vke(t,e){return e===t||t===bt?!1:t===zt?e!==zt&&e!==bt:e.startsWith(`${t}/`)}function Uke(t,e){if(e===t)return!1;if(t===Oe)return e!==Oe;let n=kn(t),r=kn(e);return!n||!r||n.key!==r.key?!1:n.valuePath?r.valuePath?r.valuePath.startsWith(`${n.valuePath}/`):!1:r.valuePath!==null}function vV({descendantCount:t,descendantEntries:e,hasCurrentOverride:n,matchesCurrentOverride:r}){let o=e.length;if(!n)return{descendantCount:t,savedDescendantCount:o,matchingSavedDescendantCount:0,changedSavedDescendantCount:o,missingSavedDescendantCount:0,affectedCount:o,disabled:t===0||o===0};let a=e.filter(r).length,i=o-a,s=Math.max(t-o,0);return{descendantCount:t,savedDescendantCount:o,matchingSavedDescendantCount:a,changedSavedDescendantCount:i,missingSavedDescendantCount:s,affectedCount:i+s,disabled:t===0||o===t&&a===t}}function Kke(t){switch(t){case"custom":return"lucide-heading";case"date":return"lucide-calendar";case"folder":return"lucide-folder";default:return"lucide-heading"}}function Cf(t,e){if(!t)return null;let n={};return t.mode!==void 0&&t.mode!==e&&(n.mode=t.mode),t.titleRows!==void 0&&(n.titleRows=t.titleRows),t.previewRows!==void 0&&(n.previewRows=t.previewRows),Object.keys(n).length>0?n:null}function Wke(t,e){return Cf(t,e)!==null}function tP(t,e){let n=t?{...t}:{};return e!==void 0&&(n.groupBy=e),Object.keys(n).length>0?n:null}function jke(t,e,n){let r=Cf(t,n),o=Cf(e,n);return!r||!o?r===o:r.mode===o.mode&&r.titleRows===o.titleRows&&r.previewRows===o.previewRows}function Ree(t){let e=[],n=new Set,r=o=>{if(n.has(o))return;n.add(o),e.push(o);let a=t.findNode(o);a&&a.children.forEach(i=>{r(i.id)})};return t.getPropertyTree().forEach(o=>{r(o.id)}),e}function WR({onManualSortStart:t,getManualSortNewFileContext:e,trackRevealFileAvailability:n=!1}={}){let{app:r,plugin:o,tagTreeService:a,propertyTreeService:i}=gt(),s=pt(),l=s.vaultProfile,c=s.vaultProfiles,u=Xt(),p=u.includeDescendantNotes,m=u.showHiddenItems,{setIncludeDescendantNotes:g}=wd(),f=Ys(),h=ar(),b=gr(),v=li(),y=Ho(),S=h.selectionType===W.FOLDER&&!!h.selectedFolder,w=h.selectionType===W.TAG&&!!h.selectedTag,k=w&&h.selectedTag!==zt&&h.selectedTag!==bt,F=h.selectionType===W.PROPERTY&&!!h.selectedProperty,P=F&&h.selectedProperty!==Oe,T=S||w||F,I=(0,rn.useCallback)(()=>{o.openSettings()},[o]),N=(0,rn.useCallback)(()=>{o.openSettings()},[o]),O=!!h.selectedFolder||k||P,K=(0,rn.useCallback)(()=>{let me=r.workspace.getActiveFile();return me?.parent?me:null},[r.workspace]),[G,X]=(0,rn.useState)(()=>n?!!K():!1),L=(0,rn.useCallback)(()=>h.selectionType===W.FOLDER&&h.selectedFolder?{type:W.FOLDER,key:h.selectedFolder.path}:h.selectionType===W.TAG&&h.selectedTag?{type:W.TAG,key:h.selectedTag}:h.selectionType===W.PROPERTY&&h.selectedProperty?{type:W.PROPERTY,key:h.selectedProperty}:null,[h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty]),V=(0,rn.useCallback)(async()=>{try{let me=e?.()??null;if(h.selectedFolder){await v.createNewFile(h.selectedFolder,s.createNewNotesInNewTab,me);return}if(k&&h.selectedTag){let fe=h.selectedFile?.path??r.workspace.getActiveFile()?.path??"";await v.createNewFileForTag(h.selectedTag,fe,s.createNewNotesInNewTab,me);return}if(P&&h.selectedProperty){let fe=h.selectedFile?.path??r.workspace.getActiveFile()?.path??"";await v.createNewFileForProperty(h.selectedProperty,fe,s.createNewNotesInNewTab,me)}}catch{}},[h.selectedFolder,h.selectedTag,h.selectedProperty,h.selectedFile,k,P,s.createNewNotesInNewTab,e,v,r]),D=(0,rn.useCallback)(async()=>{let me=K();me&&await o.revealFileInActualFolder(me,{showHiddenFileNotice:!0})},[K,o]),A=(0,rn.useCallback)(()=>Sh(s,h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty),[h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty,s]),_=(0,rn.useCallback)(()=>{if(h.selectionType===W.FOLDER&&h.selectedFolder)return s.folderAppearances?.[h.selectedFolder.path];if(h.selectionType===W.TAG&&h.selectedTag)return s.tagAppearances?.[h.selectedTag];if(h.selectionType===W.PROPERTY&&h.selectedProperty)return s.propertyAppearances?.[h.selectedProperty]},[h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty,s.folderAppearances,s.tagAppearances,s.propertyAppearances]),E=(0,rn.useCallback)(()=>h.selectionType===W.FOLDER&&h.selectedFolder?Bke(h.selectedFolder):h.selectionType===W.TAG&&h.selectedTag?h.selectedTag===zt?Array.from(a?.getAllTagPaths()??[]):Array.from(a?.collectDescendantTagPaths(h.selectedTag)??[]):h.selectionType===W.PROPERTY&&h.selectedProperty&&i?h.selectedProperty===Oe?Ree(i):Array.from(i.collectDescendantNodeIds(h.selectedProperty)):[],[i,h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty,a]),R=(0,rn.useCallback)(me=>h.selectionType===W.FOLDER&&h.selectedFolder?Hke(h.selectedFolder.path,me):h.selectionType===W.TAG&&h.selectedTag?Vke(h.selectedTag,me):h.selectionType===W.PROPERTY&&h.selectedProperty?Uke(h.selectedProperty,me):!1,[h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty]),M=(0,rn.useCallback)(()=>h.selectionType===W.FOLDER?d.paneHeader.subfolders:h.selectionType===W.TAG?d.paneHeader.subtags:h.selectionType===W.PROPERTY?h.selectedProperty===Oe?d.paneHeader.descendants:d.paneHeader.childValues:d.paneHeader.descendants,[h.selectedProperty,h.selectionType]),C=DR(s),x=(0,rn.useMemo)(()=>L(),[L]),z=(0,rn.useMemo)(()=>A(),[A]),H=(0,rn.useMemo)(()=>pl(s,z),[s,z]),Y=as(s,H.propertyKey),ee=(0,rn.useCallback)(me=>{let fe=Me(me);return fe?y.getPropertyIcon(Gn(fe))??null:null},[y]),$=(0,rn.useCallback)(()=>{let me=JK(s,z);if(as(s,H.propertyKey))return"list-ordered";if(me==="list-sort-property"){let fe=ee(H.propertyKey);if(fe)return fe}return Qe(s.interfaceIcons,me)},[ee,z,H.propertyKey,s]),j=(0,rn.useMemo)(()=>_(),[_]),J=(0,rn.useMemo)(()=>Cf(j,C),[C,j]),re=J!==null,oe=(0,rn.useMemo)(()=>RR({settings:s,selectionType:h.selectionType,folderPath:h.selectedFolder?h.selectedFolder.path:null,tag:h.selectedTag??null,propertyNodeId:h.selectedProperty??null}),[s,h.selectedFolder,h.selectedProperty,h.selectedTag,h.selectionType]),Z=oe.normalizedOverride,ce=oe.hasCustomOverride,ae=Y?"custom":Z===void 0?void 0:kf({groupBy:Z,sortOption:H.option,selectionType:h.selectionType}),se=(0,rn.useMemo)(()=>M(),[M]),[ne,B]=(0,rn.useState)(0),[q,ie]=(0,rn.useState)(0),[le,Te]=(0,rn.useState)(0);(0,rn.useEffect)(()=>{let me=nt=>{nt instanceof Lg.TFolder&&B(ct=>ct+1)},fe=r.vault.on("create",me),we=r.vault.on("delete",me),Re=r.vault.on("rename",nt=>{me(nt)});return()=>{r.vault.offref(fe),r.vault.offref(we),r.vault.offref(Re)}},[r.vault]),(0,rn.useEffect)(()=>{if(a)return a.addTreeUpdateListener(()=>{ie(me=>me+1)})},[a]),(0,rn.useEffect)(()=>{if(i)return i.addTreeUpdateListener(()=>{Te(me=>me+1)})},[i]),(0,rn.useEffect)(()=>{if(!n){X(!1);return}let me=()=>{X(!!K())};return me(),Kb({workspace:r.workspace,onChange:me})},[r.workspace,K,n]);let ke=(0,rn.useMemo)(()=>h.selectionType===W.FOLDER&&h.selectedFolder?_ke(h.selectedFolder):h.selectionType===W.TAG&&h.selectedTag?h.selectedTag===zt?a?.getAllTagPaths().length??0:a?.collectDescendantTagPaths(h.selectedTag).size??0:h.selectionType===W.PROPERTY&&h.selectedProperty&&i?h.selectedProperty===Oe?Ree(i).length:i.collectDescendantNodeIds(h.selectedProperty).size:0,[ne,i,le,h.selectedFolder,h.selectedProperty,h.selectedTag,h.selectionType,a,q]),Fe=S||w&&h.selectedTag!==bt||F,te=(0,rn.useCallback)(async()=>{let me=L();if(me){if(me.type===W.FOLDER){await y.removeFolderSortOverride(me.key);return}if(me.type===W.TAG){await y.removeTagSortOverride(me.key);return}await y.removePropertySortOverride(me.key)}},[L,y]),pe=(0,rn.useCallback)(async me=>{let fe=L();if(fe){if(fe.type===W.FOLDER){await y.setFolderSortOverride(fe.key,me);return}if(fe.type===W.TAG){await y.setTagSortOverride(fe.key,me);return}await y.setPropertySortOverride(fe.key,me)}},[L,y]),ve=(0,rn.useCallback)(async me=>{let fe=L();fe&&await f(we=>{let Re=fe.type===W.FOLDER?De(ln(we.folderAppearances)):fe.type===W.TAG?De(ln(we.tagAppearances)):De(ln(we.propertyAppearances)),nt=Re[fe.key],ct=tP(Cf(nt,C),me);if(ct?Re[fe.key]=ct:delete Re[fe.key],fe.type===W.FOLDER){we.folderAppearances=Re;return}if(fe.type===W.TAG){we.tagAppearances=Re;return}we.propertyAppearances=Re})},[C,L,f]),Ie=(0,rn.useCallback)((me,fe,we)=>{new En(r,d.modals.manualSortConfirm.propertySortTitle,d.modals.manualSortConfirm.propertySortMessage(me,fe),we,d.modals.manualSortConfirm.propertySortConfirmButton).open()},[r]),qe=(0,rn.useCallback)((me,fe)=>{let we=oL(s);return fe!==void 0&&Mee(we,me,fe),UG(ca({selectionType:h.selectionType,selectedFolder:h.selectedFolder,selectedTag:h.selectedTag,selectedProperty:h.selectedProperty},we,{includeDescendantNotes:p,showHiddenItems:m},r,a,i))},[r,p,i,h.selectedFolder,h.selectedProperty,h.selectedTag,h.selectionType,s,m,a]),xe=(0,rn.useCallback)(()=>{let me=oL(s);return ca({selectionType:h.selectionType,selectedFolder:h.selectedFolder,selectedTag:h.selectedTag,selectedProperty:h.selectedProperty},me,{includeDescendantNotes:p,showHiddenItems:m},r,a,i,{orderResults:!1})},[r,p,i,h.selectedFolder,h.selectedProperty,h.selectedTag,h.selectionType,s,m,a]),Ce=(0,rn.useCallback)(async(me,fe,we)=>{await f(Re=>{if(we){let yt=Dee(Re,fe);delete yt[fe.key],Aee(Re,fe,yt)}else Mee(Re,fe,jA("property-asc",me));let nt=fe.type===W.FOLDER?De(ln(Re.folderAppearances)):fe.type===W.TAG?De(ln(Re.tagAppearances)):De(ln(Re.propertyAppearances)),ct=Cf(nt[fe.key],C);if(ct?nt[fe.key]=ct:delete nt[fe.key],fe.type===W.FOLDER){Re.folderAppearances=nt;return}if(fe.type===W.TAG){Re.tagAppearances=nt;return}Re.propertyAppearances=nt}),r.workspace.requestSaveLayout()},[r.workspace,C,f]),vt=(0,rn.useCallback)(async(me,fe)=>{try{let we=await JG(r,me,fe);return we.failed>0?(de(d.dragDrop.errors.failedToSetProperty.replace("{error}",zh(we)),{variant:"warning"}),!1):!0}catch(we){return de(d.dragDrop.errors.failedToSetProperty.replace("{error}",to(we,d.common.unknownError)),{variant:"warning"}),!1}},[r]),Rt=(0,rn.useCallback)(async(me,fe)=>{try{let we=await eq(r,me,fe);if(we.updated>0){let Re=we.updated===1?d.fileSystem.notifications.manualSortPropertyRemovedFromNote:d.fileSystem.notifications.manualSortPropertyRemovedFromNotes.replace("{count}",we.updated.toString());de(Re,{variant:"success"})}we.failed>0&&de(d.dragDrop.errors.failedToSetProperty.replace("{error}",zh(we)),{variant:"warning"})}catch(we){de(d.dragDrop.errors.failedToSetProperty.replace("{error}",to(we,d.common.unknownError)),{variant:"warning"})}},[r]),Ve=(0,rn.useCallback)((me,fe,we)=>{!Om(me)||we===0||new En(r,d.modals.manualSortConfirm.removePropertyTitle,d.modals.manualSortConfirm.removePropertyMessage(me,we),async()=>{await Rt(fe,me)},d.modals.manualSortConfirm.removePropertyConfirmButton).open()},[r,Rt]),Ae=(0,rn.useCallback)(async()=>{let me=Tv(s),fe=L();if(!fe||!Om(me))return;let we=pl(s,z),Re=as(s,we.propertyKey),nt=pl(s),ct=nt.option==="property-asc"&&as(s,nt.propertyKey)&&KR(nt.propertyKey,me),yt=qe(fe,z),bn=zke(r,yt,me),Kn=bn.markdownCount>0&&bn.validRankCount===bn.markdownCount,kr=bn.invalidPropertyCount>0,Wo=!Re&&bn.markdownCount>0&&bn.validRankCount===0,co=!Re&&!Kn&&(kr||s.confirmBeforeManualSort),wn=async()=>{Wo&&!await vt(yt,me)||await Ce(me,fe,ct)};if(co){Ie(me,bn.markdownCount,wn);return}await wn()},[r,Ce,qe,L,Ie,z,s,vt]),Ke=(0,rn.useCallback)(()=>{let me=x;if(!me)return vV({descendantCount:0,descendantEntries:[],hasCurrentOverride:!1,matchesCurrentOverride:()=>!1});let fe=me.type===W.FOLDER?s.folderSortOverrides:me.type===W.TAG?s.tagSortOverrides:s.propertySortOverrides,we=me.type===W.FOLDER?s.folderAppearances:me.type===W.TAG?s.tagAppearances:s.propertyAppearances,Re=Object.entries(fe??{}).filter(([Ir])=>R(Ir)),nt=Object.entries(we??{}).filter(([Ir,Jn])=>R(Ir)&&Jn.groupBy!==void 0),ct=new Map(Re),yt=new Map(nt.map(([Ir,Jn])=>[Ir,Jn.groupBy])),bn=new Set([...ct.keys(),...yt.keys()]),Kn=new Set,kr=new Set,Wo=new Set,co=z!==void 0,wn=ae!==void 0;bn.forEach(Ir=>{let Jn=!1,er=!1;co?ct.has(Ir)?$K(ct.get(Ir),z)||(Jn=!0):er=!0:ct.has(Ir)&&(Jn=!0),wn?yt.has(Ir)?yt.get(Ir)!==ae&&(Jn=!0):er=!0:yt.has(Ir)&&(Jn=!0),Jn&&Kn.add(Ir),er&&kr.add(Ir),!Jn&&!er&&Wo.add(Ir)});let Jt=co||wn?Math.max(ke-bn.size,0):0,$n=kr.size+Jt,Zn=new Set([...Kn,...kr]).size+Jt;return{descendantCount:ke,savedDescendantCount:bn.size,matchingSavedDescendantCount:Wo.size,changedSavedDescendantCount:Kn.size,missingSavedDescendantCount:$n,affectedCount:Zn,disabled:ke===0||Zn===0}},[R,ke,ae,z,x,s.folderAppearances,s.folderSortOverrides,s.propertyAppearances,s.propertySortOverrides,s.tagAppearances,s.tagSortOverrides]),Be=(0,rn.useCallback)(async()=>{let me=x;if(!me)return;let fe=E();fe.length!==0&&(await f(we=>{let Re=me.type===W.FOLDER?De(ln(we.folderSortOverrides)):me.type===W.TAG?De(ln(we.tagSortOverrides)):De(ln(we.propertySortOverrides));fe.forEach(ct=>{if(z!==void 0){Re[ct]=GA(z);return}delete Re[ct]}),me.type===W.FOLDER?we.folderSortOverrides=Re:me.type===W.TAG?we.tagSortOverrides=Re:we.propertySortOverrides=Re;let nt=me.type===W.FOLDER?De(ln(we.folderAppearances)):me.type===W.TAG?De(ln(we.tagAppearances)):De(ln(we.propertyAppearances));if(fe.forEach(ct=>{let yt=tP(Cf(nt[ct],C),ae);if(yt){nt[ct]=yt;return}delete nt[ct]}),me.type===W.FOLDER){we.folderAppearances=nt;return}if(me.type===W.TAG){we.tagAppearances=nt;return}we.propertyAppearances=nt}),r.workspace.requestSaveLayout())},[r,C,ae,E,z,x,f]),wt=(0,rn.useCallback)(()=>{if(!x)return;let fe=Ke();if(fe.disabled)return;if(fe.changedSavedDescendantCount===0){Q(async()=>{await Be()});return}let we=d.modals.bulkApply.applySortAndGroupTitle(se),Re=d.modals.bulkApply.affectedCountMessage(fe.changedSavedDescendantCount);new En(r,we,Re,async()=>{await Be()},d.modals.bulkApply.applyButton,{confirmButtonClass:"mod-cta"}).open()},[r,Be,Ke,se,x]),Ct=(0,rn.useCallback)(()=>{let me=x;if(!me)return vV({descendantCount:0,descendantEntries:[],hasCurrentOverride:!1,matchesCurrentOverride:()=>!1});let fe=me.type===W.FOLDER?s.folderAppearances:me.type===W.TAG?s.tagAppearances:s.propertyAppearances,we=Object.entries(fe??{}).filter(([Re,nt])=>R(Re)&&Wke(nt,C));return vV({descendantCount:ke,descendantEntries:we,hasCurrentOverride:re,matchesCurrentOverride:([,Re])=>re&&j!==void 0&&jke(Re,j,C)})},[C,re,R,j,ke,x,s.folderAppearances,s.propertyAppearances,s.tagAppearances]),qt=(0,rn.useCallback)(async()=>{let me=x;if(!me)return;let fe=E();fe.length!==0&&(await f(we=>{if(me.type===W.FOLDER){let nt=De(ln(we.folderAppearances));fe.forEach(ct=>{let yt=tP(re?J:null,nt[ct]?.groupBy);if(yt){nt[ct]=yt;return}delete nt[ct]}),we.folderAppearances=nt;return}if(me.type===W.TAG){let nt=De(ln(we.tagAppearances));fe.forEach(ct=>{let yt=tP(re?J:null,nt[ct]?.groupBy);if(yt){nt[ct]=yt;return}delete nt[ct]}),we.tagAppearances=nt;return}let Re=De(ln(we.propertyAppearances));fe.forEach(nt=>{let ct=tP(re?J:null,Re[nt]?.groupBy);if(ct){Re[nt]=ct;return}delete Re[nt]}),we.propertyAppearances=Re}),r.workspace.requestSaveLayout())},[r,E,re,J,x,f]),lt=(0,rn.useCallback)(()=>{if(!x)return;let fe=Ct();if(fe.disabled)return;if(fe.changedSavedDescendantCount===0){Q(async()=>{await qt()});return}let we=d.modals.bulkApply.applyAppearanceTitle(se),Re=d.modals.bulkApply.affectedCountMessage(fe.changedSavedDescendantCount);new En(r,we,Re,async()=>{await qt()},d.modals.bulkApply.applyButton,{confirmButtonClass:"mod-cta"}).open()},[r,qt,Ct,se,x]),Zt=(0,rn.useCallback)(me=>{T&&xee({event:me.nativeEvent,settings:s,selectedFolder:h.selectedFolder,selectedTag:h.selectedTag,selectedProperty:h.selectedProperty,selectionType:h.selectionType,updateSettings:f,descendantAction:Fe?{menuTitle:d.paneHeader.applyAppearanceToDescendants(se),onApply:lt,disabled:Ct().disabled}:void 0,defaultSettingsAction:{menuTitle:d.settings.changeDefaultSettings,onOpen:N}})},[Fe,Ct,T,N,lt,se,s,h.selectedFolder,h.selectedTag,h.selectedProperty,h.selectionType,f]),Kt=(0,rn.useCallback)(me=>{if(!T)return;let fe=new Lg.Menu,we=pl(s,z),Re=pl(s),nt=we.option,ct=Yw(nt),yt=Kd(nt),bn=Yw(Re.option),Kn=Kd(Re.option),kr=Tv(s),Wo=GC(s.propertySortKey).filter(it=>!as(s,it)),co=Om(kr),wn=co&&x?xe():[],Jt=co?Lke(r,wn,kr):0,Xn=yt==="property"&&as(s,we.propertyKey),Zn={modified:d.settings.items.sortNotesBy.fields.modified,created:d.settings.items.sortNotesBy.fields.created,title:d.settings.items.sortNotesBy.fields.title,filename:d.settings.items.sortNotesBy.fields.filename,property:d.settings.items.sortNotesBy.fields.property},Ir={asc:d.settings.items.sortNotesBy.directions.asc,desc:d.settings.items.sortNotesBy.directions.desc},Jn=(it,Yt)=>{if(it==="property"){let fr=Yt?.trim();return fr?`${Zn.property} ‘${Oke(fr)}’`:Zn.property}return Zn[it]},er=(it,Yt)=>Yt?`${it} ${d.folderAppearance.defaultSuffix}`:it,On=(it,Yt)=>it!==Re.option?!1:Kd(it)!=="property"?!0:KR(Yt??"",Re.propertyKey),Ro=(it,Yt)=>{if(it==="property"){let fr=Kh(ee(Yt??""));if(fr)return fr}return Hr(s.interfaceIcons,YA(it))},je=(it,Yt,fr)=>{let Do=WA(it,Yt);Q(async()=>{On(Do,fr)?await te():await pe(jA(Do,fr)),r.workspace.requestSaveLayout()})},rt=z!==void 0,Et=!rt&&!ce;fe.addItem(it=>{it.setTitle(d.folderAppearance.sortBy).setIcon("lucide-arrow-up-down").setDisabled(!0)}),["modified","created","title","filename"].forEach(it=>{let Yt=Kn===it;fe.addItem(fr=>{fr.setTitle(er(Jn(it),Yt)).setIcon(Ro(it)).setChecked(yt===it).onClick(()=>{je(it,ct)})})}),Wo.forEach(it=>{let Yt=Kn==="property"&&KR(Re.propertyKey,it);fe.addItem(fr=>{fr.setTitle(er(Jn("property",it),Yt)).setIcon(Ro("property",it)).setChecked(yt==="property"&&KR(we.propertyKey,it)).onClick(()=>{je("property",ct,it)})})}),fe.addItem(it=>{let Yt=Kn==="property"&&as(s,Re.propertyKey);it.setTitle(er(d.paneHeader.manualSort,Yt)).setIcon("lucide-list-ordered").setDisabled(!co).setChecked(Xn).onClick(()=>{co&&Q(Ae)})}),fe.addItem(it=>{it.setTitle(d.paneHeader.editSortOrder).setIcon("lucide-list-ordered").setDisabled(!Xn||!t).onClick(()=>{!Xn||!t||t(we.propertyKey)})}),fe.addItem(it=>{it.setTitle(d.paneHeader.removeSortProperty).setIcon("lucide-eraser").setDisabled(Jt===0).onClick(()=>{Jt!==0&&Ve(kr,wn,Jt)})}),fe.addSeparator(),["asc","desc"].forEach(it=>{let Yt=bn===it;fe.addItem(fr=>{let Do=WA(yt,it);fr.setTitle(er(Ir[it],Yt)).setIcon(eW(Do)).setDisabled(Xn).setChecked(ct===it).onClick(()=>{Xn||je(yt,it,yt==="property"?we.propertyKey:void 0)})})}),fe.addSeparator(),fe.addItem(it=>{it.setTitle(d.folderAppearance.groupBy).setIcon("lucide-layers").setDisabled(!0)});let Xe=kf({groupBy:oe.effectiveGrouping,sortOption:nt,selectionType:h.selectionType,isManualSortActive:Xn}),Ht=it=>Xn||it==="date"&&!bh(nt);(S?["custom","date","folder"]:["custom","date"]).forEach(it=>{let Yt=Ht(it),fr=it===oe.defaultGrouping;fe.addItem(Do=>{Do.setTitle(` ${er(d.settings.items.groupNotes.options[it],fr)}`).setIcon(Kke(it)).setDisabled(Yt).setChecked(Xe===it).onClick(()=>{Yt||Q(async()=>{await ve(fr?void 0:it),r.workspace.requestSaveLayout()})})})}),Fe&&(fe.addSeparator(),fe.addItem(it=>{let Yt=Ke();it.setTitle(d.paneHeader.applySortAndGroupToDescendants(se)).setIcon("lucide-squares-unite").setDisabled(Yt.disabled).onClick(()=>{wt()})})),fe.addSeparator(),fe.addItem(it=>{it.setTitle(d.paneHeader.resetViewToDefaults).setIcon("lucide-rotate-ccw").setDisabled(Et).onClick(()=>{Et||Q(async()=>{rt&&await te(),ce&&await ve(void 0),r.workspace.requestSaveLayout()})})}),fe.addSeparator(),fe.addItem(it=>{it.setTitle(d.settings.changeDefaultSettings).setIcon("lucide-settings").onClick(()=>{I()})}),fe.showAtMouseEvent(me.nativeEvent)},[Fe,T,S,ce,r,Ae,Ke,xe,oe.defaultGrouping,oe.effectiveGrouping,I,wt,Ve,te,ee,se,x,z,h.selectionType,ve,pe,s,t]),gn=(0,rn.useCallback)(()=>{let me=p,fe=r.workspace.getActiveFile();g(!me),!me&&h.selectedFolder&&!h.selectedFile&&fe&&Uy(h.selectedFolder,s,{includeDescendantNotes:!0,showHiddenItems:m},r).some(Re=>Re.path===fe.path)&&b({type:"SET_SELECTED_FILE",file:fe})},[g,p,m,h.selectedFolder,h.selectedFile,r,b,s]),fn=z!==void 0||ce,an=me=>{if(!me)return!1;let fe=(me.mode==="compact"||me.mode==="standard")&&me.mode!==C,we=me.titleRows!==void 0||me.previewRows!==void 0;return fe||we},Pe=S&&h.selectedFolder&&an(s.folderAppearances?.[h.selectedFolder.path])||w&&h.selectedTag&&an(s.tagAppearances?.[h.selectedTag])||F&&h.selectedProperty&&an(s.propertyAppearances?.[h.selectedProperty]),ge=(0,rn.useMemo)(()=>TT(c,l).fileVisibility,[l,c]),be=(0,rn.useMemo)(()=>{let me=ge===Er.DOCUMENTS;return h.selectionType===W.TAG?me?d.paneHeader.showNotesFromDescendants:d.paneHeader.showFilesFromDescendants:h.selectionType===W.PROPERTY?me?d.paneHeader.showNotesFromDescendants:d.paneHeader.showFilesFromDescendants:h.selectionType===W.FOLDER?me?d.paneHeader.showNotesFromSubfolders:d.paneHeader.showFilesFromSubfolders:me?d.paneHeader.showNotesFromSubfolders:d.paneHeader.showFilesFromSubfolders},[ge,h.selectionType]);return{handleNewFile:V,canCreateNewFile:O,handleRevealFile:D,canRevealFile:G,handleAppearanceMenu:Zt,handleSortMenu:Kt,handleToggleDescendants:gn,getSortIcon:$,hasAppearanceOrSortSelection:T,hasCustomSortOrGroup:fn,hasCustomAppearance:Pe,descendantsTooltip:be}}var rn,Lg,Dke,Ake,yV=U(()=>{rn=ue(ze()),Lg=require("obsidian");Ur();mn();on();Tr();Ee();Ai();Ue();Rn();Eee();AR();ak();ot();Mr();wi();pr();cn();ai();dn();Ot();qF();tp();Fn();qM();Dke="",Ake=""});function Oee(t){let e=t.lastIndexOf("/");return e<=0?"/":t.slice(0,e)}function Gke(t,e=!1){let n=new Set,r=t;for(;r&&(n.add(r.path),!!e);)r=r.parent instanceof nP.TFolder?r.parent:null;return n}function qke(t,e){return t?Array.from(Gke(t,e)).join(Lee):null}function Yke(t){return new Set(t.split(Lee))}function $ke(t,e,n){return t instanceof nP.TFolder?typeof n!="string"?!1:e.has(n)||e.has(t.path):t instanceof nP.TFile?e.has(Oee(t.path))?!0:typeof n!="string"?!1:e.has(Oee(n)):!1}function bS(t,e,n,r){let[o,a]=(0,jR.useState)(0),i=r?.includeAncestors===!0,s=qke(e,i);return(0,jR.useEffect)(()=>{if(!n||!s)return;let l=Yke(s),c=(g,f)=>{$ke(g,l,f)&&a(h=>h+1)},u=t.on("create",g=>{c(g)}),p=t.on("delete",g=>{c(g)}),m=t.on("rename",(g,f)=>{c(g,f)});return()=>{t.offref(u),t.offref(p),t.offref(m)}},[n,t,s]),o}var jR,nP,Lee,GR=U(()=>{jR=ue(ze()),nP=require("obsidian"),Lee="\0"});function Bee({onHeaderClick:t,isSearchActive:e,onSearchToggle:n,onManualSortStart:r,getManualSortNewFileContext:o,actionsDisabled:a=!1,desktopTitle:i,breadcrumbSegments:s,iconName:l,showIcon:c}){let u=bs.default.useRef(null),{app:p,isMobile:m,plugin:g}=gt(),f=qs(),h=pt(),v=Xt().includeDescendantNotes,y=ar(),S=gr(),w=Yn(),k=Vr(),F=h.listPaneTitle??"header",P=Ki(),T=h.toolbarVisibility.list,I=T.reveal,{handleNewFile:N,canCreateNewFile:O,handleRevealFile:K,canRevealFile:G,handleAppearanceMenu:X,handleSortMenu:L,handleToggleDescendants:V,descendantsTooltip:D,getSortIcon:A,hasAppearanceOrSortSelection:_,hasCustomSortOrGroup:E,hasCustomAppearance:R}=WR({onManualSortStart:r,getManualSortNewFileContext:o,trackRevealFileAvailability:!m&&I}),M=T.back&&w.singlePane,C=T.search,x=T.descendants,z=T.sort,H=T.appearance,Y=T.newNote,ee=!!(y.selectedFolder||y.selectedTag||y.selectedProperty),$=m,j=!m&&F==="header",J=j&&c,re=M||j||C||I||x||z||H||Y,oe=(0,bs.useMemo)(()=>zee.Platform.isAndroidApp?"arrow-left":"chevron-left",[]),Z=(0,bs.useMemo)(()=>A(),[A]),ce=y.selectionType===W.FOLDER?y.selectedFolder:null,ae=$||j,se=bS(p.vault,ce,h.enableFolderNotes&&h.enableFolderNoteLinks&&ae),ne=(0,bs.useMemo)(()=>!ce||!h.enableFolderNotes||!h.enableFolderNoteLinks||!ae?null:Pn(ce,{enableFolderNotes:h.enableFolderNotes,folderNoteName:h.folderNoteName,folderNoteNamePattern:h.folderNoteNamePattern}),[ce,h.enableFolderNotes,h.enableFolderNoteLinks,h.folderNoteName,h.folderNoteNamePattern,ae,se]),B=bs.default.useCallback(te=>{if(!ce||!ne)return;te.stopPropagation();let pe=Hc(te,h.folderNoteOpenLocation,h.multiSelectModifier,m);Q(()=>ri({app:p,commandQueue:f,folder:ce,folderNote:ne,context:pe,openInRightSidebar:ve=>g.openFolderNoteInRightSidebar(ve)}))},[ce,ne,h.folderNoteOpenLocation,h.multiSelectModifier,m,p,f,g]),q=bs.default.useCallback(te=>{te.button!==1||!ce||!ne||(te.preventDefault(),te.stopPropagation(),Q(()=>ri({app:p,commandQueue:f,folder:ce,folderNote:ne,context:"tab"})))},[ce,ne,p,f]),ie=(0,bs.useMemo)(()=>{if(!$)return ne?(0,cr.jsx)("span",{className:"nn-pane-header-folder-note",onClick:B,onMouseDown:q,children:i}):i;let te=[];return s.forEach((pe,ve)=>{let Ie=`${pe.label}-${ve}`,qe=pe.isLast&&!!ne;if(pe.isLast||pe.targetType==="none"||!pe.targetPath)te.push((0,cr.jsx)("span",{className:`nn-path-current${qe?" nn-pane-header-folder-note":""}`,onClick:qe?B:void 0,onMouseDown:qe?q:void 0,children:pe.label},Ie));else{let xe=Ce=>{if(Ce.stopPropagation(),pe.targetType==="folder"){let vt=pe.targetPath,Rt=vt?p.vault.getFolderByPath(vt):null;Rt&&S({type:"SET_SELECTED_FOLDER",folder:Rt})}else pe.targetType==="tag"&&pe.targetPath?S({type:"SET_SELECTED_TAG",tag:Ze(pe.targetPath)}):pe.targetType==="property"&&pe.targetPath&&S({type:"SET_SELECTED_PROPERTY",nodeId:pe.targetPath})};te.push((0,cr.jsx)("span",{className:"nn-path-segment",onClick:xe,children:pe.label},Ie))}pe.isLast||te.push((0,cr.jsx)("span",{className:"nn-path-separator",children:" / "},`${Ie}-separator`))}),te},[p.vault,s,i,S,$,ne,B,q]),le=bs.default.useRef(null),[Te,ke]=bs.default.useState(!1);(0,bs.useEffect)(()=>{if(!J||!u.current)return;yn().renderIcon(u.current,l)},[l,P,J]),(0,bs.useEffect)(()=>{if(!m){ke(!1);return}if(!le.current)return;let te=window.setTimeout(()=>{le.current&&le.current.scrollTo({left:le.current.scrollWidth,behavior:"instant"})},0);return()=>window.clearTimeout(te)},[y.selectedFolder,y.selectedTag,y.selectedProperty,m]);let Fe=bs.default.useCallback(()=>{m&&le.current&&ke(le.current.scrollLeft>0)},[m]);return m?(0,cr.jsx)("div",{className:"nn-pane-header nn-pane-header-simple",onClick:t,children:(0,cr.jsxs)("div",{className:"nn-mobile-header nn-mobile-header-no-icon",children:[(0,cr.jsx)("button",{className:"nn-icon-button nn-back-button","aria-label":d.paneHeader.mobileBackToNavigation,"data-pane-toggle":"navigation",onClick:te=>{te.stopPropagation(),k({type:"SET_SINGLE_PANE_VIEW",view:"navigation"})},tabIndex:-1,children:(0,cr.jsx)(Qt,{iconId:oe,"aria-hidden":!0})}),Te&&(0,cr.jsx)("div",{className:"nn-breadcrumb-fade"}),(0,cr.jsx)("div",{ref:le,className:"nn-breadcrumb-scroll",onScroll:Fe,children:(0,cr.jsx)("span",{className:"nn-mobile-title",children:ie})})]})}):re?(0,cr.jsx)("div",{className:"nn-pane-header",children:(0,cr.jsxs)("div",{className:"nn-header-actions nn-header-actions--space-between",children:[M?(0,cr.jsx)("button",{className:"nn-icon-button","data-pane-toggle":"navigation",onClick:()=>{k({type:"SET_SINGLE_PANE_VIEW",view:"navigation"}),k({type:"SET_FOCUSED_PANE",pane:"navigation"})},"aria-label":d.paneHeader.showFolders,tabIndex:-1,children:(0,cr.jsx)(Qt,{iconId:oe,"aria-hidden":!0})}):null,(0,cr.jsxs)("span",{className:"nn-pane-header-title",children:[J&&(0,cr.jsx)("span",{ref:u,className:"nn-pane-header-icon"}),j&&(0,cr.jsx)("span",{className:"nn-pane-header-text",children:ie})]}),(0,cr.jsxs)("div",{className:"nn-header-actions",children:[C?(0,cr.jsx)("button",{className:`nn-icon-button ${e?"nn-icon-button-active":""}`,"aria-label":d.paneHeader.search,onClick:n,disabled:a||!ee,tabIndex:-1,children:(0,cr.jsx)(Qt,{iconId:Qe(h.interfaceIcons,"list-search")})}):null,I?(0,cr.jsx)("button",{className:"nn-icon-button","aria-label":d.commands.revealFile,onClick:()=>{Q(()=>K())},disabled:a||!G,tabIndex:-1,children:(0,cr.jsx)(Qt,{iconId:Qe(h.interfaceIcons,"list-reveal-file")})}):null,x?(0,cr.jsx)("button",{className:`nn-icon-button ${v?"nn-icon-button-active":""}`,"aria-label":D,onClick:V,disabled:a||!ee,tabIndex:-1,children:(0,cr.jsx)(Qt,{iconId:Qe(h.interfaceIcons,"list-descendants")})}):null,z?(0,cr.jsx)("button",{className:`nn-icon-button ${E?"nn-icon-button-active":""}`,"aria-label":d.paneHeader.changeSortAndGroup,onClick:L,disabled:a||!_,tabIndex:-1,children:(0,cr.jsx)(Qt,{iconId:Z})}):null,H?(0,cr.jsx)("button",{className:`nn-icon-button ${R?"nn-icon-button-active":""}`,"aria-label":d.paneHeader.changeAppearance,onClick:X,disabled:a||!_,tabIndex:-1,children:(0,cr.jsx)(Qt,{iconId:Qe(h.interfaceIcons,"list-appearance")})}):null,Y?(0,cr.jsx)("button",{className:"nn-icon-button","aria-label":d.paneHeader.newNote,onClick:()=>{Q(()=>N())},disabled:a||!O,tabIndex:-1,children:(0,cr.jsx)(Qt,{iconId:Qe(h.interfaceIcons,"list-new-note")})}):null]})]})}):null}var bs,zee,cr,_ee=U(()=>{bs=ue(ze()),zee=require("obsidian");Ur();mn();on();Tr();pa();Ee();Ha();Al();yV();GR();Ue();Jc();td();Sn();ot();pr();cr=ue(Ge())});function Hee({isSearchActive:t,onSearchToggle:e,onManualSortStart:n,getManualSortNewFileContext:r,useFloatingLayout:o=!1}){let i=Xt().includeDescendantNotes,s=ar(),l=pt(),c=l.toolbarVisibility.list,u=c.reveal,{handleNewFile:p,canCreateNewFile:m,handleRevealFile:g,canRevealFile:f,handleAppearanceMenu:h,handleSortMenu:b,handleToggleDescendants:v,descendantsTooltip:y,getSortIcon:S,hasAppearanceOrSortSelection:w,hasCustomSortOrGroup:k,hasCustomAppearance:F}=WR({onManualSortStart:n,getManualSortNewFileContext:r,trackRevealFileAvailability:u}),P=c.search,T=c.descendants,I=c.sort,N=c.appearance,O=c.newNote,K=!!(s.selectedFolder||s.selectedTag||s.selectedProperty),G=[P,u,T,I,N].filter(Boolean).length,X=G+(O?1:0),L=G===1?"nn-mobile-toolbar-circle":"nn-mobile-toolbar-pill",V=G===1?"nn-mobile-toolbar-button nn-mobile-toolbar-button-circle":"nn-mobile-toolbar-button";if(X===0)return null;let D=[P?(0,Da.jsx)("button",{className:`${V}${t?" nn-mobile-toolbar-button-active":""}`,"aria-label":d.paneHeader.search,onClick:e,disabled:!K,tabIndex:-1,children:(0,Da.jsx)(Qt,{iconId:Qe(l.interfaceIcons,"list-search")})},"search"):null,u?(0,Da.jsx)("button",{className:V,"aria-label":d.commands.revealFile,onClick:()=>{Q(()=>g())},disabled:!f,tabIndex:-1,children:(0,Da.jsx)(Qt,{iconId:Qe(l.interfaceIcons,"list-reveal-file")})},"reveal"):null,T?(0,Da.jsx)("button",{className:`${V}${i?" nn-mobile-toolbar-button-active":""}`,"aria-label":y,onClick:v,disabled:!K,tabIndex:-1,children:(0,Da.jsx)(Qt,{iconId:Qe(l.interfaceIcons,"list-descendants")})},"descendants"):null,I?(0,Da.jsx)("button",{className:`${V}${k?" nn-mobile-toolbar-button-active":""}`,"aria-label":d.paneHeader.changeSortAndGroup,onClick:b,disabled:!w,tabIndex:-1,children:(0,Da.jsx)(Qt,{iconId:S()})},"sort"):null,N?(0,Da.jsx)("button",{className:`${V}${F?" nn-mobile-toolbar-button-active":""}`,"aria-label":d.paneHeader.changeAppearance,onClick:h,disabled:!w,tabIndex:-1,children:(0,Da.jsx)(Qt,{iconId:Qe(l.interfaceIcons,"list-appearance")})},"appearance"):null].filter(Boolean),A=O?(0,Da.jsx)("button",{className:"nn-mobile-toolbar-button nn-mobile-toolbar-button-circle","aria-label":d.paneHeader.newNote,onClick:()=>{Q(()=>p())},disabled:!m,tabIndex:-1,children:(0,Da.jsx)(Qt,{iconId:Qe(l.interfaceIcons,"list-new-note")})},"new-note"):null;return o?(0,Da.jsxs)("div",{className:"nn-mobile-toolbar",children:[(0,Da.jsx)("div",{className:"nn-mobile-toolbar-left",children:G>0?(0,Da.jsx)("div",{className:L,children:D}):null}),O?(0,Da.jsx)("div",{className:"nn-mobile-toolbar-right",children:(0,Da.jsx)("div",{className:"nn-mobile-toolbar-circle",children:A})}):null]}):(0,Da.jsxs)("div",{className:"nn-mobile-toolbar",children:[D,A]})}var Da,Vee=U(()=>{Ur();on();Tr();Ee();Al();yV();ot();pr();Da=ue(Ge())});var Wee={};In(Wee,{InfoModal:()=>Nf});function Qke(t,e){if(!e)return;let n=0;for(let r of e.matchAll(Xke)){let o=r[0],a=r[1];if(!o||a===void 0)continue;let i=r.index??-1;if(i===-1)break;i>n&&t.appendText(e.slice(n,i));let s=t.createEl("strong");s.textContent=a,n=i+o.length}n{Kee=require("obsidian"),Xke=/`([^`]+)`/g;Nf=class extends Kee.Modal{constructor(e,n){super(e),this.modalContent=n,this.modalEl.addClass("nn-search-help-modal"),this.titleEl.setText(n.title)}onOpen(){let{contentEl:e}=this;e.empty();let n=e.createDiv({cls:"nn-search-help-scroll"});this.modalContent.intro&&n.createEl("p",{text:this.modalContent.intro}),this.modalContent.emphasizedIntro&&n.createEl("p").createEl("strong",{text:this.modalContent.emphasizedIntro});let r=this.modalContent.sections??[];if(r.length>0){for(let o of r)n.createEl("h3",{text:o.title}),Uee(n,o.items);return}this.modalContent.items&&this.modalContent.items.length>0&&Uee(n,this.modalContent.items)}onClose(){this.modalEl.removeClass("nn-search-help-modal"),this.contentEl.empty()}}});var Cd,If,jee,Gee=U(()=>{Cd=ue(ze()),If=ue(Ge()),jee=Cd.default.memo(function({className:e,ariaText:n,dayNumber:r,isMobile:o,showUnfinishedTaskIndicator:a,onClick:i,onContextMenu:s,style:l,tooltipEnabled:c,tooltipData:u,onHideTooltip:p,onShowTooltip:m}){let g=(0,Cd.useRef)(null),{dateTimestamp:f,imageUrl:h,previewEnabled:b,previewPath:v,showDate:y,title:S}=u,w=(0,Cd.useMemo)(()=>({imageUrl:h,title:S,dateTimestamp:f,previewPath:v,previewEnabled:b,showDate:y}),[f,h,b,v,y,S]),k=(0,Cd.useCallback)(()=>{if(o||!c)return;let T=g.current;T&&m(T,w)},[o,m,w,c]),F=(0,Cd.useCallback)(()=>{let T=g.current;!T||o||p(T)},[o,p]),P=(0,Cd.useCallback)(T=>{let I=g.current;I&&p(I),i(T)},[i,p]);return(0,Cd.useEffect)(()=>{let T=g.current;T&&(o||c&&T.matches(":hover")&&m(T,w))},[o,m,w,c]),(0,If.jsxs)("button",{ref:g,type:"button",className:e,style:l,onMouseEnter:k,onMouseLeave:F,onClick:P,onContextMenu:s,children:[(0,If.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),(0,If.jsx)("span",{className:"nn-navigation-calendar-day-number","aria-hidden":"true",children:r}),a?(0,If.jsx)("span",{className:"nn-navigation-calendar-day-unfinished-task-indicator","aria-hidden":"true"}):null,(0,If.jsx)("span",{className:"nn-visually-hidden",children:n})]})})});function ku(t,e,n){return Math.min(Math.max(t,e),n)}function rP(t){return t.format("YYYY-MM-DD")}function qee(t,e){switch(t){case"day":return`@${e.format("YYYY-MM-DD")}`;case"week":{let n=e.clone().startOf("day"),r=n.clone().add(6,"day");return`@${n.format("YYYY-MM-DD")}..${r.format("YYYY-MM-DD")}`}case"month":return`@${e.format("YYYY-MM")}`;case"quarter":{let n=Math.floor(e.month()/3)+1;return`@${e.format("YYYY")}-Q${n}`}case"year":return`@${e.format("YYYY")}`;default:return""}}function oP(t){return t==="day"||t==="week"||t==="month"}function Yee(t,e,n){return n?!1:Dv(t,e)}function Zke(t){return t.toDate().getDay()}function bV(t,e){let r=(Zke(t)-e+7)%7;return t.clone().subtract(r,"day").startOf("day")}function $ee(t){let e=ku(t.weeksToShow,1,6);if(e===6){let o=t.cursor.clone().startOf("month"),a=bV(o,t.weekStartsOn);if(t.alwaysRenderSixWeeks)return{windowStart:a,weekCount:6};let i=o.clone().endOf("month"),s=bV(i,t.weekStartsOn),l=ku(s.diff(a,"weeks")+1,1,6);return{windowStart:a,weekCount:l}}let n=Math.floor((e-1)/2);return{windowStart:bV(t.cursor.clone(),t.weekStartsOn).clone().subtract(n,"week"),weekCount:e}}function SS(t,e){switch(e){case"none":return!1;case"fri-sat":return t===5||t===6;case"thu-fri":return t===4||t===5;default:return t===0||t===6}}function Jke(t,e){let n=t.getFile(e)?.taskUnfinished;return typeof n!="number"||n<=0?null:n}function SV(t,e,n,r){if(!n)return;let o=Jke(r,n.path);o!==null&&t.set(e,o)}var YR=U(()=>{td()});var Xee,io,Qee,Zee=U(()=>{Xee=ue(ze());Zl();Gee();YR();io=ue(Ge()),Qee=Xee.default.memo(function({activeEditorFilePath:e,showWeekNumbers:n,weekdays:r,weekStartsOn:o,trailingSpacerWeekCount:a,weeks:i,weekNotesEnabled:s,weekNoteFilesByKey:l,weekUnfinishedTaskCountByKey:c,displayLocale:u,calendarWeekendDays:p,todayIso:m,unfinishedTaskCountByIso:g,featureImageUrls:f,featureImageKeysByIso:h,frontmatterTitlesByPath:b,dateFormat:v,isMobile:y,canCreateDayNotes:S,onShowTooltip:w,onHideTooltip:k,onDayClick:F,onDayContextMenu:P,onWeekClick:T,onWeekLabelClick:I,onWeekContextMenu:N}){return(0,io.jsxs)("div",{className:"nn-navigation-calendar-grid","data-weeknumbers":n?"true":void 0,children:[(0,io.jsxs)("div",{className:"nn-navigation-calendar-weekdays","data-weeknumbers":n?"true":void 0,children:[n?(0,io.jsx)("div",{className:"nn-navigation-calendar-weeknumber-spacer"}):null,n?(0,io.jsx)("div",{className:"nn-navigation-calendar-weeknumber-divider","aria-hidden":"true"}):null,r.map((O,K)=>(0,io.jsx)("div",{className:"nn-navigation-calendar-weekday",children:O},(o+K)%7))]}),(0,io.jsxs)("div",{className:"nn-navigation-calendar-weeks","data-weeknumbers":n?"true":void 0,children:[i.map((O,K)=>{let G=l.get(O.key)??null,X=(c.get(O.key)??0)>0,L=!!(G&&e===G.path),V=K>0?i[K-1]:null,D=KT(A,O,G),onContextMenu:A=>N(A,O,G),children:[(0,io.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),(0,io.jsx)("span",{className:"nn-navigation-calendar-weeknumber-value",children:O.weekNumber})]}):(0,io.jsxs)("button",{type:"button",className:"nn-navigation-calendar-weeknumber nn-navigation-calendar-weeknumber-button",onClick:A=>I(A,O),onContextMenu:A=>N(A,O,null),children:[(0,io.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),(0,io.jsx)("span",{className:"nn-navigation-calendar-weeknumber-value",children:O.weekNumber})]}),(0,io.jsx)("div",{className:"nn-navigation-calendar-weeknumber-divider","aria-hidden":"true"})]}):null,O.days.map((A,_)=>{let E=A.date.date(),R=!!A.file,C=(R?g.get(A.iso)??0:0)>0,x=f[A.iso]??null,z=h.has(A.iso),H=m===A.iso,Y=!!(A.file&&e===A.file.path),ee=A.date.toDate().getDay(),$=SS(ee,p),j=_>0?O.days[_-1]:null,J=_0,Ie=ve?pe:zr.formatDate(te,v),qe=ve,xe=ve?`${Fe}, ${pe}`:Fe,Ce=!!(A.file||x),vt={imageUrl:x,title:Ie||Fe,dateTimestamp:te,previewPath:A.file?.path??null,previewEnabled:!!(A.file&&A.file.extension==="md"),showDate:qe};return(0,io.jsx)("div",{className:le,children:(0,io.jsx)(jee,{className:Te,ariaText:xe,style:ke,tooltipEnabled:Ce,tooltipData:vt,dayNumber:E,isMobile:y,showUnfinishedTaskIndicator:C,onShowTooltip:w,onHideTooltip:k,onClick:Rt=>F(Rt,A),onContextMenu:Rt=>P(Rt,A,S)})},A.iso)})]},O.key)}),Array.from({length:a}).map((O,K)=>(0,io.jsxs)("div",{className:"nn-navigation-calendar-week nn-navigation-calendar-week-spacer",children:[n?(0,io.jsx)(io.Fragment,{children:(0,io.jsx)("div",{className:"nn-navigation-calendar-weeknumber nn-navigation-calendar-weeknumber-spacer-row","aria-hidden":"true"})}):null,Array.from({length:7}).map((G,X)=>(0,io.jsx)("div",{className:"nn-navigation-calendar-day-spacer","aria-hidden":"true"},`spacer-day-${K}-${X}`))]},`spacer-week-${K}`))]})]})})});var Jee,Kr,ete,tte=U(()=>{Jee=ue(ze());Ee();Al();Kr=ue(Ge()),ete=Jee.default.memo(function({monthLabel:e,yearLabel:n,quarterLabel:r,showYearInHeader:o,showQuarter:a,hasMonthPeriodNote:i,hasQuarterPeriodNote:s,hasYearPeriodNote:l,isMonthPeriodActive:c,isQuarterPeriodActive:u,isYearPeriodActive:p,showInlineMonthNavigation:m,showCompactQuarterInMonthRow:g,showHeaderPeriodDetails:f,showHeaderNavRow:h,showCompactHeaderInlineInfoButton:b,showInfoInNavRow:v,onNavigate:y,onToday:S,onOpenHelp:w,onPeriodClick:k,onPeriodContextMenu:F}){let P=N=>{N.button===0&&N.preventDefault()},T=o?(0,Kr.jsxs)("button",{type:"button",className:["nn-navigation-calendar-period-button","nn-navigation-calendar-period-year",l?"has-period-note":"",p?"is-active-editor-file":""].filter(Boolean).join(" "),onMouseDown:P,onClick:N=>k(N,"year"),onContextMenu:N=>F(N,"year"),children:[(0,Kr.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),n]}):null,I=N=>(0,Kr.jsxs)("button",{type:"button",className:["nn-navigation-calendar-period-button","nn-navigation-calendar-quarter-button",N?"nn-navigation-calendar-quarter-inline":"",s?"has-period-note":"",u?"is-active-editor-file":""].filter(Boolean).join(" "),onMouseDown:P,onClick:O=>k(O,"quarter"),onContextMenu:O=>F(O,"quarter"),children:[(0,Kr.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),(0,Kr.jsx)("span",{className:"nn-navigation-calendar-quarter-paren","aria-hidden":"true",children:"("}),(0,Kr.jsx)("span",{className:"nn-navigation-calendar-quarter-value",children:r}),(0,Kr.jsx)("span",{className:"nn-navigation-calendar-quarter-paren","aria-hidden":"true",children:")"})]});return(0,Kr.jsxs)("div",{className:"nn-navigation-calendar-header",children:[(0,Kr.jsxs)("div",{className:["nn-navigation-calendar-month",m?"has-inline-month-nav":"",b?"has-inline-help":""].filter(Boolean).join(" "),children:[m?(0,Kr.jsx)("button",{type:"button",className:"nn-navigation-calendar-nav-button nn-navigation-calendar-year-nav-button nn-navigation-calendar-inline-month-nav-prev","aria-label":d.common.previous,onMouseDown:P,onClick:()=>y(-1),children:(0,Kr.jsx)(Qt,{iconId:"lucide-chevron-left","aria-hidden":!0})}):null,(0,Kr.jsxs)("div",{className:"nn-navigation-calendar-inline-month-center",children:[(0,Kr.jsxs)("button",{type:"button",className:["nn-navigation-calendar-period-button","nn-navigation-calendar-period-month",i?"has-period-note":"",c?"is-active-editor-file":""].filter(Boolean).join(" "),onMouseDown:P,onClick:N=>k(N,"month"),onContextMenu:N=>F(N,"month"),children:[(0,Kr.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),e]}),g?I(!0):null,b?(0,Kr.jsx)("button",{type:"button",className:"nn-navigation-calendar-nav-button nn-navigation-calendar-month-help nn-navigation-calendar-inline-help","aria-label":d.navigationCalendar.helpModal.title,onMouseDown:P,onClick:w,children:(0,Kr.jsx)(Qt,{iconId:"info","aria-hidden":!0})}):null]}),m?(0,Kr.jsx)("button",{type:"button",className:"nn-navigation-calendar-nav-button nn-navigation-calendar-year-nav-button nn-navigation-calendar-inline-month-nav-next","aria-label":d.common.next,onMouseDown:P,onClick:()=>y(1),children:(0,Kr.jsx)(Qt,{iconId:"lucide-chevron-right","aria-hidden":!0})}):null,f?T:null,f&&a?I(!1):null]}),h?(0,Kr.jsxs)("div",{className:"nn-navigation-calendar-nav",children:[v?(0,Kr.jsx)("button",{type:"button",className:["nn-navigation-calendar-nav-button","nn-navigation-calendar-help","nn-navigation-calendar-help-inline"].filter(Boolean).join(" "),"aria-label":d.navigationCalendar.helpModal.title,onMouseDown:P,onClick:w,children:(0,Kr.jsx)(Qt,{iconId:"info","aria-hidden":!0})}):null,(0,Kr.jsx)("button",{type:"button",className:"nn-navigation-calendar-nav-button nn-navigation-calendar-nav-prev","aria-label":d.common.previous,onMouseDown:P,onClick:()=>y(-1),children:(0,Kr.jsx)(Qt,{iconId:"lucide-chevron-left","aria-hidden":!0})}),(0,Kr.jsx)("button",{type:"button",className:"nn-navigation-calendar-today","aria-label":d.dateGroups.today,onMouseDown:P,onClick:S,children:d.dateGroups.today}),(0,Kr.jsx)("button",{type:"button",className:"nn-navigation-calendar-nav-button nn-navigation-calendar-nav-next","aria-label":d.common.next,onMouseDown:P,onClick:()=>y(1),children:(0,Kr.jsx)(Qt,{iconId:"lucide-chevron-right","aria-hidden":!0})})]}):null]})})});var nte,rte,zg,ote,ate=U(()=>{nte=ue(ze()),rte=ue(pF()),zg=ue(Ge()),ote=nte.default.memo(function({isMobile:e,hoverTooltip:n,hoverTooltipStyle:r,hoverTooltipRef:o,hoverTooltipPreviewText:a,shouldShowHoverTooltipPreview:i,hoverTooltipDateText:s}){return!n||e?null:(0,rte.createPortal)((0,zg.jsxs)("div",{ref:o,className:"nn-navigation-calendar-hover-tooltip",style:r??{top:0,left:0,transform:"translateY(-50%)",visibility:"hidden"},role:"tooltip",children:[n.tooltipData.imageUrl?(0,zg.jsx)("div",{className:"nn-navigation-calendar-hover-tooltip-image",style:{backgroundImage:`url(${n.tooltipData.imageUrl})`}}):null,(0,zg.jsxs)("div",{className:"nn-compact-file-text-content",children:[(0,zg.jsx)("div",{className:"nn-file-name",style:{"--filename-rows":2,height:"auto",minHeight:0},children:n.tooltipData.title}),i?(0,zg.jsx)("div",{className:"nn-file-preview",style:{"--preview-rows":2},children:a}):null,s?(0,zg.jsx)("div",{className:"nn-file-date",children:s}):null]})]}),activeDocument.body)})});var ite,Ss,ste,lte=U(()=>{ite=ue(ze());Ee();Al();Ss=ue(Ge()),ste=ite.default.memo(function({showYearCalendar:e,currentMonthKey:n,displayedYearValue:r,activeYearValue:o,activeMonthIndex:a,hasYearPeriodNote:i,isYearPeriodActive:s,yearMonthEntries:l,highlightedMonthFeatureImageKeys:c,highlightedMonthImageUrls:u,onNavigateYear:p,onYearPeriodClick:m,onYearPeriodContextMenu:g,onSelectYearMonth:f}){return e?(0,Ss.jsxs)("div",{className:"nn-navigation-calendar-year-panel",children:[(0,Ss.jsxs)("div",{className:"nn-navigation-calendar-year-nav",children:[(0,Ss.jsx)("button",{type:"button",className:"nn-navigation-calendar-nav-button nn-navigation-calendar-year-nav-button","aria-label":d.common.previous,onClick:()=>p(-1),children:(0,Ss.jsx)(Qt,{iconId:"lucide-chevron-left","aria-hidden":!0})}),(0,Ss.jsxs)("button",{type:"button",className:["nn-navigation-calendar-year-label","nn-navigation-calendar-period-button",i?"has-period-note":"",s?"is-active-editor-file":""].filter(Boolean).join(" "),"aria-live":"polite",onClick:m,onContextMenu:g,children:[(0,Ss.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),r]}),(0,Ss.jsx)("button",{type:"button",className:"nn-navigation-calendar-nav-button nn-navigation-calendar-year-nav-button","aria-label":d.common.next,onClick:()=>p(1),children:(0,Ss.jsx)(Qt,{iconId:"lucide-chevron-right","aria-hidden":!0})})]}),(0,Ss.jsx)("div",{className:"nn-navigation-calendar-year-grid",children:l.map(h=>{let b=r===o&&h.monthIndex===a,v=h.key===n,y=c.has(h.key),S=u[h.key]??null,w=`${h.fullLabel} ${r}`,k=S?{backgroundImage:`url(${S})`}:void 0;return(0,Ss.jsxs)("button",{type:"button",className:["nn-navigation-calendar-year-month",v?"is-current-month":"",b?"is-selected-month":"",h.hasDailyNote?"has-daily-note":"",h.hasUnfinishedTasks?"has-unfinished-tasks":"",y?"has-feature-image-key":"",S?"has-feature-image":""].filter(Boolean).join(" "),"aria-label":w,style:k,onClick:F=>f(F,h.date),children:[(0,Ss.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),(0,Ss.jsx)("span",{className:"nn-navigation-calendar-year-month-label",children:h.shortLabel}),h.hasUnfinishedTasks?(0,Ss.jsx)("span",{className:"nn-navigation-calendar-year-month-unfinished-task-indicator","aria-hidden":"true"}):null]},h.key)})})]}):null})});function cte(t){return t.replace(/\.md$/iu,"")}function dte(t){return(0,aP.normalizePath)(t).replace(/^\/+/u,"").replace(/\/+$/u,"")}function eFe(t){let e="",n=!1;for(let r of t){if(r==="["){n=!0;continue}if(r==="]"){n=!1;continue}n||(e+=r)}return e}function tFe(t){let e=eFe(t);return/[YgG]/u.test(e)&&/[wW]/u.test(e)}function nFe(t,e){let n=dte(t),r=dte(e);return r?n===r?"":n.startsWith(`${r}/`)?n.slice(r.length+1):null:n}function rFe({filePath:t,resolverContext:e,parseLocale:n,calendarLocale:r,weekLocale:o,customCalendarRootFolderSettings:a,momentApi:i}){let s=cte(t),l=nFe(s,a.calendarCustomRootFolder);if(!l)return null;let c=e.momentPattern.split("/").filter(Boolean),u=l.split("/").filter(Boolean);if(c.length!==u.length)return null;for(let p=c.length-1;p>=0;p--){let m=c.slice(p).join("/");if(!tFe(m))continue;let g=u.slice(p).join("/"),f=i(g,m,n,!0);if(!f.isValid())continue;if(sP({kind:"week",date:f,resolverContext:e,calendarLocale:r,weekLocale:o,customCalendarRootFolderSettings:a,momentApi:i})?.filePath===t)return f}return null}function iP(t,e){let n=np(t,e),r=Im(n.calendarCustomFilePattern,n.fallbackPattern);return{config:n,momentPattern:r}}function sP({kind:t,date:e,resolverContext:n,calendarLocale:r,weekLocale:o,customCalendarRootFolderSettings:a,momentApi:i}){let{config:s,momentPattern:l}=n;if(!s.isPatternValid(l,i))return null;let c=rp(t,e,l,r,o);return xm(c,a,s.calendarCustomFilePattern,s.fallbackPattern)}function $R({app:t,kind:e,date:n,resolverContext:r,calendarLocale:o,weekLocale:a,customCalendarRootFolderSettings:i,momentApi:s}){let l=sP({kind:e,date:n,resolverContext:r,calendarLocale:o,weekLocale:a,customCalendarRootFolderSettings:i,momentApi:s});if(!l)return null;let c=t.vault.getAbstractFileByPath(l.filePath);return c instanceof aP.TFile?c:null}function ute({filePath:t,kind:e,resolverContext:n,calendarLocale:r,weekLocale:o,customCalendarRootFolderSettings:a,momentApi:i,parseLocale:s}){if(!i||!t.toLowerCase().endsWith(".md"))return null;let l=(0,aP.normalizePath)(t),{config:c,momentPattern:u}=n;if(!c.isPatternValid(u,i))return null;if(e==="week")return rFe({filePath:l,kind:e,resolverContext:n,calendarLocale:r,weekLocale:o,customCalendarRootFolderSettings:a,momentApi:i,parseLocale:s});let p=Pw(a.calendarCustomRootFolder),m=p?`${p}/${u}`:u,g=i(cte(l),m,s,!0);if(!g.isValid())return null;let f=sP({kind:e,date:g,resolverContext:n,calendarLocale:r,weekLocale:o,customCalendarRootFolderSettings:a,momentApi:i});return!f||f.filePath!==l?null:g}var aP,wV=U(()=>{aP=require("obsidian");Xl();iy()});function TV(t,e){return!t||!e?null:`${t}\0${e}`}function pte({regenerationKeys:t,filePath:e,featureImageKey:n}){let r=TV(e,n);return!r||t.has(r)?!1:(t.add(r),!0)}function mte(t,e){let n=`${e}\0`;for(let r of t)r.startsWith(n)&&t.delete(r)}function kV({db:t,showFeatureImages:e,targets:n,maxConcurrentLoads:r,onMissingFeatureImage:o}){let a=(0,Vp.useRef)(new Map),[i,s]=(0,Vp.useState)({}),l=(0,Vp.useCallback)(c=>{let u=a.current;if(u.size===0){c&&s(p=>Object.keys(p).length===0?p:{});return}for(let p of u.values())URL.revokeObjectURL(p.url);u.clear(),c&&s(p=>Object.keys(p).length===0?p:{})},[]);return(0,Vp.useEffect)(()=>()=>{l(!1)},[l]),(0,Vp.useEffect)(()=>{let c=!0;if(!t||!e)return l(!0),()=>{c=!1};let u=a.current,p=new Map,m=[],g=async()=>{try{let f=async y=>{let S=u.get(y.id);if(S&&S.key===y.key){p.set(y.id,S);return}let w;try{w=await t.getFeatureImageBlob(y.file.path,y.key)}catch{return}if(!c)return;if(!w){o?.(y);return}let k=URL.createObjectURL(w);m.push(k),p.set(y.id,{key:y.key,url:k})},h=Math.min(Math.max(1,r),n.length||1),b=0,v=[];for(let y=0;y{for(;;){let S=b;if(b+=1,S>=n.length)return;await f(n[S])}})());if(await Promise.all(v),!c){m.forEach(y=>URL.revokeObjectURL(y));return}for(let[y,S]of u.entries()){let w=p.get(y);(!w||w.url!==S.url)&&URL.revokeObjectURL(S.url)}a.current=p,s(Object.fromEntries([...p.entries()].map(([y,S])=>[y,S.url])))}catch(f){m.forEach(h=>URL.revokeObjectURL(h)),c&&console.error("Failed to load calendar feature images",f)}};return Q(()=>g()),()=>{c=!1}},[l,t,r,o,e,n]),i}var Vp,gte=U(()=>{Vp=ue(ze());ot()});function hte(t,e){return t.imageUrl===e.imageUrl&&t.title===e.title&&t.dateTimestamp===e.dateTimestamp&&t.previewPath===e.previewPath&&t.previewEnabled===e.previewEnabled&&t.showDate===e.showDate}function fte({db:t,dateFormat:e,isMobile:n,previewVersion:r}){let[o,a]=(0,ma.useState)(null),[i,s]=(0,ma.useState)(null),l=(0,ma.useRef)(null),c=(0,ma.useRef)(null),u=(0,ma.useRef)(null),p=(0,ma.useRef)(null),m=(0,ma.useMemo)(()=>!o||!t||!o.tooltipData.previewEnabled||!o.tooltipData.previewPath?"":t.getCachedPreviewText(o.tooltipData.previewPath),[t,o,r]),g=m.trim().length>0,f=o&&o.tooltipData.showDate?zr.formatDate(o.tooltipData.dateTimestamp,e):"",h=(0,ma.useCallback)(()=>{c.current=null,s(null),a(null)},[]);(0,ma.useEffect)(()=>{p.current=o},[o]);let b=(0,ma.useCallback)(()=>{if(!o){s(null);return}if(typeof window>"u"){s(null);return}if(!o.anchorEl.isConnected){a(null),s(null);return}let S=l.current;if(!S){s({top:0,left:0,transform:"translateY(-50%)",visibility:"hidden"});return}let w=S.offsetWidth,k=S.offsetHeight,F=o.anchorEl.getBoundingClientRect(),P=Sm(),T=10,I=8,N=F.top+F.height/2,O=k/2,K=I+O,G=window.innerHeight-I-O,X=Number.isFinite(K)&&Number.isFinite(G)&&G>=K?ku(N,K,G):ku(N,I,window.innerHeight-I),L=window.innerWidth-F.right-I,V=F.left-I,D=w+T,A=L>=D,_=V>=D,E=P;P==="right"&&!A&&_?E="left":P==="left"&&!_&&A?E="right":!_&&!A&&(E=L>=V?"right":"left");let R=I,M=window.innerWidth-I-w,C=E==="right"?F.right+T:F.left-T-w;Number.isFinite(R)&&Number.isFinite(M)&&M>=R&&(C=ku(C,R,M)),s({top:X,left:C,transform:"translateY(-50%)",visibility:"visible"})},[o]);(0,ma.useLayoutEffect)(()=>{b()},[b]),(0,ma.useLayoutEffect)(()=>{if(!o||n){u.current=null;return}let S=u.current;u.current=g,!(S===null||S===g)&&b()},[o,n,g,b]),(0,ma.useEffect)(()=>{if(!o||typeof window>"u")return;let S=null,w=()=>{S===null&&(S=window.requestAnimationFrame(()=>{S=null,b()}))};return window.addEventListener("resize",w),window.addEventListener("scroll",w,!0),()=>{S!==null&&window.cancelAnimationFrame(S),window.removeEventListener("resize",w),window.removeEventListener("scroll",w,!0)}},[o,b]);let v=(0,ma.useCallback)((S,w)=>{c.current!==S&&(c.current=S,s(null));let k=p.current,F=k&&k.anchorEl===S?k.tooltipData:null,P=F!==null&&hte(F,w),T=w.previewPath;!P&&w.previewEnabled&&T&&t&&Q(()=>t.ensurePreviewTextLoaded(T)),a(I=>{if(I&&I.anchorEl===S){let N=I.tooltipData;if(hte(N,w))return I}return{anchorEl:S,tooltipData:w}})},[t]),y=(0,ma.useCallback)(S=>{c.current===S&&(c.current=null,s(null)),a(w=>!w||w.anchorEl!==S?w:null)},[]);return{hoverTooltip:o,hoverTooltipStyle:i,hoverTooltipRef:l,hoverTooltipStateRef:p,hoverTooltipPreviewText:m,shouldShowHoverTooltipPreview:g,hoverTooltipDateText:f,handleShowTooltip:v,handleHideTooltip:y,clearHoverTooltip:h}}var ma,vte=U(()=>{ma=ue(ze());ot();Zl();os();YR()});function yte({app:t,commandQueue:e,fileSystemOps:n,isMobile:r,settings:o,dailyNoteSettings:a,momentApi:i,dailyNoteLocale:s,calendarLocale:l,weekLocale:c,customCalendarRootFolderSettings:u,openFile:p,clearHoverTooltip:m,onVaultChange:g,showMonthHighlightActions:f,setCalendarMonthHighlight:h,removeCalendarMonthHighlight:b}){let v=(0,Bg.useCallback)(()=>{!r||!t.workspace.leftSplit||t.workspace.leftSplit.collapse()},[t,r]),y=(0,Bg.useCallback)(T=>iP(T,o),[o]),S=(0,Bg.useCallback)((T,I)=>$R({app:t,kind:T,date:I,resolverContext:y(T),calendarLocale:l,weekLocale:c,customCalendarRootFolderSettings:u,momentApi:i}),[t,l,u,y,i,c]),w=(0,Bg.useCallback)((T,I,N)=>{if(N){p(N,{active:!0}),v();return}let O=y(T),K=sP({kind:T,date:I,resolverContext:O,calendarLocale:l,weekLocale:c,customCalendarRootFolderSettings:u,momentApi:i});if(!K){de(O.config.parsingErrorText);return}m();let G=t.vault.getAbstractFileByPath(K.filePath);if(G instanceof XR.TFile){p(G,{active:!0}),v();return}let X=async()=>{let V;try{let D=oy(T,o);V=await ay(t,K.folderPath,K.fileName,D)}catch(D){console.error("Failed to create calendar note",D),de(d.common.unknownError);return}g(),p(V,{active:!0}),v()},L=()=>Q(()=>X());if(o.calendarConfirmBeforeCreate){new En(t,d.paneHeader.newNote,d.navigationCalendar.createDailyNote.message.replace("{filename}",K.filePath),L,d.navigationCalendar.createDailyNote.confirmButton,{confirmButtonClass:"mod-cta"}).open();return}L()},[t,m,v,u,l,y,i,g,p,o,c]),k=(0,Bg.useCallback)((T,I)=>{if(I){p(I,{active:!0}),v();return}if(o.calendarIntegrationMode==="daily-notes"){let N=a;if(!N){de(d.navigationCalendar.dailyNotesNotEnabled);return}let O=T.clone().locale(s),K=Ox(O,N),G=async()=>{let X=await Gy(t,O,N);X&&(g(),p(X,{active:!0}),v())};if(o.calendarConfirmBeforeCreate){new En(t,d.navigationCalendar.createDailyNote.title,d.navigationCalendar.createDailyNote.message.replace("{filename}",K),()=>{Q(G)},d.navigationCalendar.createDailyNote.confirmButton,{confirmButtonClass:"mod-cta"}).open();return}Q(()=>G());return}w("day",T,null)},[t,v,s,a,g,p,w,o]),F=(0,Bg.useCallback)((T,I)=>{T.addItem(N=>{$e(N.setTitle(d.contextMenu.file.openInNewTab).setIcon("lucide-file-plus"),async()=>{await no({app:t,commandQueue:e,file:I,context:"tab"})})}),T.addItem(N=>{$e(N.setTitle(d.contextMenu.file.openToRight).setIcon("lucide-separator-vertical"),async()=>{await no({app:t,commandQueue:e,file:I,context:"split"})})}),r||T.addItem(N=>{$e(N.setTitle(d.contextMenu.file.openInNewWindow).setIcon("lucide-external-link"),async()=>{await no({app:t,commandQueue:e,file:I,context:"window"})})})},[t,e,r]),P=(0,Bg.useCallback)((T,I)=>{T.preventDefault(),T.stopPropagation(),m();let N=new XR.Menu,O=I.currentMonthHighlightDayIso===I.dayIso,K=I.existingFile;K&&(F(N,K),N.addSeparator());let G=!1;if(f&&I.kind==="day"&&I.hasFeatureImage&&I.monthKey&&I.dayIso){let{monthKey:X,dayIso:L}=I;O||(G=!0,N.addItem(V=>{V.setTitle(d.contextMenu.file.setCalendarHighlight).setIcon("lucide-image").onClick(()=>{Q(()=>h(X,L))})})),O&&(G=!0,N.addItem(V=>{V.setTitle(d.contextMenu.file.removeCalendarHighlight).setIcon("lucide-image-off").onClick(()=>{Q(()=>b(X))})}))}K?(G&&N.addSeparator(),N.addItem(X=>{X.setTitle(d.contextMenu.file.deleteNote).setIcon("lucide-trash").setWarning(!0).onClick(()=>{Q(()=>n.deleteFile(K,o.confirmBeforeDelete,()=>{g(),v()}))})})):N.addItem(X=>{X.setTitle(d.contextMenu.folder.newNote).setIcon(Hr(o.interfaceIcons,"list-new-note","lucide-pen-box")).setDisabled(!I.canCreate).onClick(()=>{if(I.canCreate){if(I.kind==="day"){Q(()=>k(I.date,null));return}Q(()=>w(I.kind,I.date,null))}})}),N.showAtMouseEvent(T.nativeEvent)},[F,m,v,n,g,w,k,b,h,f,o.confirmBeforeDelete,o.interfaceIcons]);return{getExistingCustomCalendarNoteFile:S,openOrCreateCustomCalendarNote:w,openOrCreateDailyNote:k,showCalendarNoteContextMenu:P}}var Bg,XR,bte=U(()=>{Bg=ue(ze()),XR=require("obsidian");Ee();Ai();ot();pk();wu();Fn();Zc();iy();pr();wV()});function Ste(t,e){if(!t)return null;if(e){let n=t(e,"YYYY-MM-DD",!0);if(n.isValid())return n.startOf("day")}return t().startOf("day")}function oFe(t){let n=t.getActiveViewOfType(Ol.FileView)?.file;return n instanceof Ol.TFile?n:null}function wte(t,e){let n=oFe(t),r=e instanceof Ol.TFile?e:n;return r?r.path:null}function aFe(t,e){if(typeof t.iterateAllLeaves!="function")return!1;let n=!1;return t.iterateAllLeaves(r=>{if(n)return;let o=r.view;if(!(o instanceof Ol.FileView))return;let a=o.file;a instanceof Ol.TFile&&a.path===e&&(n=!0)}),n}function iFe(t){return t.replace(/\.md$/iu,"")}function Up({onWeekCountChange:t,onNavigationAction:e,weeksToShowOverride:n,onAddDateFilter:r,onMissingFeatureImage:o,onVisibleCalendarNoteFilesChange:a,isRightSidebar:i=!1}){let{app:s,commandQueue:l,fileSystemOps:c,isMobile:u,plugin:p}=gt(),m=pt(),g=Ys(),f=nn(m).periodicNotesFolder,h=(0,Je.useMemo)(()=>({calendarCustomRootFolder:f}),[f]),b=n??m.calendarWeeksToShow,v=A7(),[y,S]=(0,Je.useState)(()=>Sr()),w=v?.getDB()??y,k=v?.regenerateFeatureImageForFile,F=vu(),P=(0,Je.useId)(),T=qr(),[I]=(0,Je.useState)(()=>p.getCalendarCursorDateIso()),[N]=(0,Je.useState)(()=>Ste(T,I)),[O,K]=(0,Je.useState)(()=>N),[G,X]=(0,Je.useState)(()=>N?.year()??null),L=hR(),[V,D]=(0,Je.useState)(()=>wte(s.workspace)??null),[A,_]=(0,Je.useState)(0),[E,R]=(0,Je.useState)(0),[M,C]=(0,Je.useState)(0),[x,z]=(0,Je.useState)(0),[H,Y]=(0,Je.useState)(0),ee=(0,Je.useRef)(new Set),$=(0,Je.useRef)(new Set),j=(0,Je.useRef)(new Set),J=(0,Je.useRef)(new Map),re=(0,Je.useRef)(new Set),oe=(0,Je.useRef)(null),Z=(0,Je.useRef)(I!==null),ce=(0,Je.useRef)(new Map),ae=(0,Je.useRef)(null),se=(0,Je.useCallback)(()=>{if(ce.current.clear(),typeof window>"u"){_(Se=>Se+1);return}ae.current===null&&(ae.current=window.setTimeout(()=>{ae.current=null,_(Se=>Se+1)},120))},[]),ne=(0,Je.useCallback)(Se=>{let Ne=wte(s.workspace,Se);D(He=>He===Ne?He:Ne!==null?Ne:He&&aFe(s.workspace,He)?He:null)},[s.workspace]),B=(0,Je.useCallback)(Se=>{if(pte({regenerationKeys:re.current,filePath:Se.file.path,featureImageKey:Se.key})){if(k){k(Se.file);return}o?.(Se)}},[o,k]),q=(0,Je.useCallback)(Se=>Se instanceof Ol.TFile?Se.extension==="md":!0,[]),{hoverTooltip:ie,hoverTooltipStyle:le,hoverTooltipRef:Te,hoverTooltipStateRef:ke,hoverTooltipPreviewText:Fe,shouldShowHoverTooltipPreview:te,hoverTooltipDateText:pe,handleShowTooltip:ve,handleHideTooltip:Ie,clearHoverTooltip:qe}=fte({db:w,dateFormat:m.dateFormat,isMobile:u,previewVersion:x});(0,Je.useEffect)(()=>{if(v||y)return;let Se=!0;return Q(async()=>{for(;Se&&!is();){let Ne=await AW();if(!Se)return;if(Ne){S(Ne);return}await new Promise(He=>{window.setTimeout(He,250)})}}),()=>{Se=!1}},[y,v]),(0,Je.useEffect)(()=>{let Se=Kb({workspace:s.workspace,commandQueue:l,onChange:({candidateFile:Ne})=>{ne(Ne)}});return ne(),()=>{Se()}},[s.workspace,l,ne]),(0,Je.useEffect)(()=>{let Se=sn=>{q(sn)&&se()},Ne=s.vault.on("create",Se),He=s.vault.on("delete",Se),ht=s.vault.on("rename",Se);return()=>{s.vault.offref(Ne),s.vault.offref(He),s.vault.offref(ht),typeof window<"u"&&ae.current!==null&&(window.clearTimeout(ae.current),ae.current=null)}},[s.vault,se,q]),(0,Je.useEffect)(()=>{if(w)return w.onContentChange(Se=>{let Ne=ee.current,He=$.current,ht=ke.current,sn=ht&&ht.tooltipData.previewEnabled?ht.tooltipData.previewPath:null,yr=m.calendarShowFeatureImage&&He.size>0,Qr=Ne.size>0,hi=!!sn,fi=!yr,Fr=!Qr,aa=!hi;for(let Wn of Se){let Ji=Wn.changes.featureImage!==void 0||Wn.changes.featureImageKey!==void 0||Wn.changes.featureImageStatus!==void 0;if(Ji&&mte(re.current,Wn.path),!aa&&sn&&Wn.path===sn&&Wn.changes.preview!==void 0&&(aa=!0),!Fr&&Ne.has(Wn.path)&&Wn.changes.taskUnfinished!==void 0&&(Fr=!0),!fi&&He.has(Wn.path)&&Ji&&(fi=!0),fi&&Fr&&aa)break}yr&&fi&&R(Wn=>Wn+1),Qr&&Fr&&C(Wn=>Wn+1),hi&&aa&&z(Wn=>Wn+1)})},[w,ke,m.calendarShowFeatureImage]),(0,Je.useEffect)(()=>{let Se=m.frontmatterNameField.trim();if(!m.useFrontmatterMetadata||Se.length===0)return;let Ne=s.metadataCache.on("changed",He=>{if(!(He instanceof Ol.TFile)||!j.current.has(He.path))return;let ht=J.current.get(He.path)??"",sn=kz(s,He,Se).trim();ht!==sn&&Y(yr=>yr+1)});return()=>{s.metadataCache.offref(Ne)}},[s,s.metadataCache,m.frontmatterNameField,m.useFrontmatterMetadata]),(0,Je.useEffect)(()=>{if(!T||O)return;let Se=p.getCalendarCursorDateIso();Se!==null&&(Z.current=!0),K(Ste(T,Se))},[O,T,p]),(0,Je.useEffect)(()=>{O&&p.setCalendarCursorDateIso(rP(O))},[O,p]),(0,Je.useEffect)(()=>{O&&X(Se=>Se===O.year()?Se:O.year())},[O]);let xe=Ei(),{displayLocale:Ce,calendarRulesLocale:vt}=(0,Je.useMemo)(()=>Hu(m.calendarLocale,T,xe),[xe,T,m.calendarLocale]),Rt=Lc(T),Ve=Vu(m.calendarPeriodicNotesLocaleSource,vt,T);(0,Je.useEffect)(()=>{K(Se=>Se?.clone().locale(Ce)??Se)},[Ce]);let Ae=m.calendarIntegrationMode==="notebook-navigator",Ke=Ae&&m.calendarCustomWeekPattern.trim()!=="",Be=Ae&&m.calendarCustomMonthPattern.trim()!=="",wt=Ae&&m.calendarCustomQuarterPattern.trim()!=="",Ct=Ae&&m.calendarCustomYearPattern.trim()!=="",qt=(0,Je.useMemo)(()=>Ke&&Iw(m.calendarCustomWeekPattern)==="isoWeek"?"iso":"locale",[m.calendarCustomWeekPattern,Ke]),lt=(0,Je.useMemo)(()=>{if(qt==="iso"||!T)return 1;let Ne=T().locale(vt).localeData().firstDayOfWeek();return typeof Ne=="number"&&Number.isInteger(Ne)&&Ne>=0&&Ne<=6?Ne:1},[vt,qt,T]),Zt=(0,Je.useMemo)(()=>{if(!T)return[];let Se=lt,He=T().locale(Ce).localeData().weekdaysMin();return!Array.isArray(He)||He.length!==7?[]:[...He.slice(Se),...He.slice(0,Se)].map(sn=>Array.from(sn.trim())[0]??"")},[Ce,T,lt]),Kt=(0,Je.useMemo)(()=>m.calendarIntegrationMode!=="daily-notes"?null:tg(s),[s,m.calendarIntegrationMode,A]),gn=(0,Je.useMemo)(()=>iP("day",m),[m]),fn=(0,Je.useMemo)(()=>T?m.calendarIntegrationMode==="notebook-navigator"&&gn.config.isPatternValid(gn.momentPattern,T):!1,[gn,T,m.calendarIntegrationMode]);(0,Je.useEffect)(()=>{ce.current.clear()},[fn,h,Kt,gn,Rt,T,Ve,m.calendarIntegrationMode,A]);let an=(0,Je.useCallback)(Se=>{let Ne=rP(Se),He=ce.current.get(Ne);if(He!==void 0)return He;let ht=null;return fn?ht=$R({app:s,kind:"day",date:Se,resolverContext:gn,calendarLocale:Ve,weekLocale:Ve,customCalendarRootFolderSettings:h,momentApi:T}):m.calendarIntegrationMode==="daily-notes"&&Kt&&(ht=jy(s,Se.clone().locale(Rt),Kt)),ce.current.set(Ne,ht),ht},[s,fn,h,Kt,Rt,gn,T,Ve,m.calendarIntegrationMode]),Pe=(0,Je.useCallback)(Se=>{if(!T||!Se.toLowerCase().endsWith(".md"))return null;let Ne=(0,Ol.normalizePath)(Se),He=iFe(Ne);if(m.calendarIntegrationMode==="daily-notes"){if(!Kt)return null;let fi=Pw(Kt.folder),Fr=fi?`${fi}/${Kt.format}`:Kt.format,aa=T(He,Fr,Rt,!0);if(!aa.isValid())return null;let Wn=(0,Ol.normalizePath)(Kt.folder.trim()).replace(/^\/+/u,"").replace(/\/+$/u,"");return`${(0,Ol.normalizePath)(Wn?`${Wn}/${aa.format(Kt.format)}`:aa.format(Kt.format))}.md`!==Ne?null:aa.startOf("day")}if(!fn)return null;let ht=Pw(h.calendarCustomRootFolder),sn=ht?`${ht}/${gn.momentPattern}`:gn.momentPattern,yr=T(He,sn,Ve,!0);if(!yr.isValid())return null;let Qr=yr.startOf("day");return an(Qr)?.path!==Ne?null:Qr},[fn,h.calendarCustomRootFolder,Kt,Rt,gn.momentPattern,an,T,Ve,m.calendarIntegrationMode]),ge=(0,Je.useCallback)(Se=>{if(!T||m.calendarIntegrationMode!=="notebook-navigator")return null;let Ne=[{kind:"week",enabled:Ke,parseLocale:Ve},{kind:"month",enabled:Be,parseLocale:Ve},{kind:"quarter",enabled:wt,parseLocale:Ve},{kind:"year",enabled:Ct,parseLocale:Ve}];for(let{enabled:He,kind:ht,parseLocale:sn}of Ne){if(!He)continue;let yr=iP(ht,m),Qr=ute({filePath:Se,kind:ht,resolverContext:yr,calendarLocale:Ve,weekLocale:Ve,customCalendarRootFolderSettings:h,momentApi:T,parseLocale:sn});if(Qr)switch(ht){case"week":return{date:Qr.clone().locale(Ve).startOf(Iw(yr.momentPattern)),shouldAutoReveal:oP(ht)};case"month":return{date:Qr.clone().locale(Ce).startOf("month"),shouldAutoReveal:oP(ht)};case"quarter":return{date:Qr.clone().locale(Ce).startOf("quarter"),shouldAutoReveal:oP(ht)};case"year":return{date:Qr.clone().locale(Ce).startOf("year"),shouldAutoReveal:oP(ht)}}}return null},[Ce,T,Ve,m,Ke,Be,wt,Ct,h]),be=(0,Je.useMemo)(()=>{if(!T||!O)return[];let Se=ku(b,1,6),Ne=O.clone().startOf("day"),He=Ne.month(),ht=Ne.year(),{windowStart:sn,weekCount:yr}=$ee({cursor:Ne,weekStartsOn:lt,weeksToShow:Se,alwaysRenderSixWeeks:i}),Qr=[];for(let hi=0;hi{if(!V)return null;for(let Ne of be)for(let He of Ne.days)if(He.file?.path===V)return{date:He.date.clone().startOf("day").locale(Ce),shouldAutoReveal:!0};let Se=Pe(V);return Se?{date:Se,shouldAutoReveal:!0}:ge(V)},[V,Ce,Pe,ge,be]),fe=V&&me?`${V}::${rP(me.date)}`:null;(0,Je.useLayoutEffect)(()=>{if(!me||!fe||!me.shouldAutoReveal){oe.current=null,Z.current=!1;return}if(Z.current){Z.current=!1,oe.current=fe;return}oe.current!==fe&&(oe.current=fe,K(Se=>{let Ne=me.date.clone().startOf("day").locale(Ce);return Se&&Se.year()===Ne.year()&&Se.month()===Ne.month()?Se:Ne}))},[me,fe,Ce]);let we=(0,Je.useMemo)(()=>{let Se=new Set;for(let Ne of be)for(let He of Ne.days)He.file&&Se.add(He.file.path);return Se},[be]),Re=(0,Je.useMemo)(()=>{let Se=new Map;if(!w||!m.calendarShowFeatureImage)return Se;for(let Ne of be)for(let He of Ne.days){let ht=He.file;if(!ht)continue;let sn=w.getFile(ht.path),yr=sn?.featureImageKey??null;(sn?.featureImageStatus??null)==="has"&&yr&&yr!==""&&Se.set(He.iso,yr)}return Se},[w,E,m.calendarShowFeatureImage,be]),nt=(0,Je.useMemo)(()=>{let Se=[];if(!m.calendarShowFeatureImage)return Se;for(let Ne of be)for(let He of Ne.days){if(!He.file)continue;let ht=Re.get(He.iso);ht&&Se.push({id:He.iso,file:He.file,key:ht})}return Se},[Re,m.calendarShowFeatureImage,be]),ct=(0,Je.useMemo)(()=>{let Se=new Map;if(!w)return Se;for(let Ne of be)for(let He of Ne.days)SV(Se,He.iso,He.file,w);return Se},[w,M,be]),yt=i&&m.calendarShowYearCalendar,bn=(0,Je.useMemo)(()=>ku(b,1,6)===6&&yt?6:be.length,[yt,be.length,b]),Kn=Math.max(0,bn-be.length);(0,Je.useLayoutEffect)(()=>{be.length!==0&&t?.(bn)},[t,bn,be.length]);let kr=(0,Je.useMemo)(()=>{if(!m.useFrontmatterMetadata||m.frontmatterNameField.trim().length===0)return new Map;let Se=new Map;for(let Ne of be)for(let He of Ne.days){let ht=He.file;if(!ht)continue;let sn=kz(s,ht,m.frontmatterNameField).trim();sn&&Se.set(ht.path,sn)}return Se},[s,H,m.frontmatterNameField,m.useFrontmatterMetadata,be]);J.current=kr;let Wo=kV({db:w,showFeatureImages:m.calendarShowFeatureImage,targets:nt,maxConcurrentLoads:u?4:6,onMissingFeatureImage:B}),co=(0,Je.useCallback)(Se=>{if(!T)return;qe();let Ne=ku(b,1,6),He=Ne===6?"month":"week",ht=Ne===6?Se:Se*Ne;K(sn=>(sn??T().startOf("day").locale(Ce)).clone().add(ht,He).locale(Ce)),e?.()},[qe,Ce,T,e,b]),wn=(0,Je.useCallback)(Se=>{qe(),X(Ne=>(Ne??O?.year()??T?.().startOf("day").year()??new Date().getFullYear())+Se),e?.()},[qe,O,T,e]),Jt=(0,Je.useCallback)(()=>{let Se=m.multiSelectModifier==="optionAlt"?d.navigationCalendar.helpModal.dateFilterOptionAlt:d.navigationCalendar.helpModal.dateFilterCmdCtrl;new Nf(s,{title:d.navigationCalendar.helpModal.title,items:[...d.navigationCalendar.helpModal.items,Se]}).open()},[s,m.multiSelectModifier]),$n=(0,Je.useCallback)((Se,Ne,He)=>{if(!r||!Yee(Se,m.multiSelectModifier,u))return!1;let ht=qee(Ne,He);return ht?(Se.preventDefault(),Se.stopPropagation(),qe(),r(ht),!0):!1},[qe,r,m.multiSelectModifier,u]),Xn=(0,Je.useCallback)((Se,Ne)=>{$n(Se,"month",Ne)||(qe(),K(Ne.clone().startOf("day").locale(Ce)),X(Ne.year()),e?.())},[qe,Ce,$n,e]),Zn=(0,Je.useCallback)(()=>{se()},[se]),Ir=(0,Je.useCallback)(async(Se,Ne)=>{await g(He=>{let ht=De(He.calendarMonthHighlights,Ln);ht[Se]=Ne,He.calendarMonthHighlights=ht})},[g]),Jn=(0,Je.useCallback)(async Se=>{await g(Ne=>{let He=De(Ne.calendarMonthHighlights,Ln);delete He[Se],Ne.calendarMonthHighlights=He})},[g]),er=m.calendarShowFeatureImage&&yt,{getExistingCustomCalendarNoteFile:On,openOrCreateCustomCalendarNote:Ro,openOrCreateDailyNote:je,showCalendarNoteContextMenu:rt}=yte({app:s,commandQueue:l,fileSystemOps:c,isMobile:u,settings:m,dailyNoteSettings:Kt,momentApi:T,dailyNoteLocale:Rt,calendarLocale:Ve,weekLocale:Ve,customCalendarRootFolderSettings:h,openFile:F,clearHoverTooltip:qe,onVaultChange:Zn,showMonthHighlightActions:er,setCalendarMonthHighlight:Ir,removeCalendarMonthHighlight:Jn}),Et=(0,Je.useCallback)(()=>{if(!T)return;let Se=T().startOf("day").locale(Ce);qe(),K(Se.clone()),e?.();let Ne=an(Se);Ne&&je(Se,Ne)},[qe,Ce,an,T,e,je]),Xe=m.calendarShowWeekNumber,Ht=m.calendarHighlightToday,vn=i&&yt,it=!i||!yt,Yt=m.showInfoButtons&&!u&&vn,fr=!1,Do=vn&&m.calendarShowQuarter,ba=!vn,nl=!0,Cc=Yt,Sa=!1,So=G??O?.year()??null,qa=(0,Je.useMemo)(()=>{if(!T||So===null||!yt)return[];let Se=[];for(let Ne=0;Ne<12;Ne++){let He=T(new Date(So,Ne,1)).startOf("day").locale(Ce),ht=new Date(So,Ne+1,0).getDate(),sn=[];for(let yr=1;yr<=ht;yr++){let Qr=He.clone().set({date:yr}),hi=an(Qr);hi&&sn.push(hi)}Se.push({date:He,dayFiles:sn,fullLabel:He.format("MMMM"),hasDailyNote:sn.length>0,key:He.format("YYYY-MM"),monthIndex:Ne,shortLabel:He.format("MMM")})}return Se},[Ce,So,an,T,yt,A]),Iu=(0,Je.useMemo)(()=>qa.map(Se=>({date:Se.date,fullLabel:Se.fullLabel,hasDailyNote:Se.hasDailyNote,hasUnfinishedTasks:w?Se.dayFiles.some(Ne=>(w.getFile(Ne.path)?.taskUnfinished??0)>0):!1,key:Se.key,monthIndex:Se.monthIndex,shortLabel:Se.shortLabel})),[w,M,qa]),Ul=(0,Je.useMemo)(()=>{let Se=new Map;if(!T||!yt)return Se;for(let Ne of qa){let He=m.calendarMonthHighlights[Ne.key]??null;if(He){let ht=T(He,"YYYY-MM-DD",!0);if(ht.isValid()&&ht.format("YYYY-MM")===Ne.key){let sn=an(ht.startOf("day"));sn&&Se.set(Ne.key,sn)}continue}if(Ne.hasDailyNote&&w)for(let ht of Ne.dayFiles){let sn=w.getFile(ht.path),yr=sn?.featureImageKey??null;if(!((sn?.featureImageStatus??null)!=="has"||!yr||yr==="")){Se.set(Ne.key,ht);break}}}return Se},[w,E,an,T,m.calendarMonthHighlights,yt,qa]),Ya=(0,Je.useMemo)(()=>{let Se=[];return!w||!m.calendarShowFeatureImage||Ul.forEach((Ne,He)=>{let ht=w.getFile(Ne.path),sn=ht?.featureImageKey??null;(ht?.featureImageStatus??null)!=="has"||!sn||sn===""||Se.push({id:He,file:Ne,key:sn})}),Se},[w,E,Ul,m.calendarShowFeatureImage]);(0,Je.useEffect)(()=>{let Se=new Set;for(let He of[...nt,...Ya]){let ht=TV(He.file.path,He.key);ht&&Se.add(ht)}let Ne=re.current;for(let He of Ne)Se.has(He)||Ne.delete(He)},[nt,Ya]);let Md=(0,Je.useMemo)(()=>{let Se=new Set;return Ya.forEach(Ne=>{Se.add(Ne.id)}),Se},[Ya]),$p=(0,Je.useMemo)(()=>{let Se=new Set;return Ul.forEach(Ne=>{Se.add(Ne.path)}),Se},[Ul]),$a=kV({db:w,showFeatureImages:m.calendarShowFeatureImage&&yt,targets:Ya,maxConcurrentLoads:u?2:4,onMissingFeatureImage:B}),vr=(0,Je.useMemo)(()=>!T||!O||So===null?null:O.clone().set({year:So}).locale(Ce),[O,Ce,So,T]),jo=(0,Je.useMemo)(()=>{if(!T||!O)return{month:null,quarter:null,year:null};let Se=O.clone().locale(Ce),Ne=Be?On("month",Se):null,He=Ct?On("year",Se):null,ht=m.calendarShowQuarter&&wt?On("quarter",Se):null;return{month:Ne,quarter:ht,year:He}},[O,Ce,On,T,Be,wt,m.calendarShowQuarter,A,Ct]),Xr=(0,Je.useCallback)(Se=>{switch(Se){case"month":return{existingFile:jo.month,canCreate:Be};case"quarter":return{existingFile:jo.quarter,canCreate:m.calendarShowQuarter&&wt};case"year":return{existingFile:jo.year,canCreate:Ct}}},[jo.month,jo.quarter,jo.year,Be,wt,m.calendarShowQuarter,Ct]),Wr=(0,Je.useCallback)((Se,Ne)=>{if(!O)return;let He=O.clone().locale(Ce);if($n(Se,Ne,He))return;let{existingFile:ht,canCreate:sn}=Xr(Ne);sn&&Ro(Ne,He,ht)},[O,Ce,Xr,$n,Ro]),Nc=(0,Je.useCallback)((Se,Ne)=>{if(!O)return;let{existingFile:He,canCreate:ht}=Xr(Ne);rt(Se,{kind:Ne,date:O.clone().locale(Ce),existingFile:He,canCreate:ht})},[O,Ce,Xr,rt]),pi=(0,Je.useMemo)(()=>!vr||!Ct?null:On("year",vr),[On,A,Ct,vr]),Xp=(0,Je.useCallback)(Se=>{vr&&($n(Se,"year",vr)||Ct&&Ro("year",vr,pi))},[$n,Ro,Ct,vr,pi]),Qp=(0,Je.useCallback)(Se=>{vr&&rt(Se,{kind:"year",date:vr,existingFile:pi,canCreate:Ct})},[rt,Ct,vr,pi]),Ns=(0,Je.useMemo)(()=>{if(!T||!O)return new Map;if(!Xe||!Ke)return new Map;let Se=new Map;for(let Ne of be){let He=Ne.days[0]?.date;if(!He)continue;let ht=He.clone().locale(Ce),sn=On("week",ht);Se.set(Ne.key,sn)}return Se},[O,Ce,On,T,Xe,A,Ke,be]),Yg=(0,Je.useMemo)(()=>{if(!w)return new Map;let Se=new Map;return Ns.forEach((Ne,He)=>{SV(Se,He,Ne,w)}),Se},[w,M,Ns]),Qi=(0,Je.useMemo)(()=>{let Se=new Map;for(let Ne of be)for(let He of Ne.days)He.file&&Se.set(He.file.path,He.file);Ns.forEach(Ne=>{Ne&&Se.set(Ne.path,Ne)});for(let Ne of qa)for(let He of Ne.dayFiles)Se.set(He.path,He);return Array.from(Se.values()).filter(Ne=>Ne.extension==="md")},[Ns,be,qa]);(0,Je.useEffect)(()=>{a?.(Qi)},[a,Qi]);let Zp=(0,Je.useMemo)(()=>{let Se=new Set;return Qi.forEach(Ne=>{Se.add(Ne.path)}),Se},[Qi]);ee.current=Zp;let Jp=(0,Je.useMemo)(()=>{let Se=new Set(we);return $p.forEach(Ne=>{Se.add(Ne)}),Se},[$p,we]);$.current=Jp,j.current=we;let xu=(0,Je.useCallback)((Se,Ne,He)=>{let ht=Ne.days[0]?.date;if(!ht)return;let sn=ht.clone().locale(Ce);$n(Se,"week",sn)||Ke&&Ro("week",sn,He)},[Ce,$n,Ro,Ke]),mi=(0,Je.useCallback)((Se,Ne)=>{let He=Ne.days[0]?.date;He&&$n(Se,"week",He.clone().locale(Ce))},[Ce,$n]),Ic=(0,Je.useCallback)((Se,Ne,He)=>{let ht=Ne.days[0]?.date;ht&&rt(Se,{kind:"week",date:ht.clone().locale(Ce),existingFile:He,canCreate:Ke})},[Ce,rt,Ke]),Rd=(0,Je.useCallback)((Se,Ne)=>{$n(Se,"day",Ne.date)||je(Ne.date,Ne.file)},[$n,je]),Dd=(0,Je.useCallback)((Se,Ne,He)=>{let ht=Ne.date.format("YYYY-MM");rt(Se,{kind:"day",date:Ne.date,existingFile:Ne.file,canCreate:He,monthKey:ht,dayIso:Ne.iso,hasFeatureImage:Re.has(Ne.iso),currentMonthHighlightDayIso:m.calendarMonthHighlights[ht]??null})},[Re,m.calendarMonthHighlights,rt]);if(!T||!O)return null;let Is=O.year(),xs=L?L.slice(0,7):null,Ao=O.clone().locale(Ce),Kl=m.calendarMonthHeadingFormat==="short"?"MMM":"MMMM",$g=Ao.format(Kl),gi=Ao.format("YYYY"),em=Ao.format("[Q]Q"),Zi=m.calendarIntegrationMode!=="daily-notes"||!!Kt,tm=!!(V&&jo.month?.path===V),nm=!!(V&&jo.quarter?.path===V),rm=!!(V&&jo.year?.path===V),Es=!!(V&&pi?.path===V);return(0,yc.jsxs)(yc.Fragment,{children:[(0,yc.jsx)(ote,{isMobile:u,hoverTooltip:ie,hoverTooltipStyle:le,hoverTooltipRef:Te,hoverTooltipPreviewText:Fe,shouldShowHoverTooltipPreview:te,hoverTooltipDateText:pe}),(0,yc.jsxs)("div",{className:"nn-navigation-calendar",role:"group","aria-labelledby":P,"data-highlight-today":Ht?"true":void 0,"data-weeknumbers":Xe?"true":void 0,"data-split-header":"true",children:[(0,yc.jsx)("span",{id:P,className:"nn-visually-hidden",children:d.navigationCalendar.ariaLabel}),(0,yc.jsx)(ete,{monthLabel:$g,yearLabel:gi,quarterLabel:em,showYearInHeader:it,showQuarter:m.calendarShowQuarter,hasMonthPeriodNote:!!jo.month,hasQuarterPeriodNote:!!jo.quarter,hasYearPeriodNote:!!jo.year,isMonthPeriodActive:tm,isQuarterPeriodActive:nm,isYearPeriodActive:rm,showInlineMonthNavigation:fr,showCompactQuarterInMonthRow:Do,showHeaderPeriodDetails:ba,showHeaderNavRow:nl,showCompactHeaderInlineInfoButton:Cc,showInfoInNavRow:Sa,onNavigate:co,onToday:Et,onOpenHelp:Jt,onPeriodClick:Wr,onPeriodContextMenu:Nc}),(0,yc.jsx)(Qee,{activeEditorFilePath:V,showWeekNumbers:Xe,weekdays:Zt,weekStartsOn:lt,trailingSpacerWeekCount:Kn,weeks:be,weekNotesEnabled:Ke,weekNoteFilesByKey:Ns,weekUnfinishedTaskCountByKey:Yg,displayLocale:Ce,calendarWeekendDays:m.calendarWeekendDays,todayIso:L,unfinishedTaskCountByIso:ct,featureImageUrls:Wo,featureImageKeysByIso:Re,frontmatterTitlesByPath:kr,dateFormat:m.dateFormat,isMobile:u,canCreateDayNotes:Zi,onShowTooltip:ve,onHideTooltip:Ie,onDayClick:Rd,onDayContextMenu:Dd,onWeekClick:xu,onWeekLabelClick:mi,onWeekContextMenu:Ic}),(0,yc.jsx)(ste,{showYearCalendar:yt,currentMonthKey:xs,displayedYearValue:So??Is,activeYearValue:Is,activeMonthIndex:O.month(),hasYearPeriodNote:!!pi,isYearPeriodActive:Es,yearMonthEntries:Iu,highlightedMonthFeatureImageKeys:Md,highlightedMonthImageUrls:$a,onNavigateYear:wn,onYearPeriodClick:Xp,onYearPeriodContextMenu:Qp,onSelectYearMonth:Xn})]})]})}var Je,Ol,yc,Tte=U(()=>{Je=ue(ze()),Ol=require("obsidian");Ee();qR();mn();on();Xi();zn();ot();Xl();pk();Bd();Jb();xH();rk();Xl();dn();qM();Zee();tte();ate();lte();wV();YR();gte();vte();bte();Ot();yc=ue(Ge())});var lP=U(()=>{Tte()});var wS,sFe,kte,lFe,dFe,QR,Fte=U(()=>{wS=require("obsidian");KF();Rn();sFe=20,kte=/^[a-z0-9:./-]*$/i,lFe=/^[a-z0-9:./-]*/i,dFe=t=>t?/\s/.test(t)||t==="!":!0,QR=class extends wS.AbstractInputSuggest{constructor(n,r,o){super(n,r);this.activeRange=null;this.applySuggestion=o.onApply,this.searchInputEl=r,this.limit=sFe,this.isMobile=o.isMobile}getSuggestions(n){let r=this.resolveActiveRange();if(!r)return this.activeRange=null,[];this.activeRange=r;let o=r.query.trim();if(!o)return nS.slice(0,this.limit).map(s=>({token:s,match:null}));let a=(0,wS.prepareFuzzySearch)(o),i=[];for(let s of nS){let l=a(s);l&&i.push({token:s,match:l})}return i.sort((s,l)=>{let c=s.match?.score??Number.POSITIVE_INFINITY,u=l.match?.score??Number.POSITIVE_INFINITY;return c===u?Mt(s.token,l.token):c-u}),i.slice(0,this.limit)}renderSuggestion(n,r){r.addClass("nn-search-tag-suggestion");let o=r.createDiv({cls:"nn-search-tag-suggestion__label"});o.createSpan({cls:"nn-search-tag-suggestion__prefix",text:"@"});let a=o.createSpan({cls:"nn-search-tag-suggestion__text"});n.match&&n.match.matches.length>0?(0,wS.renderMatches)(a,n.token,n.match.matches):a.setText(n.token)}selectSuggestion(n){if(!this.activeRange){this.close();return}let{start:r,end:o,prefix:a}=this.activeRange,i=this.searchInputEl.value,s=i.substring(0,r),l=i.substring(o),c=`@${a}${n.token}`,u=`${s}${c}${l}`,p=r+c.length;this.applySuggestion(u,p),this.close()}dispose(){this.close()}onOpen(){if(this.isMobile){if(!this.containerEl){console.error("[SearchDateInputSuggest] containerEl missing on open");return}this.containerEl.addClass("nn-mobile")}}resolveActiveRange(){let n=this.searchInputEl,r=n.value;if(!r)return null;let o=n.selectionStart??r.length,a=n.selectionEnd??o;if(o!==a)return null;let i=r.lastIndexOf("@",o-1);if(i===-1)return null;if(i>0){let g=r.charAt(i-1);if(!dFe(g))return null}let s=r.slice(i+1,o);if(!kte.test(s))return null;let c=r.slice(o).match(lFe)?.[0]??"",u=s+c;if(!kte.test(u))return null;let{prefix:p,remainder:m}=BF(u);return{start:i,end:o+c.length,prefix:p,query:m}}}});var TS,cFe,Pte,uFe,ZR,Cte=U(()=>{TS=require("obsidian");Rn();Sn();cFe=50,Pte=new RegExp(`^[^${Ch}]*$`,"u"),uFe=new RegExp(`^[^${Ch}]*`,"u"),ZR=class extends TS.AbstractInputSuggest{constructor(n,r,o){super(n,r);this.activeRange=null;this.getTags=o.getTags,this.applySuggestion=o.onApply,this.searchInputEl=r,this.limit=cFe,this.isMobile=o.isMobile}getSuggestions(n){let r=this.resolveActiveRange();if(!r)return this.activeRange=null,[];this.activeRange=r;let o=this.getTags();if(o.length===0)return[];if(r.query.length===0)return o.slice(0,this.limit).map(s=>({displayPath:s.displayPath,match:null}));let a=(0,TS.prepareFuzzySearch)(r.query),i=[];for(let s of o){let l=a(s.displayPath);l&&i.push({displayPath:s.displayPath,match:l})}return i.sort((s,l)=>{let c=s.match?.score??Number.POSITIVE_INFINITY,u=l.match?.score??Number.POSITIVE_INFINITY;return c===u?Mt(s.displayPath,l.displayPath):c-u}),i.slice(0,this.limit)}renderSuggestion(n,r){r.addClass("nn-search-tag-suggestion");let o=r.createDiv({cls:"nn-search-tag-suggestion__label"});o.createSpan({cls:"nn-search-tag-suggestion__prefix",text:"#"});let a=o.createSpan({cls:"nn-search-tag-suggestion__text"});n.match&&n.match.matches.length>0?(0,TS.renderMatches)(a,n.displayPath,n.match.matches):a.setText(n.displayPath)}selectSuggestion(n){if(!this.activeRange){this.close();return}let{start:r,end:o}=this.activeRange,a=this.searchInputEl.value,i=a.substring(0,r),s=a.substring(o),l=`#${n.displayPath}`,c=`${i}${l}${s}`,u=r+l.length;this.applySuggestion(c,u),this.close()}dispose(){this.close()}onOpen(){if(this.isMobile){if(!this.containerEl){console.error("[SearchTagInputSuggest] containerEl missing on open");return}this.containerEl.addClass("nn-mobile")}}resolveActiveRange(){let n=this.searchInputEl,r=n.value;if(!r)return null;let o=n.selectionStart??r.length,a=n.selectionEnd??o;if(o!==a)return null;let i=r.lastIndexOf("#",o-1);if(i===-1)return null;if(i>0){let p=r.charAt(i-1);if(p&&!fN(p))return null}let s=r.slice(i+1,o);if(!Pte.test(s))return null;let c=r.slice(o).match(uFe)?.[0]??"",u=s+c;return Pte.test(u)?{start:i,end:o+c.length,query:u}:null}}});function Nte({searchQuery:t,onSearchQueryChange:e,onClose:n,onFocusFiles:r,shouldFocus:o,onFocusComplete:a,containerRef:i,onSaveShortcut:s,onRemoveShortcut:l,isShortcutSaved:c,isShortcutDisabled:u,searchProvider:p}){let m=(0,Ci.useRef)(null),g=(0,Ci.useRef)(null),f=(0,Ci.useRef)(null),{isMobile:h,omnisearchService:b,app:v,tagTreeService:y,plugin:S}=gt(),w=pt(),k=Yn(),F=Vr(),P=p??w.searchProvider??"internal",T=b?.isAvailable()??!1,I=P==="omnisearch"&&T,N=(0,Ci.useMemo)(()=>Qe(w.interfaceIcons,"nav-shortcuts"),[w.interfaceIcons]),O=(0,Ci.useMemo)(()=>I?"text-search":Qe(w.interfaceIcons,"list-search"),[I,w.interfaceIcons]),K=I?d.searchInput.placeholderOmnisearch:d.searchInput.placeholder,G=t.trim().length>0,X=G&&!!(s||c&&l),L=u||!c&&!s||c&&!l,V=`nn-search-input-container${X?" nn-search-input-container--has-shortcut":""}`,D=(0,Ci.useCallback)(x=>{let z=m.current;if(!z)return;z.focus();let H=x?.start??z.selectionStart,Y=x?.end??z.selectionEnd;H!==null&&Y!==null&&z.setSelectionRange(H,Y)},[]),A=(0,Ci.useCallback)(x=>{if(!T)return;let z=m.current,H=z?{start:z.selectionStart,end:z.selectionEnd}:void 0;S.setSearchProvider(I?"internal":"omnisearch"),x?.restoreFocus&&window.requestAnimationFrame(()=>D(H))},[T,I,S,D]);(0,Ci.useEffect)(()=>{o&&(m.current?.focus(),a&&a())},[o,a]);let _=(0,Ci.useCallback)((x,z)=>{e(x),window.requestAnimationFrame(()=>{let H=m.current;H&&(H.focus(),H.setSelectionRange(z,z))})},[e]);(0,Ci.useEffect)(()=>{let x=m.current;if(!x||!y||!w.showTags||I){g.current?.dispose(),g.current=null;return}if(g.current)return;let z=new ZR(v,x,{getTags:()=>y.getFlattenedTagNodes()??[],onApply:_,isMobile:h});return g.current=z,()=>{z.dispose(),g.current=null}},[v,y,w.showTags,I,_,h]),(0,Ci.useEffect)(()=>{let x=m.current;if(!x||I){f.current?.dispose(),f.current=null;return}if(f.current)return;let z=new QR(v,x,{onApply:_,isMobile:h});return f.current=z,()=>{z.dispose(),f.current=null}},[v,_,h,I]),(0,Ci.useEffect)(()=>{t.trim().length>0||(g.current?.close(),f.current?.close())},[t]);let E=()=>{window.setTimeout(()=>{let z=(i?.current??activeDocument).querySelector(".nn-list-pane-scroller");z instanceof HTMLElement&&Di(z)},0)},R=x=>{let z=x.nativeEvent,H=w.keyboardShortcuts;if(!(z.isComposing||z.keyCode===229)){if((x.key==="ArrowUp"||x.key==="ArrowDown")&&T){if(z.repeat||!!(g.current?.containerEl?.isConnected||f.current?.containerEl?.isConnected))return;x.preventDefault(),A({restoreFocus:!0});return}if(un(z,H,Ft.SEARCH_CLOSE)){x.preventDefault(),n(),F({type:"SET_FOCUSED_PANE",pane:"files"}),E();return}if(un(z,H,Ft.SEARCH_FOCUS_NAVIGATION)){!k.singlePane&&!h&&(x.preventDefault(),F({type:"SET_FOCUSED_PANE",pane:"navigation"}));return}if(un(z,H,Ft.SEARCH_FOCUS_LIST)){if(x.preventDefault(),F({type:"SET_FOCUSED_PANE",pane:"files"}),h){F({type:"SET_SINGLE_PANE_VIEW",view:"files"}),E();return}r&&r(),E()}}},M=()=>{F({type:"SET_FOCUSED_PANE",pane:"search"})},C=(0,Ci.useCallback)(()=>{g.current?.close(),f.current?.close();let{fileNames:x,tags:z,properties:H,tasks:Y,connectors:ee,dates:$,omnisearch:j}=d.searchInput.searchHelpModal.sections,J=Object.prototype.hasOwnProperty.call(d.searchInput.searchHelpModal.sections,"properties")?H:void 0,re=[x,J,z,$,Y,ee,j].filter(oe=>!!oe);new Nf(v,{title:d.searchInput.searchHelpTitle,intro:d.searchInput.searchHelpModal.intro,emphasizedIntro:d.searchInput.searchHelpModal.introSwitching,sections:re}).open()},[v]);return(0,Ll.jsx)("div",{className:"nn-search-input-wrapper",children:(0,Ll.jsxs)("div",{className:V,children:[(0,Ll.jsx)("div",{className:"nn-search-input-icon",role:"button",tabIndex:T?0:-1,"aria-label":I?d.searchInput.switchToFilterSearch:d.searchInput.switchToOmnisearch,style:T?void 0:{pointerEvents:"none"},onMouseDown:T?x=>{x.preventDefault()}:void 0,onClick:T?()=>A({restoreFocus:!0}):void 0,onKeyDown:T?x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),A({restoreFocus:!0}))}:void 0,children:(0,Ll.jsx)(Qt,{iconId:O,"aria-hidden":!0})}),(0,Ll.jsx)("input",{ref:m,type:"search",className:`nn-search-input ${t?"nn-search-active":""}`,placeholder:K,spellCheck:!1,enterKeyHint:"search",value:t,onChange:x=>e(x.target.value),onKeyDown:R,onClick:M}),!G&&w.showInfoButtons&&(0,Ll.jsx)("div",{className:"nn-search-help-button",role:"button",tabIndex:0,"aria-label":d.searchInput.searchHelp,onClick:()=>{C()},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),C())},children:(0,Ll.jsx)(Qt,{iconId:"info","aria-hidden":!0})}),X&&(0,Ll.jsx)("div",{className:`nn-search-star-button ${c?"nn-search-star-button--active":""}`,role:"button",tabIndex:0,"aria-label":c?d.searchInput.removeSearchShortcut:d.searchInput.saveSearchShortcut,"aria-pressed":c||!1,onClick:()=>{if(L)return;let x=c?l:s;x&&Q(x),m.current?.focus()},onKeyDown:x=>{if((x.key==="Enter"||x.key===" ")&&!L){x.preventDefault();let z=c?l:s;z&&Q(z),m.current?.focus()}},children:(0,Ll.jsx)(Qt,{iconId:N,"aria-hidden":!0})}),G&&(0,Ll.jsx)("div",{className:"nn-search-clear-button",role:"button",tabIndex:0,"aria-label":d.searchInput.clearSearch,onClick:()=>{e(""),m.current?.focus()},onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),e(""),m.current?.focus())},children:(0,Ll.jsx)(Qt,{iconId:"circle-x","aria-hidden":!0})})]})})}var Ci,Ll,Ite=U(()=>{Ci=ue(ze());Al();pa();on();mn();Ee();rh();ot();Fte();Cte();pr();qR();os();Ll=ue(Ge())});function xte({desktopTitle:t}){let{app:e,isMobile:n,plugin:r}=gt(),o=qs(),a=pt(),i=ar(),s=i.selectionType===W.FOLDER?i.selectedFolder:null,l=bS(e.vault,s,a.enableFolderNotes&&a.enableFolderNoteLinks),c=(0,cP.useMemo)(()=>!s||!a.enableFolderNotes||!a.enableFolderNoteLinks?null:Pn(s,{enableFolderNotes:a.enableFolderNotes,folderNoteName:a.folderNoteName,folderNoteNamePattern:a.folderNoteNamePattern}),[s,a.enableFolderNotes,a.enableFolderNoteLinks,a.folderNoteName,a.folderNoteNamePattern,l]),u=(0,cP.useCallback)(m=>{if(!s||!c)return;m.stopPropagation();let g=Hc(m,a.folderNoteOpenLocation,a.multiSelectModifier,n);Q(()=>ri({app:e,commandQueue:o,folder:s,folderNote:c,context:g,openInRightSidebar:f=>r.openFolderNoteInRightSidebar(f)}))},[s,c,a.folderNoteOpenLocation,a.multiSelectModifier,n,e,o,r]),p=(0,cP.useCallback)(m=>{m.button!==1||!s||!c||(m.preventDefault(),m.stopPropagation(),Q(()=>ri({app:e,commandQueue:o,folder:s,folderNote:c,context:"tab"})))},[s,c,e,o]);return(0,dP.jsx)("div",{className:"nn-list-title-area",children:(0,dP.jsx)("div",{className:"nn-list-title-content",children:(0,dP.jsx)("span",{className:"nn-list-title-text",children:(0,dP.jsx)("span",{className:`nn-list-title-label${c?" nn-list-title-label--folder-note":""}`,onClick:c?u:void 0,onMouseDown:c?p:void 0,children:t})})})})}var cP,dP,Ete=U(()=>{cP=ue(ze());Ur();mn();on();GR();Ue();ot();Jc();td();dP=ue(Ge())});function xf(t){let{model:e,folderPath:n,color:r,backgroundColor:o}=t;if(e.isExcludedPath(n))return{color:r??void 0,backgroundColor:o??void 0};let a=t$({mode:e.navRainbowMode,folderPath:n,scope:e.folderRainbowScope,showRootFolder:e.showRootFolder,colors:e.folderRainbowColors,color:r,backgroundColor:o});return{color:a.color,backgroundColor:a.backgroundColor}}var JR=U(()=>{Gm()});function pFe(t,e,n){return n?.startsWith("created-")?`${d.tooltips.createdAt} ${t}
${d.tooltips.lastModifiedAt} ${e}`:`${d.tooltips.lastModifiedAt} ${e}
${d.tooltips.createdAt} ${t}`}function uP({file:t,displayName:e,extensionSuffix:n,settings:r,getFileTimestamps:o,sortOption:a,unfinishedTaskTooltipText:i,wordCount:s}){let l=r.timeFormat?`${r.dateFormat} ${r.timeFormat}`:r.dateFormat,c=o(t),u=zr.formatDate(c.created,l),p=zr.formatDate(c.modified,l),g=[n.length>0?t.name:e];return r.showTooltipPath&&g.push(t.parent?.path??"/"),i&&g.push(i),r.showTooltipWordCount&&t.extension==="md"&&typeof s=="number"&&Number.isFinite(s)&&s>=0&&g.push(`${d.tooltips.wordCount}: ${id(s)}`),g.push("",pFe(u,p,a)),g.join(`
`)}function tD({app:t,folder:e,displayName:n,fileVisibility:r,hiddenFolders:o,settings:a,showHiddenItems:i}){let s=0,l=0,c=ng(a,i),u=po(c);for(let f of e.children)f instanceof eD.TFile?rl(f,r,t)&&!Xo(f,u,t)&&s++:f instanceof eD.TFolder&&(i||!qd(f.name,o,f.path))&&l++;let p=s===1?`${s} ${d.tooltips.file}`:`${s} ${d.tooltips.files}`,m=l===1?`${l} ${d.tooltips.folder}`:`${l} ${d.tooltips.folders}`,g=`${p}, ${m}`;return e.path==="/"?g:`${n}
${g}`}var eD,nD=U(()=>{eD=require("obsidian");Ee();Zl();qy();Yr();Mr();Am()});function gFe(t,e){if(!t||typeof e!="number"||!Number.isFinite(e)||e<=0)return t;let n=t.indexOf("#"),r=n===-1?t:t.slice(0,n),o=n===-1?"":t.slice(n),a=r.includes("?")?"&":"?";return`${r}${a}${mFe}=${Math.trunc(e)}${o}`}function pP(t,e,n=e.stat.mtime){return gFe(t.vault.getResourcePath(e),n)}var mFe,FV=U(()=>{mFe="nn-mtime"});function fFe(t){let{db:e,filePath:n,loadSnapshot:r,applySnapshot:o,onChange:a}=t,i=e.onFileContentChange(n,a);return o(r()),i}function vFe({changes:t,shouldLoadFeatureImage:e,refreshMetadataVersionOnFeatureImageChange:n}){return t.metadata!==void 0?!0:(t.featureImageKey!==void 0||t.featureImageStatus!==void 0)&&!e&&n}function Mte(t){return{loadPreviewText:t?.loadPreviewText??!0,loadTags:t?.loadTags??!0,loadFeatureImage:t?.loadFeatureImage??!0,loadProperties:t?.loadProperties??!0,loadWordCount:t?.loadWordCount??!0,loadCharacterCount:t?.loadCharacterCount??!0,loadTaskUnfinished:t?.loadTaskUnfinished??!0}}function yFe({app:t,file:e,showPreview:n,showImage:r,skipFeatureImage:o,fileStatMtime:a=e.stat.mtime,db:i,loadOptions:s}){let{loadPreviewText:l,loadTags:c,loadFeatureImage:u,loadProperties:p,loadWordCount:m,loadCharacterCount:g,loadTaskUnfinished:f}=Mte(s),h=c||u||p||m||g||f,b=l&&n&&e.extension==="md"?i.getCachedPreviewText(e.path):"",v=h?i.getFile(e.path):null,y=c?[...Pr({app:t,file:e,db:i,fileData:v})]:[],S=u&&r&&!o&&Ms(e),w=u&&v?.featureImageKey?v.featureImageKey:S?`direct-image:${e.path}@${a}`:null,k=u?v?.featureImageStatus??"unprocessed":"unprocessed",F=p?Xw(v?.properties??null):null,P=m?v?.wordCount??null:null,T=g?v?.characterCountWithSpaces??null:null,I=g?v?.characterCountWithoutSpaces??null:null,N=f?v?.taskUnfinished??null:null,O=null;if(S)try{O=pP(t,e,a)}catch{O=null}return{previewText:b,tags:y,featureImageKey:w,featureImageStatus:k,featureImageUrl:O,properties:F,wordCount:P,characterCountWithSpaces:T,characterCountWithoutSpaces:I,taskUnfinished:N}}function Rte({app:t,file:e,showPreview:n,showImage:r,skipFeatureImage:o=!1,fileStatMtime:a=e.stat.mtime,getDB:i,regenerateFeatureImageForFile:s,loadOptions:l,refreshMetadataVersionOnFeatureImageChange:c=!1}){let u=l?.loadPreviewText,p=l?.loadTags,m=l?.loadFeatureImage,g=l?.loadProperties,f=l?.loadWordCount,h=l?.loadCharacterCount,b=l?.loadTaskUnfinished,v=(0,so.useMemo)(()=>Mte({loadPreviewText:u,loadTags:p,loadFeatureImage:m,loadProperties:g,loadWordCount:f,loadCharacterCount:h,loadTaskUnfinished:b}),[h,m,u,g,p,b,f]),{loadPreviewText:y,loadTags:S,loadFeatureImage:w,loadProperties:k,loadWordCount:F,loadCharacterCount:P,loadTaskUnfinished:T}=v,I=(0,so.useCallback)(()=>yFe({app:t,file:e,showPreview:n,showImage:r,skipFeatureImage:o,fileStatMtime:a,db:i(),loadOptions:v}),[t,e,a,i,v,r,n,o]),N=(0,so.useRef)(null),O=N.current??I();N.current=O;let[K,G]=(0,so.useState)(O.previewText),[X,L]=(0,so.useState)(O.tags),[V,D]=(0,so.useState)(O.featureImageKey),[A,_]=(0,so.useState)(O.featureImageStatus),[E,R]=(0,so.useState)(O.featureImageUrl),[M,C]=(0,so.useState)(O.properties),[x,z]=(0,so.useState)(O.wordCount),[H,Y]=(0,so.useState)(O.characterCountWithSpaces),[ee,$]=(0,so.useState)(O.characterCountWithoutSpaces),[j,J]=(0,so.useState)(O.taskUnfinished),[re,oe]=(0,so.useState)(0),Z=(0,so.useRef)(O.properties),ce=(0,so.useRef)(null),ae=(0,so.useRef)(null);return(0,so.useLayoutEffect)(()=>{let se=i(),ne=fFe({db:se,filePath:e.path,loadSnapshot:I,applySnapshot:B=>{G(q=>q===B.previewText?q:B.previewText),L(q=>go(q,B.tags)?q:B.tags),D(q=>q===B.featureImageKey?q:B.featureImageKey),_(q=>q===B.featureImageStatus?q:B.featureImageStatus),wh(Z.current,B.properties)||(Z.current=B.properties,C(B.properties)),z(q=>q===B.wordCount?q:B.wordCount),Y(q=>q===B.characterCountWithSpaces?q:B.characterCountWithSpaces),$(q=>q===B.characterCountWithoutSpaces?q:B.characterCountWithoutSpaces),J(q=>q===B.taskUnfinished?q:B.taskUnfinished)},onChange:B=>{let q=vFe({changes:B,shouldLoadFeatureImage:w,refreshMetadataVersionOnFeatureImageChange:c});if(B.preview!==void 0&&y&&n&&e.extension==="md"){let ie=B.preview||"";G(le=>le===ie?le:ie)}if(B.featureImageKey!==void 0&&w&&D(ie=>ie===B.featureImageKey?ie:B.featureImageKey??null),B.featureImageStatus!==void 0&&w){let ie=B.featureImageStatus;_(le=>le===ie?le:ie)}if(B.tags!==void 0&&S){let ie=[...B.tags??[]];L(le=>go(le,ie)?le:ie)}if(B.wordCount!==void 0&&F){let ie=B.wordCount??null;z(le=>le===ie?le:ie)}if(B.characterCountWithSpaces!==void 0&&P){let ie=B.characterCountWithSpaces??null;Y(le=>le===ie?le:ie)}if(B.characterCountWithoutSpaces!==void 0&&P){let ie=B.characterCountWithoutSpaces??null;$(le=>le===ie?le:ie)}if(B.taskUnfinished!==void 0&&T){let ie=B.taskUnfinished??null;J(le=>le===ie?le:ie)}if(B.properties!==void 0&&k){let ie=Xw(B.properties??null);wh(Z.current,ie)||(Z.current=ie,C(ie))}q&&oe(ie=>ie+1)}});return y&&n&&e.extension==="md"&&se.ensurePreviewTextLoaded(e.path),()=>{ne()}},[e,e.path,i,I,P,w,y,k,S,T,F,c,n]),(0,so.useEffect)(()=>()=>{ce.current&&(URL.revokeObjectURL(ce.current),ce.current=null)},[]),(0,so.useEffect)(()=>{let se=!0;if(ce.current&&(URL.revokeObjectURL(ce.current),ce.current=null),!w||!r||o)return R(null),()=>{se=!1};if(Ms(e)){try{R(pP(t,e,a))}catch{R(null)}return()=>{se=!1}}if(A!=="has"||!V)return R(null),()=>{se=!1};let ne=i(),B=V;return ne.getFeatureImageBlob(e.path,B).then(q=>{if(!se)return;if(!q){R(null);let le=Date.now(),Te=ae.current;(!Te||Te.key!==B||le-Te.at>=hFe)&&(ae.current={key:B,at:le},s(e));return}let ie=URL.createObjectURL(q);ce.current=ie,R(ie)}),()=>{se=!1}},[t,V,A,e,a,i,s,w,r,o]),{previewText:K,tags:X,featureImageKey:V,featureImageStatus:A,featureImageUrl:E,properties:M,wordCount:x,characterCountWithSpaces:H,characterCountWithoutSpaces:ee,taskUnfinished:j,metadataVersion:re}}var so,hFe,Dte=U(()=>{so=ue(ze());Sn();Mr();ed();Sl();FV();hFe=1e4});function Ate(){let t=pt(),e=ta(),n=gr(),r=Ra(),o=Yn(),a=Vr(),{findTagInTree:i,getPropertyTree:s}=xo(),l=(0,PV.useCallback)((u,p)=>{MF({showTags:t.showTags,showAllTagsFolder:t.showAllTagsFolder,expandedTags:e.expandedTags,expandedVirtualFolders:e.expandedVirtualFolders,collapseOtherBranchesOnExpand:t.collapseOtherBranchesOnExpand,expansionDispatch:r,selectionDispatch:n,uiState:{singlePane:o.singlePane,currentSinglePaneView:o.currentSinglePaneView,focusedPane:o.focusedPane},uiDispatch:a,findTagInTree:i},u,{...p,preserveNavigationFocus:p?.preserveNavigationFocus??!1,requireTagInTree:p?.requireTagInTree??!1})},[n,r,e.expandedTags,e.expandedVirtualFolders,t.showAllTagsFolder,t.collapseOtherBranchesOnExpand,t.showTags,i,a,o.currentSinglePaneView,o.focusedPane,o.singlePane]),c=(0,PV.useCallback)((u,p)=>{RF({showProperties:t.showProperties,showAllPropertiesFolder:t.showAllPropertiesFolder,propertyTree:s(),expandedProperties:e.expandedProperties,expandedVirtualFolders:e.expandedVirtualFolders,collapseOtherBranchesOnExpand:t.collapseOtherBranchesOnExpand,expansionDispatch:r,selectionDispatch:n,uiState:{singlePane:o.singlePane,currentSinglePaneView:o.currentSinglePaneView,focusedPane:o.focusedPane},uiDispatch:a},u,{...p,preserveNavigationFocus:p?.preserveNavigationFocus??!1,requirePropertyInTree:p?.requirePropertyInTree??!1})},[r,e.expandedProperties,e.expandedVirtualFolders,s,n,t.showAllPropertiesFolder,t.collapseOtherBranchesOnExpand,t.showProperties,a,o.currentSinglePaneView,o.focusedPane,o.singlePane]);return{navigateToTag:l,navigateToProperty:c}}var PV,Ote=U(()=>{PV=ue(ze());Qs();Ur();on();pa();Xi();lH();dH()});function NV(t,e,n,r){let o=r??((s,l)=>Mt(s.name,l.name));if(!n||n.size===0)return o(t,e);let a=n.get(t.path),i=n.get(e.path);return a!==void 0&&i!==void 0?a-i:a!==void 0?-1:i!==void 0?1:o(t,e)}function kS(t,e,n,r){if(!n||n.size===0)return r?r(t,e):Mt(t.name,e.name);let o=n.get(t.path),a=n.get(e.path);return o!==void 0&&a!==void 0?o-a:o!==void 0?-1:a!==void 0?1:r?r(t,e):Mt(t.name,e.name)}function rD(t,e,n,r){if(!n||n.size===0)return r?r(t,e):Mt(t.name,e.name);let o=n.get(t.key),a=n.get(e.key);return o!==void 0&&a!==void 0?o-a:o!==void 0?-1:a!==void 0?1:r?r(t,e):Mt(t.name,e.name)}function Lte({rootFolders:t,excludePatterns:e,rootOrderMap:n,defaultSortOrder:r,childSortOrderOverrides:o,getFolderSortName:a,isFolderExcluded:i,level:s=0,visitedPaths:l=new Set,onFolder:c,onSiblingGroup:u,shouldVisitChildren:p}){let g={folderSortOrder:r??"alpha-asc",folderTreeSortOverrides:o},f=S=>ZK(g,S),h=S=>(w,k)=>{let F=a?a(w):w.name,P=a?a(k):k.name,T=ju(F,P,S);return T!==0?T:w.path.localeCompare(k.path)},b=S=>{let w=e.length>0&&ei(S,e),k=i?i(S):!1;return w||k},v=(S,w)=>{if(S.length<=1)return S;let k=f(w),F=h(k),P=S.slice();return w==="/"?P.sort((T,I)=>NV(T,I,n,F)):P.sort(F)},y=(S,w,k)=>{let F=v(w.filter(P=>!l.has(P.path)),S).map(P=>({folder:P,level:k,isExcluded:b(P),parentPath:S}));u?.({parentPath:S,level:k,entries:F}),F.forEach(P=>{if(l.add(P.folder.path),c?.(P),p?.(P)===!1)return;let T=P.folder.children.filter(I=>I instanceof CV.TFolder);T.length!==0&&y(P.folder.path,T,k+1)})};if(t.length===1&&t[0]?.path==="/"){let S=t[0];if(l.has(S.path))return;let w={folder:S,level:s,isExcluded:b(S),parentPath:""};if(l.add(S.path),c?.(w),p?.(w)===!1)return;let k=S.children.filter(F=>F instanceof CV.TFolder);k.length>0&&y("/",k,s+1);return}y("/",t,s)}function zte(t,e,n,r=0,o=new Set,a={}){let i=[];return Lte({rootFolders:t,excludePatterns:n,rootOrderMap:a.rootOrderMap,defaultSortOrder:a.defaultSortOrder,childSortOrderOverrides:a.childSortOrderOverrides,getFolderSortName:a.getFolderSortName,isFolderExcluded:a.isFolderExcluded,level:r,visitedPaths:o,onFolder:({folder:s,level:l,isExcluded:c})=>{let u={type:he.FOLDER,data:s,level:l,path:s.path,key:s.path};c&&(u.isExcluded=!0),i.push(u)},shouldVisitChildren:({folder:s})=>e.has(s.path)}),i}function Bte({rootFolders:t,excludePatterns:e,rootOrderMap:n,defaultSortOrder:r,childSortOrderOverrides:o,getFolderSortName:a,isFolderExcluded:i,includeDescendantSiblingGroups:s=!0}){let l=new Map;return Lte({rootFolders:t,excludePatterns:e,rootOrderMap:n,defaultSortOrder:r,childSortOrderOverrides:o,getFolderSortName:a,isFolderExcluded:i,onSiblingGroup:({parentPath:c,entries:u})=>{l.set(c,u.filter(p=>!p.isExcluded).map(p=>p.folder.path))},shouldVisitChildren:({folder:c})=>s?!0:c.path==="/"}),{siblingPathsByParent:l}}function FS(t,e,n=0,r={}){let o=[],{hiddenMatcher:a,comparator:i,childSortOrderOverrides:s}=r,l=i??((g,f)=>Mt(g.name,f.name)),c=t.slice().sort(l),u=g=>(f,h)=>{let b=ju(f.name,h.name,g);return b!==0?b:f.path.localeCompare(h.path)},p=g=>{if(s&&Object.prototype.hasOwnProperty.call(s,g)){let f=s[g];if(f)return u(f)}return l};function m(g,f,h=!1){let b=a?ss(g.path,g.name,a):!1,v=h||b,y={type:he.TAG,data:g,level:f,path:g.path,key:g.path};if(v&&(y.isHidden=!0),o.push(y),e.has(g.path)&&g.children&&g.children.size>0){let S=p(g.path);Array.from(g.children.values()).sort(S).forEach(k=>m(k,f+1,v))}}return c.forEach(g=>m(g,n)),o}var CV,PS=U(()=>{CV=require("obsidian");Rn();Ue();Yr();Dr()});function bFe(){return{colorsByPath:new Map,rootColor:void 0,getInheritedColor:t=>{}}}function _te(){return{colorsByNodeId:new Map,rootColor:void 0,rootColorsByKey:new Map}}function SFe(t,e){let n=Mt(t.name,e.name);return n!==0?n:t.path.localeCompare(e.path)}function wFe(t,e){let n=Mt(t.name,e.name);return n!==0?n:(t.valuePath??"").localeCompare(e.valuePath??"")}function Hte(t){return(e,n)=>-t(e,n)}function TFe(t){let{order:e,keyNode:n,includeDescendantNotes:r}=t,o=wFe;if(e==="alpha-asc")return o;if(e==="alpha-desc")return Hte(o);let a=(i,s)=>{let l=u=>r&&u.valuePath?Pm(n,u.valuePath):u.notesWithValue.size,c=l(i)-l(s);return c!==0?c:o(i,s)};return e==="frequency-asc"?a:Hte(a)}function kFe(t,e){return(n,r)=>{let o=ju(n.name,r.name,t);return o!==0?o:e(n).localeCompare(e(r))}}function Vte(t){let{visibleTagTree:e,rootTagKeys:n,rootTagOrderMap:r,tagComparator:o,palette:a,scope:i,showAllTagsFolder:s,inheritColors:l,childSortOrderOverrides:c}=t;if(a.length===0||e.size===0)return bFe();let u=Array.from(e.values()),p=o??SFe,m=r.size>0?(b,v)=>kS(b,v,r,p):p,g=new Set;u.forEach(b=>{ml(b,g)});let f=s?1:0,h;if(n&&n.length>0){let b=new Set;h=[],n.forEach(v=>{if(v===bt){let S={name:bt,path:bt,displayPath:bt,children:new Map,notesWithTag:new Set};h.push({type:he.UNTAGGED,data:S,level:f,key:bt});return}let y=e.get(v);!y||b.has(y.path)||(b.add(y.path),h.push(...FS([y],g,f,{comparator:p,childSortOrderOverrides:c})))}),u.filter(v=>!b.has(v.path)).sort(m).forEach(v=>{h.push(...FS([v],g,f,{comparator:p,childSortOrderOverrides:c}))})}else h=FS(u,g,f,{comparator:m,childSortOrderOverrides:c});return VI({items:h,palette:a,scope:i,rootLevel:f,showAllTagsFolder:s,inheritColors:l})}function Ute(t){let{propertyTree:e,visiblePropertyNavigationKeySet:n,rootPropertyOrderMap:r,propertyKeyComparator:o,palette:a,scope:i,showAllPropertiesFolder:s,propertySortOrder:l,propertyTreeSortOverrides:c,includeDescendantNotes:u}=t;if(a.length===0||e.size===0||n.size===0)return _te();let p=Array.from(e.values()).filter(v=>n.has(v.key));if(p.length===0)return _te();let m=r.size>0?(v,y)=>rD(v,y,r,o):o,g=p.slice().sort(m),f=s?1:0,h=f+1,b=[];return g.forEach(v=>{b.push({type:he.PROPERTY_KEY,data:v,level:f,key:v.id});let y=Array.from(v.children.values());if(y.length===0)return;let S=c?.[v.id],w=S?kFe(S,k=>k.valuePath??""):TFe({order:l,keyNode:v,includeDescendantNotes:u});y.sort(w).forEach(k=>{b.push({type:he.PROPERTY_VALUE,data:k,level:h,key:k.id})})}),UI({items:b,palette:a,scope:i,showAllPropertiesFolder:s})}function Kte(t){let{model:e,tagPath:n,color:r,backgroundColor:o}=t,a=It(n),i=a.length>0?a:n,s=e.tagRainbowColors.colorsByPath.get(i),l=s?void 0:e.tagRainbowColors.getInheritedColor(i),c=Ey({mode:e.navRainbowMode,rainbowColor:s??l,color:r,backgroundColor:o});return{color:c.color,backgroundColor:c.backgroundColor}}function Wte(t){let{model:e,nodeId:n,color:r,backgroundColor:o}=t,a=e.propertyRainbowColors.colorsByNodeId.get(n),i=zi(n),s=i?kn(i):null,l=a||!e.inheritPropertyColors||!i||i===n||!s?.key?void 0:e.propertyRainbowColors.rootColorsByKey.get(s.key),c=Ey({mode:e.navRainbowMode,rainbowColor:a??l,color:r,backgroundColor:o});return{color:c.color,backgroundColor:c.backgroundColor}}var IV=U(()=>{Ue();Gm();cn();Rn();Dr();Ba();PS()});function FFe(t,e){let n=Mt(t.name,e.name);return n!==0?n:t.path.localeCompare(e.path)}function jte(t,e){let n=Mt(t,e);return n!==0?n:t.localeCompare(e)}function Gte(t){return t?t.split("/").filter(e=>e.length>0):[]}function qte(t,e,n){let r=t,o,a="";for(let i=0;i<=n;i+=1){let s=e[i];if(!s||(a=i===0?s:`${a}/${s}`,o=r.get(a),!o))return;r=o.children}return o}function Yte(t,e,n){if(n.size===0)return 0;let r=n.get(t),o=n.get(e);return r!==void 0&&o!==void 0?r-o:r!==void 0?-1:o!==void 0?1:0}function PFe({leftNode:t,rightNode:e,parentPath:n,orderModel:r,childSortOrderOverrides:o}){let a=n?o?.[n]:void 0;if(a){let i=ju(t.name,e.name,a);return i!==0?i:t.path.localeCompare(e.path)}return kS(t,e,r.rootTagOrderMap,r.tagComparator??FFe)}function $te({leftTag:t,rightTag:e,orderModel:n,childSortOrderOverrides:r}){let o=It(t),a=It(e);if(o===a)return 0;let i=Gte(o),s=Gte(a),l=Math.min(i.length,s.length);for(let c=0;c{Ot();Rn();Dr();PS()});function xV(t,e,n){t.sort((r,o)=>$te({leftTag:r,rightTag:o,orderModel:e,childSortOrderOverrides:n}))}function EV(t){t.sort((e,n)=>{let r=Mt(e.label,n.label);if(r!==0)return r;let o=Mt(e.value,n.value);return o!==0?o:Mt(e.fieldKey??"",n.fieldKey??"")})}function IFe(t,e){if(t.length<=1)return[...t];if(!e){let o=[...t];return EV(o),o}let n=[],r=[];return t.forEach(o=>{if(o.hasCustomColor===!0){n.push(o);return}r.push(o)}),EV(n),EV(r),[...n,...r]}function Zte(t){return t?t.some(e=>e.hasCustomColor===!0):!1}function xFe(t,e,n,r,o){if(t.length<=1)return[...t];let a=[...t];return a.sort((i,s)=>{if(n){let l=Zte(e.get(i)),c=Zte(e.get(s));if(l!==c)return l?-1:1}return Xte(i,s,r.rootPropertyNavigationOrderMap,o)}),a}function Jte(t){let e=t?.trim()??"";if(!e)return;let n=Gn(e);return Gt(n)??n}function ene(t){if(!t)return!1;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}function tne({file:t,isCompactMode:e,tags:n,properties:r,wordCount:o,characterCount:a,wordCountDisplayText:i,characterCountDisplayText:s,settings:l,visiblePropertyKeys:c,visibleNavigationPropertyKeys:u,hiddenTagVisibility:p,onModifySearchWithTag:m,onModifySearchWithProperty:g,fileItemPillDecorationModel:f,fileItemPillOrderModel:h}){let{app:b,isMobile:v}=gt(),y=Ho(),{selectionType:S,selectedTag:w,selectedProperty:k}=Ml(),{navigateToTag:F,navigateToProperty:P}=Ate(),T=(0,Cr.useMemo)(()=>Qe(l.interfaceIcons,"file-word-count"),[l.interfaceIcons]),I=(0,Cr.useMemo)(()=>Qe(l.interfaceIcons,"file-character-count"),[l.interfaceIcons]),N=(0,Cr.useMemo)(()=>PR({selectionType:S,selectedTag:w,showSelectedNavigationPills:l.showSelectedNavigationPills}),[w,S,l.showSelectedNavigationPills]),O=(0,Cr.useMemo)(()=>CR({selectionType:S,selectedProperty:k,showSelectedNavigationPills:l.showSelectedNavigationPills}),[k,S,l.showSelectedNavigationPills]),K=(0,Cr.useCallback)((ne,B)=>{if(ne.stopPropagation(),m){let q=Av(ne,l.multiSelectModifier,v);if(q){ne.preventDefault(),m(B,q);return}}F(B,{preserveNavigationFocus:!1})},[v,F,m,l.multiSelectModifier]),G=(0,Cr.useCallback)((ne,B)=>{let q=B.propertyNodeId,ie=B.propertySearchKey,le=B.canNavigateToProperty===!0;if(ne.stopPropagation(),B.linkTarget?.kind==="unsupported")return;if(le&&g&&ie){let ke=Av(ne,l.multiSelectModifier,v);if(ke){ne.preventDefault(),g(ie,B.propertySearchValuePath??null,ke);return}}let Te=B.linkTarget;if(Te?.kind==="internal"&&l.enablePropertyInternalLinks){ne.preventDefault(),Q(()=>b.workspace.openLinkText(Te.target,t.path,!1));return}if(Te?.kind==="external"&&l.enablePropertyExternalLinks){ne.preventDefault(),window.open(Te.target);return}!le||!q||!ie||P(q,{preserveNavigationFocus:!1})},[b.workspace,t.path,v,P,g,l.enablePropertyExternalLinks,l.enablePropertyInternalLinks,l.multiSelectModifier]),X=(0,Cr.useCallback)(ne=>y.getTagColorData(ne),[y]),L=(0,Cr.useMemo)(()=>n.length===0||!p.shouldFilterHiddenTags&&!N?n:n.filter(ne=>p.shouldFilterHiddenTags&&!p.isTagVisible(ne)?!1:N?Ze(ne)!==N:!0),[p,N,n]),V=(0,Cr.useMemo)(()=>{if(l.tagColors,l.tagBackgroundColors,l.inheritTagColors,!l.colorFileTags||L.length===0)return CFe;let ne=new Map;return L.forEach(B=>{let q=X(B),ie=!!(q.color||q.background),le=Kte({model:f,tagPath:B,color:q.color,backgroundColor:q.background});(le.color||le.backgroundColor)&&ne.set(B,{color:le.color,background:le.backgroundColor,hasCustomColor:ie})}),ne},[f,X,l.colorFileTags,l.inheritTagColors,l.tagBackgroundColors,l.tagColors,L]),D=(0,Cr.useMemo)(()=>{if(L.length===0)return L;if(!l.prioritizeColoredFileTags||!l.colorFileTags){let q=[...L];return xV(q,h,l.tagTreeSortOverrides),q}let ne=[],B=[];return L.forEach(q=>{if(V.get(q)?.hasCustomColor===!0){ne.push(q);return}B.push(q)}),xV(ne,h,l.tagTreeSortOverrides),xV(B,h,l.tagTreeSortOverrides),[...ne,...B]},[h,l.colorFileTags,l.prioritizeColoredFileTags,l.tagTreeSortOverrides,V,L]),A=(0,Cr.useMemo)(()=>!(!l.showTags||!l.showFileTags||D.length===0||e&&!l.showFileTagsInCompactMode),[D,e,l.showFileTags,l.showFileTagsInCompactMode,l.showTags]),_=(0,Cr.useMemo)(()=>{let ne=[];return tV({properties:r,visiblePropertyKeys:c,hiddenPropertyValueNodeId:O,visitor:B=>{ne.push(B)}}),ne},[r,O,c]),E=(0,Cr.useMemo)(()=>{if(!l.showFileProperties||!l.colorFileProperties||_.length===0)return"";let ne=l.propertyColors,B=l.propertyBackgroundColors,q=l.inheritPropertyColors?"inherit:1":"inherit:0",ie=[],le=new Set,Te=new Set;for(let ke of _){let Fe=ke.propertyNodeId;if(!Fe)continue;le.has(Fe)||(le.add(Fe),ie.push(`v:${Fe}\0${ne?.[Fe]??""}\0${B?.[Fe]??""}`));let te=zi(Fe);!te||Te.has(te)||(Te.add(te),ie.push(`k:${te}\0${ne?.[te]??""}\0${B?.[te]??""}`))}return ie.length===0?q:ie.length===1?`${q}${ie[0]??""}`:(ie.sort(),`${q}${ie.join("")}`)},[l.colorFileProperties,l.inheritPropertyColors,l.propertyBackgroundColors,l.propertyColors,l.showFileProperties,_]),R=(0,Cr.useMemo)(()=>!(t.extension!=="md"||e&&!l.showFilePropertiesInCompactMode),[t.extension,e,l.showFilePropertiesInCompactMode]),M=(0,Cr.useMemo)(()=>!R||!il(l.textCountDisplay)||l.textCountPlacement!=="property"||i===null||typeof o!="number"||!Number.isFinite(o)||o<=0?null:{value:Math.trunc(o).toString(),label:i,linkTarget:null,iconId:T},[R,l.textCountDisplay,l.textCountPlacement,o,i,T]),C=(0,Cr.useMemo)(()=>!R||!Gl(l.textCountDisplay)||l.textCountPlacement!=="property"||s===null||typeof a!="number"||!Number.isFinite(a)||a<=0?null:{value:Math.trunc(a).toString(),label:s,linkTarget:null,iconId:I},[R,a,s,I,l.textCountDisplay,l.textCountPlacement]),x=(0,Cr.useMemo)(()=>[M,C].filter(ne=>ne!==null),[C,M]),z=(0,Cr.useMemo)(()=>{let ne=[],B=[];if(!R||!l.showFileProperties||_.length===0)return ne;let q=new Map;for(let Fe of _){let{entry:te,rawValue:pe,trimmedFieldKey:ve,normalizedValuePath:Ie,isKeyOnlyValue:qe,propertyNodeId:xe}=Fe,Ce=qe?null:$C(pe),vt=Ce?Ce.displayText:pe,Rt=xe??`${te.fieldKey}\0${pe}`,Ve=q.get(Rt);if(!Ve){if(l.colorFileProperties&&xe){let lt=y.getPropertyColorData(xe),Zt=!!(lt.color||lt.background),Kt=Wte({model:f,nodeId:xe,color:lt.color,backgroundColor:lt.background});Ve={color:Kt.color,background:Kt.backgroundColor,hasCustomColor:Zt}}else Ve={hasCustomColor:!1};q.set(Rt,Ve)}let Ae=xe?kn(xe):null,Ke=xe?zi(xe)??Jte(ve):Jte(ve),Be=Ae?.key||ve,wt=qe?null:Ae?.valuePath??Ie,Ct=Me(Be),qt=xe!==void 0&&Ct.length>0&&u.has(Ct);B.push({value:pe,label:vt,linkTarget:Ce,fieldKey:te.fieldKey,propertyKeyNodeId:Ke,color:Ve.color,background:Ve.background,hasCustomColor:Ve.hasCustomColor,propertyNodeId:xe,propertySearchKey:Be.length>0?Be:void 0,propertySearchValuePath:wt,canNavigateToProperty:qt})}let ie=l.prioritizeColoredFileProperties&&l.colorFileProperties,le=new Map,Te=[];return B.forEach(Fe=>{let te=Fe.fieldKey??"",pe=le.get(te);if(pe){pe.push(Fe);return}le.set(te,[Fe]),Te.push(te)}),xFe(Te,le,ie,h,u).forEach(Fe=>{let te=le.get(Fe);!te||te.length===0||ne.push(...IFe(te,ie))}),ne},[R,f,h,y,E,l.colorFileProperties,l.prioritizeColoredFileProperties,l.showFileProperties,u,_]),H=(0,Cr.useMemo)(()=>{let ne=new Map;if(z.length===0)return ne;for(let B of z){let q=B.color?.trim()??"",ie=B.background?.trim()??"";if(!q&&!ie)continue;let le=`${q}\0${ie}`;if(ne.has(le))continue;let Te={},ke=!1,Fe=!1;ie&&QA(ie)&&(Te["--nn-file-tag-custom-bg"]=ie,Fe=!0),q&&QA(q)&&(Te.color=q,ke=!0),ne.set(le,{style:ke||Fe?Te:void 0,hasColor:ke,hasBackground:Fe})}return ne},[z]),Y=z.length>0,ee=x.length>0,$=(0,Cr.useMemo)(()=>{if(!l.showPropertiesOnSeparateRows)return[];let ne=[],B=new Map,q=null;for(let ie of z){let le=ie.fieldKey?.trim()??"";if(!le){q||(q=[],ne.push(q)),q.push(ie);continue}let Te=B.get(le);Te||(Te=[],B.set(le,Te),ne.push(Te)),Te.push(ie)}return ne},[z,l.showPropertiesOnSeparateRows]),j=(0,Cr.useCallback)(ne=>KJ(ne,l.showFileTagAncestors),[l.showFileTagAncestors]),J=(0,Cr.useMemo)(()=>{let ne=new Map;return!l.tagIcons||!ene(l.tagIcons)||D.length===0||D.forEach(B=>{let q=y.getTagIcon(B);q&&ne.set(B,q)}),ne},[D,y,l.tagIcons]),re=(0,Cr.useMemo)(()=>{let ne=new Map,B=q=>{if(q.linkTarget?.kind==="external"&&l.enablePropertyExternalLinks)return NFe;if(q.iconId)return q.iconId;if(!l.propertyIcons||!ene(l.propertyIcons))return;let ie=null;if(q.propertyNodeId){let Te=y.getPropertyIcon(q.propertyNodeId);if(Te)return Te;let ke=zi(q.propertyNodeId);if(ke&&(ie=ke,ke!==q.propertyNodeId)){let Fe=y.getPropertyIcon(ke);if(Fe)return Fe}}let le=q.propertyKeyNodeId;if(!(!le||ie===le))return y.getPropertyIcon(le)};z.forEach(q=>{let ie=B(q);ie&&ne.set(q,ie)});for(let q of x)q.iconId&&ne.set(q,q.iconId);return ne},[y,z,l.enablePropertyExternalLinks,l.propertyIcons,x]),oe=(0,Cr.useCallback)((ne,B)=>{let q=ne.linkTarget?.kind==="unsupported",ie=ne.canNavigateToProperty===!0&&!q,le=ne.linkTarget?.kind==="internal"&&l.enablePropertyInternalLinks||ne.linkTarget?.kind==="external"&&l.enablePropertyExternalLinks,Te=ie||le,ke=["nn-file-tag","nn-file-property",Te?"nn-clickable-tag":"",le?"nn-file-property-link":""].filter(Ce=>Ce.length>0).join(" "),Fe=ne.color?.trim()??"",te=ne.background?.trim()??"",pe=`${Fe}\0${te}`,ve=Fe||te?H.get(pe):void 0,Ie=!!ve?.hasColor,qe=!!ve?.hasBackground,xe=re.get(ne);return(0,ws.jsxs)("span",{className:ke,"data-has-color":Ie?"true":void 0,"data-has-background":qe?"true":void 0,onClick:Te?Ce=>G(Ce,ne):void 0,role:Te?"button":void 0,tabIndex:Te?0:void 0,style:ve?.style,children:[xe?(0,ws.jsx)(Qt,{iconId:xe,className:"nn-file-pill-inline-icon","aria-hidden":!0}):null,ne.label]},B)},[G,H,re,l.enablePropertyExternalLinks,l.enablePropertyInternalLinks]),Z=(0,Cr.useMemo)(()=>A?(0,ws.jsx)("div",{className:"nn-file-tags",children:D.map((ne,B)=>{let q=V.get(ne),ie=q?.color,le=q?.background,Te=j(ne),ke=J.get(ne),Fe={};return le&&(Fe["--nn-file-tag-custom-bg"]=le),ie&&(Fe.color=ie),(0,ws.jsxs)("span",{className:"nn-file-tag nn-clickable-tag","data-has-color":ie?"true":void 0,"data-has-background":le?"true":void 0,onClick:te=>K(te,ne),role:"button",tabIndex:0,style:ie||le?Fe:void 0,children:[ke?(0,ws.jsx)(Qt,{iconId:ke,className:"nn-file-pill-inline-icon","aria-hidden":!0}):null,Te]},B)})}):null,[D,j,K,A,V,J]),ce=(0,Cr.useMemo)(()=>Y?l.showPropertiesOnSeparateRows?(0,ws.jsx)(ws.Fragment,{children:$.map((ne,B)=>(0,ws.jsx)("div",{className:"nn-file-property-row",children:ne.map((q,ie)=>oe(q,ie))},B))}):(0,ws.jsx)("div",{className:"nn-file-property-row",children:z.map(oe)}):null,[z,$,oe,l.showPropertiesOnSeparateRows,Y]),ae=(0,Cr.useMemo)(()=>ee?(0,ws.jsx)("div",{className:"nn-file-property-row",children:x.map(oe)}):null,[oe,ee,x]),se=(0,Cr.useMemo)(()=>(0,ws.jsxs)(ws.Fragment,{children:[Z,ce,ae]}),[ce,Z,ae]);return{shouldShowFileTags:A,shouldShowProperty:Y,shouldShowTextCountProperty:ee,hasVisiblePillRows:A||Y||ee,pillRows:se}}var Cr,ws,CFe,NFe,nne=U(()=>{Cr=ue(ze());mn();Ur();Ote();xn();ot();iS();Rn();Sn();ed();Ot();pr();cn();IV();Qte();Al();ws=ue(Ge()),CFe=new Map,NFe="external-link"});function rne(t){let{app:e,file:n,enabled:r,source:o,metadataVersion:a}=t,[i,s]=(0,Ef.useState)(0),l=o!==void 0,c=o?.providerId??null,u=o?.iconId??null,p=o?.showsFeatureImageBox??!1,m=o?.supportsCompanionImages??!1,g=(0,Ef.useMemo)(()=>l?c===null||u===null?null:{providerId:c,iconId:u,showsFeatureImageBox:p,supportsCompanionImages:m}:jd(e,n),[e,n,l,a,u,c,p,m]),f=r&&g!==null&&g.supportsCompanionImages,h=sS(e,f);return(0,Ef.useEffect)(()=>{if(f)return rj(n.path,()=>{s(b=>b+1)})},[n.path,f]),(0,Ef.useMemo)(()=>{if(!r||!g)return{isDrawing:!!g,showsFeatureImageBox:!1,supportsCompanionImages:!1,isMissing:!1,iconId:g?.iconId??null,key:null,url:null};if(!g.supportsCompanionImages)return{isDrawing:!0,showsFeatureImageBox:g.showsFeatureImageBox,supportsCompanionImages:!1,isMissing:g.showsFeatureImageBox,iconId:g.iconId,key:g.showsFeatureImageBox?`${n.path}:placeholder:${g.providerId}`:null,url:null};let b=SN(e,n,g.providerId,h);if(!b)return{isDrawing:!0,showsFeatureImageBox:g.showsFeatureImageBox,supportsCompanionImages:!0,isMissing:!0,iconId:g.iconId,key:`${n.path}:missing:${h}:${i}`,url:null};let v=null;try{v=pP(e,b)}catch{v=null}return{isDrawing:!0,showsFeatureImageBox:g.showsFeatureImageBox,supportsCompanionImages:!0,isMissing:v===null,iconId:g.iconId,key:`${b.path}@${b.stat.mtime}:${h}:${i}`,url:v}},[e,i,r,n,g,h])}var Ef,one=U(()=>{Ef=ue(ze());gl();MR();FV()});function _g({initialValue:t,ariaLabel:e,onCommit:n,onCancel:r,onRestoreFocus:o,inputFilter:a,onInputChange:i,className:s}){let[l,c]=(0,Ts.useState)(t),[u,p]=(0,Ts.useState)(!1),m=(0,Ts.useRef)(null),g=(0,Ts.useRef)(!1),f=(0,Ts.useRef)(!1);(0,Ts.useEffect)(()=>{let w=m.current;w&&(w.focus({preventScroll:!0}),w.select())},[]);let h=(0,Ts.useCallback)(()=>{window.requestAnimationFrame(()=>{let w=m.current;!w||g.current||(w.focus({preventScroll:!0}),w.select())})},[]),b=(0,Ts.useCallback)(async w=>{if(!(g.current||f.current)){f.current=!0,p(!0);try{if(await n(l)){g.current=!0,w?.restoreFocus&&o?.();return}}catch(k){console.error("[Notebook Navigator] Inline rename commit failed",k)}f.current=!1,p(!1),h()}},[n,o,h,l]),v=(0,Ts.useCallback)(w=>{let k=w.currentTarget.value,F=a?a(k):k;c(F),i?.({rawValue:k,filteredValue:F})},[a,i]),y=(0,Ts.useCallback)(w=>{g.current||(g.current=!0,r(),w?.restoreFocus&&o?.())},[r,o]),S=(0,Ts.useCallback)(w=>{if(w.stopPropagation(),w.key==="Enter"){w.preventDefault(),b({restoreFocus:!0});return}w.key==="Escape"&&(w.preventDefault(),y({restoreFocus:!0}))},[y,b]);return(0,ane.jsx)("input",{ref:m,className:s?`nn-inline-rename-input ${s}`:"nn-inline-rename-input",value:l,"aria-label":e,disabled:u,spellCheck:!1,onChange:v,onBlur:()=>{b()},onClick:w=>w.stopPropagation(),onMouseDown:w=>w.stopPropagation(),onDoubleClick:w=>w.stopPropagation(),onKeyDown:S})}var Ts,ane,mP=U(()=>{Ts=ue(ze()),ane=ue(Ge())});function sne(t,e){return t.replace("{count}",e)}function EFe(t){return typeof t!="number"||!Number.isFinite(t)||t<=0?null:id(t)}function MFe(t){let{wordCountDisplayText:e,characterCountDisplayText:n}=t;if(e&&n){let r=!e.includes("/")&&!e.includes("%")?sne(d.fileCounts.words,e):e,o=sne(d.fileCounts.characters,n);return`${r}${d.fileCounts.separator}${o}`}return e??n}function RFe(t,e,n){let[r,o]=(0,tn.useState)(e.stat.mtime);return(0,tn.useEffect)(()=>{o(e.stat.mtime)},[e,e.stat.mtime]),(0,tn.useEffect)(()=>{if(!n)return;let a=t.vault.on("modify",i=>{i instanceof zl.TFile&&i.path===e.path&&o(i.stat.mtime)});return()=>{t.vault.offref(a)}},[t,n,e.path]),n?r:e.stat.mtime}function DFe(t,e,n){if(!t)return[];let r=t.toLowerCase(),o=[],a=new Set,i=s=>{if(!s)return;let l=s.toLowerCase();if(!l||a.has(l))return;a.add(l);let c=r.indexOf(l);for(;c!==-1;)o.push({start:c,end:c+l.length}),c=r.indexOf(l,c+l.length)};if(n&&(n.matches.forEach(s=>i(s.text)),n.terms.forEach(s=>i(s))),!n&&o.length===0&&e){let s=e.trim().toLowerCase();s&&s.split(/\s+/).filter(Boolean).forEach(l=>i(l))}return o.length===0?[]:ou(o)}function lne(t,e,n){if(!t)return t;let r=DFe(t,e,n);if(r.length===0)return t;let o=[],a=0;return r.forEach((i,s)=>{i.start>a&&o.push(t.slice(a,i.start)),o.push((0,pn.jsx)("span",{className:"nn-search-highlight",children:t.slice(i.start,i.end)},`h-${s}`)),a=i.end}),a{s&&(v.preventDefault(),v.stopPropagation(),s())},[s]);return(0,tn.useEffect)(()=>{let v=l.current;if(!v||(v.innerHTML="",!t||!a))return;yn().renderIcon(v,t)},[t,n,a]),(0,pn.jsx)("div",{className:"nn-parent-folder","data-dot-separator":a?"false":"true",children:(0,pn.jsxs)("div",{className:"nn-parent-folder-content","data-has-background":u?"true":"false","data-reveal":h?"true":"false",style:g,onClick:h?b:void 0,children:[a?(0,pn.jsx)("span",{className:"nn-parent-folder-icon",ref:l,"aria-hidden":"true","data-has-color":c?"true":"false",style:p}):null,(0,pn.jsx)("span",{className:f,style:m,"data-has-color":i?"true":"false",children:e})]})})}var tn,zl,pn,ine,oD,MV=U(()=>{tn=ue(ze()),zl=require("obsidian");mn();mn();on();Ee();Zl();ot();os();Zc();Mr();JR();LM();nD();iS();Ha();Sl();iR();pr();ai();Rn();Vm();Dte();nne();Al();gl();one();pp();Am();xn();mP();pn=ue(Ge()),ine=16/9;oD=tn.default.memo(function({file:e,isSelected:n,hasSelectedAbove:r,hasSelectedBelow:o,showQuickActionsPanel:a,onFileClick:i,fileIndex:s,groupHeaderLabel:l,sortOption:c,parentFolder:u,isPinned:p=!1,selectionType:m,searchQuery:g,searchMeta:f,isHidden:h=!1,onModifySearchWithTag:b,onModifySearchWithProperty:v,localDayReference:y,fileIconSize:S,appearanceSettings:w,includeDescendantNotes:k,hiddenTagVisibility:F,fileNameIconNeedles:P,visiblePropertyKeys:T,visibleNavigationPropertyKeys:I,fileItemStorage:N,shortcutKey:O,onToggleNoteShortcut:K,folderDecorationModel:G,fileItemPillDecorationModel:X,fileItemPillOrderModel:L,getSolidBackground:V,disableNativeDrag:D=!1,manualSortDisabled:A=!1,inlineRename:_}){let{app:E,isMobile:R,plugin:M,commandQueue:C,fileSystemOps:x,tagOperations:z}=gt(),H=pt(),Y=Ho(),{getFileDisplayName:ee,getDB:$,getFileTimestamps:j,hasPreview:J,regenerateFeatureImageForFile:re}=N,oe=w.mode==="compact",Z=il(H.textCountDisplay),ce=Gl(H.textCountDisplay),ae=e.extension==="md",se=ae&&(!oe||H.showFilePropertiesInCompactMode),ne=ae&&H.showTags&&H.showFileTags&&(!oe||H.showFileTagsInCompactMode),B=ae&&Z&&(H.textCountPlacement==="title"||H.textCountPlacement==="property"&&se),q=B||ae&&!R&&H.showTooltips&&H.showTooltipWordCount,ie=ae&&ce&&(H.textCountPlacement==="title"||H.textCountPlacement==="property"&&se),le=ae&&(se&&H.showFileProperties&&T.size>0||B&&H.wordCountTargetProperty.trim().length>0),Te=ae&&(H.showFileIconUnfinishedTask||H.showFileBackgroundUnfinishedTask||!R&&H.showTooltips),ke=ae&&w.showImage,Fe=RFe(E,e,w.showImage&&Ms(e)),te=jd(E,e),pe=te!==null,{previewText:ve,tags:Ie,featureImageKey:qe,featureImageStatus:xe,featureImageUrl:Ce,properties:vt,wordCount:Rt,characterCountWithSpaces:Ve,characterCountWithoutSpaces:Ae,taskUnfinished:Ke,metadataVersion:Be}=Rte({app:E,file:e,showPreview:w.showPreview,showImage:w.showImage,skipFeatureImage:pe,fileStatMtime:Fe,getDB:$,regenerateFeatureImageForFile:re,loadOptions:{loadPreviewText:w.showPreview&&ae&&!f?.excerpt,loadTags:ne,loadFeatureImage:w.showImage&&!pe,loadProperties:le,loadWordCount:q,loadCharacterCount:ie,loadTaskUnfinished:Te},refreshMetadataVersionOnFeatureImageChange:ke}),wt=rne({app:E,file:e,enabled:w.showImage,source:te,metadataVersion:Be}),Ct=wt.url??(wt.isDrawing?null:Ce),qt=wt.key??qe,[lt,Zt]=(0,tn.useState)(null),[Kt,gn]=(0,tn.useState)(!1),fn=(0,tn.useRef)(null),an=(0,tn.useRef)(null),Pe=(0,tn.useRef)(null),ge=(0,tn.useRef)(null),be=(0,tn.useRef)(null),me=(0,tn.useRef)(null),fe=(0,tn.useRef)(null),we=(0,tn.useRef)(null),Re=(0,tn.useId)(),nt=H.showQuickActions&&H.quickActionOpenInNewTab,ct=H.showQuickActions&&H.quickActionPinNote,yt=H.showQuickActions&&H.quickActionRevealInFolder&&e.parent&&e.parent.path!==u,bn=e.extension==="md",Kn=H.showQuickActions&&H.quickActionAddTag&&bn&&!!z,kr=H.showQuickActions&&H.quickActionAddToShortcuts,Wo=nt||ct||yt||Kn||kr,co=typeof O=="string",wn=Ki(),Jt=H.showFileIcons,$n=typeof Ke=="number"&&Ke>0,Xn=H.showFileIconUnfinishedTask&&$n,Zn=(0,tn.useMemo)(()=>Qe(H.interfaceIcons,"file-unfinished-task"),[H.interfaceIcons]),Ir=d.modals.interfaceIcons.items["file-unfinished-task"],Jn=(0,tn.useMemo)(()=>!$n||typeof Ke!="number"?null:`${Ir}: ${Ke}`,[$n,Ke,Ir]),er=(0,tn.useMemo)(()=>ee(e),[e,ee,Be]),On=(0,tn.useMemo)(()=>lne(er,g,f),[er,g,f]),Ro=(0,tn.useMemo)(()=>ah(e),[e]),je=Y.getFileIcon(e.path),rt=Y.getFileColor(e.path),Et=e.parent,Xe=Et instanceof zl.TFolder,vn=NR({showParentFolder:H.showParentFolder,isPinned:p,selectionType:m,includeDescendantNotes:k,parentFolder:u,fileParentPath:Et?.path??null})&&Xe&&Et.path!=="/",it=vn&&H.showParentFolderIcon,Yt=vn&&H.showParentFolderColor,fr=vn&&!H.showParentFolderFullPath,Do=!Xn,ba=Do&&H.useFolderIconForFiles&&!je&&Xe,nl=Do&&!rt&&Xe&&(H.useFolderColorForTitles||H.useFolderIconForFiles),Cc=!H.colorIconOnly&&H.useFolderColorForTitles&&!rt&&Xe,Sa=nl||Cc,So=Xe&&(ba||Sa||fr||it||Yt)?Y.getFolderDisplayData(Et.path,{includeDisplayName:fr,includeColor:Sa||Yt,includeBackgroundColor:Yt,includeIcon:ba||it,includeInheritedColors:Sa||Yt}):null,qa=ba?So?.icon:void 0,Iu=Sa&&Xe?xf({model:G,folderPath:Et.path,color:So?.color,backgroundColor:void 0}).color:void 0,Ul=Y.getFileBackgroundColor(e.path),Ya=(0,tn.useMemo)(()=>jL({customBackgroundColor:Ul,taskUnfinished:Ke,showUnfinishedTaskBackground:H.showFileBackgroundUnfinishedTask,unfinishedTaskBackgroundColor:H.unfinishedTaskBackgroundColor,getSolidBackground:V}),[Ul,V,H.showFileBackgroundUnfinishedTask,H.unfinishedTaskBackgroundColor,Ke]),Md=e.extension.toLowerCase(),$p=Md==="base",$a=Md==="canvas",vr=(0,tn.useMemo)(()=>!rl(e,Er.SUPPORTED,E),[E,e]),jo=rt??Iu,Xr=H.showCategoryIcons||H.colorIconOnly&&!!jo,Wr=(0,tn.useMemo)(()=>Xn?Zn:OM(e,{showFilenameMatchIcons:H.showFilenameMatchIcons,fileNameIconMap:H.fileNameIconMap,showCategoryIcons:H.showCategoryIcons,fileTypeIconMap:H.fileTypeIconMap,fileTypeIconPreset:H.fileTypeIconPreset,externalIconProviders:H.externalIconProviders},{customIconId:je??qa,metadataCache:E.metadataCache,isExternalFile:vr,allowCategoryIcons:Xr,fallbackMode:Xr?"file":"none",fileNameNeedles:P,fileNameForMatch:er}),[Xr,E.metadataCache,er,P,je,qa,e,vr,Be,H.fileNameIconMap,H.externalIconProviders,H.fileTypeIconPreset,H.fileTypeIconMap,H.showCategoryIcons,H.showFilenameMatchIcons,Xn,Zn]),Nc=H.colorIconOnly?void 0:rt??(H.useFolderColorForTitles?Iu:void 0),pi=!!Nc,Xp=(0,tn.useMemo)(()=>w7(e,H.fileTypeIconMap,E.metadataCache,void 0,H.fileTypeIconPreset,H.externalIconProviders),[E.metadataCache,e,Be,H.externalIconProviders,H.fileTypeIconMap,H.fileTypeIconPreset]),Qp=Wr||Xp,Ns=(0,tn.useMemo)(()=>!(!Jt||!Wr),[Wr,Jt]),Yg=!!jo&&!Xn,Qi=jo&&!Xn?{color:jo}:void 0,Zp=Xn?"nn-file-icon nn-file-icon-unfinished-task":"nn-file-icon",Jp=Xn?void 0:jo??void 0,xu=oe&&($p||$a),mi=(0,tn.useMemo)(()=>!Z||e.extension!=="md"?null:BG({wordCount:Rt,properties:vt,targetProperty:H.wordCountTargetProperty,showTargetPercentage:H.showWordCountPercentage}),[e.extension,vt,H.showWordCountPercentage,H.wordCountTargetProperty,Z,Rt]),Ic=H.characterCountSpaces==="include"?Ve:Ae,Rd=(0,tn.useMemo)(()=>!ce||e.extension!=="md"?null:EFe(Ic),[e.extension,Ic,ce]),Dd=(0,tn.useMemo)(()=>MFe({wordCountDisplayText:mi,characterCountDisplayText:Rd}),[Rd,mi]),Is=H.textCountPlacement==="title"&&Dd!==null,xs=(0,tn.useMemo)(()=>_?x.getFileDisplayNameRenameInput(e):null,[e,x,_]),Ao=(0,tn.useMemo)(()=>_&&xs?(0,pn.jsxs)("div",{className:"nn-file-name nn-file-name--inline-renaming","data-has-color":pi?"true":"false","data-title-rows":w.titleRows,style:{"--filename-rows":w.titleRows,...pi?{"--nn-file-name-custom-color":Nc}:{}},children:[(0,pn.jsx)(_g,{initialValue:xs.initialValue,ariaLabel:e.extension==="md"?d.contextMenu.file.renameNote:d.contextMenu.file.renameFile,onCommit:Nt=>_.onCommit(e,Nt),onCancel:_.onCancel,onRestoreFocus:_.onRestoreFocus,inputFilter:xs.inputFilter,onInputChange:xs.onInputChange,className:"nn-file-inline-rename"}),Ro.length>0&&(0,pn.jsx)("span",{className:"nn-file-ext-suffix",children:Ro})]}):(0,pn.jsxs)("div",{className:"nn-file-name","data-has-color":pi?"true":"false","data-title-rows":w.titleRows,style:{"--filename-rows":w.titleRows,...pi?{"--nn-file-name-custom-color":Nc}:{}},children:[On,Is?(0,pn.jsxs)("span",{className:"nn-file-word-count-suffix",children:[" (",Dd,")"]}):null,Ro.length>0&&(0,pn.jsx)("span",{className:"nn-file-ext-suffix",children:Ro})]}),[w.titleRows,Ro,Nc,pi,On,_,e,xs,Is,Dd]),{shouldShowFileTags:Kl,hasVisiblePillRows:$g,pillRows:gi}=tne({file:e,isCompactMode:oe,tags:Ie,properties:vt,wordCount:Rt,characterCount:Ic,wordCountDisplayText:mi,characterCountDisplayText:Rd,settings:H,visiblePropertyKeys:T,visibleNavigationPropertyKeys:I,hiddenTagVisibility:F,onModifySearchWithTag:b,onModifySearchWithProperty:v,fileItemPillDecorationModel:X,fileItemPillOrderModel:L}),em=(0,tn.useMemo)(()=>{if(!w.showDate||!c)return"";let Nt=j(e),xi=qC(c,H.alphabeticalDateMode??"modified")==="created"?Nt.created:Nt.modified;if(p){let Ad=zr.getDateGroup(xi,y??void 0);return zr.formatDateForGroup(xi,Ad,H.dateFormat,H.timeFormat)}return l&&l!==d.listPane.pinnedSection?zr.formatDateForGroup(xi,l,H.dateFormat,H.timeFormat):zr.formatDate(xi,H.dateFormat)},[e,e.stat.mtime,e.stat.ctime,c,l,p,w.showDate,H.dateFormat,H.timeFormat,H.alphabeticalDateMode,j,Be,y]),Zi=f?.excerpt?f.excerpt:ve,nm=(w.showPreview&&e.extension==="md"?J(e.path):!1)||Zi.length>0,rm=(0,tn.useMemo)(()=>f?lne(Zi,g,f):Zi,[Zi,f,g]),Es=p?1:w.previewRows,Se=IR({showImage:w.showImage,file:e,featureImageStatus:xe,hasFeatureImageUrl:!!Ct,showDrawingFeatureImage:wt.showsFeatureImageBox}),Ne=wt.isMissing,He=xR({showFeatureImageArea:Se,file:e,hasFeatureImageUrl:!!Ct,showDrawingMissingFeatureImage:Ne}),ht=!Ne,sn=ht&&Kl,yr=ht&&$g,Qr=ht?gi:null,{shouldShowMultilinePreview:hi,shouldShowDateForItem:fi}=nV({isCompactMode:oe,showDate:w.showDate,showPreview:w.showPreview,isPinned:p,hasPreviewContent:nm,showFeatureImageArea:Se,showExtensionBadgeThumbnail:He,hasVisiblePillRows:yr}),Fr=null;if(vn&&Xe){let Nt=it?So?.icon:void 0,ts="lucide-folder-closed",xi=Yt?xf({model:G,folderPath:Et.path,color:So?.color,backgroundColor:So?.backgroundColor}):{color:void 0,backgroundColor:void 0},Ad=xi.color,im=!!Ad;Fr={name:H.showParentFolderFullPath?eY({metadataService:Y,folderPath:Et.path}):So?.displayName||Et.name,iconId:Nt??ts,color:im?Ad:void 0,backgroundColor:xi.backgroundColor,applyColorToName:im&&!H.colorIconOnly,showIcon:it}}let aa=()=>Fr?(0,pn.jsx)(AFe,{iconId:Fr.iconId,label:Fr.name,iconVersion:wn,color:Fr.color,backgroundColor:Fr.backgroundColor,showIcon:Fr.showIcon,applyColorToName:Fr.applyColorToName,onReveal:H.parentFolderClickRevealsFile?om:void 0}):null,Wn=fi||Fr!==null;(0,tn.useEffect)(()=>{gn(!1)},[qt,Ct]);let Ji=wt.isDrawing,Go=!Ct||H.forceSquareFeatureImage,Ii=(0,tn.useMemo)(()=>{let Nt=["nn-file-thumbnail"];return Go?Nt.push("nn-file-thumbnail--square"):Nt.push("nn-file-thumbnail--natural"),Ct&&Nt.push("nn-file-thumbnail--inset-highlight"),Ji&&Nt.push("nn-file-thumbnail--drawing"),(He||Ne)&&Nt.push("nn-file-thumbnail--extension-badge"),Kt&&Nt.push("nn-file-thumbnail--hidden"),Nt.join(" ")},[Ct,Ji,Kt,Ne,He,Go]),es=(0,tn.useMemo)(()=>Go?void 0:{"--nn-file-thumbnail-aspect-ratio":lt??1},[lt,Go]),Ye=(0,tn.useCallback)(()=>{if(Go)return;let Nt=we.current;if(!Nt)return;let ts=Nt.naturalWidth||Nt.width||0,xi=Nt.naturalHeight||Nt.height||0;if(ts<=0||xi<=0){Zt(null);return}let Ad=ts/xi,im=Math.min(Ad,ine);Zt(im)},[Go]),xt=(0,tn.useMemo)(()=>({dateFormat:H.dateFormat,timeFormat:H.timeFormat,showTooltipPath:H.showTooltipPath,showTooltipWordCount:H.showTooltipWordCount}),[H.dateFormat,H.showTooltipPath,H.showTooltipWordCount,H.timeFormat]),Vn=H.showTooltips,Qn=(0,tn.useMemo)(()=>{let Nt=["nn-file"];return n&&Nt.push("nn-selected"),oe&&Nt.push("nn-compact"),n&&r&&Nt.push("nn-has-selected-above"),n&&o&&Nt.push("nn-has-selected-below"),Ya&&Nt.push("nn-has-custom-background"),h&&Nt.push("nn-hidden-file"),A&&Nt.push("nn-file-manual-sort-disabled"),Nt.join(" ")},[n,oe,r,o,Ya,h,A]),Or=(0,tn.useMemo)(()=>{if(Ya)return{"--nn-file-custom-bg-color":Ya}},[Ya]),za=(0,tn.useMemo)(()=>{if(h)return d.listPane.hiddenItemAriaLabel.replace("{name}",er)},[h,er]);(0,tn.useEffect)(()=>{if(Go){Zt(null);return}Zt(null);let Nt=we.current;if(Nt&&Nt.complete){let ts=Nt.naturalWidth||Nt.width||0,xi=Nt.naturalHeight||Nt.height||0;if(ts>0&&xi>0){let Ad=ts/xi,im=Math.min(Ad,ine);Zt(im)}}},[Ct,Go]),(0,tn.useEffect)(()=>{if(!fn.current||R)return;if(!Vn){(0,zl.setTooltip)(fn.current,"");return}let Nt=uP({file:e,displayName:er,extensionSuffix:Ro,settings:xt,getFileTimestamps:j,sortOption:c,unfinishedTaskTooltipText:Jn,wordCount:Rt});(0,zl.setTooltip)(fn.current,Nt,{placement:Sm()})},[R,e,e.stat.ctime,e.stat.mtime,Vn,xt,er,Ro,j,c,Be,e.name,Jn,Rt]);let om=()=>{Q(async()=>{await M.activateView(),await M.revealFileInActualFolder(e,{showHiddenFileNotice:!0})})},Xg=ik(m??null),Qg=Y.isFilePinned(e.path,Xg),xc=Nt=>{Nt.stopPropagation(),Nt.preventDefault(),Q(()=>no({app:E,commandQueue:C,file:e,context:"tab"}))},rw=Nt=>{Nt.stopPropagation(),Nt.preventDefault(),Q(async()=>{e.parent&&await Y.togglePin(e.path,Xg)})},Ec=Nt=>{Nt.stopPropagation(),Nt.preventDefault(),Q(async()=>K(e,O))},ow=Nt=>{Nt.stopPropagation(),Nt.preventDefault(),om()},Eu=Nt=>{Nt.stopPropagation(),Nt.preventDefault(),z&&$b({app:E,plugin:M,tagOperations:z,files:[e]})},aw=Nt=>{Nt.button===1&&(Nt.preventDefault(),Nt.stopPropagation(),Q(()=>no({app:E,commandQueue:C,file:e,context:"tab"})))},am=[];a&&yt&&am.push({key:"reveal",element:(0,pn.jsx)("div",{ref:an,className:"nn-quick-action-item",onClick:ow,title:d.contextMenu.file.revealInFolder})}),a&&Kn&&am.push({key:"add-tag",element:(0,pn.jsx)("div",{ref:Pe,className:"nn-quick-action-item",onClick:Eu,title:d.contextMenu.file.addTag})}),a&&kr&&am.push({key:"shortcut",element:(0,pn.jsx)("div",{ref:ge,className:"nn-quick-action-item",onClick:Ec,title:co?d.shortcuts.remove:d.shortcuts.add})}),a&&ct&&am.push({key:"pin",element:(0,pn.jsx)("div",{ref:be,className:"nn-quick-action-item",onClick:rw,title:Qg?e.extension==="md"?d.contextMenu.file.unpinNote:d.contextMenu.file.unpinFile:e.extension==="md"?d.contextMenu.file.pinNote:d.contextMenu.file.pinFile})}),a&&nt&&am.push({key:"new-tab",element:(0,pn.jsx)("div",{ref:me,className:"nn-quick-action-item",onClick:xc,title:d.contextMenu.file.openInNewTab})}),(0,tn.useEffect)(()=>{let Nt=fe.current;if(!Nt||(Nt.innerHTML="",!Ns))return;let ts=Wr;if(!ts)return;yn().renderIcon(Nt,ts,S)},[Wr,wn,Ns,oe,S]),(0,tn.useEffect)(()=>{R||!a||(an.current&&yt&&(0,zl.setIcon)(an.current,"lucide-folder-search"),Pe.current&&Kn&&(0,zl.setIcon)(Pe.current,"lucide-tag"),ge.current&&kr&&(0,zl.setIcon)(ge.current,co?"lucide-star-off":"lucide-star"),be.current&&ct&&(0,zl.setIcon)(be.current,Qg?"lucide-pin-off":"lucide-pin"),me.current&&nt&&(0,zl.setIcon)(me.current,"lucide-file-plus"))},[R,nt,ct,yt,Kn,kr,a,co,Qg]);let rA=(0,tn.useCallback)(Nt=>{i(e,s,Nt)},[e,s,i]);return(0,pn.jsxs)("div",{ref:fn,className:Qn,"data-path":e.path,"data-drag-path":e.path,"data-drag-type":"file","data-draggable":!R&&!D?"true":void 0,"data-drag-icon":Qp,"data-drag-fallback-icon":Xp,"data-drag-icon-color":Jp,onClick:rA,onMouseDown:aw,draggable:!R&&!D,role:"listitem","aria-describedby":za?Re:void 0,style:Or,children:[(0,pn.jsxs)("div",{className:"nn-file-content",children:[!R&&Wo&&a&&(0,pn.jsx)("div",{className:`nn-quick-actions-panel ${oe?"nn-compact-mode":""}`,"data-title-rows":w.titleRows,"data-has-tags":sn?"true":"false",children:am.map((Nt,ts)=>(0,pn.jsxs)(tn.default.Fragment,{children:[ts>0&&(0,pn.jsx)("div",{className:"nn-quick-action-separator"}),Nt.element]},Nt.key))}),(0,pn.jsxs)("div",{className:"nn-file-inner-content",children:[Jt?(0,pn.jsx)("div",{className:"nn-file-icon-slot",children:Ns?(0,pn.jsx)("span",{ref:fe,className:Zp,"data-has-color":Yg?"true":"false",style:Qi,title:!R&&!H.showTooltips&&Xn?Jn??void 0:void 0}):null}):null,oe?(0,pn.jsxs)("div",{className:"nn-compact-file-text-content",children:[(0,pn.jsxs)("div",{className:"nn-compact-file-header",children:[Ao,xu?(0,pn.jsx)("div",{className:"nn-compact-extension-badge","aria-hidden":"true",children:(0,pn.jsx)("div",{className:"nn-file-icon-rectangle",children:(0,pn.jsx)("span",{className:"nn-file-icon-rectangle-text",children:Md})})}):null]}),Qr]}):(0,pn.jsxs)(pn.Fragment,{children:[(0,pn.jsxs)("div",{className:"nn-file-text-content",children:[Ao,hi&&(0,pn.jsx)("div",{className:"nn-file-preview",style:{"--preview-rows":Es},children:rm}),Qr,Wn&&(0,pn.jsxs)("div",{className:"nn-file-second-line",children:[fi&&(0,pn.jsx)("div",{className:"nn-file-date",children:em}),aa()]})]}),Se&&(0,pn.jsx)("div",{className:Ii,style:es,children:Ct?(0,pn.jsx)("img",{src:Ct,alt:d.common.featureImageAlt,className:"nn-file-thumbnail-img",ref:we,draggable:!1,onDragStart:Nt=>Nt.preventDefault(),onLoad:Ye,onError:()=>{gn(!0)}},qt??Ct):Ne?(0,pn.jsx)("div",{className:"nn-file-extension-badge nn-file-extension-badge--drawing","aria-hidden":"true",children:(0,pn.jsx)(Qt,{iconId:wt.iconId??"brush",className:"nn-file-extension-icon","aria-hidden":!0})}):He?(0,pn.jsx)("div",{className:"nn-file-extension-badge",children:(0,pn.jsx)("span",{className:"nn-file-extension-text",children:e.extension})}):null})]})]})]}),za?(0,pn.jsx)("span",{id:Re,className:"nn-visually-hidden",children:za}):null]})})});function dne(t){return Math.max(0,Math.trunc(t))}function OFe(t,e,n){let r=id(dne(e)),o=DT(t,n);return o!==null?`${r} / ${id(o)}`:r}function LFe(t,e){if(e<=0)return null;let n=Math.round(dne(t)/e*100);return Number.isFinite(n)?n:0}function cne(t,e,n){let r=DT(t,n),o=r!==null?LFe(e,r):null,a=o===null?null:Math.min(100,Math.max(0,o));return{progressPercent:o,progressWidth:a}}function une(t,e){let n={};return t.color&&(n["--nn-manual-sort-group-header-accent"]=t.color),e.progressWidth!==null&&(n["--nn-manual-sort-group-header-progress"]=`${e.progressWidth}%`),n}function gP({header:t,wordCount:e,targetWordCount:n}){let r=lp(t),o=OFe(t,e,n),a=cne(t,e,n),i=une(t,a),s=["nn-manual-sort-group-header-content"];return t.color&&a.progressPercent===null&&s.push("nn-manual-sort-group-header-content--accent-all"),(t.color||a.progressPercent!==null)&&s.push("nn-manual-sort-group-header-content--accent-icon"),(0,Fu.jsxs)("div",{className:s.join(" "),style:i,children:[t.iconId?(0,Fu.jsx)(Qt,{iconId:t.iconId,className:"nn-manual-sort-group-header-custom-icon","aria-hidden":!0}):null,(0,Fu.jsx)("span",{className:"nn-manual-sort-group-header-title",children:t.title}),r?(0,Fu.jsxs)("span",{className:"nn-manual-sort-group-header-count",children:["(",o,")"]}):null,a.progressPercent!==null?(0,Fu.jsxs)("span",{className:"nn-manual-sort-group-header-percent",children:[a.progressPercent,"%"]}):null]})}function aD({header:t,wordCount:e,targetWordCount:n}){let r=cne(t,e,n);if(r.progressWidth===null)return null;let o=une(t,r);return(0,Fu.jsx)("div",{className:"nn-manual-sort-group-header-progress-row",style:o,"aria-hidden":!0,children:(0,Fu.jsx)("div",{className:"nn-manual-sort-group-header-progress",children:(0,Fu.jsx)("div",{className:"nn-manual-sort-group-header-progress-fill"})})})}var Fu,RV=U(()=>{wi();Am();Al();Fu=ue(Ge())});function iD(t,e){if(!(e<0||e>=t.length))return t[e]}function zFe(t){let e=new Array(t.length).fill(null),n=null;return t.forEach((r,o)=>{if(r.type===en.HEADER&&r.headerKind==="date"&&typeof r.data=="string"){n=r.data;return}r.type===en.FILE&&(e[o]=n)}),e}function BFe(t,e){for(let n=e+1;n0,p=!!l&&!t.isPinnedHeader&&!u,m=c!==null&&Bh(c,t.manualSortHeaderTargetWordCount),g=t.folderColor??void 0,f=g?{color:g}:void 0,h=t.applyFolderColorToLabel&&g?{color:g}:void 0,b=(0,di.useCallback)(P=>{if(P.stopPropagation(),t.isPinnedHeader){r();return}t.collapseKey&&o(t.collapseKey)},[t.collapseKey,t.isPinnedHeader,o,r]),v=["nn-list-group-header"];t.isPinnedHeader&&v.push("nn-pinned-section-header"),c&&v.push("nn-list-group-header--manual-sort");let y=P=>s(P,t),S=`nn-list-group-header-text ${p?"nn-list-group-header-text--folder-note":""} ${t.applyFolderColorToLabel?"nn-list-group-header-text--custom-color":""}`,w=`${S} nn-list-group-header-path`,k=()=>u?(0,ur.jsx)("span",{className:w,style:h,children:t.folderGroupHeaderSegments.map((P,T)=>{let I=P.target,N=`nn-list-group-header-folder-segment ${I?"nn-list-group-header-text--folder-note":""}`;return(0,ur.jsxs)(di.default.Fragment,{children:[T>0?(0,ur.jsx)("span",{className:"nn-list-group-header-path-separator","aria-hidden":"true",children:"/"}):null,(0,ur.jsx)("span",{className:N,onClick:I?O=>a(O,I):void 0,onMouseDown:I?O=>i(O,I):void 0,children:P.label})]},P.path)})}):(0,ur.jsx)("span",{className:S,style:h,onClick:l?P=>a(P,l):void 0,onMouseDown:l?P=>i(P,l):void 0,children:t.label}),F=(0,ur.jsxs)("div",{className:v.join(" "),onContextMenu:m?void 0:y,children:[c?(0,ur.jsx)(gP,{header:c,wordCount:t.manualSortHeaderWordCount,targetWordCount:t.manualSortHeaderTargetWordCount}):(0,ur.jsxs)(ur.Fragment,{children:[t.isPinnedHeader&&n?(0,ur.jsx)(Qt,{iconId:n,className:"nn-list-group-header-icon nn-pinned-section-icon","aria-hidden":!0}):null,!t.isPinnedHeader&&t.folderIconId?(0,ur.jsx)(Qt,{iconId:t.folderIconId,className:"nn-list-group-header-icon nn-list-group-header-folder-icon","aria-hidden":!0,"data-has-color":g?"true":"false",style:f}):null,k()]}),t.isCollapsible?(0,ur.jsx)("button",{type:"button",className:"nn-list-group-header-collapse-button","aria-label":t.isCollapsed?d.listPane.expandGroup:d.listPane.collapseGroup,"aria-expanded":!t.isCollapsed,onClick:b,children:(0,ur.jsx)(Qt,{iconId:t.isCollapsed?e.collapsed:e.expanded,className:"nn-list-group-header-icon","aria-hidden":!0})}):null]});return m?(0,ur.jsxs)("div",{className:"nn-manual-sort-group-header-shell",onContextMenu:y,children:[F,(0,ur.jsx)(aD,{header:c,wordCount:t.manualSortHeaderWordCount,targetWordCount:t.manualSortHeaderTargetWordCount})]}):F}function mne(t){if(!(t instanceof Element))return null;let e=t.closest(".nn-file");return e instanceof HTMLElement?e.dataset.path??null:null}function gne(t,e){if(!t||!e)return null;let n=t.ownerDocument;if(!n)return null;let r=n.elementFromPoint(e.clientX,e.clientY);return!(r instanceof Element)||!t.contains(r)?null:mne(r)}function hP(t){return t?.type===en.FILE&&t.data instanceof Zs.TFile}function hne({listItems:t,rowVirtualizer:e,scrollContainerRefCallback:n,activeFolderDropPath:r,isCompactMode:o,isEmptySelection:a,hasNoFiles:i,topSpacerHeight:s,settings:l,pinnedGroupExpanded:c,onPinnedGroupHeaderToggle:u,onListGroupHeaderToggle:p,selectionType:m,selectedFolderPath:g,sortOption:f,searchHighlightQuery:h,isFolderNavigation:b,lastSelectedFilePath:v,isFileSelected:y,hoveredFilePath:S,suppressRowHover:w,onHoveredFilePathChange:k,onFileClick:F,onModifySearchWithTag:P,onModifySearchWithProperty:T,localDayReference:I,fileIconSize:N,appearanceSettings:O,includeDescendantNotes:K,hiddenTagVisibility:G,fileNameIconNeedles:X,visibleListPropertyKeys:L,visibleNavigationPropertyKeys:V,fileItemStorage:D,noteShortcutKeysByPath:A,onToggleNoteShortcut:_,inlineRenameFilePath:E,onFileRenameCommit:R,onFileRenameCancel:M,onFileRenameRestoreFocus:C,onNavigateToFolder:x,folderDecorationModel:z,fileItemPillDecorationModel:H,fileItemPillOrderModel:Y,getSolidBackground:ee}){let{app:$,commandQueue:j,isMobile:J,plugin:re}=gt(),oe=li(),Z=Ho(),ce=(0,di.useMemo)(()=>({collapsed:Qe(l.interfaceIcons,"nav-tree-expand"),expanded:Qe(l.interfaceIcons,"nav-tree-collapse")}),[l.interfaceIcons]),ae=(0,di.useMemo)(()=>Qe(l.interfaceIcons,"list-pinned"),[l.interfaceIcons]),se=(0,di.useMemo)(()=>sd({manualSortGroupHeaderProperty:l.manualSortGroupHeaderProperty,manualSortPropertyKey:l.manualSortPropertyKey}),[l.manualSortGroupHeaderProperty,l.manualSortPropertyKey]),ne=(0,di.useMemo)(()=>{let Ve=new Map,Ae=Ke=>{if(!Ke||Ve.has(Ke))return;let Be=$.vault.getFolderByPath(Ke);if(!Be)return;let wt=l.enableFolderNotes&&l.enableFolderNoteLinks?Pn(Be,{enableFolderNotes:l.enableFolderNotes,folderNoteName:l.folderNoteName,folderNoteNamePattern:l.folderNoteNamePattern}):null;Ve.set(Ke,{folder:Be,folderNote:wt})};return t.forEach(Ke=>{Ke.type===en.HEADER&&(Ae(Ke.headerFolderPath),Ke.headerFolderSegments?.forEach(Be=>{Ae(Be.path)}))}),Ve},[$.vault,t,l.enableFolderNoteLinks,l.enableFolderNotes,l.folderNoteName,l.folderNoteNamePattern]),{headerModels:B,headerModelByIndex:q}=(0,di.useMemo)(()=>{let Ve=[],Ae=new Map,Ke=!1;return t.forEach((Be,wt)=>{if(Be.type===en.FILE){Ke=!0;return}if(Be.type!==en.HEADER||typeof Be.data!="string")return;let Ct=Be.headerFolderPath??null,qt=Be.key===gw,lt=Be.collapseKey??null,Zt=qt?!c:Be.isCollapsed===!0,Kt=Be.headerKind==="manual-sort-custom"?Be.manualSortHeader??null:null,gn=Kt?.title??Be.data,fn=Be.headerKind==="folder"?Ct??"/":null,an=Be.headerKind==="folder"&&l.showFolderGroupPaths?(Be.headerFolderSegments??[]).map(we=>({label:we.label,path:we.path,target:ne.get(we.path)??null})):[],Pe=null,ge=null,be=l.showFolderIcons,me=l.showFolderIcons||!l.colorIconOnly;if(fn!==null&&(be||me)){let we=Z.getFolderDisplayData(fn,{includeDisplayName:!1,includeColor:me,includeBackgroundColor:!1,includeIcon:be,includeInheritedColors:me});Pe=be?we.icon??Qe(l.interfaceIcons,fn==="/"?"nav-folder-root":Zt?"nav-folder-closed":"nav-folder-open"):null,me&&(ge=xf({model:z,folderPath:fn,color:we.color,backgroundColor:void 0}).color??null)}let fe={index:wt,label:Be.data,baseLabel:gn,isFirstHeader:Ve.length===0&&!Ke,isPinnedHeader:qt,collapseKey:lt,isCollapsed:Zt,isCollapsible:qt||lt!==null,folderGroupHeaderTarget:Ct!==null?ne.get(Ct)??null:null,folderGroupHeaderPath:Be.headerKind==="folder"?Ct??"/":null,folderGroupHeaderSegments:an,groupFilePaths:Be.groupFilePaths??[],manualSortHeaderFilePath:Be.headerKind==="manual-sort-custom"?Be.manualSortHeaderFilePath??null:null,manualSortHeader:Kt,manualSortHeaderWordCount:Be.manualSortHeaderWordCount??0,manualSortHeaderTargetWordCount:Be.manualSortHeaderTargetWordCount??null,folderIconId:Pe,folderColor:ge,applyFolderColorToLabel:ge!==null&&!l.colorIconOnly};Ve.push(fe),Ae.set(wt,fe)}),{headerModels:Ve,headerModelByIndex:Ae}},[z,ne,t,Z,c,l.colorIconOnly,l.showFolderGroupPaths,l.interfaceIcons,l.showFolderIcons]),ie=(0,di.useMemo)(()=>zFe(t),[t]),le=(0,di.useCallback)((Ve,Ae)=>{Ve.stopPropagation();let Ke=Ae.folderNote,Be={source:"manual",suppressAutoSelect:!!Ke};if(x(Ae.folder.path,Be),!Ke)return;let wt=Hc(Ve,l.folderNoteOpenLocation,l.multiSelectModifier,J);wt==="right-sidebar"&&l.showNearestFolderNoteInSidebar&&!(m===W.FOLDER&&g===Ae.folder.path)||Q(()=>ri({app:$,commandQueue:j,folder:Ae.folder,folderNote:Ke,context:wt,openInRightSidebar:Ct=>re.openFolderNoteInRightSidebar(Ct)}))},[$,j,J,x,re,g,m,l.folderNoteOpenLocation,l.multiSelectModifier,l.showNearestFolderNoteInSidebar]),Te=(0,di.useCallback)((Ve,Ae)=>{let Ke=Ae.folderNote;Ve.button!==1||!Ke||(Ve.preventDefault(),Ve.stopPropagation(),x(Ae.folder.path,{source:"manual",suppressAutoSelect:!0}),Q(()=>ri({app:$,commandQueue:j,folder:Ae.folder,folderNote:Ke,context:"tab"})))},[$,j,x]),ke=(0,di.useCallback)((Ve,Ae)=>{let Ke=Ae.groupFilePaths.map(qt=>$.vault.getFileByPath(qt)).filter(qt=>qt instanceof Zs.TFile),Be=zp(Ke),wt=new Zs.Menu,Ct=!1;if(Be.length>=2&&(Ct=VR({menu:wt,app:$,commandQueue:j,fileSystemOps:oe,files:Be,outputFolder:_Fe($,Ae,Be),defaultOutputName:Ae.baseLabel||d.modals.mergeNotes.outputNamePlaceholder,title:d.contextMenu.file.mergeNotesInGroup})),se&&Ae.manualSortHeaderFilePath){let qt=$.vault.getFileByPath(Ae.manualSortHeaderFilePath);if(qt instanceof Zs.TFile&&qt.extension==="md"){Ct&&wt.addSeparator();let lt=hS({menu:wt,app:$,file:qt,propertyKey:se,metadataService:Z});Ct=Ct||lt}}Ct&&(Ve.preventDefault(),Ve.stopPropagation(),wt.showAtMouseEvent(Ve.nativeEvent))},[$,j,oe,se,Z]),Fe=(0,di.useCallback)(Ve=>{k(mne(Ve.target),{clientX:Ve.clientX,clientY:Ve.clientY})},[k]),te=(0,di.useCallback)(()=>{k(null,null)},[k]),pe=(0,di.useCallback)(Ve=>{if(Ve?.type!==en.FILE||!(Ve.data instanceof Zs.TFile))return!1;let Ae=Ve.data,Ke=l.showFileBackgroundUnfinishedTask?D.getDB().getFile(Ae.path)?.taskUnfinished:void 0;return _I({customBackgroundColor:Z.getFileBackgroundColor(Ae.path),taskUnfinished:Ke,showUnfinishedTaskBackground:l.showFileBackgroundUnfinishedTask,unfinishedTaskBackgroundColor:l.unfinishedTaskBackgroundColor,getSolidBackground:ee})},[D,ee,Z,l.showFileBackgroundUnfinishedTask,l.unfinishedTaskBackgroundColor]),ve=(0,di.useCallback)(Ve=>y(Ve)||b&&v===Ve.path,[y,b,v]),Ie=e.getVirtualItems(),qe=e.scrollOffset??0,xe=l.stickyGroupHeaders,Ce=xe&&(s===0||qe>=s)?Math.max(0,qe+.5):null,vt=Ce!==null&&t.length>0?e.getVirtualItemForOffset(Ce):void 0,Rt=xe?HFe(B,vt?.index??null):null;return(0,ur.jsxs)("div",{ref:n,className:`nn-list-pane-scroller ${!a&&!i&&o?"nn-compact-mode":""}`,"data-drop-zone":r?"folder":void 0,"data-drop-path":r??void 0,"data-allow-internal-drop":r?"false":void 0,"data-allow-external-drop":r?"true":void 0,"data-pane":"files",role:"list",tabIndex:-1,onMouseMove:Fe,onMouseLeave:te,children:[Rt?(0,ur.jsx)("div",{className:"nn-list-sticky-header",children:(0,ur.jsx)(pne,{header:Rt,collapseChevronIcons:ce,pinnedSectionIcon:ae,onPinnedGroupHeaderToggle:u,onListGroupHeaderToggle:p,onFolderGroupHeaderClick:le,onFolderGroupHeaderMouseDown:Te,onGroupHeaderContextMenu:ke})}):null,(0,ur.jsx)("div",{className:"nn-list-pane-content",children:a?(0,ur.jsx)("div",{className:"nn-empty-state",children:(0,ur.jsx)("div",{className:"nn-empty-message",children:d.listPane.emptyStateNoSelection})}):i?(0,ur.jsx)("div",{className:"nn-empty-state",children:(0,ur.jsx)("div",{className:"nn-empty-message",children:d.listPane.emptyStateNoNotes})}):t.length>0?(0,ur.jsx)("div",{className:"nn-virtual-container",style:{height:`${e.getTotalSize()}px`},children:Ie.map(Ve=>{let Ae=iD(t,Ve.index);if(!Ae)return null;let Ke=iD(t,Ve.index+1),Be=iD(t,Ve.index-1),wt=hP(Ae),Ct=wt&&ve(Ae.data),qt=hP(Be)&&ve(Be.data),lt=hP(Ke)&&ve(Ke.data),Zt=pe(Ae),Kt=wt&&pe(Be),gn=wt&&pe(Ke),fn=Zt&&Kt,an=wt&&gn,Pe=wt&&(Ct||Zt),ge=Pe&&hP(Be)&&(qt||Kt),be=Pe&&hP(Ke)&&(lt||gn),me=wt&&(Ve.index===t.length-1||Ke&&(Ke.type===en.HEADER||Ke.type===en.HEADER_SPACER||Ke.type===en.TOP_SPACER||Ke.type===en.BOTTOM_SPACER)),fe=wt&&qt,we=wt&<,Re=Ae.type===en.FILE?ie[Ve.index]??null:null,nt=Ae.type===en.FILE&&Ae.data instanceof Zs.TFile?A.get(Ae.data.path):void 0,ct=Ae.type===en.FILE&&Ae.data instanceof Zs.TFile&&Ae.data.path===E,yt=q.get(Ve.index)??null,bn=yt?BFe(t,Ve.index):null,Kn=VFe(yt)||UFe(yt),kr=Ae.type===en.FILE&&(Ct&&!we||!Ct&<),Wo=bn!==null&&ve(bn),co=kr||Wo,wn={top:Math.max(0,Ve.start),"--item-height":`${Ve.size}px`},Jt=["nn-virtual-item"];return Ae.type===en.FILE&&Jt.push("nn-virtual-file-item"),yt&&Jt.push("nn-virtual-list-group-header"),Kn&&Jt.push("nn-hide-list-group-header-separator"),me&&Jt.push("nn-last-file"),co&&Jt.push("nn-hide-separator-selection"),Pe&&Jt.push("nn-virtual-file-item-has-filled-background"),ge&&Jt.push("nn-virtual-file-item-has-filled-background-previous"),be&&Jt.push("nn-virtual-file-item-has-filled-background-next"),Zt&&Jt.push("nn-virtual-file-item-has-custom-background"),fn&&Jt.push("nn-virtual-file-item-has-custom-background-previous"),an&&Jt.push("nn-virtual-file-item-has-custom-background-next"),(0,ur.jsx)("div",{className:Jt.join(" "),style:wn,"data-index":Ve.index,children:yt?(0,ur.jsx)(pne,{header:yt,collapseChevronIcons:ce,pinnedSectionIcon:ae,onPinnedGroupHeaderToggle:u,onListGroupHeaderToggle:p,onFolderGroupHeaderClick:le,onFolderGroupHeaderMouseDown:Te,onGroupHeaderContextMenu:ke}):Ae.type===en.HEADER_SPACER?(0,ur.jsx)("div",{className:"nn-list-group-header-spacer"}):Ae.type===en.TOP_SPACER?(0,ur.jsx)("div",{className:"nn-list-top-spacer",style:{height:`${s}px`}}):Ae.type===en.BOTTOM_SPACER?(0,ur.jsx)("div",{className:"nn-list-bottom-spacer"}):Ae.type===en.FILE&&Ae.data instanceof Zs.TFile?(0,ur.jsx)(oD,{file:Ae.data,isSelected:Ct,hasSelectedAbove:fe,hasSelectedBelow:we,showQuickActionsPanel:!ct&&!w&&S===Ae.data.path,onFileClick:F,fileIndex:Ae.fileIndex,selectionType:m,groupHeaderLabel:Re,sortOption:f,parentFolder:Ae.parentFolder,isPinned:Ae.isPinned,searchQuery:h,searchMeta:Ae.searchMeta,isHidden:!!Ae.isHidden,onModifySearchWithTag:P,onModifySearchWithProperty:T,localDayReference:I,fileIconSize:N,appearanceSettings:O,includeDescendantNotes:K,hiddenTagVisibility:G,fileNameIconNeedles:X,visiblePropertyKeys:L,visibleNavigationPropertyKeys:V,fileItemStorage:D,shortcutKey:nt,onToggleNoteShortcut:_,folderDecorationModel:z,fileItemPillDecorationModel:H,fileItemPillOrderModel:Y,getSolidBackground:ee,inlineRename:ct?{onCommit:R,onCancel:M,onRestoreFocus:C}:void 0},Ae.key):null},Ve.key)})}):null})]})}var di,Zs,ur,fne=U(()=>{di=ue(ze()),Zs=require("obsidian");mn();Ee();Ue();ot();Jc();td();MV();Al();pr();pp();wi();JR();HR();mV();Xb();RV();ur=ue(Ge())});function yne(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(o=>o(r))},e)}function Mf(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function sD(t){return"nodeType"in t}function ks(t){var e,n;return t?Mf(t)?t:sD(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function lD(t){let{Document:e}=ks(t);return t instanceof e}function CS(t){return Mf(t)?!1:t instanceof ks(t).HTMLElement}function AV(t){return t instanceof ks(t).SVGElement}function Rf(t){return t?Mf(t)?t.document:sD(t)?lD(t)?t:CS(t)||AV(t)?t.ownerDocument:document:document:document}function dD(t){let e=(0,ga.useRef)(t);return Id(()=>{e.current=t}),(0,ga.useCallback)(function(){for(var n=arguments.length,r=new Array(n),o=0;o{t.current=setInterval(r,o)},[]),n=(0,ga.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function NS(t,e){e===void 0&&(e=[t]);let n=(0,ga.useRef)(t);return Id(()=>{n.current!==t&&(n.current=t)},e),n}function IS(t,e){let n=(0,ga.useRef)();return(0,ga.useMemo)(()=>{let r=t(n.current);return n.current=r,r},[...e])}function vP(t){let e=dD(t),n=(0,ga.useRef)(null),r=(0,ga.useCallback)(o=>{o!==n.current&&e?.(o,n.current),n.current=o},[]);return[n,r]}function cD(t){let e=(0,ga.useRef)();return(0,ga.useEffect)(()=>{e.current=t},[t]),e.current}function Df(t,e){return(0,ga.useMemo)(()=>{if(e)return e;let n=DV[t]==null?0:DV[t]+1;return DV[t]=n,t+"-"+n},[t,e])}function Sne(t){return function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o{let s=Object.entries(i);for(let[l,c]of s){let u=a[l];u!=null&&(a[l]=u+t*c)}return a},{...e})}}function KFe(t){return"clientX"in t&&"clientY"in t}function yP(t){if(!t)return!1;let{KeyboardEvent:e}=ks(t.target);return e&&t instanceof e}function WFe(t){if(!t)return!1;let{TouchEvent:e}=ks(t.target);return e&&t instanceof e}function uD(t){if(WFe(t)){if(t.touches&&t.touches.length){let{clientX:e,clientY:n}=t.touches[0];return{x:e,y:n}}else if(t.changedTouches&&t.changedTouches.length){let{clientX:e,clientY:n}=t.changedTouches[0];return{x:e,y:n}}}return KFe(t)?{x:t.clientX,y:t.clientY}:null}function wne(t){return t.matches(vne)?t:t.querySelector(vne)}var ga,fP,Id,DV,Af,xS,Nd,vne,ES=U(()=>{ga=ue(ze());fP=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";Id=fP?ga.useLayoutEffect:ga.useEffect;DV={};Af=Sne(1),xS=Sne(-1);Nd=Object.freeze({Translate:{toString(t){if(!t)return;let{x:e,y:n}=t;return"translate3d("+(e?Math.round(e):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(t){if(!t)return;let{scaleX:e,scaleY:n}=t;return"scaleX("+e+") scaleY("+n+")"}},Transform:{toString(t){if(t)return[Nd.Translate.toString(t),Nd.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),vne="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]"});function Tne(t){let{id:e,value:n}=t;return Of.default.createElement("div",{id:e,style:jFe},n)}function kne(t){let{id:e,announcement:n,ariaLiveType:r="assertive"}=t,o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return Of.default.createElement("div",{id:e,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Fne(){let[t,e]=(0,Of.useState)("");return{announce:(0,Of.useCallback)(r=>{r!=null&&e(r)},[]),announcement:t}}var Of,jFe,Pne=U(()=>{Of=ue(ze()),jFe={display:"none"}});function GFe(t){let e=(0,We.useContext)(zne);(0,We.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function qFe(){let[t]=(0,We.useState)(()=>new Set),e=(0,We.useCallback)(r=>(t.add(r),()=>t.delete(r)),[t]);return[(0,We.useCallback)(r=>{let{type:o,event:a}=r;t.forEach(i=>{var s;return(s=i[o])==null?void 0:s.call(i,a)})},[t]),e]}function XFe(t){let{announcements:e=$Fe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=YFe}=t,{announce:a,announcement:i}=Fne(),s=Df("DndLiveRegion"),[l,c]=(0,We.useState)(!1);if((0,We.useEffect)(()=>{c(!0)},[]),GFe((0,We.useMemo)(()=>({onDragStart(p){let{active:m}=p;a(e.onDragStart({active:m}))},onDragMove(p){let{active:m,over:g}=p;e.onDragMove&&a(e.onDragMove({active:m,over:g}))},onDragOver(p){let{active:m,over:g}=p;a(e.onDragOver({active:m,over:g}))},onDragEnd(p){let{active:m,over:g}=p;a(e.onDragEnd({active:m,over:g}))},onDragCancel(p){let{active:m,over:g}=p;a(e.onDragCancel({active:m,over:g}))}}),[a,e])),!l)return null;let u=We.default.createElement(We.default.Fragment,null,We.default.createElement(Tne,{id:r,value:o.draggable}),We.default.createElement(kne,{id:s,announcement:i}));return n?(0,Lf.createPortal)(u,n):u}function mD(){}function Vg(t,e){return(0,We.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function RS(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}function QFe(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function ZFe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function JFe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function Bne(t,e){if(!t||t.length===0)return null;let[n]=t;return e?n[e]:n}function Cne(t,e,n){return e===void 0&&(e=t.left),n===void 0&&(n=t.top),{x:e+t.width*.5,y:n+t.height*.5}}function ePe(t,e){let n=Math.max(e.top,t.top),r=Math.max(e.left,t.left),o=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height),i=o-r,s=a-n;if(r1?r-1:0),a=1;a({...i,top:i.top+t*s.y,bottom:i.bottom+t*s.y,left:i.left+t*s.x,right:i.right+t*s.x}),{...n})}}function aPe(t){if(t.startsWith("matrix3d(")){let e=t.slice(9,-1).split(/, /);return{x:+e[12],y:+e[13],scaleX:+e[0],scaleY:+e[5]}}else if(t.startsWith("matrix(")){let e=t.slice(7,-1).split(/, /);return{x:+e[4],y:+e[5],scaleX:+e[0],scaleY:+e[3]}}return null}function iPe(t,e,n){let r=aPe(e);if(!r)return t;let{scaleX:o,scaleY:a,x:i,y:s}=r,l=t.left-i-(1-o)*parseFloat(n),c=t.top-s-(1-a)*parseFloat(n.slice(n.indexOf(" ")+1)),u=o?t.width/o:t.width,p=a?t.height/a:t.height;return{width:u,height:p,top:c,right:l+u,bottom:c+p,left:l}}function Vf(t,e){e===void 0&&(e=sPe);let n=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:c,transformOrigin:u}=ks(t).getComputedStyle(t);c&&(n=iPe(n,c,u))}let{top:r,left:o,width:a,height:i,bottom:s,right:l}=n;return{top:r,left:o,width:a,height:i,bottom:s,right:l}}function Nne(t){return Vf(t,{ignoreTransform:!0})}function lPe(t){let e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function dPe(t,e){return e===void 0&&(e=ks(t).getComputedStyle(t)),e.position==="fixed"}function cPe(t,e){e===void 0&&(e=ks(t).getComputedStyle(t));let n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(o=>{let a=e[o];return typeof a=="string"?n.test(a):!1})}function fD(t,e){let n=[];function r(o){if(e!=null&&n.length>=e||!o)return n;if(lD(o)&&o.scrollingElement!=null&&!n.includes(o.scrollingElement))return n.push(o.scrollingElement),n;if(!CS(o)||AV(o)||n.includes(o))return n;let a=ks(t).getComputedStyle(o);return o!==t&&cPe(o,a)&&n.push(o),dPe(o,a)?n:r(o.parentNode)}return t?r(t):n}function Hne(t){let[e]=fD(t,1);return e??null}function OV(t){return!fP||!t?null:Mf(t)?t:sD(t)?lD(t)||t===Rf(t).scrollingElement?window:CS(t)?t:null:null}function Vne(t){return Mf(t)?t.scrollX:t.scrollLeft}function Une(t){return Mf(t)?t.scrollY:t.scrollTop}function BV(t){return{x:Vne(t),y:Une(t)}}function Kne(t){return!fP||!t?!1:t===document.scrollingElement}function Wne(t){let e={x:0,y:0},n=Kne(t)?{height:window.innerHeight,width:window.innerWidth}:{height:t.clientHeight,width:t.clientWidth},r={x:t.scrollWidth-n.width,y:t.scrollHeight-n.height},o=t.scrollTop<=e.y,a=t.scrollLeft<=e.x,i=t.scrollTop>=r.y,s=t.scrollLeft>=r.x;return{isTop:o,isLeft:a,isBottom:i,isRight:s,maxScroll:r,minScroll:e}}function pPe(t,e,n,r,o){let{top:a,left:i,right:s,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=uPe);let{isTop:c,isBottom:u,isLeft:p,isRight:m}=Wne(t),g={x:0,y:0},f={x:0,y:0},h={height:e.height*o.y,width:e.width*o.x};return!c&&a<=e.top+h.height?(g.y=ci.Backward,f.y=r*Math.abs((e.top+h.height-a)/h.height)):!u&&l>=e.bottom-h.height&&(g.y=ci.Forward,f.y=r*Math.abs((e.bottom-h.height-l)/h.height)),!m&&s>=e.right-h.width?(g.x=ci.Forward,f.x=r*Math.abs((e.right-h.width-s)/h.width)):!p&&i<=e.left+h.width&&(g.x=ci.Backward,f.x=r*Math.abs((e.left+h.width-i)/h.width)),{direction:g,speed:f}}function mPe(t){if(t===document.scrollingElement){let{innerWidth:a,innerHeight:i}=window;return{top:0,left:0,right:a,bottom:i,width:a,height:i}}let{top:e,left:n,right:r,bottom:o}=t.getBoundingClientRect();return{top:e,left:n,right:r,bottom:o,width:t.clientWidth,height:t.clientHeight}}function jne(t){return t.reduce((e,n)=>Af(e,BV(n)),bc)}function gPe(t){return t.reduce((e,n)=>e+Vne(n),0)}function hPe(t){return t.reduce((e,n)=>e+Une(n),0)}function fPe(t,e){if(e===void 0&&(e=Vf),!t)return;let{top:n,left:r,bottom:o,right:a}=e(t);Hne(t)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}function yPe(t){let{EventTarget:e}=ks(t);return t instanceof e?t:Rf(t)}function LV(t,e){let n=Math.abs(t.x),r=Math.abs(t.y);return typeof e=="number"?Math.sqrt(n**2+r**2)>e:"x"in e&&"y"in e?n>e.x&&r>e.y:"x"in e?n>e.x:"y"in e?r>e.y:!1}function Ine(t){t.preventDefault()}function bPe(t){t.stopPropagation()}function xne(t){return!!(t&&"distance"in t)}function Ene(t){return!!(t&&"delay"in t)}function kPe(t){let{acceleration:e,activator:n=bP.Pointer,canScroll:r,draggingRect:o,enabled:a,interval:i=5,order:s=hD.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:p,threshold:m}=t,g=PPe({delta:p,disabled:!a}),[f,h]=bne(),b=(0,We.useRef)({x:0,y:0}),v=(0,We.useRef)({x:0,y:0}),y=(0,We.useMemo)(()=>{switch(n){case bP.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case bP.DraggableRect:return o}},[n,o,l]),S=(0,We.useRef)(null),w=(0,We.useCallback)(()=>{let F=S.current;if(!F)return;let P=b.current.x*v.current.x,T=b.current.y*v.current.y;F.scrollBy(P,T)},[]),k=(0,We.useMemo)(()=>s===hD.TreeOrder?[...c].reverse():c,[s,c]);(0,We.useEffect)(()=>{if(!a||!c.length||!y){h();return}for(let F of k){if(r?.(F)===!1)continue;let P=c.indexOf(F),T=u[P];if(!T)continue;let{direction:I,speed:N}=pPe(F,T,y,e,m);for(let O of["x","y"])g[O][I[O]]||(N[O]=0,I[O]=0);if(N.x>0||N.y>0){h(),S.current=F,f(w,i),b.current=N,v.current=I;return}}b.current={x:0,y:0},v.current={x:0,y:0},h()},[e,w,r,h,a,i,JSON.stringify(y),JSON.stringify(g),f,c,k,u,JSON.stringify(m)])}function PPe(t){let{delta:e,disabled:n}=t,r=cD(e);return IS(o=>{if(n||!r||!o)return FPe;let a={x:Math.sign(e.x-r.x),y:Math.sign(e.y-r.y)};return{x:{[ci.Backward]:o.x[ci.Backward]||a.x===-1,[ci.Forward]:o.x[ci.Forward]||a.x===1},y:{[ci.Backward]:o.y[ci.Backward]||a.y===-1,[ci.Forward]:o.y[ci.Forward]||a.y===1}}},[n,e,r])}function CPe(t,e){let n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return IS(o=>{var a;return e==null?null:(a=r??o)!=null?a:null},[r,e])}function NPe(t,e){return(0,We.useMemo)(()=>t.reduce((n,r)=>{let{sensor:o}=r,a=o.activators.map(i=>({eventName:i.eventName,handler:e(i.handler,r)}));return[...n,...a]},[]),[t,e])}function IPe(t,e){let{dragging:n,dependencies:r,config:o}=e,[a,i]=(0,We.useState)(null),{frequency:s,measure:l,strategy:c}=o,u=(0,We.useRef)(t),p=b(),m=NS(p),g=(0,We.useCallback)(function(v){v===void 0&&(v=[]),!m.current&&i(y=>y===null?v:y.concat(v.filter(S=>!y.includes(S))))},[m]),f=(0,We.useRef)(null),h=IS(v=>{if(p&&!n)return Mne;if(!v||v===Mne||u.current!==t||a!=null){let y=new Map;for(let S of t){if(!S)continue;if(a&&a.length>0&&!a.includes(S.id)&&S.rect.current){y.set(S.id,S.rect.current);continue}let w=S.node.current,k=w?new SP(l(w),w):null;S.rect.current=k,k&&y.set(S.id,k)}return y}return v},[t,a,n,p,l]);return(0,We.useEffect)(()=>{u.current=t},[t]),(0,We.useEffect)(()=>{p||g()},[n,p]),(0,We.useEffect)(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),(0,We.useEffect)(()=>{p||typeof s!="number"||f.current!==null||(f.current=setTimeout(()=>{g(),f.current=null},s))},[s,p,g,...r]),{droppableRects:h,measureDroppableContainers:g,measuringScheduled:a!=null};function b(){switch(c){case TP.Always:return!1;case TP.BeforeDragging:return n;default:return!n}}}function qne(t,e){return IS(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function xPe(t,e){return qne(t,e)}function EPe(t){let{callback:e,disabled:n}=t,r=dD(e),o=(0,We.useMemo)(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(r)},[r,n]);return(0,We.useEffect)(()=>()=>o?.disconnect(),[o]),o}function vD(t){let{callback:e,disabled:n}=t,r=dD(e),o=(0,We.useMemo)(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(r)},[n]);return(0,We.useEffect)(()=>()=>o?.disconnect(),[o]),o}function MPe(t){return new SP(Vf(t),t)}function Rne(t,e,n){e===void 0&&(e=MPe);let[r,o]=(0,We.useState)(null);function a(){o(l=>{if(!t)return null;if(t.isConnected===!1){var c;return(c=l??n)!=null?c:null}let u=e(t);return JSON.stringify(l)===JSON.stringify(u)?l:u})}let i=EPe({callback(l){if(t)for(let c of l){let{type:u,target:p}=c;if(u==="childList"&&p instanceof HTMLElement&&p.contains(t)){a();break}}}}),s=vD({callback:a});return Id(()=>{a(),t?(s?.observe(t),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[t]),r}function RPe(t){let e=qne(t);return _ne(t,e)}function DPe(t){let e=(0,We.useRef)(t),n=IS(r=>t?r&&r!==Dne&&t&&e.current&&t.parentNode===e.current.parentNode?r:fD(t):Dne,[t]);return(0,We.useEffect)(()=>{e.current=t},[t]),n}function APe(t){let[e,n]=(0,We.useState)(null),r=(0,We.useRef)(t),o=(0,We.useCallback)(a=>{let i=OV(a.target);i&&n(s=>s?(s.set(i,BV(i)),new Map(s)):null)},[]);return(0,We.useEffect)(()=>{let a=r.current;if(t!==a){i(a);let s=t.map(l=>{let c=OV(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,BV(c)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=t}return()=>{i(t),i(a)};function i(s){s.forEach(l=>{let c=OV(l);c?.removeEventListener("scroll",o)})}},[o,t]),(0,We.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((a,i)=>Af(a,i),bc):jne(t):bc,[t,e])}function Ane(t,e){e===void 0&&(e=[]);let n=(0,We.useRef)(null);return(0,We.useEffect)(()=>{n.current=null},e),(0,We.useEffect)(()=>{let r=t!==bc;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?xS(t,n.current):bc}function OPe(t){(0,We.useEffect)(()=>{if(!fP)return;let e=t.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(let n of e)n?.()}},t.map(e=>{let{sensor:n}=e;return n}))}function LPe(t,e){return(0,We.useMemo)(()=>t.reduce((n,r)=>{let{eventName:o,handler:a}=r;return n[o]=i=>{a(i,e)},n},{}),[t,e])}function Yne(t){return(0,We.useMemo)(()=>t?lPe(t):null,[t])}function zPe(t,e){e===void 0&&(e=Vf);let[n]=t,r=Yne(n?ks(n):null),[o,a]=(0,We.useState)(One);function i(){a(()=>t.length?t.map(l=>Kne(l)?r:new SP(e(l),l)):One)}let s=vD({callback:i});return Id(()=>{s?.disconnect(),i(),t.forEach(l=>s?.observe(l))},[t]),o}function BPe(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return CS(e)?e:t}function _Pe(t){let{measure:e}=t,[n,r]=(0,We.useState)(null),o=(0,We.useCallback)(c=>{for(let{target:u}of c)if(CS(u)){r(p=>{let m=e(u);return p?{...p,width:m.width,height:m.height}:m});break}},[e]),a=vD({callback:o}),i=(0,We.useCallback)(c=>{let u=BPe(c);a?.disconnect(),u&&a?.observe(u),r(u?e(u):null)},[e,a]),[s,l]=vP(i);return(0,We.useMemo)(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}function WPe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Bf}}}function jPe(t,e){switch(e.type){case ja.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ja.DragMove:return t.draggable.active==null?t:{...t,draggable:{...t.draggable,translate:{x:e.coordinates.x-t.draggable.initialCoordinates.x,y:e.coordinates.y-t.draggable.initialCoordinates.y}}};case ja.DragEnd:case ja.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ja.RegisterDroppable:{let{element:n}=e,{id:r}=n,o=new Bf(t.droppable.containers);return o.set(r,n),{...t,droppable:{...t.droppable,containers:o}}}case ja.SetDroppableDisabled:{let{id:n,key:r,disabled:o}=e,a=t.droppable.containers.get(n);if(!a||r!==a.key)return t;let i=new Bf(t.droppable.containers);return i.set(n,{...a,disabled:o}),{...t,droppable:{...t.droppable,containers:i}}}case ja.UnregisterDroppable:{let{id:n,key:r}=e,o=t.droppable.containers.get(n);if(!o||r!==o.key)return t;let a=new Bf(t.droppable.containers);return a.delete(n),{...t,droppable:{...t.droppable,containers:a}}}default:return t}}function GPe(t){let{disabled:e}=t,{active:n,activatorEvent:r,draggableNodes:o}=(0,We.useContext)(yD),a=cD(r),i=cD(n?.id);return(0,We.useEffect)(()=>{if(!e&&!r&&a&&i!=null){if(!yP(a)||document.activeElement===a.target)return;let s=o.get(i);if(!s)return;let{activatorNode:l,node:c}=s;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(let u of[l.current,c.current]){if(!u)continue;let p=wne(u);if(p){p.focus();break}}})}},[r,e,o,i,a]),null}function qPe(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((o,a)=>a({transform:o,...r}),n):n}function YPe(t){return(0,We.useMemo)(()=>({draggable:{...pD.draggable,...t?.draggable},droppable:{...pD.droppable,...t?.droppable},dragOverlay:{...pD.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function $Pe(t){let{activeNode:e,measure:n,initialRect:r,config:o=!0}=t,a=(0,We.useRef)(!1),{x:i,y:s}=typeof o=="boolean"?{x:o,y:o}:o;Id(()=>{if(!i&&!s||!e){a.current=!1;return}if(a.current||!r)return;let c=e?.node.current;if(!c||c.isConnected===!1)return;let u=n(c),p=_ne(u,r);if(i||(p.x=0),s||(p.y=0),a.current=!0,Math.abs(p.x)>0||Math.abs(p.y)>0){let m=Hne(c);m&&m.scrollBy({top:p.y,left:p.x})}},[e,i,s,r,n])}function Qne(t){let{id:e,data:n,disabled:r=!1,attributes:o}=t,a=Df(QPe),{activators:i,activatorEvent:s,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:p,over:m}=(0,We.useContext)(yD),{role:g=Lne,roleDescription:f="draggable",tabIndex:h=0}=o??{},b=l?.id===e,v=(0,We.useContext)(b?Xne:XPe),[y,S]=vP(),[w,k]=vP(),F=LPe(i,e),P=NS(n);Id(()=>(p.set(e,{id:e,key:a,node:y,activatorNode:w,data:P}),()=>{let I=p.get(e);I&&I.key===a&&p.delete(e)}),[p,e]);let T=(0,We.useMemo)(()=>({role:g,tabIndex:h,"aria-disabled":r,"aria-pressed":b&&g===Lne?!0:void 0,"aria-roledescription":f,"aria-describedby":u.draggable}),[r,g,h,b,f,u.draggable]);return{active:l,activatorEvent:s,activeNodeRect:c,attributes:T,isDragging:b,listeners:r?void 0:F,node:y,over:m,setNodeRef:S,setActivatorNodeRef:k,transform:v}}function Zne(){return(0,We.useContext)($ne)}function Jne(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:o}=t,a=Df(ZPe),{active:i,dispatch:s,over:l,measureDroppableContainers:c}=(0,We.useContext)(yD),u=(0,We.useRef)({disabled:n}),p=(0,We.useRef)(!1),m=(0,We.useRef)(null),g=(0,We.useRef)(null),{disabled:f,updateMeasurementsFor:h,timeout:b}={...JPe,...o},v=NS(h??r),y=(0,We.useCallback)(()=>{if(!p.current){p.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(v.current)?v.current:[v.current]),g.current=null},b)},[b]),S=vD({callback:y,disabled:f||!i}),w=(0,We.useCallback)((T,I)=>{S&&(I&&(S.unobserve(I),p.current=!1),T&&S.observe(T))},[S]),[k,F]=vP(w),P=NS(e);return(0,We.useEffect)(()=>{!S||!k.current||(S.disconnect(),p.current=!1,S.observe(k.current))},[k,S]),(0,We.useEffect)(()=>(s({type:ja.RegisterDroppable,element:{id:r,key:a,disabled:n,node:k,rect:m,data:P}}),()=>s({type:ja.UnregisterDroppable,key:a,id:r})),[r]),(0,We.useEffect)(()=>{n!==u.current.disabled&&(s({type:ja.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:i,rect:m,isOver:l?.id===r,node:k,over:l,setNodeRef:F}}var We,Lf,zne,YFe,$Fe,ja,bc,kP,tPe,oPe,sPe,ci,uPe,vPe,SP,zf,xd,hr,Gne,SPe,gD,wP,wPe,MS,TPe,_V,_f,zV,Hf,bP,hD,FPe,TP,HV,Mne,Dne,One,HPe,VPe,pD,Bf,UPe,KPe,yD,$ne,Xne,Hg,DS,XPe,Lne,QPe,ZPe,JPe,Uf=U(()=>{We=ue(ze()),Lf=ue(pF());ES();Pne();zne=(0,We.createContext)(null);YFe={draggable:`
To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel.
`},$Fe={onDragStart(t){let{active:e}=t;return"Picked up draggable item "+e.id+"."},onDragOver(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was moved over droppable area "+n.id+".":"Draggable item "+e.id+" is no longer over a droppable area."},onDragEnd(t){let{active:e,over:n}=t;return n?"Draggable item "+e.id+" was dropped over droppable area "+n.id:"Draggable item "+e.id+" was dropped."},onDragCancel(t){let{active:e}=t;return"Dragging was cancelled. Draggable item "+e.id+" was dropped."}};(function(t){t.DragStart="dragStart",t.DragMove="dragMove",t.DragEnd="dragEnd",t.DragCancel="dragCancel",t.DragOver="dragOver",t.RegisterDroppable="registerDroppable",t.SetDroppableDisabled="setDroppableDisabled",t.UnregisterDroppable="unregisterDroppable"})(ja||(ja={}));bc=Object.freeze({x:0,y:0});kP=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t,o=Cne(e,e.left,e.top),a=[];for(let i of r){let{id:s}=i,l=n.get(s);if(l){let c=QFe(Cne(l),o);a.push({id:s,data:{droppableContainer:i,value:c}})}}return a.sort(ZFe)};tPe=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t,o=[];for(let a of r){let{id:i}=a,s=n.get(i);if(s){let l=ePe(s,e);l>0&&o.push({id:i,data:{droppableContainer:a,value:l}})}}return o.sort(JFe)};oPe=rPe(1);sPe={ignoreTransform:!1};(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(ci||(ci={}));uPe={x:.2,y:.2};vPe=[["x",["left","right"],gPe],["y",["top","bottom"],hPe]],SP=class{constructor(e,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;let r=fD(n),o=jne(r);this.rect={...e},this.width=e.width,this.height=e.height;for(let[a,i,s]of vPe)for(let l of i)Object.defineProperty(this,l,{get:()=>{let c=s(r),u=o[a]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}},zf=class{constructor(e){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=e}add(e,n,r){var o;(o=this.target)==null||o.addEventListener(e,n,r),this.listeners.push([e,n,r])}};(function(t){t.Click="click",t.DragStart="dragstart",t.Keydown="keydown",t.ContextMenu="contextmenu",t.Resize="resize",t.SelectionChange="selectionchange",t.VisibilityChange="visibilitychange"})(xd||(xd={}));(function(t){t.Space="Space",t.Down="ArrowDown",t.Right="ArrowRight",t.Left="ArrowLeft",t.Up="ArrowUp",t.Esc="Escape",t.Enter="Enter",t.Tab="Tab"})(hr||(hr={}));Gne={start:[hr.Space,hr.Enter],cancel:[hr.Esc],end:[hr.Space,hr.Enter,hr.Tab]},SPe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case hr.Right:return{...n,x:n.x+25};case hr.Left:return{...n,x:n.x-25};case hr.Down:return{...n,y:n.y+25};case hr.Up:return{...n,y:n.y-25}}},gD=class{constructor(e){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=e;let{event:{target:n}}=e;this.props=e,this.listeners=new zf(Rf(n)),this.windowListeners=new zf(ks(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(xd.Resize,this.handleCancel),this.windowListeners.add(xd.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(xd.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&fPe(r),n(bc)}handleKeyDown(e){if(yP(e)){let{active:n,context:r,options:o}=this.props,{keyboardCodes:a=Gne,coordinateGetter:i=SPe,scrollBehavior:s="smooth"}=o,{code:l}=e;if(a.end.includes(l)){this.handleEnd(e);return}if(a.cancel.includes(l)){this.handleCancel(e);return}let{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:bc;this.referenceCoordinates||(this.referenceCoordinates=u);let p=i(e,{active:n,context:r.current,currentCoordinates:u});if(p){let m=xS(p,u),g={x:0,y:0},{scrollableAncestors:f}=r.current;for(let h of f){let b=e.code,{isTop:v,isRight:y,isLeft:S,isBottom:w,maxScroll:k,minScroll:F}=Wne(h),P=mPe(h),T={x:Math.min(b===hr.Right?P.right-P.width/2:P.right,Math.max(b===hr.Right?P.left:P.left+P.width/2,p.x)),y:Math.min(b===hr.Down?P.bottom-P.height/2:P.bottom,Math.max(b===hr.Down?P.top:P.top+P.height/2,p.y))},I=b===hr.Right&&!y||b===hr.Left&&!S,N=b===hr.Down&&!w||b===hr.Up&&!v;if(I&&T.x!==p.x){let O=h.scrollLeft+m.x,K=b===hr.Right&&O<=k.x||b===hr.Left&&O>=F.x;if(K&&!m.y){h.scrollTo({left:O,behavior:s});return}K?g.x=h.scrollLeft-O:g.x=b===hr.Right?h.scrollLeft-k.x:h.scrollLeft-F.x,g.x&&h.scrollBy({left:-g.x,behavior:s});break}else if(N&&T.y!==p.y){let O=h.scrollTop+m.y,K=b===hr.Down&&O<=k.y||b===hr.Up&&O>=F.y;if(K&&!m.x){h.scrollTo({top:O,behavior:s});return}K?g.y=h.scrollTop-O:g.y=b===hr.Down?h.scrollTop-k.y:h.scrollTop-F.y,g.y&&h.scrollBy({top:-g.y,behavior:s});break}}this.handleMove(e,Af(xS(p,this.referenceCoordinates),g))}}}handleMove(e,n){let{onMove:r}=this.props;e.preventDefault(),r(n)}handleEnd(e){let{onEnd:n}=this.props;e.preventDefault(),this.detach(),n()}handleCancel(e){let{onCancel:n}=this.props;e.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}};gD.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=Gne,onActivation:o}=e,{active:a}=n,{code:i}=t.nativeEvent;if(r.start.includes(i)){let s=a.activatorNode.current;return s&&t.target!==s?!1:(t.preventDefault(),o?.({event:t.nativeEvent}),!0)}return!1}}];wP=class{constructor(e,n,r){var o;r===void 0&&(r=yPe(e.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=e,this.events=n;let{event:a}=e,{target:i}=a;this.props=e,this.events=n,this.document=Rf(i),this.documentListeners=new zf(this.document),this.listeners=new zf(r),this.windowListeners=new zf(ks(i)),this.initialCoordinates=(o=uD(a))!=null?o:bc,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){let{events:e,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(e.move.name,this.handleMove,{passive:!1}),this.listeners.add(e.end.name,this.handleEnd),e.cancel&&this.listeners.add(e.cancel.name,this.handleCancel),this.windowListeners.add(xd.Resize,this.handleCancel),this.windowListeners.add(xd.DragStart,Ine),this.windowListeners.add(xd.VisibilityChange,this.handleCancel),this.windowListeners.add(xd.ContextMenu,Ine),this.documentListeners.add(xd.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Ene(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(xne(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(e,n){let{active:r,onPending:o}=this.props;o(r,e,this.initialCoordinates,n)}handleStart(){let{initialCoordinates:e}=this,{onStart:n}=this.props;e&&(this.activated=!0,this.documentListeners.add(xd.Click,bPe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(xd.SelectionChange,this.removeTextSelection),n(e))}handleMove(e){var n;let{activated:r,initialCoordinates:o,props:a}=this,{onMove:i,options:{activationConstraint:s}}=a;if(!o)return;let l=(n=uD(e))!=null?n:bc,c=xS(o,l);if(!r&&s){if(xne(s)){if(s.tolerance!=null&&LV(c,s.tolerance))return this.handleCancel();if(LV(c,s.distance))return this.handleStart()}if(Ene(s)&&LV(c,s.tolerance))return this.handleCancel();this.handlePending(s,c);return}e.cancelable&&e.preventDefault(),i(l)}handleEnd(){let{onAbort:e,onEnd:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleCancel(){let{onAbort:e,onCancel:n}=this.props;this.detach(),this.activated||e(this.props.active),n()}handleKeydown(e){e.code===hr.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},wPe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},MS=class extends wP{constructor(e){let{event:n}=e,r=Rf(n.target);super(e,wPe,r)}};MS.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];TPe={move:{name:"mousemove"},end:{name:"mouseup"}};(function(t){t[t.RightClick=2]="RightClick"})(_V||(_V={}));_f=class extends wP{constructor(e){super(e,TPe,Rf(e.event.target))}};_f.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===_V.RightClick?!1:(r?.({event:n}),!0)}}];zV={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Hf=class extends wP{constructor(e){super(e,zV)}static setup(){return window.addEventListener(zV.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(zV.move.name,e)};function e(){}}};Hf.activators=[{eventName:"onTouchStart",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e,{touches:o}=n;return o.length>1?!1:(r?.({event:n}),!0)}}];(function(t){t[t.Pointer=0]="Pointer",t[t.DraggableRect=1]="DraggableRect"})(bP||(bP={}));(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(hD||(hD={}));FPe={x:{[ci.Backward]:!1,[ci.Forward]:!1},y:{[ci.Backward]:!1,[ci.Forward]:!1}};(function(t){t[t.Always=0]="Always",t[t.BeforeDragging=1]="BeforeDragging",t[t.WhileDragging=2]="WhileDragging"})(TP||(TP={}));(function(t){t.Optimized="optimized"})(HV||(HV={}));Mne=new Map;Dne=[];One=[];HPe=[{sensor:MS,options:{}},{sensor:gD,options:{}}],VPe={current:{}},pD={draggable:{measure:Nne},droppable:{measure:Nne,strategy:TP.WhileDragging,frequency:HV.Optimized},dragOverlay:{measure:Vf}},Bf=class extends Map{get(e){var n;return e!=null&&(n=super.get(e))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(e=>{let{disabled:n}=e;return!n})}getNodeFor(e){var n,r;return(n=(r=this.get(e))==null?void 0:r.node.current)!=null?n:void 0}},UPe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Bf,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:mD},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:pD,measureDroppableContainers:mD,windowRect:null,measuringScheduled:!1},KPe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:mD,draggableNodes:new Map,over:null,measureDroppableContainers:mD},yD=(0,We.createContext)(KPe),$ne=(0,We.createContext)(UPe);Xne=(0,We.createContext)({...bc,scaleX:1,scaleY:1});(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Hg||(Hg={}));DS=(0,We.memo)(function(e){var n,r,o,a;let{id:i,accessibility:s,autoScroll:l=!0,children:c,sensors:u=HPe,collisionDetection:p=tPe,measuring:m,modifiers:g,...f}=e,h=(0,We.useReducer)(jPe,void 0,WPe),[b,v]=h,[y,S]=qFe(),[w,k]=(0,We.useState)(Hg.Uninitialized),F=w===Hg.Initialized,{draggable:{active:P,nodes:T,translate:I},droppable:{containers:N}}=b,O=P!=null?T.get(P):null,K=(0,We.useRef)({initial:null,translated:null}),G=(0,We.useMemo)(()=>{var lt;return P!=null?{id:P,data:(lt=O?.data)!=null?lt:VPe,rect:K}:null},[P,O]),X=(0,We.useRef)(null),[L,V]=(0,We.useState)(null),[D,A]=(0,We.useState)(null),_=NS(f,Object.values(f)),E=Df("DndDescribedBy",i),R=(0,We.useMemo)(()=>N.getEnabled(),[N]),M=YPe(m),{droppableRects:C,measureDroppableContainers:x,measuringScheduled:z}=IPe(R,{dragging:F,dependencies:[I.x,I.y],config:M.droppable}),H=CPe(T,P),Y=(0,We.useMemo)(()=>D?uD(D):null,[D]),ee=qt(),$=xPe(H,M.draggable.measure);$Pe({activeNode:P!=null?T.get(P):null,config:ee.layoutShiftCompensation,initialRect:$,measure:M.draggable.measure});let j=Rne(H,M.draggable.measure,$),J=Rne(H?H.parentElement:null),re=(0,We.useRef)({activatorEvent:null,active:null,activeNode:H,collisionRect:null,collisions:null,droppableRects:C,draggableNodes:T,draggingNode:null,draggingNodeRect:null,droppableContainers:N,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),oe=N.getNodeFor((n=re.current.over)==null?void 0:n.id),Z=_Pe({measure:M.dragOverlay.measure}),ce=(r=Z.nodeRef.current)!=null?r:H,ae=F?(o=Z.rect)!=null?o:j:null,se=!!(Z.nodeRef.current&&Z.rect),ne=RPe(se?null:j),B=Yne(ce?ks(ce):null),q=DPe(F?oe??H:null),ie=zPe(q),le=qPe(g,{transform:{x:I.x-ne.x,y:I.y-ne.y,scaleX:1,scaleY:1},activatorEvent:D,active:G,activeNodeRect:j,containerNodeRect:J,draggingNodeRect:ae,over:re.current.over,overlayNodeRect:Z.rect,scrollableAncestors:q,scrollableAncestorRects:ie,windowRect:B}),Te=Y?Af(Y,I):null,ke=APe(q),Fe=Ane(ke),te=Ane(ke,[j]),pe=Af(le,Fe),ve=ae?oPe(ae,le):null,Ie=G&&ve?p({active:G,collisionRect:ve,droppableRects:C,droppableContainers:R,pointerCoordinates:Te}):null,qe=Bne(Ie,"id"),[xe,Ce]=(0,We.useState)(null),vt=se?le:Af(le,te),Rt=nPe(vt,(a=xe?.rect)!=null?a:null,j),Ve=(0,We.useRef)(null),Ae=(0,We.useCallback)((lt,Zt)=>{let{sensor:Kt,options:gn}=Zt;if(X.current==null)return;let fn=T.get(X.current);if(!fn)return;let an=lt.nativeEvent,Pe=new Kt({active:X.current,activeNode:fn,event:an,options:gn,context:re,onAbort(be){if(!T.get(be))return;let{onDragAbort:fe}=_.current,we={id:be};fe?.(we),y({type:"onDragAbort",event:we})},onPending(be,me,fe,we){if(!T.get(be))return;let{onDragPending:nt}=_.current,ct={id:be,constraint:me,initialCoordinates:fe,offset:we};nt?.(ct),y({type:"onDragPending",event:ct})},onStart(be){let me=X.current;if(me==null)return;let fe=T.get(me);if(!fe)return;let{onDragStart:we}=_.current,Re={activatorEvent:an,active:{id:me,data:fe.data,rect:K}};(0,Lf.unstable_batchedUpdates)(()=>{we?.(Re),k(Hg.Initializing),v({type:ja.DragStart,initialCoordinates:be,active:me}),y({type:"onDragStart",event:Re}),V(Ve.current),A(an)})},onMove(be){v({type:ja.DragMove,coordinates:be})},onEnd:ge(ja.DragEnd),onCancel:ge(ja.DragCancel)});Ve.current=Pe;function ge(be){return async function(){let{active:fe,collisions:we,over:Re,scrollAdjustedTranslate:nt}=re.current,ct=null;if(fe&&nt){let{cancelDrop:yt}=_.current;ct={activatorEvent:an,active:fe,collisions:we,delta:nt,over:Re},be===ja.DragEnd&&typeof yt=="function"&&await Promise.resolve(yt(ct))&&(be=ja.DragCancel)}X.current=null,(0,Lf.unstable_batchedUpdates)(()=>{v({type:be}),k(Hg.Uninitialized),Ce(null),V(null),A(null),Ve.current=null;let yt=be===ja.DragEnd?"onDragEnd":"onDragCancel";if(ct){let bn=_.current[yt];bn?.(ct),y({type:yt,event:ct})}})}}},[T]),Ke=(0,We.useCallback)((lt,Zt)=>(Kt,gn)=>{let fn=Kt.nativeEvent,an=T.get(gn);if(X.current!==null||!an||fn.dndKit||fn.defaultPrevented)return;let Pe={active:an};lt(Kt,Zt.options,Pe)===!0&&(fn.dndKit={capturedBy:Zt.sensor},X.current=gn,Ae(Kt,Zt))},[T,Ae]),Be=NPe(u,Ke);OPe(u),Id(()=>{j&&w===Hg.Initializing&&k(Hg.Initialized)},[j,w]),(0,We.useEffect)(()=>{let{onDragMove:lt}=_.current,{active:Zt,activatorEvent:Kt,collisions:gn,over:fn}=re.current;if(!Zt||!Kt)return;let an={active:Zt,activatorEvent:Kt,collisions:gn,delta:{x:pe.x,y:pe.y},over:fn};(0,Lf.unstable_batchedUpdates)(()=>{lt?.(an),y({type:"onDragMove",event:an})})},[pe.x,pe.y]),(0,We.useEffect)(()=>{let{active:lt,activatorEvent:Zt,collisions:Kt,droppableContainers:gn,scrollAdjustedTranslate:fn}=re.current;if(!lt||X.current==null||!Zt||!fn)return;let{onDragOver:an}=_.current,Pe=gn.get(qe),ge=Pe&&Pe.rect.current?{id:Pe.id,rect:Pe.rect.current,data:Pe.data,disabled:Pe.disabled}:null,be={active:lt,activatorEvent:Zt,collisions:Kt,delta:{x:fn.x,y:fn.y},over:ge};(0,Lf.unstable_batchedUpdates)(()=>{Ce(ge),an?.(be),y({type:"onDragOver",event:be})})},[qe]),Id(()=>{re.current={activatorEvent:D,active:G,activeNode:H,collisionRect:ve,collisions:Ie,droppableRects:C,draggableNodes:T,draggingNode:ce,draggingNodeRect:ae,droppableContainers:N,over:xe,scrollableAncestors:q,scrollAdjustedTranslate:pe},K.current={initial:ae,translated:ve}},[G,H,Ie,ve,T,ce,ae,C,N,xe,q,pe]),kPe({...ee,delta:I,draggingRect:ve,pointerCoordinates:Te,scrollableAncestors:q,scrollableAncestorRects:ie});let wt=(0,We.useMemo)(()=>({active:G,activeNode:H,activeNodeRect:j,activatorEvent:D,collisions:Ie,containerNodeRect:J,dragOverlay:Z,draggableNodes:T,droppableContainers:N,droppableRects:C,over:xe,measureDroppableContainers:x,scrollableAncestors:q,scrollableAncestorRects:ie,measuringConfiguration:M,measuringScheduled:z,windowRect:B}),[G,H,j,D,Ie,J,Z,T,N,C,xe,x,q,ie,M,z,B]),Ct=(0,We.useMemo)(()=>({activatorEvent:D,activators:Be,active:G,activeNodeRect:j,ariaDescribedById:{draggable:E},dispatch:v,draggableNodes:T,over:xe,measureDroppableContainers:x}),[D,Be,G,j,v,E,T,xe,x]);return We.default.createElement(zne.Provider,{value:S},We.default.createElement(yD.Provider,{value:Ct},We.default.createElement($ne.Provider,{value:wt},We.default.createElement(Xne.Provider,{value:Rt},c)),We.default.createElement(GPe,{disabled:s?.restoreFocus===!1})),We.default.createElement(XFe,{...s,hiddenTextDescribedById:E}));function qt(){let lt=L?.autoScrollEnabled===!1,Zt=typeof l=="object"?l.enabled===!1:l===!1,Kt=F&&!lt&&!Zt;return typeof l=="object"?{...l,enabled:Kt}:{enabled:Kt}}}),XPe=(0,We.createContext)(null),Lne="button",QPe="Draggable";ZPe="Droppable",JPe={timeout:25}});function Kp(t,e,n){let r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function eCe(t,e){return t.reduce((n,r,o)=>{let a=e.get(r);return a&&(n[o]=a),n},Array(t.length))}function bD(t){return t!==null&&t>=0}function tCe(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;nr.map(F=>typeof F=="object"&&"id"in F?F.id:F),[r]),f=i!=null,h=i?g.indexOf(i.id):-1,b=c?g.indexOf(c.id):-1,v=(0,ha.useRef)(g),y=!tCe(g,v.current),S=b!==-1&&h===-1||y,w=nCe(a);Id(()=>{y&&f&&u(g)},[y,g,f,u]),(0,ha.useEffect)(()=>{v.current=g},[g]);let k=(0,ha.useMemo)(()=>({activeIndex:h,containerId:p,disabled:w,disableTransforms:S,items:g,overIndex:b,useDragOverlay:m,sortedRects:eCe(g,l),strategy:o}),[h,p,w.draggable,w.droppable,S,g,b,l,m,o]);return ha.default.createElement(nre.Provider,{value:k},e)}function dCe(t){let{disabled:e,index:n,node:r,rect:o}=t,[a,i]=(0,ha.useState)(null),s=(0,ha.useRef)(n);return Id(()=>{if(!e&&n!==s.current&&r.current){let l=o.current;if(l){let c=Vf(r.current,{ignoreTransform:!0}),u={x:l.left-c.left,y:l.top-c.top,scaleX:l.width/c.width,scaleY:l.height/c.height};(u.x||u.y)&&i(u)}}n!==s.current&&(s.current=n)},[e,n,r,o]),(0,ha.useEffect)(()=>{a&&i(null)},[a]),a}function LS(t){let{animateLayoutChanges:e=aCe,attributes:n,disabled:r,data:o,getNewIndex:a=oCe,id:i,strategy:s,resizeObserverConfig:l,transition:c=iCe}=t,{items:u,containerId:p,activeIndex:m,disabled:g,disableTransforms:f,sortedRects:h,overIndex:b,useDragOverlay:v,strategy:y}=(0,ha.useContext)(nre),S=cCe(r,g),w=u.indexOf(i),k=(0,ha.useMemo)(()=>({sortable:{containerId:p,index:w,items:u},...o}),[p,o,w,u]),F=(0,ha.useMemo)(()=>u.slice(u.indexOf(i)),[u,i]),{rect:P,node:T,isOver:I,setNodeRef:N}=Jne({id:i,data:k,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:F,...l}}),{active:O,activatorEvent:K,activeNodeRect:G,attributes:X,setNodeRef:L,listeners:V,isDragging:D,over:A,setActivatorNodeRef:_,transform:E}=Qne({id:i,data:k,attributes:{...lCe,...n},disabled:S.draggable}),R=yne(N,L),M=!!O,C=M&&!f&&bD(m)&&bD(b),x=!v&&D,z=x&&C?E:null,Y=C?z??(s??y)({rects:h,activeNodeRect:G,activeIndex:m,overIndex:b,index:w}):null,ee=bD(m)&&bD(b)?a({id:i,items:u,activeIndex:m,overIndex:b}):w,$=O?.id,j=(0,ha.useRef)({activeId:$,items:u,newIndex:ee,containerId:p}),J=u!==j.current.items,re=e({active:O,containerId:p,isDragging:D,isSorting:M,id:i,index:w,items:u,newIndex:j.current.newIndex,previousItems:j.current.items,previousContainerId:j.current.containerId,transition:c,wasDragging:j.current.activeId!=null}),oe=dCe({disabled:!re,index:w,node:T,rect:P});return(0,ha.useEffect)(()=>{M&&j.current.newIndex!==ee&&(j.current.newIndex=ee),p!==j.current.containerId&&(j.current.containerId=p),u!==j.current.items&&(j.current.items=u)},[M,ee,p,u]),(0,ha.useEffect)(()=>{if($===j.current.activeId)return;if($!=null&&j.current.activeId==null){j.current.activeId=$;return}let ce=setTimeout(()=>{j.current.activeId=$},50);return()=>clearTimeout(ce)},[$]),{active:O,activeIndex:m,attributes:X,data:k,rect:P,index:w,newIndex:ee,items:u,isOver:I,isSorting:M,isDragging:D,listeners:V,node:T,overIndex:b,over:A,setNodeRef:R,setActivatorNodeRef:_,setDroppableNodeRef:N,setDraggableNodeRef:L,transform:oe??Y,transition:Z()};function Z(){if(oe||J&&j.current.newIndex===w)return sCe;if(!(x&&!yP(K)||!c)&&(M||re))return Nd.Transition.toString({...c,property:rre})}}function cCe(t,e){var n,r;return typeof t=="boolean"?{draggable:t,droppable:!1}:{draggable:(n=t?.draggable)!=null?n:e.draggable,droppable:(r=t?.droppable)!=null?r:e.droppable}}var ha,ere,SD,AS,tre,nre,oCe,aCe,iCe,rre,sCe,lCe,Kst,zS=U(()=>{ha=ue(ze());Uf();ES();ere=t=>{let{rects:e,activeIndex:n,overIndex:r,index:o}=t,a=Kp(e,r,n),i=e[o],s=a[o];return!s||!i?null:{x:s.left-i.left,y:s.top-i.top,scaleX:s.width/i.width,scaleY:s.height/i.height}},SD={scaleX:1,scaleY:1},AS=t=>{var e;let{activeIndex:n,activeNodeRect:r,index:o,rects:a,overIndex:i}=t,s=(e=a[n])!=null?e:r;if(!s)return null;if(o===n){let c=a[i];return c?{x:0,y:nn&&o<=i?{x:0,y:-s.height-l,...SD}:o=i?{x:0,y:s.height+l,...SD}:{x:0,y:0,...SD}};tre="Sortable",nre=ha.default.createContext({activeIndex:-1,containerId:tre,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ere,disabled:{draggable:!1,droppable:!1}});oCe=t=>{let{id:e,items:n,activeIndex:r,overIndex:o}=t;return Kp(n,r,o).indexOf(e)},aCe=t=>{let{containerId:e,isSorting:n,wasDragging:r,index:o,items:a,newIndex:i,previousItems:s,previousContainerId:l,transition:c}=t;return!c||!r||s!==a&&o===i?!1:n?!0:i!==o&&e===l},iCe={duration:200,easing:"ease"},rre="transform",sCe=Nd.Transition.toString({property:rre,duration:0,easing:"linear"}),lCe={roleDescription:"sortable"};Kst=[hr.Down,hr.Right,hr.Up,hr.Left]});function ire({scrollContainerRef:t,files:e,markdownFiles:n,selectedFiles:r,selectedFilePath:o,isSaving:a,onKeyboardSelect:i,onScheduleKeyboardOpen:s,onScheduleKeyboardOpenForFile:l,onCommitKeyboardOpen:c,onReorder:u}){let{app:p,commandQueue:m,isMobile:g}=gt(),f=pt(),h=ar(),b=gr(),v=vu(),y=li(),{handleShiftArrowSelection:S,selectAll:w}=eS(),k=(0,Ga.useRef)(null),F=(0,Ga.useRef)(null),P=(0,Ga.useCallback)(V=>{let D=t.current;if(!D)return;let A=null;for(let R of D.querySelectorAll(".nn-file"))if(R.dataset.path===V){A=R;break}if(!A)return;let _=D.getBoundingClientRect(),E=A.getBoundingClientRect();E.top>=_.top&&E.bottom<=_.bottom||D.scrollTo({top:D.scrollTop+E.top-_.top-Math.max((D.clientHeight-E.height)/2,0),behavior:"auto"})},[t]),T=(0,Ga.useCallback)(V=>{F.current=V,P(V)},[P]);(0,Ga.useEffect)(()=>{if(!o)return;if(F.current===o){F.current=null;return}F.current=null;let V=window.requestAnimationFrame(()=>{P(o)});return()=>{window.cancelAnimationFrame(V)}},[P,o]),(0,Ga.useEffect)(()=>{let V=k.current;if(!V)return;k.current=null;let D=window.requestAnimationFrame(()=>{P(V)});return()=>{window.cancelAnimationFrame(D)}},[e,P]);let I=(0,Ga.useMemo)(()=>o?e.findIndex(V=>V.path===o):-1,[e,o]),N=(0,Ga.useCallback)((V,D)=>{let A=e[V];A&&(i(A,{debounceOpen:D?.debounceOpen}),T(A.path))},[e,i,T]),O=(0,Ga.useCallback)(V=>{let D=e[V];if(!D||!h.selectedFile)return;let A=e.findIndex(M=>M.path===h.selectedFile?.path);if(A===-1){b({type:"SET_SELECTED_FILE",file:D});return}let _=Ky(e,Math.min(A,V),Math.max(A,V)),{selectedFiles:E,changed:R}=Wy(h.selectedFiles,_);b({type:"APPLY_FILE_SELECTION",selectedFiles:E,selectedFile:D,lastMovementDirection:R?null:h.lastMovementDirection}),f.enterToOpenFiles||v(D),T(D.path)},[e,v,T,b,h.selectedFile,h.selectedFiles,h.lastMovementDirection,f.enterToOpenFiles]),K=(0,Ga.useCallback)(V=>{if(a)return!0;let D=o,A=dI(e,D,r,V);if(!A)return!0;let _=Lm(n,D??"",r),E=_.size>0?_:D?new Set([D]):new Set;return u({nextFiles:A.files,movedPaths:E,onApplied:()=>{k.current=A.scrollPath}}),!0},[e,a,n,u,o,r]),G=(0,Ga.useCallback)(V=>{if(are(V))return;let D=V.nativeEvent;if(_u(D))return;let A=f.keyboardShortcuts,_=I,E=e.length>0;if(f.enterToOpenFiles&&Mv(D)){let R=fc(p,h);if(!R)return;V.preventDefault();let M=Rv(D,f);if(M==="rename"){Q(()=>y.renameFile(R));return}if(M){Q(()=>no({app:p,commandQueue:m,file:R,context:M,active:!1}));return}v(R);return}if(un(D,A,Ft.LIST_MANUAL_SORT_DOWN)&&K("down")){V.preventDefault();return}if(un(D,A,Ft.LIST_MANUAL_SORT_UP)&&K("up")){V.preventDefault();return}if(un(D,A,Ft.LIST_EXTEND_SELECTION_DOWN)){if(V.preventDefault(),!g&&_!==-1){let R=S("down",_,e,{openFile:D.key==="ArrowDown"&&l?l:void 0});if(R===-1&&D.key==="ArrowDown"&&s?.(),R>=0){let M=e[R];M&&T(M.path)}}return}if(un(D,A,Ft.LIST_EXTEND_SELECTION_UP)){if(V.preventDefault(),!g&&_!==-1){let R=S("up",_,e,{openFile:D.key==="ArrowUp"&&l?l:void 0});if(R===-1&&D.key==="ArrowUp"&&s?.(),R>=0){let M=e[R];M&&T(M.path)}}return}if(un(D,A,Ft.LIST_SELECT_ALL)){V.preventDefault(),w(e);return}if(un(D,A,Ft.LIST_RANGE_TO_START)){V.preventDefault(),!g&&E&&O(0);return}if(un(D,A,Ft.LIST_RANGE_TO_END)){V.preventDefault(),!g&&E&&O(e.length-1);return}if(un(D,A,Ft.PANE_MOVE_DOWN)){if(V.preventDefault(),!E)return;let R=_===-1?0:wD(_+1,e);if(R===_){D.key==="ArrowDown"&&s?.();return}N(R,{debounceOpen:D.key==="ArrowDown"});return}if(un(D,A,Ft.PANE_MOVE_UP)){if(V.preventDefault(),!E)return;let R=_===-1?0:wD(_-1,e);if(R===_){D.key==="ArrowUp"&&s?.();return}N(R,{debounceOpen:D.key==="ArrowUp"});return}if(un(D,A,Ft.PANE_PAGE_DOWN)){if(V.preventDefault(),!E)return;let R=ore(t.current),M=_===-1?0:wD(_+R,e);if(M===_){D.key==="PageDown"&&s?.();return}N(M,{debounceOpen:D.key==="PageDown"});return}if(un(D,A,Ft.PANE_PAGE_UP)){if(V.preventDefault(),!E)return;let R=ore(t.current),M=_===-1?0:wD(_-R,e);if(M===_){D.key==="PageUp"&&s?.();return}N(M,{debounceOpen:D.key==="PageUp"});return}if(un(D,A,Ft.PANE_HOME)){if(V.preventDefault(),!E||_===0)return;N(0);return}if(un(D,A,Ft.PANE_END)){if(V.preventDefault(),!E||_===e.length-1)return;N(e.length-1)}},[e,p,m,K,S,y,g,s,l,v,t,T,N,O,w,I,h,f]),X=(0,Ga.useCallback)(V=>{if(are(V)||!c)return;let D=V.nativeEvent;_u(D)||D.ctrlKey||D.metaKey||D.altKey||D.key!=="ArrowUp"&&D.key!=="ArrowDown"&&D.key!=="PageUp"&&D.key!=="PageDown"||c()},[c]),L=(0,Ga.useCallback)(()=>{let V=t.current;V&&Di(V)},[t]);return(0,Ga.useLayoutEffect)(()=>{L();let V=window.requestAnimationFrame(L);return()=>{window.cancelAnimationFrame(V)}},[L]),{handleKeyDown:G,handleKeyUp:X}}var Ga,wD,ore,are,sre=U(()=>{Ga=ue(ze());Ur();mn();on();ot();os();td();rh();wi();Zc();ai();Jb();mR();wD=(t,e)=>e.length===0?-1:Math.max(0,Math.min(t,e.length-1)),ore=t=>{if(!t)return 1;let n=t.querySelector(".nn-manual-sort-row")?.getBoundingClientRect().height??0;return n<=0?1:Math.max(1,Math.floor(t.clientHeight/n)-1)},are=t=>{let e=t.target;return!(e instanceof HTMLElement)||e===t.currentTarget?!1:e.isContentEditable||e.closest("button, input, textarea, select")!==null}});var BS,TD,lre,dre,cre,FP=U(()=>{Uf();BS=({transform:t})=>({...t,x:0}),TD=t=>{let e=t.active?.data?.current?.type;if(!e)return kP(t);let n=t.droppableContainers.filter(r=>r.data.current?.type===e);return kP({...t,droppableContainers:n})},lre={distance:6},dre={distance:6},cre={distance:6}});function Bl({name:t,className:e,"aria-label":n,"aria-hidden":r}){let o=(0,kD.useRef)(null);return(0,kD.useEffect)(()=>{o.current&&(o.current.empty(),(0,ure.setIcon)(o.current,t))},[t]),(0,pre.jsx)("span",{ref:o,className:e,"aria-label":n,"aria-hidden":r})}var kD,ure,pre,Kf=U(()=>{kD=ue(ze()),ure=require("obsidian"),pre=ue(Ge())});function gre({canReorder:t,isDragBlockMember:e,isSorting:n=!1,isLastEntry:r,hideSeparator:o,hasCustomBackground:a,hasPreviousCustomBackground:i,hasNextCustomBackground:s,hasFilledBackground:l,hasPreviousFilledBackground:c,hasNextFilledBackground:u}){let p=["nn-manual-sort-row",t?"nn-manual-sort-row-draggable":"nn-manual-sort-row-disabled"];return e&&p.push("nn-manual-sort-row-drag-block"),n&&p.push("nn-manual-sort-row-sorting"),r&&p.push("nn-manual-sort-row-last"),o&&p.push("nn-manual-sort-row-hide-separator"),l&&p.push("nn-manual-sort-row-has-filled-background"),c&&p.push("nn-manual-sort-row-has-filled-background-previous"),u&&p.push("nn-manual-sort-row-has-filled-background-next"),a&&p.push("nn-manual-sort-row-has-custom-background"),i&&p.push("nn-manual-sort-row-has-custom-background-previous"),s&&p.push("nn-manual-sort-row-has-custom-background-next"),p.join(" ")}function mre(){}async function mCe(){}function hre({entry:t,canReorder:e,isMobile:n,selectionType:r,sortOption:o,localDayReference:a,fileIconSize:i,appearanceSettings:s,includeDescendantNotes:l,hiddenTagVisibility:c,fileNameIconNeedles:u,visibleListPropertyKeys:p,visibleNavigationPropertyKeys:m,fileItemStorage:g,shortcutKey:f,folderDecorationModel:h,fileItemPillDecorationModel:b,fileItemPillOrderModel:v,getSolidBackground:y,onFileClick:S,isSelected:w,hasSelectedAbove:k,hasSelectedBelow:F,dragHandle:P}){return(0,An.jsxs)(An.Fragment,{children:[(0,An.jsx)("div",{className:"nn-manual-sort-file",children:(0,An.jsx)(oD,{file:t.file,isSelected:w,hasSelectedAbove:k,hasSelectedBelow:F,showQuickActionsPanel:!1,onFileClick:S,fileIndex:t.info.fileIndex,sortOption:o,parentFolder:t.info.parentFolder,isPinned:!1,selectionType:r,isHidden:t.info.isHidden,onModifySearchWithTag:mre,onModifySearchWithProperty:mre,localDayReference:a,fileIconSize:i,appearanceSettings:s,includeDescendantNotes:l,hiddenTagVisibility:c,fileNameIconNeedles:u,visiblePropertyKeys:p,visibleNavigationPropertyKeys:m,fileItemStorage:g,shortcutKey:f,onToggleNoteShortcut:mCe,folderDecorationModel:h,fileItemPillDecorationModel:b,fileItemPillOrderModel:v,getSolidBackground:y,disableNativeDrag:!0,manualSortDisabled:!e})}),n&&e?P:null]})}function gCe(t){let{entry:e,isLastEntry:n,canReorder:r,isMobile:o,isDragBlockMember:a,hideSeparator:i,hasCustomBackground:s,hasPreviousCustomBackground:l,hasNextCustomBackground:c,hasFilledBackground:u,hasPreviousFilledBackground:p,hasNextFilledBackground:m,headerFilePath:g,header:f,headerWordCount:h,headerTargetWordCount:b,suppressHeaderTopSpacing:v}=t,{attributes:y,listeners:S,setNodeRef:w,setActivatorNodeRef:k,transform:F,transition:P,isSorting:T}=LS({id:e.sortableId,disabled:!r,data:{type:"manual-sort-file"}}),I={transform:F?Nd.Translate.toString(F):void 0,transition:P},N=r&&!o,O=r&&o,K=f?Bh(f,b):!1,G=(0,An.jsx)("span",{ref:k,className:"nn-drag-handle",role:"button",tabIndex:-1,...O?y:void 0,...O?S:void 0,children:(0,An.jsx)(Bl,{name:"lucide-grip-horizontal"})});return(0,An.jsxs)("div",{ref:w,className:`nn-manual-sort-sortable-item${T?" nn-manual-sort-sortable-item-sorting":""}`,style:I,children:[f?K?(0,An.jsxs)("div",{className:`nn-manual-sort-group-header-shell nn-manual-sort-custom-header${v?"":" nn-manual-sort-section-header"}`,"data-manual-sort-header-file-path":g,children:[(0,An.jsx)("div",{className:"nn-list-group-header nn-list-group-header--manual-sort",children:(0,An.jsx)(gP,{header:f,wordCount:h??0,targetWordCount:b})}),(0,An.jsx)(aD,{header:f,wordCount:h??0,targetWordCount:b})]}):(0,An.jsx)("div",{className:`nn-list-group-header nn-list-group-header--manual-sort nn-manual-sort-custom-header${v?"":" nn-manual-sort-section-header"}`,"data-manual-sort-header-file-path":g,children:(0,An.jsx)(gP,{header:f,wordCount:h??0,targetWordCount:b})}):null,(0,An.jsx)("div",{className:gre({canReorder:r,isDragBlockMember:a,isSorting:T,isLastEntry:n,hideSeparator:i,hasCustomBackground:s,hasPreviousCustomBackground:l,hasNextCustomBackground:c,hasFilledBackground:u,hasPreviousFilledBackground:p,hasNextFilledBackground:m}),...N?y:void 0,...N?S:void 0,children:(0,An.jsx)(hre,{...t,dragHandle:G})})]})}function hCe(t){let{isLastEntry:e,isDragBlockMember:n,hideSeparator:r,hasCustomBackground:o,hasPreviousCustomBackground:a,hasNextCustomBackground:i,hasFilledBackground:s,hasPreviousFilledBackground:l,hasNextFilledBackground:c}=t;return(0,An.jsx)("div",{className:gre({canReorder:!1,isDragBlockMember:n,isLastEntry:e,hideSeparator:r,hasCustomBackground:o,hasPreviousCustomBackground:a,hasNextCustomBackground:i,hasFilledBackground:s,hasPreviousFilledBackground:l,hasNextFilledBackground:c}),children:(0,An.jsx)(hre,{...t,canReorder:!1})})}function VV(t,e,n,r,o,a){let i=[],s=0,l=null,c=null,u=0,p=null,m=()=>{!l||!c||(l.headerWordCount=u,l.headerTargetWordCount=p)};return e.forEach(g=>{let f;if(n&&g.file.extension==="md"){let b=zm(t,g.file,n);b&&(s+=1,f=b,c=b,u=0,p=b.targetWordCount)}let h={key:g.sortableId,entry:g,segmentKey:`${r}:${s}`,header:f};if(i.push(h),c&&f&&(l=h,l.headerFilePath=g.file.path,m()),c&&lp(c)&&g.file.extension==="md"){if(u+=o(g.file),c.targetWordCount===null){let b=a(g.file);b!==null&&(p=(p??0)+b)}m()}}),i}function fCe({rankedRows:t,unsortedRows:e,nonMarkdownRows:n,sortableIds:r,canReorder:o,rowContext:a,noteShortcutKeysByPath:i,selectedFiles:s,activeDragPaths:l}){let{fileItemStorage:c,getSolidBackground:u}=a,p=pt(),m=Ho(),g=new Map,f=b=>{if(!b)return!1;let v=g.get(b.file.path);if(v!==void 0)return v;let y=p.showFileBackgroundUnfinishedTask?c.getDB().getFile(b.file.path)?.taskUnfinished:void 0,S=_I({customBackgroundColor:m.getFileBackgroundColor(b.file.path),taskUnfinished:y,showUnfinishedTaskBackground:p.showFileBackgroundUnfinishedTask,unfinishedTaskBackgroundColor:p.unfinishedTaskBackgroundColor,getSolidBackground:u});return g.set(b.file.path,S),S},h=(b,v=!1)=>b.map((y,S)=>{let w=y.entry,k=b[S-1],F=b[S+1],P=k?.segmentKey===y.segmentKey?k.entry:void 0,T=F?.segmentKey===y.segmentKey?F.entry:void 0,I=!T,N=s.has(w.file.path),O=T?s.has(T.file.path):!1,K=P?s.has(P.file.path):!1,G=f(w),X=f(P),L=f(T),V=G&&X,D=L,A=N||G,_=A&&!!(P&&(K||X)),E=A&&!!(T&&(O||L)),R={...a,entry:w,isLastEntry:I,canReorder:o&&w.file.extension==="md",isSelected:N,hasSelectedAbove:!!(P&&s.has(P.file.path)),hasSelectedBelow:!!(T&&s.has(T.file.path)),isDragBlockMember:l.has(w.file.path),hideSeparator:N&&!O||!N&&O,hasCustomBackground:G,hasPreviousCustomBackground:V,hasNextCustomBackground:D,hasFilledBackground:A,hasPreviousFilledBackground:_,hasNextFilledBackground:E,headerFilePath:y.headerFilePath,header:y.header,headerWordCount:y.headerWordCount,headerTargetWordCount:y.headerTargetWordCount,suppressHeaderTopSpacing:!!(y.header&&v&&S===0),shortcutKey:i.get(w.file.path)};return w.file.extension!=="md"?(0,An.jsx)(hCe,{...R},y.key):(0,An.jsx)(gCe,{...R},y.key)});return(0,An.jsxs)(OS,{items:r,strategy:AS,children:[h(t,!0),e.length>0?(0,An.jsxs)(An.Fragment,{children:[(0,An.jsx)("div",{className:"nn-list-group-header nn-manual-sort-section-header",children:(0,An.jsx)("span",{className:"nn-list-group-header-text",children:d.listPane.unsortedSection})}),h(e)]}):null,h(n)]})}function vCe(t){let e=new Map;return t.forEach(n=>{n.type!==en.FILE||!(n.data instanceof PP.TFile)||e.set(n.data.path,{fileIndex:n.fileIndex,parentFolder:n.parentFolder,isHidden:n.isHidden})}),e}function fre({files:t,listItems:e,hiddenFileState:n,propertyKey:r,manualSortGroupHeaderPropertyKey:o,wordCountTargetProperty:a,rankByPath:i,selectedFolderPath:s,isSaving:l,isDoneDisabled:c,selectionType:u,sortOption:p,localDayReference:m,fileIconSize:g,appearanceSettings:f,includeDescendantNotes:h,hiddenTagVisibility:b,fileNameIconNeedles:v,visibleListPropertyKeys:y,visibleNavigationPropertyKeys:S,fileItemStorage:w,noteShortcutKeysByPath:k,folderDecorationModel:F,fileItemPillDecorationModel:P,fileItemPillOrderModel:T,getSolidBackground:I,selectedFiles:N,selectedFilePath:O,onFileClick:K,onKeyboardSelect:G,onScheduleKeyboardOpen:X,onScheduleKeyboardOpenForFile:L,onCommitKeyboardOpen:V,onDone:D,onReorder:A}){let{app:_,isMobile:E}=gt(),R=Ho(),M=(0,Nr.useRef)(null),[C,x]=(0,Nr.useState)(()=>new Set),z=(0,Nr.useMemo)(()=>vCe(e),[e]),H=(0,Nr.useMemo)(()=>ld(t),[t]),Y=H.markdown,ee=H.nonMarkdown,$=(0,Nr.useMemo)(()=>new Map(t.map((Ae,Ke)=>[Ae.path,Ke])),[t]),j=(0,Nr.useMemo)(()=>Y.filter(Ae=>i.has(Ae.path)),[Y,i]),J=(0,Nr.useMemo)(()=>Y.filter(Ae=>!i.has(Ae.path)),[Y,i]),re=ee.length,oe=t.length===0,Z=(0,Nr.useCallback)(Ae=>Ae.map(Ke=>{let Be=z.get(Ke.path)??{};return{file:Ke,sortableId:Ke.path,info:{...Be,fileIndex:$.get(Ke.path)??Be.fileIndex,parentFolder:Be.parentFolder??s,isHidden:Be.isHidden??n.get(Ke.path)}}}),[z,n,$,s]),ce=(0,Nr.useMemo)(()=>Z(j),[Z,j]),ae=(0,Nr.useMemo)(()=>Z(J),[Z,J]),se=(0,Nr.useMemo)(()=>Z(ee),[Z,ee]),ne=(0,Nr.useCallback)(Ae=>gI(w.getDB().getFile(Ae.path)?.wordCount),[w]),B=(0,Nr.useCallback)(Ae=>ET(w.getDB().getFile(Ae.path)?.properties,a)??sI(_,Ae,a),[_,w,a]),q=(0,Nr.useMemo)(()=>VV(_,ce,o,"ranked",ne,B),[_,ne,B,o,ce]),ie=(0,Nr.useMemo)(()=>VV(_,ae,o,"unsorted",ne,B),[_,ne,B,o,ae]),le=(0,Nr.useMemo)(()=>VV(_,se,null,"non-markdown",ne,B),[_,ne,B,se]),Te=(0,Nr.useMemo)(()=>[...ce,...ae,...se],[se,ce,ae]),ke=(0,Nr.useMemo)(()=>new Map(Te.map(Ae=>[Ae.sortableId,Ae])),[Te]),Fe=(0,Nr.useMemo)(()=>Y.map(Ae=>Ae.path),[Y]),te=(0,Nr.useMemo)(()=>({isMobile:E,selectionType:u,sortOption:p,localDayReference:m,fileIconSize:g,appearanceSettings:f,includeDescendantNotes:h,hiddenTagVisibility:b,fileNameIconNeedles:v,visibleListPropertyKeys:y,visibleNavigationPropertyKeys:S,fileItemStorage:w,folderDecorationModel:F,fileItemPillDecorationModel:P,fileItemPillOrderModel:T,getSolidBackground:I,onFileClick:K}),[E,u,p,m,g,f,h,b,v,y,S,w,F,P,T,I,K]),pe=(0,Nr.useCallback)(Ae=>{let Ke=Lm(Y,Ae,N);return Ke.size>1?Ke:new Set},[Y,N]),ve=(0,Nr.useCallback)((Ae,Ke)=>KG(t,Ae,Ke,N),[t,N]),Ie=RS(Vg(_f,{activationConstraint:uCe}),Vg(Hf,{activationConstraint:pCe})),{handleKeyDown:qe,handleKeyUp:xe}=ire({scrollContainerRef:M,files:t,markdownFiles:Y,selectedFiles:N,selectedFilePath:O,isSaving:l,onKeyboardSelect:G,onScheduleKeyboardOpen:X,onScheduleKeyboardOpenForFile:L,onCommitKeyboardOpen:V,onReorder:A}),Ce=(0,Nr.useCallback)(Ae=>{if(x(new Set),l)return;let Ke=Ae.active.id,Be=Ae.over?.id;if(!Be||Ke===Be)return;let wt=ke.get(Ke),Ct=ke.get(Be);if(!wt||!Ct||wt.file.extension!=="md"||Ct.file.extension!=="md")return;let qt=ve(wt.file.path,Ct.file.path);if(!qt)return;let lt=Lm(Y,wt.file.path,N);A({nextFiles:qt,movedPaths:lt.size>1?lt:new Set([wt.file.path])})},[l,Y,ve,A,N,ke]),vt=(0,Nr.useCallback)(Ae=>{if(l)return;let Ke=Ae.active.id;x(pe(Ke))},[pe,l]),Rt=(0,Nr.useCallback)(()=>{x(new Set)},[]),Ve=(0,Nr.useCallback)(Ae=>{if(!o)return;let Ke=Ae.target;if(!(Ke instanceof Element))return;let Be,wt=Ke.closest(".nn-manual-sort-custom-header");if(wt instanceof HTMLElement&&(Be=wt.dataset.manualSortHeaderFilePath),!Be){let lt=Ke.closest(".nn-file");if(!(lt instanceof HTMLElement))return;Be=lt.dataset.path}let Ct=Be?_.vault.getFileByPath(Be):null;if(!(Ct instanceof PP.TFile)||Ct.extension!=="md")return;Ae.preventDefault(),Ae.stopPropagation();let qt=new PP.Menu;hS({menu:qt,app:_,file:Ct,propertyKey:o,metadataService:R}),qt.showAtMouseEvent(Ae.nativeEvent)},[_,o,R]);return(0,An.jsx)("div",{ref:M,className:"nn-list-pane-scroller nn-manual-sort-scroller",role:"list",tabIndex:-1,onKeyDown:qe,onKeyUp:xe,onContextMenu:Ve,children:(0,An.jsxs)("div",{className:"nn-manual-sort-panel",children:[(0,An.jsxs)("div",{className:"nn-manual-sort-header",children:[(0,An.jsxs)("div",{className:"nn-manual-sort-header-text",children:[(0,An.jsx)("span",{className:"nn-manual-sort-title",children:d.listPane.manualSortTitle.replace("{property}",r)}),(0,An.jsx)("span",{className:"nn-manual-sort-hint",children:d.listPane.manualSortHint.replace("{property}",r)}),re>0?(0,An.jsx)("span",{className:"nn-manual-sort-hint",children:d.listPane.manualSortNonMarkdownHint}):null]}),(0,An.jsx)("button",{type:"button",className:"nn-support-button nn-manual-sort-done",onClick:D,disabled:c,children:d.listPane.manualSortDone})]}),oe?(0,An.jsx)("div",{className:"nn-empty-state",children:(0,An.jsx)("div",{className:"nn-empty-message",children:d.listPane.emptyStateNoNotes})}):(0,An.jsx)(DS,{sensors:Ie,collisionDetection:TD,modifiers:[BS],onDragStart:vt,onDragCancel:Rt,onDragEnd:Ce,children:(0,An.jsx)("div",{className:"nn-manual-sort-list","aria-busy":l?"true":void 0,children:Te.length>0?(0,An.jsx)(fCe,{rankedRows:q,unsortedRows:ie,nonMarkdownRows:le,sortableIds:Fe,canReorder:!l,rowContext:te,noteShortcutKeysByPath:k,selectedFiles:N,activeDragPaths:C}):null})})]})})}var Nr,PP,An,uCe,pCe,vre=U(()=>{Nr=ue(ze());Uf();zS();ES();PP=require("obsidian");mn();on();Ee();Ue();sre();FP();wi();pp();HR();Am();Kf();MV();RV();An=ue(Ge()),uCe={distance:2},pCe={distance:4}});function bCe(t){return activeDocument?.body?(_S||(_S=new MutationObserver(()=>{FD.forEach(e=>e())}),_S.observe(activeDocument.body,yCe)),FD.add(t),()=>{FD.delete(t),FD.size===0&&_S&&(_S.disconnect(),_S=null)}):()=>{}}function SCe(t,e){if(!t)return{observer:null,rafId:window.requestAnimationFrame(()=>e())};let n=new MutationObserver(e);return n.observe(t,{attributes:!0,attributeFilter:["class","style"]}),{observer:n,rafId:null}}function PD(t,e){let{app:n,rootContainerRef:r,variables:o}=e,[a,i]=(0,Wf.useState)(null),[s,l]=(0,Wf.useState)(0),c=(0,Wf.useMemo)(()=>o.slice(),[o]);return(0,Wf.useEffect)(()=>{let u=t.current;if(!u)return;let p=!1,m=()=>{if(p)return;let S=t.current;if(!S)return;let w=window.getComputedStyle(S),k=jm(w.backgroundColor,{container:S}),F=!1;i(T=>jY(T,k)?T:(F=!0,k));let P=!1;for(let T of c){let I=w.getPropertyValue(T.source),N=xy(k,I,{container:S}),O=S.style.getPropertyValue(T.target);N?O!==N&&(S.style.setProperty(T.target,N),P=!0):O&&(S.style.removeProperty(T.target),P=!0)}(F||P)&&l(T=>T+1)},g=window.requestAnimationFrame(m);m();let f=null,h=null,b=()=>{if(f)return;let S=r.current;if(!S){h=window.requestAnimationFrame(b);return}let w=SCe(S,m);f=w.observer,h=w.rafId};b();let v=bCe(m),y=null;return n?.workspace&&(y=n.workspace.on("css-change",m)),()=>{p=!0,cancelAnimationFrame(g),h!==null&&cancelAnimationFrame(h),f&&f.disconnect(),v(),y&&n?.workspace?.offref(y),u&&HY(u)}},[n,t,r,c]),{color:a,version:s}}var Wf,yCe,FD,_S,UV=U(()=>{Wf=ue(ze());pp();yCe={attributes:!0,attributeFilter:["class","style","data-theme"]},FD=new Set,_S=null});var yre,bre,KV=U(()=>{yre=[{source:"--nn-theme-file-selected-bg",target:"--nn-computed-file-selected-bg"},{source:"--nn-theme-file-selected-inactive-bg",target:"--nn-computed-file-selected-inactive-bg"}],bre=[{source:"--nn-theme-navitem-selected-bg",target:"--nn-computed-navitem-selected-bg"},{source:"--nn-theme-navitem-selected-inactive-bg",target:"--nn-computed-navitem-selected-inactive-bg"},{source:"--nn-theme-tag-positive-bg",target:"--nn-computed-tag-positive-bg"},{source:"--nn-theme-tag-negative-bg",target:"--nn-computed-tag-negative-bg"}]});function Sre(t){return ld(t).markdown.map(e=>e.path)}function WV(t,e,n,r=[]){let o=new Map;if(!n)return o;let a=new Set(e.map(i=>i.path));return e.forEach(i=>{if(i.extension!=="md")return;let s=RT(t,i,n);s!==null&&o.set(i.path,s)}),r.forEach(i=>{a.has(i.path)&&o.set(i.path,i.value)}),o}function TCe({onHeaderClick:t,isSearchActive:e,onSearchToggle:n,onManualSortStart:r,getManualSortNewFileContext:o,actionsDisabled:a,shouldShowDesktopTitleArea:i,children:s}){let{desktopTitle:l,breadcrumbSegments:c,iconName:u,showIcon:p}=QJ();return(0,fa.jsxs)(fa.Fragment,{children:[(0,fa.jsx)(Bee,{onHeaderClick:t,isSearchActive:e,onSearchToggle:n,onManualSortStart:r,getManualSortNewFileContext:o,actionsDisabled:a,desktopTitle:l,breadcrumbSegments:c,iconName:u,showIcon:p}),s,i?(0,fa.jsx)(xte,{desktopTitle:l}):null]})}var tt,Pu,fa,wCe,wre,Tre=U(()=>{tt=ue(ze()),Pu=require("obsidian");Ur();mn();on();pa();Qs();Xi();xg();bZ();NJ();jH();YJ();ZJ();AR();nee();aee();eP();Ue();Rn();_ee();Vee();lP();Ite();Ete();fne();vre();JF();Tr();UV();KV();iS();Dr();dn();Zl();pp();ot();ai();wi();Fn();tp();Ee();Ai();qF();os();fa=ue(Ge()),wCe=new Set;wre=tt.default.memo((0,tt.forwardRef)(function(e,n){let{app:r,isMobile:o,plugin:a,fileSystemOps:i,tagTreeService:s,propertyTreeService:l}=gt(),{onNavigateToFolder:c,onRevealTag:u,onRevealProperty:p,folderDecorationModel:m,fileItemPillDecorationModel:g,fileItemPillOrderModel:f}=e,h=ar(),b=gr(),v=pt(),y=$s(),{fileNameIconNeedles:S}=_M(),w=ta(),k=Ra(),F=Xt(),P=F.includeDescendantNotes,T=F.showHiddenItems,I=F.showCalendar,N=eee(),{getFileDisplayName:O,getDB:K,getFileTimestamps:G,hasPreview:X,regenerateFeatureImageForFile:L}=xo(),{noteShortcutKeysByPath:V,addNoteShortcut:D,removeShortcut:A}=Td(),_=Yn(),E=Vr(),R=!_.singlePane&&_.effectiveDualPaneOrientation==="vertical",M=v.calendarPlacement,C=v.calendarEnabled&&M==="left-sidebar"&&I&&R,x=(0,tt.useRef)(null),z=(0,tt.useRef)(null),H=Pu.Platform.isAndroidApp,{color:Y,version:ee}=PD(x,{app:r,rootContainerRef:e.rootContainerRef,variables:yre}),$=(0,tt.useRef)(new Map),[j,J]=(0,tt.useState)(()=>v.calendarWeeksToShow),[re,oe]=(0,tt.useState)(!1),[Z,ce]=(0,tt.useState)(null),[ae,se]=(0,tt.useState)(null),[ne,B]=(0,tt.useState)(null),[q,ie]=(0,tt.useState)(null),le=(0,tt.useRef)(null),Te=(0,tt.useRef)(null),ke=(0,tt.useRef)(0),Fe=(0,tt.useRef)(0),te=(0,tt.useRef)(0),pe=(0,tt.useRef)(!1),ve=(0,tt.useRef)(null),Ie=(0,tt.useRef)(!1),qe=(0,tt.useRef)(D),xe=(0,tt.useRef)(A),Ce=v.listPaneTitle??"header",vt=!o&&Ce==="list",Rt=aS(o),Ve=vt?0:Rt.topSpacer,Ae=(0,tt.useMemo)(()=>{if(!v.showFileIcons)return{"--nn-file-icon-slot-width":"0px","--nn-file-icon-slot-width-mobile":"0px","--nn-file-icon-slot-gap":"0px"}},[v.showFileIcons]),Ke=(0,tt.useMemo)(()=>({...Ae??{},"--nn-calendar-week-count":j}),[j,Ae]);(0,tt.useEffect)(()=>{v.calendarWeeksToShow!==6&&J(v.calendarWeeksToShow)},[v.calendarWeeksToShow]),(0,tt.useEffect)(()=>{$.current.clear()},[Y,ee]);let Be=(0,tt.useMemo)(()=>dt=>{if(!dt)return;let ft=dt.trim();if(!ft)return;let Vt=$.current;if(Vt.has(ft))return Vt.get(ft);let jn=x.current,Mn=xy(Y,ft,{container:jn??null});return Vt.set(ft,Mn),Mn},[Y,ee]),wt=o&&Pu.Platform.isIosApp&&v.useFloatingToolbars,Ct=(0,tt.useMemo)(()=>wt?YP:0,[wt]),qt=(0,tt.useRef)(null),{isSearchActive:lt,searchProvider:Zt,searchQuery:Kt,debouncedSearchQuery:gn,debouncedSearchTokens:fn,searchHighlightQuery:an,shouldFocusSearch:Pe,activeSearchShortcut:ge,isSavingSearchShortcut:be,suppressSearchTopScrollRef:me,setSearchQuery:fe,handleSearchToggle:we,closeSearch:Re,focusSearchComplete:nt,handleSaveSearchShortcut:ct,handleRemoveSearchShortcut:yt,modifySearchWithTag:bn,modifySearchWithProperty:Kn,modifySearchWithDateToken:kr,toggleSearch:Wo,executeSearchShortcut:co}=tee({rootContainerRef:e.rootContainerRef,onSearchTokensChange:e.onSearchTokensChange,onNavigateToFolder:c,onRevealTag:u,onRevealProperty:p,ensureSelectionForCurrentFilterRef:qt}),{selectionType:wn,selectedFolder:Jt,selectedTag:$n,selectedProperty:Xn,selectedFile:Zn}=h,Ir=wn===W.FOLDER?Jt?.path??null:null,Jn=Tm(v,wn,Jt,$n,Xn),er=Jn.option,On=Jn.propertyKey.trim(),je=Kd(er)==="property"&&as(v,On),rt=sd(v),Et=(0,tt.useMemo)(()=>wn===W.FOLDER&&Jt?`${wn}:${Jt.path}`:wn===W.TAG&&$n?`${wn}:${$n}`:wn===W.PROPERTY&&Xn?`${wn}:${Xn}`:"none",[Jt,Xn,$n,wn]),Xe=ne!==null;(0,tt.useLayoutEffect)(()=>{let dt=Ie.current;if(Ie.current=Xe,!dt||Xe)return;let ft=e.rootContainerRef.current;ft&&Di(ft)},[Xe,e.rootContainerRef]);let Ht=bx({selectionType:wn,selectedFolder:Jt,selectedTag:$n,selectedProperty:Xn}),vn=v.collapsedPinnedContexts[Ht]!==!0,it=tt.default.useCallback(()=>{Q(()=>a.togglePinnedGroupCollapsed(Ht))},[Ht,a]),Yt=Xe?wCe:w.collapsedListGroups,fr=(0,tt.useMemo)(()=>{let dt=Array.from(Yt);return dt.sort(),`${vn?"expanded":"collapsed"}:${dt.join("")}`},[Yt,vn]),Do=tt.default.useCallback(dt=>{k({type:"TOGGLE_LIST_GROUP_COLLAPSED",collapseKey:dt})},[k]);(0,tt.useEffect)(()=>{!ne||ne.selectionKey===Et||B(null)},[Et,ne]),(0,tt.useEffect)(()=>{q&&(Xe||lt||!je||!On||q.selectionKey!==Et||q.propertyKey!==On)&&(pe.current=!1,ve.current=null,ie(null))},[On,Xe,je,lt,Et,q]);let ba=!Xe&&!lt&&je&&On.length>0,nl=ba&&q?.selectionKey===Et&&q.propertyKey===On?q:null,Cc=nl?.order??null,Sa=kf({groupBy:N.groupBy,sortOption:er,selectionType:wn,isManualSortActive:je,isManualSortEditActive:Xe}),So=(0,tt.useMemo)(()=>Sa===N.groupBy?N:{...N,groupBy:Sa},[N,Sa]),qa=tt.default.useCallback((dt,ft,Vt,jn)=>{if(Vt.length===0){jn(!1);return}Q(async()=>{let Mn=!1;try{let wo=await AT(r,dt,ft,Vt);wo.failed>0&&(Mn=!0,de(d.dragDrop.errors.failedToSetProperty.replace("{error}",zh(wo)),{variant:"warning"}))}catch(wo){Mn=!0,de(d.dragDrop.errors.failedToSetProperty.replace("{error}",to(wo,d.common.unknownError)),{variant:"warning"})}finally{jn(Mn)}})},[r]),Iu=tt.default.useCallback((dt,ft,Vt,jn,Mn,wo)=>{qa(dt,ft,Vt,uo=>{B(ia=>!ia||ia.propertyKey!==ft||ia.selectionKey!==jn||ia.sessionId!==Mn||ia.saveId!==wo?ia:{...ia,order:uo?null:ia.order,pendingAssignments:uo?[]:ia.pendingAssignments,isSaving:!1})})},[qa]),Ul=tt.default.useCallback((dt,ft,Vt,jn,Mn)=>{qa(dt,ft,Vt,wo=>{te.current===Mn&&(pe.current=!1),ie(uo=>!uo||uo.propertyKey!==ft||uo.selectionKey!==jn||uo.saveId!==Mn?uo:wo?null:{...uo,isSaving:!1})})},[qa]),Ya=tt.default.useCallback((dt,ft)=>{new En(r,d.modals.manualSortConfirm.compactTitle,d.modals.manualSortConfirm.compactMessage(dt),ft,d.modals.manualSortConfirm.compactConfirmButton,{confirmButtonClass:"mod-cta"}).open()},[r]),Md=tt.default.useCallback(dt=>{let ft=ke.current+1;ke.current=ft;let Vt=Et;Re(),_.singlePane&&E({type:"SET_SINGLE_PANE_VIEW",view:"files"}),E({type:"SET_FOCUSED_PANE",pane:"files"}),B({propertyKey:dt,order:null,pendingAssignments:[],isSaving:!1,selectionKey:Vt,sessionId:ft,saveId:0})},[Re,Et,E,_.singlePane]),$p=!_.singlePane||_.currentSinglePaneView==="files",{listItems:$a,orderedFiles:vr,orderedFileIndexMap:jo,filePathToIndex:Xr,files:Wr,hiddenFileState:Nc,localDayKey:pi}=CJ({selectionType:wn,selectedFolder:Jt,selectedTag:$n,selectedProperty:Xn,settings:v,activeProfile:y,groupBy:So.groupBy,pinnedGroupExpanded:vn,collapsedListGroups:Yt,searchProvider:Zt,searchQuery:!Xe&<?gn:void 0,searchTokens:!Xe&<?fn:void 0,visibility:{includeDescendantNotes:P,showHiddenItems:T},propertySortOrderOverride:Cc}),Xp=$a[0]?.type===en.TOP_SPACER&&$a[1]?.type===en.HEADER,Qp=v.stickyGroupHeaders&&Xp?0:Ve,Ns=(0,tt.useMemo)(()=>zr.parseLocalDayKey(pi),[pi]);(0,tt.useEffect)(()=>{if(!q||q.isSaving)return;let dt=new Set(q.order),Vt=Wr.filter(Mn=>dt.has(Mn.path)).filter(Mn=>Mn.extension==="md").map(Mn=>Mn.path);if(!(Vt.length===q.order.length&&Vt.every((Mn,wo)=>Mn===q.order[wo]))){ie(Mn=>Mn&&Mn.saveId===q.saveId?null:Mn);return}ZG(r,q.assignmentFiles,q.propertyKey,q.pendingAssignments)&&ie(Mn=>Mn&&Mn.saveId===q.saveId&&!Mn.isSaving?null:Mn)},[r,Wr,q]);let Yg=(0,tt.useMemo)(()=>wn!=="folder"||!Jt?null:Jt.path,[wn,Jt]),{visibleListPropertyKeys:Qi,visibleNavigationPropertyKeys:Zp}=(0,tt.useMemo)(()=>({visibleListPropertyKeys:qv(y.propertyKeys,"list"),visibleNavigationPropertyKeys:qv(y.propertyKeys,"navigation")}),[y.propertyKeys]),Jp=(0,tt.useMemo)(()=>({getFileDisplayName:O,getDB:K,getFileTimestamps:G,hasPreview:X,regenerateFeatureImageForFile:L}),[O,K,G,X,L]),xu=(0,tt.useMemo)(()=>Br(y.hiddenTags,T),[y.hiddenTags,T]),mi=tt.default.useCallback(dt=>{let ft=gne(dt,z.current);ce(Vt=>Vt===ft?Vt:ft)},[]),Ic=tt.default.useCallback(dt=>{if(typeof window>"u"||typeof window.requestAnimationFrame!="function"){mi(dt);return}le.current!==null&&window.cancelAnimationFrame(le.current),le.current=window.requestAnimationFrame(()=>{le.current=null,mi(dt)})},[mi]),Rd=tt.default.useCallback((dt,ft)=>{if(dt){oe(Vt=>Vt||!0),ce(Vt=>Vt===null?Vt:null);return}mi(ft),oe(!1)},[mi]),Dd=tt.default.useCallback((dt,ft)=>{if(oe(!1),!dt){le.current!==null&&(window.cancelAnimationFrame(le.current),le.current=null),ce(Vt=>Vt===null?Vt:null);return}mi(ft),Ic(ft)},[mi,Ic]),Is=(0,tt.useMemo)(()=>{if(Qi.size===0)return"";let dt=Array.from(Qi);return dt.sort(),dt.join("")},[Qi]);(0,tt.useEffect)(()=>{if(Xe||!h.isRevealOperation||h.revealSource!=="manual"||!Zn||Xr.has(Zn.path))return;let dt=wJ($a,Zn.path,vn);if(dt){if(dt.type==="pinned"){if(Te.current===Ht)return;Te.current=Ht,Q(async()=>{try{await a.togglePinnedGroupCollapsed(Ht)}finally{Te.current===Ht&&(Te.current=null)}});return}k({type:"EXPAND_LIST_GROUP",collapseKey:dt.collapseKey})}},[k,Xr,Xe,$a,Ht,vn,a,Zn,h.isRevealOperation,h.revealSource]);let{rowVirtualizer:xs,scrollContainerRef:Ao,scrollContainerRefCallback:Kl,handleScrollToTop:$g,scrollToIndexSafely:gi}=qJ({enabled:!Xe,listItems:$a,filePathToIndex:Xr,selectedFile:Zn,selectedFolder:Jt,selectedTag:$n,selectedProperty:Xn,settings:v,folderSettings:So,isVisible:$p,selectionState:h,selectionDispatch:b,searchQuery:!Xe&<?gn:void 0,suppressSearchTopScrollRef:me,topSpacerHeight:Qp,includeDescendantNotes:P,groupCollapseStateSignature:fr,visiblePropertyKeys:Qi,visiblePropertyKeySignature:Is,hiddenTagVisibility:xu,scrollMargin:0,scrollPaddingEnd:Ct,onVirtualizerScrollingChange:Rd,onScrollContainerVisibilityChange:Dd}),em=tt.default.useCallback(()=>{let dt=()=>{let ft=Ao.current??e.rootContainerRef.current;ft&&Di(ft)};if(typeof window.requestAnimationFrame=="function"){window.requestAnimationFrame(dt);return}window.setTimeout(dt,0)},[e.rootContainerRef,Ao]),Zi=(0,tt.useRef)(C),tm=(0,tt.useRef)(j);(0,tt.useEffect)(()=>{let dt=Zi.current,ft=tm.current,Vt=C&&!dt,jn=C&&j!==ft;if(Zi.current=C,tm.current=j,!Vt&&!jn||!Zn)return;let Mn=Xr.get(Zn.path);if(Mn===void 0)return;let wo=()=>gi(Mn,"auto");if(typeof requestAnimationFrame<"u"){window.requestAnimationFrame(()=>{window.requestAnimationFrame(wo)});return}window.setTimeout(wo,0)},[j,Xr,gi,Zn,C]);let nm=tt.default.useCallback((dt,ft)=>{z.current=ft,ce(Vt=>Vt===dt?Vt:dt)},[]);(0,tt.useEffect)(()=>{if(o)return;let dt=Vt=>{z.current={clientX:Vt.clientX,clientY:Vt.clientY}},ft=Vt=>{Vt.relatedTarget||(z.current=null)};return window.addEventListener("mousemove",dt,{passive:!0}),window.addEventListener("mouseout",ft),()=>{window.removeEventListener("mousemove",dt),window.removeEventListener("mouseout",ft)}},[o]),(0,tt.useEffect)(()=>()=>{le.current!==null&&(window.cancelAnimationFrame(le.current),le.current=null)},[]),(0,tt.useLayoutEffect)(()=>{re||mi(Ao.current)},[re,$a,Ao,mi]),(0,tt.useEffect)(()=>{qe.current=D,xe.current=A},[D,A]),Og(Ao,{type:YF,item:Jt??null,options:{orderedFiles:vr}});let rm=N.mode==="compact",{selectFileFromList:Es,selectAdjacentFile:Se,ensureSelectionForCurrentFilter:Ne,handleFileItemClick:He,lastSelectedFilePath:ht,isFileSelected:sn,scheduleKeyboardSelectionOpen:yr,scheduleKeyboardSelectionOpenForFile:Qr,commitPendingKeyboardSelectionOpen:hi}=oee({rootContainerRef:e.rootContainerRef,orderedFiles:vr,filePathToIndex:Xr,scrollToIndexSafely:gi});qt.current=Ne;let fi=tt.default.useCallback(async(dt,ft)=>{if(ft){await xe.current(ft);return}await qe.current(dt.path)},[]),Fr=tt.default.useCallback((dt,ft,Vt)=>{if(!ft)return[...dt];let jn=[...dt],Mn=new Map;return $w(jn,"property-asc",uo=>G(uo).created,uo=>G(uo).modified,O,uo=>{if(Mn.has(uo.path))return Mn.get(uo.path)??null;let ia=Vt.get(uo.path),sm=ia===void 0?jG(r,uo,ft):ia.toString();return Mn.set(uo.path,sm),sm},v.propertySortSecondary),jn},[r,O,G,v.propertySortSecondary]),aa=tt.default.useCallback(dt=>{if(!dt||wn!==W.FOLDER||!Jt||!P)return{files:Wr,isBroadened:!1};let ft=Jt.parent instanceof Pu.TFolder?Jt.parent:null;if(!ft||ft.path===Jt.path)return{files:Wr,isBroadened:!1};for(;ft.parent instanceof Pu.TFolder&&ft.parent.path!==ft.path;)ft=ft.parent;let Vt=ca({selectionType:W.FOLDER,selectedFolder:ft},v,{includeDescendantNotes:!0,showHiddenItems:T},r,s,l,{orderResults:!1}),jn=new Set(Wr.map(wo=>wo.path));return Vt.some(wo=>!jn.has(wo.path))?{files:Vt,isBroadened:!0}:{files:Wr,isBroadened:!1}},[r,Wr,P,l,Jt,wn,v,T,s]),Wn=ne?.propertyKey??"",Ji=(0,tt.useMemo)(()=>aa(Wn),[aa,Wn]),Go=Ji.files,Ii=Ji.isBroadened,es=(0,tt.useMemo)(()=>WV(r,Go,Wn,ne?.pendingAssignments??[]),[r,Go,Wn,ne?.pendingAssignments]),Ye=(0,tt.useMemo)(()=>Wn?Fr(Go,Wn,es):Go,[Go,Wn,es,Fr]),xt=(0,tt.useMemo)(()=>Ii?aL(Jt,Go,Ye):void 0,[Ii,Go,Ye,Jt]),Vn=(0,tt.useMemo)(()=>Wn?Fr(Wr,Wn,es):Wr,[Wr,Wn,es,Fr]),Qn=(0,tt.useMemo)(()=>{let dt=ne?.order;return dt?lI(Vn,dt):Vn},[ne?.order,Vn]),Or=(0,tt.useMemo)(()=>ba?WV(r,vr,On,nl?.pendingAssignments??[]):new Map,[nl?.pendingAssignments,r,ba,On,vr]),za=tt.default.useCallback(()=>{if(!ba)return{files:vr,isBroadened:!1,rankByPath:Or};let dt=aa(On);if(!dt.isBroadened)return{files:vr,isBroadened:!1,rankByPath:Or};let ft=WV(r,dt.files,On,nl?.pendingAssignments??[]),Vt=Fr(dt.files,On,ft);return{files:Vt,isBroadened:!0,rankByPath:ft,insertionIndex:aL(Jt,dt.files,Vt)}},[nl?.pendingAssignments,r,ba,On,aa,vr,Or,Jt,Fr]),om=!!ne?.isSaving,Xg=tt.default.useCallback(()=>{!ne||om||B(null)},[om,ne]),Qg=tt.default.useCallback(({nextFiles:dt,movedPaths:ft,onApplied:Vt})=>{if(!ne?.propertyKey)return;let{propertyKey:jn,selectionKey:Mn,sessionId:wo}=ne,uo=Ii?cI(Ye,Qn,dt):dt,ia=hy(uo,ft,es),sm=()=>{let iw=Fe.current+1;Fe.current=iw;let sw=Sre(dt);Vt?.(),B(Qf=>Qf&&Qf.sessionId===wo?{...Qf,order:sw,pendingAssignments:ia.assignments,isSaving:ia.assignments.length>0,saveId:iw}:Qf),Iu(ia.files,jn,ia.assignments,Mn,wo,iw)};if(ia.requiresCompaction){Ya(ia.assignments.length,sm);return}sm()},[Ya,Ii,Qn,Ye,es,ne,Iu]),xc=tt.default.useCallback((dt,ft,Vt)=>{He(dt,ft,Vt,Qn)},[He,Qn]),rw=tt.default.useCallback((dt,ft)=>{Es(dt,{markKeyboardNavigation:!0,suppressOpen:v.enterToOpenFiles,debounceOpen:ft?.debounceOpen})},[Es,v.enterToOpenFiles]),Ec=tt.default.useCallback(dt=>{if(!dt)return[];let ft=$a.find(jn=>jn.type===en.FILE&&jn.data instanceof Pu.TFile&&jn.data.path===dt);if(!ft||!(ft.data instanceof Pu.TFile))return[];let Vt=!!ft.isPinned;return $a.flatMap(jn=>jn.type!==en.FILE||!(jn.data instanceof Pu.TFile)?[]:!!jn.isPinned!==Vt?[]:[jn.data])},[$a]),ow=tt.default.useCallback(dt=>{if(!ba)return!1;if(pe.current)return!0;let ft=Zn?.path??null,Vt=Ec(ft),jn=dI(Vt,ft,h.selectedFiles,dt);if(!jn)return!0;let Mn=new Set(Vt.map(Mu=>Mu.path)),wo=0,uo=vr.map(Mu=>{if(!Mn.has(Mu.path))return Mu;let Rie=jn.files[wo];return wo+=1,Rie??Mu}),{markdown:ia}=ld(Vt),sm=Lm(ia,ft??"",h.selectedFiles),iw=sm.size>1?sm:new Set(ft?[ft]:[]),sw=za(),Qf=sw.isBroadened?cI(sw.files,vr,uo):uo,Zg=hy(Qf,iw,sw.rankByPath),y1=()=>{let Mu=te.current+1;te.current=Mu,pe.current=!0,ve.current=jn.scrollPath,ie({propertyKey:On,order:Sre(uo),pendingAssignments:Zg.assignments,assignmentFiles:Zg.files,isSaving:Zg.assignments.length>0,selectionKey:Et,saveId:Mu}),Ul(Zg.files,On,Zg.assignments,Et,Mu)};return Zg.requiresCompaction?(Ya(Zg.assignments.length,y1),!0):(y1(),!0)},[ba,Ya,On,za,Ec,Et,vr,Ul,Zn,h.selectedFiles]),Eu=tt.default.useCallback(()=>{let dt=Zn?.path??null,ft=v.manualSortNewNotePlacement,Vt=wn===W.FOLDER&&Jt?{targetType:"folder",targetKey:Jt.path}:wn===W.TAG&&$n?{targetType:"tag",targetKey:$n}:wn===W.PROPERTY&&Xn?{targetType:"property",targetKey:Xn}:null;if(!Vt)return null;if(ne?.propertyKey)return{...Vt,propertyKey:ne.propertyKey,files:Qn,planningFiles:Ii?Ye:void 0,planningInsertionIndex:xt,selectedFilePath:dt,rankByPath:es,placement:ft};if(!ba||!On)return null;let jn=za();return{...Vt,propertyKey:On,files:vr,planningFiles:jn.isBroadened?jn.files:void 0,planningInsertionIndex:jn.insertionIndex,selectedFilePath:dt,rankByPath:jn.rankByPath,placement:ft}},[ba,On,za,Ii,Qn,xt,Ye,es,ne?.propertyKey,vr,Jt,Zn,Xn,$n,wn,v.manualSortNewNotePlacement]),aw=(0,tt.useMemo)(()=>(0,fa.jsx)(Hee,{isSearchActive:lt,onSearchToggle:we,onManualSortStart:Md,getManualSortNewFileContext:Eu,useFloatingLayout:wt}),[Eu,Md,we,lt,wt]);(0,tt.useEffect)(()=>i.setManualSortNewFileContextProvider(Eu),[i,Eu]),(0,tt.useEffect)(()=>{let dt=ve.current;if(!dt)return;let ft=Xr.get(dt);ft!==void 0&&(ve.current=null,gi(ft,"auto"))},[Xr,q?.order,gi]),(0,tt.useEffect)(()=>{!ae||Xr.has(ae)||se(null)},[Xr,ae]);let am=tt.default.useCallback(()=>{if(!Zn)return!1;let dt=Xr.get(Zn.path);return dt===void 0?!1:(se(Zn.path),gi(dt,"auto"),!0)},[Xr,gi,Zn]),rA=tt.default.useCallback(async(dt,ft)=>{let Vt=await i.renameFileDisplayName(dt,ft);return Vt&&se(null),Vt},[i]),Nt=tt.default.useCallback(()=>{se(null)},[]);(0,tt.useImperativeHandle)(n,()=>({getIndexOfPath:dt=>Xr.get(dt)??-1,virtualizer:xs,scrollContainerRef:Ao.current,getOrderedFiles:()=>vr,selectFile:Es,selectAdjacentFile:Se,modifySearchWithTag:bn,modifySearchWithProperty:Kn,modifySearchWithDateToken:kr,toggleSearch:Wo,executeSearchShortcut:co,getManualSortNewFileContext:Eu}),[Xr,vr,xs,Ao,Wo,co,Es,Se,bn,Kn,kr,Eu]),yZ({enabled:!Xe,items:$a,virtualizer:xs,containerRef:e.rootContainerRef,pathToIndex:Xr,orderedFiles:vr,orderedFileIndexMap:jo,scrollToIndexSafely:gi,onSelectFile:(dt,ft)=>Es(dt,{markKeyboardNavigation:!0,suppressOpen:v.enterToOpenFiles||ft?.suppressOpen,debounceOpen:ft?.debounceOpen}),onScheduleKeyboardOpen:yr,onScheduleKeyboardOpenForFile:Qr,onCommitKeyboardOpen:hi,onReorderPropertySort:ow,onStartRename:am});let ts=!Jt&&!$n&&!Xn,xi=Wr.length===0,Ad=o&&!H,im=Ad&&wt,v1=Ad&&!wt;return(0,fa.jsxs)("div",{ref:x,className:`nn-list-pane ${lt?"nn-search-active":""}`,style:Ke,"data-calendar":C?"true":void 0,children:[e.resizeHandleProps&&(0,fa.jsx)("div",{className:"nn-resize-handle",...e.resizeHandleProps}),(0,fa.jsx)("div",{className:"nn-list-pane-chrome",children:(0,fa.jsxs)(TCe,{onHeaderClick:$g,isSearchActive:lt,onSearchToggle:we,onManualSortStart:Md,getManualSortNewFileContext:Eu,actionsDisabled:Xe,shouldShowDesktopTitleArea:vt,children:[o&&H&&!ne?aw:null,(0,fa.jsx)("div",{className:`nn-search-bar-container ${lt?"nn-search-bar-visible":""}`,children:lt&&(0,fa.jsx)(Nte,{searchQuery:Kt,onSearchQueryChange:fe,shouldFocus:Pe,onFocusComplete:nt,onClose:Re,onFocusFiles:()=>{Ne({openInEditor:!1})},containerRef:e.rootContainerRef,onSaveShortcut:ge?void 0:ct,onRemoveShortcut:ge?yt:void 0,isShortcutSaved:!!ge,isShortcutDisabled:be,searchProvider:Zt})})]})}),(0,fa.jsxs)("div",{className:"nn-list-pane-panel",children:[ne?(0,fa.jsx)(fre,{files:Qn,listItems:$a,hiddenFileState:Nc,propertyKey:ne.propertyKey,manualSortGroupHeaderPropertyKey:rt,wordCountTargetProperty:v.wordCountTargetProperty,rankByPath:es,selectedFolderPath:Jt?.path??null,isSaving:ne.isSaving,isDoneDisabled:om,selectionType:wn,sortOption:er,localDayReference:Ns,fileIconSize:Rt.fileIconSize,appearanceSettings:So,includeDescendantNotes:P,hiddenTagVisibility:xu,fileNameIconNeedles:S,visibleListPropertyKeys:Qi,visibleNavigationPropertyKeys:Zp,fileItemStorage:Jp,noteShortcutKeysByPath:V,folderDecorationModel:m,fileItemPillDecorationModel:g,fileItemPillOrderModel:f,getSolidBackground:Be,selectedFiles:h.selectedFiles,selectedFilePath:Zn?.path??null,onFileClick:xc,onKeyboardSelect:rw,onScheduleKeyboardOpen:yr,onScheduleKeyboardOpenForFile:Qr,onCommitKeyboardOpen:hi,onDone:Xg,onReorder:Qg}):(0,fa.jsx)(hne,{listItems:$a,rowVirtualizer:xs,scrollContainerRefCallback:Kl,activeFolderDropPath:Yg,isCompactMode:rm,isEmptySelection:ts,hasNoFiles:xi,topSpacerHeight:Qp,settings:v,pinnedGroupExpanded:vn,onPinnedGroupHeaderToggle:it,onListGroupHeaderToggle:Do,selectionType:wn,selectedFolderPath:Ir,sortOption:er,searchHighlightQuery:an,isFolderNavigation:h.isFolderNavigation,lastSelectedFilePath:ht,isFileSelected:sn,hoveredFilePath:Z,suppressRowHover:re,onHoveredFilePathChange:nm,onFileClick:He,onModifySearchWithTag:bn,onModifySearchWithProperty:Kn,localDayReference:Ns,fileIconSize:Rt.fileIconSize,appearanceSettings:So,includeDescendantNotes:P,hiddenTagVisibility:xu,fileNameIconNeedles:S,visibleListPropertyKeys:Qi,visibleNavigationPropertyKeys:Zp,fileItemStorage:Jp,noteShortcutKeysByPath:V,onToggleNoteShortcut:fi,inlineRenameFilePath:ae,onFileRenameCommit:rA,onFileRenameCancel:Nt,onFileRenameRestoreFocus:em,onNavigateToFolder:c,folderDecorationModel:m,fileItemPillDecorationModel:g,fileItemPillOrderModel:f,getSolidBackground:Be}),im&&!ne?(0,fa.jsx)("div",{className:"nn-pane-bottom-toolbar",children:aw}):null]}),C?(0,fa.jsx)("div",{className:"nn-navigation-calendar-overlay",children:(0,fa.jsx)(Up,{onWeekCountChange:J,onAddDateFilter:kr})}):null,v1&&!ne?(0,fa.jsx)("div",{className:"nn-pane-bottom-toolbar",children:aw}):null]})}))});function jV(t){return t.type===he.VIRTUAL_FOLDER&&typeof t.tagCollectionId=="string"&&t.tagCollectionId.length>0}function GV(t){return t.type===he.VIRTUAL_FOLDER&&typeof t.propertyCollectionId=="string"&&t.propertyCollectionId.length>0}function kCe(t){return t.key==="Tab"&&t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey}function kre({items:t,virtualizer:e,containerRef:n,pathToIndex:r,onStartRename:o}){let{app:a,commandQueue:i,isMobile:s,plugin:l}=gt(),c=li(),u=pt(),p=Xt(),m=p.includeDescendantNotes,g=p.showHiddenItems,f=ar(),h=gr(),b=ta(),v=Ra(),y=Yn(),S=Vr(),w=(0,NP.useCallback)((T,I)=>{if(!T)return-1;if(I){let G=Rl(r,I,T);if(G!==void 0)return G}let N=Rl(r,W.FOLDER,T);if(N!==void 0)return N;let O=Rl(r,W.TAG,T);if(O!==void 0)return O;let K=Rl(r,W.PROPERTY,T);return K!==void 0?K:-1},[r]),k=(0,NP.useCallback)(()=>f.selectionType===W.FOLDER&&f.selectedFolder?.path?w(f.selectedFolder.path,W.FOLDER):f.selectionType===W.TAG&&f.selectedTag?w(f.selectedTag,W.TAG):f.selectionType===W.PROPERTY&&f.selectedProperty?w(f.selectedProperty,W.PROPERTY):-1,[f,w]),F=(0,NP.useCallback)(T=>{if(T.type===he.FOLDER){if(!(T.data instanceof CD.TFolder))return;let I=T.data;if(h({type:"SET_SELECTED_FOLDER",folder:I}),u.autoExpandNavItems&&I.children.some(N=>N instanceof CD.TFolder)&&!b.expandedFolders.has(I.path)){let N=Eg(T,{showHiddenItems:g});N&&Fd(N,b,v,"expand",{collapseOtherBranches:u.collapseOtherBranchesOnExpand})}return}else if(T.type===he.TAG||T.type===he.UNTAGGED){let I=T.data;if(h({type:"SET_SELECTED_TAG",tag:I.path}),u.autoExpandNavItems&&I.children.size>0&&!b.expandedTags.has(I.path)){let N=Eg(T,{showHiddenItems:g});N&&Fd(N,b,v,"expand",{collapseOtherBranches:u.collapseOtherBranchesOnExpand})}}else if(T.type===he.PROPERTY_KEY||T.type===he.PROPERTY_VALUE){let I=T.data;if(h({type:"SET_SELECTED_PROPERTY",nodeId:I.id}),u.autoExpandNavItems&&I.children.size>0&&!b.expandedProperties.has(I.id)){let N=Eg(T,{showHiddenItems:g});N&&Fd(N,b,v,"expand",{collapseOtherBranches:u.collapseOtherBranchesOnExpand})}}else if(GV(T))h({type:"SET_SELECTED_PROPERTY",nodeId:Oe});else if(jV(T)){let I=T.tagCollectionId;h({type:"SET_SELECTED_TAG",tag:I})}},[h,u,b,v,g]),P=(0,NP.useCallback)((T,I)=>{let N=k(),O=u.keyboardShortcuts,K=I.isRTL(),G=-1,X=!1;if(kCe(T)){T.preventDefault();return}if(un(T,O,Ft.PANE_RENAME)&&o?.()){T.preventDefault();return}let L=()=>I.findNextIndex(-1),V=D=>{if(t.length===0)return-1;for(let A=Math.min(D,t.length-1);A>=0;A--){let _=I.getItemAt(A);if(_&&CP(_))return A}return-1};if(Mv(T)&&u.enableFolderNoteLinks&&f.selectionType===W.FOLDER&&f.selectedFolder){let D=f.selectedFolder,A=Pn(D,u);if(A){T.preventDefault();let _=Rv(T,u);if(_==="rename"){o?.();return}let E=_??lN(u.folderNoteOpenLocation);Q(()=>ri({app:a,commandQueue:i,folder:D,folderNote:A,context:E,active:!1,openInRightSidebar:R=>l.openFolderNoteInRightSidebar(R)}));return}}if(un(T,O,Ft.PANE_MOVE_DOWN)){if(T.preventDefault(),G=I.findNextIndex(N),G===N&&N>=0)return}else if(un(T,O,Ft.PANE_MOVE_UP)){if(T.preventDefault(),N===-1)G=I.findNextIndex(-1);else if(G=I.findPreviousIndex(N),G===N&&N>=0)return}else if(un(T,O,Ft.PANE_PAGE_DOWN)){if(T.preventDefault(),N!==-1){let D=I.getPageSize(),A=Math.min(N+D,t.length-1),_=I.findNextIndex(A-1);if(_===N&&N!==t.length-1)for(let E=t.length-1;E>=0;E--){let R=I.getItemAt(E);if(R&&CP(R)){_=E;break}}G=_}}else if(un(T,O,Ft.PANE_PAGE_UP)){T.preventDefault();let D=L();if(N===-1)G=D,D>=0&&(X=!0);else{let A=I.getPageSize(),_=Math.max(0,N-A),E=V(_);E>=0?(G=E,D>=0&&E===D&&(X=!0)):(G=D,D>=0&&(X=!0))}}else if(un(T,O,Ft.NAV_EXPAND_OR_FOCUS_LIST,{isRTL:K,directional:"horizontal"})){if(T.preventDefault(),N>=0){let D=I.getItemAt(N);if(!D)return;let A=Eg(D,{showHiddenItems:g}),_=A?Fd(A,b,v,"expand",{collapseOtherBranches:u.collapseOtherBranchesOnExpand}):!1,E=!_;_&&y.singlePane&&u.autoExpandNavItems?S({type:"SET_FOCUSED_PANE",pane:"navigation"}):E&&(y.singlePane&&!s?(S({type:"SET_SINGLE_PANE_VIEW",view:"files"}),S({type:"SET_FOCUSED_PANE",pane:"files"})):(h({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!0}),S({type:"SET_FOCUSED_PANE",pane:"files"})))}}else if(un(T,O,Ft.NAV_COLLAPSE_OR_PARENT,{isRTL:K,directional:"horizontal"})){if(T.preventDefault(),N>=0){let D=I.getItemAt(N);if(!D)return;let A=Eg(D,{showHiddenItems:g}),_=()=>A?Fd(A,b,v,"collapse"):!1,E=()=>{if(!u.showAllTagsFolder)return;let R=w(zt,W.TAG);if(R>=0){let M=I.getItemAt(R);M&&(F(M),I.scrollToIndex(R))}};if(D.type===he.FOLDER){if(!(D.data instanceof CD.TFolder))return;let R=D.data;if(!_()&&R.parent&&(!u.showRootFolder||R.path!=="/")){let M=R.parent.path,C=w(M,W.FOLDER);if(C>=0){let x=I.getItemAt(C);x&&(F(x),I.scrollToIndex(C))}}}else if(D.type===he.TAG){let R=D.data;if(!_()){let M=R.path.lastIndexOf("/");if(M>0){let C=R.path.substring(0,M),x=w(C,W.TAG);if(x>=0){let z=I.getItemAt(x);z&&(F(z),I.scrollToIndex(x))}}else E()}}else if(D.type===he.UNTAGGED)E();else if(D.type===he.PROPERTY_KEY||D.type===he.PROPERTY_VALUE){let R=D.data;if(!_())if(R.kind==="value"){let M=Gn(R.key),C=w(M,W.PROPERTY);if(C>=0){let x=I.getItemAt(C);x&&(F(x),I.scrollToIndex(C))}}else{let M=w(Oe,W.PROPERTY);if(M>=0){let C=I.getItemAt(M);C&&(F(C),I.scrollToIndex(M))}}}else(jV(D)||GV(D))&&_()}}else if(un(T,O,Ft.NAV_FOCUS_LIST))T.preventDefault(),s||(y.singlePane?(S({type:"SET_SINGLE_PANE_VIEW",view:"files"}),S({type:"SET_FOCUSED_PANE",pane:"files"})):(h({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!0}),S({type:"SET_FOCUSED_PANE",pane:"files"})));else if(un(T,O,Ft.DELETE_SELECTED))f.selectionType===W.FOLDER&&f.selectedFolder&&(T.preventDefault(),Q(()=>nZ({app:a,fileSystemOps:c,settings:u,visibility:{includeDescendantNotes:m,showHiddenItems:g},selectionState:f,selectionDispatch:h})));else if(un(T,O,Ft.PANE_HOME))T.preventDefault(),G=L(),G>=0&&(X=!0);else if(un(T,O,Ft.PANE_END)){T.preventDefault();for(let D=t.length-1;D>=0;D--){let A=I.getItemAt(D);if(A&&CP(A)){G=D;break}}}if(G>=0&&G{NP=ue(ze()),CD=require("obsidian");Qs();Ur();mn();on();Tr();pa();Ue();JM();IH();rh();ot();Mg();Jc();td();cn();hu();CP=t=>t.type===he.FOLDER||t.type===he.TAG||t.type===he.UNTAGGED||t.type===he.PROPERTY_KEY||t.type===he.PROPERTY_VALUE||(jV(t)||GV(t))&&!!t.isSelectable});function Cre({plugin:t,children:e}){let[n,r]=(0,Sc.useState)(()=>t.getRecentNotes()),[o,a]=(0,Sc.useState)(()=>t.getRecentIcons());(0,Sc.useEffect)(()=>{let s=`recent-data-${Date.now()}`,l=()=>{r(t.getRecentNotes()),a(t.getRecentIcons())};return t.registerRecentDataListener(s,l),()=>{t.unregisterRecentDataListener(s)}},[t]);let i=Sc.default.useMemo(()=>({recentNotes:n,recentIcons:o}),[n,o]);return(0,Ire.jsx)(Pre.Provider,{value:i,children:e})}function Nre(){let t=(0,Sc.useContext)(Pre);if(t===null)throw new Error("useRecentData must be used within a RecentDataProvider");return t}var Sc,Ire,Pre,qV=U(()=>{Sc=ue(ze()),Ire=ue(Ge()),Pre=(0,Sc.createContext)(null)});function IP(t,e){let n=e.cache?.get(t.path);if(n)return n;let r=0,o=0,a=e.excludedFileMatcher??po(e.excludedFiles);for(let s of t.children)if(s instanceof ND.TFile){if(e.folderNoteSettings.enableFolderNotes&&e.hideFolderNoteInList&&zs(s,t,e.folderNoteSettings))continue;let l=e.hiddenFileTagVisibility,c=!1;l&&l.hasHiddenRules&&s.extension==="md"&&Pr({app:e.app,file:s,db:e.db}).some(p=>!l.isTagVisible(p))&&(c=!0),rl(s,e.fileVisibility,e.app)&&!(e.fileNameMatcher&&e.fileNameMatcher.matches(s))&&!Xo(s,a,e.app)&&!c&&(r+=1)}else if(s instanceof ND.TFolder){if(!e.includeDescendants||!e.showHiddenFolders&&qd(s.name,e.excludedFolders,s.path))continue;let l=IP(s,e);o+=l.total}let i=e.includeDescendants?{current:r,descendants:o,total:r+o}:{current:r,descendants:0,total:r};return e.cache?.set(t.path,i),i}var ND,YV=U(()=>{ND=require("obsidian");Mr();Yr();_a();Sn()});function Ere(t){let{app:e,isVisible:n,settings:r,propertiesSectionActive:o,itemsWithMetadata:a,includeDescendantNotes:i,visibleTaggedCount:s,untaggedCount:l,renderPropertyTree:c,propertyCollectionCount:u,effectiveFrontmatterExclusions:p,hiddenFolders:m,hiddenFileTags:g,showHiddenItems:f,folderCountFileNameMatcher:h,fileVisibility:b,vaultChangeVersion:v,metadataVisibilityVersion:y,tagDataVersion:S}=t,w=(0,Fs.useRef)(new Map),k=(0,Fs.useRef)(new Map),F=(0,Fs.useRef)(new Map),P=!f&&g.length>0?S:0,T=(0,Fs.useMemo)(()=>{if(!n||!r.showTags||!r.showNoteCount)return null;let X=new Map,L=i?s:0;return X.set(zt,{current:L,descendants:0,total:L}),r.showUntagged&&X.set(bt,{current:l,descendants:0,total:l}),a.forEach(V=>{if(V.type!==he.TAG)return;let D=V.data;if(V.noteCount){X.set(D.path,V.noteCount);return}X.set(D.path,pN(D,i))}),X},[i,n,a,r.showNoteCount,r.showTags,r.showUntagged,l,s]),I=(0,Fs.useMemo)(()=>!r.showTags||!r.showNoteCount?new Map:T??w.current,[T,r.showNoteCount,r.showTags]);(0,Fs.useEffect)(()=>{if(!r.showTags||!r.showNoteCount){w.current=new Map;return}T&&(w.current=T)},[T,r.showNoteCount,r.showTags]);let N=(0,Fs.useMemo)(()=>{if(!n||!o||!r.showNoteCount)return null;let X=new Map;u&&X.set(Oe,u);let L=new Map;return a.forEach(V=>{(V.type===he.PROPERTY_KEY||V.type===he.PROPERTY_VALUE)&&L.set(V.data.id,V.data)}),L.size===0||L.forEach(V=>{if(V.kind==="key"){let R=jc(V);if(!i){X.set(V.id,{current:R,descendants:0,total:R});return}let M=V.notesWithValue.size,C=Math.max(M-R,0);X.set(V.id,{current:R,descendants:C,total:M});return}let D=V.notesWithValue.size;if(!i||!V.valuePath){X.set(V.id,{current:D,descendants:0,total:D});return}let A=c.get(V.key);if(!A){X.set(V.id,{current:D,descendants:0,total:D});return}let _=Pm(A,V.valuePath),E=Math.max(_-D,0);X.set(V.id,{current:D,descendants:E,total:_})}),X},[i,n,a,o,u,c,r.showNoteCount]),O=(0,Fs.useMemo)(()=>!o||!r.showNoteCount?new Map:N??k.current,[N,o,r.showNoteCount]);(0,Fs.useEffect)(()=>{if(!o||!r.showNoteCount){k.current=new Map;return}N&&(k.current=N)},[N,o,r.showNoteCount]);let K=(0,Fs.useMemo)(()=>{if(!n||!r.showNoteCount)return null;let X=new Map,L=p,V=po(L),D=m,A=f?null:Br(g,!1),_=A&&A.hasHiddenRules?Sr():null,E=No({enableFolderNotes:r.enableFolderNotes,folderNoteName:r.folderNoteName,folderNoteNamePattern:r.folderNoteNamePattern}),C={app:e,db:_,fileVisibility:b,excludedFiles:L,excludedFileMatcher:V,excludedFolders:D,fileNameMatcher:h,hiddenFileTagVisibility:A,includeDescendants:i,showHiddenFolders:f,hideFolderNoteInList:r.hideFolderNoteInList,folderNoteSettings:E,cache:X};return a.forEach(x=>{x.type===he.FOLDER&&x.data instanceof xre.TFolder&&IP(x.data,C)}),X},[e,p,b,h,P,g,m,i,n,a,y,r.enableFolderNotes,r.folderNoteName,r.folderNoteNamePattern,r.hideFolderNoteInList,r.showNoteCount,f,v]),G=(0,Fs.useMemo)(()=>r.showNoteCount?K??F.current:new Map,[K,r.showNoteCount]);return(0,Fs.useEffect)(()=>{if(!r.showNoteCount){F.current=new Map;return}K&&(F.current=K)},[K,r.showNoteCount]),{tagCounts:I,propertyCounts:O,folderCounts:G}}var Fs,xre,Mre=U(()=>{Fs=ue(ze()),xre=require("obsidian");Ue();Ba();Yr();Dr();zn();_a();YV();cn()});function Dre(t){return typeof t!="string"?null:Rre.has(t)?t:null}function HS(t){let e=new Set,n=[];return t.forEach(r=>{Rre.has(r)&&(e.has(r)||(e.add(r),n.push(r)))}),jP.forEach(r=>{e.has(r)||(e.add(r),n.push(r))}),n}function $V(t){if(!Array.isArray(t))return[...jP];let e=t.map(Dre).filter(n=>!!n);return HS(e)}function Are(t,e){let n=[],r=new Set;return t.forEach(o=>{let a=Dre(o);a&&(r.has(a)||(r.add(a),n.push(a)))}),e.forEach(o=>{r.has(o)||(r.add(o),n.push(o))}),HS(n)}var Rre,ID=U(()=>{Ue();Rre=new Set(jP)});function Ore(t){let{app:e,settings:n,navRainbow:r,fileNameIconNeedles:o,getFileDisplayName:a,metadataService:i,parsedExcludedFolders:s,folderDecorationModel:l,navRainbowPalettes:c,navRainbowColors:u}=t,p=new Map,m=T=>{let I=p.get(T);if(I)return I;let N=i.getFolderDisplayData(T);return p.set(T,N),N},g={showFilenameMatchIcons:n.showFilenameMatchIcons,fileNameIconMap:n.fileNameIconMap,showCategoryIcons:!0,fileTypeIconMap:n.fileTypeIconMap,fileTypeIconPreset:n.fileTypeIconPreset,externalIconProviders:n.externalIconProviders},f="file",h=T=>{if(n.showFilenameMatchIcons)return a(T)},b=r.mode,v=b!=="none",y=n.showAllTagsFolder?1:0,S=n.showAllPropertiesFolder?1:0,w=c.tag,k=c.property,F=c.shortcut,P=c.recent;return{app:e,settings:n,metadataService:i,parsedExcludedFolders:s,getFolderDisplayData:m,folderDecorationModel:l,fileIcons:{settings:g,fallbackMode:f,fileNameIconNeedles:o,getFileNameForMatch:h},rainbow:{mode:b,isEnabled:v,tag:{isEnabled:!!w,scope:r.tags.scope,rootLevel:y,colors:u.tag},property:{isEnabled:!!k,scope:r.properties.scope,rootLevel:S,colors:u.property},shortcut:{isEnabled:!!F,colors:u.shortcut},recent:{isEnabled:!!P,colors:u.recent}}}}function Lre(t){let{ctx:e,folderPath:n,color:r,backgroundColor:o}=t;return xf({model:e.folderDecorationModel,folderPath:n,color:r,backgroundColor:o})}function zre(t){let{ctx:e,rainbowColor:n,color:r,backgroundColor:o}=t;return!e.rainbow.isEnabled||!n?{color:r,backgroundColor:o}:Ey({mode:e.rainbow.mode,rainbowColor:n,color:r,backgroundColor:o})}function xP(t){let{ctx:e,shouldApply:n,rainbowColor:r,colors:o}=t;if(!n||!r)return o;let a=zre({ctx:e,rainbowColor:r,color:o.color,backgroundColor:o.backgroundColor});return{color:a.color,backgroundColor:a.backgroundColor}}function EP(t){let{ctx:e,enabled:n,virtualFolderId:r,color:o,backgroundColor:a}=t;if(!n||o&&a)return null;let i=o?void 0:e.settings.virtualFolderColors[r],s=a?void 0:e.settings.virtualFolderBackgroundColors[r];return!i&&!s?null:{color:o??i,backgroundColor:a??s}}function FCe(t,e,n){return EP({ctx:t,enabled:!0,virtualFolderId:yi,color:e,backgroundColor:n})}function PCe(t,e,n){return EP({ctx:t,enabled:!0,virtualFolderId:bi,color:e,backgroundColor:n})}function Bre(t,e,n){if(!t.rainbow.isEnabled||!n)return e;let r=e.color??void 0,o=e.backgroundColor??void 0,a=zre({ctx:t,rainbowColor:n,color:r,backgroundColor:o});return a.color===r&&a.backgroundColor===o?e:{...e,...a}}function xD(t,e,n){let r=!rl(e,Er.SUPPORTED,t.app);return OM(e,t.fileIcons.settings,{customIconId:n,metadataCache:t.app.metadataCache,isExternalFile:r,fallbackMode:t.fileIcons.fallbackMode,fileNameNeedles:t.fileIcons.fileNameIconNeedles,fileNameForMatch:t.fileIcons.getFileNameForMatch(e)})??void 0}function CCe(t,e){if(t.rainbow.shortcut.isEnabled)return t.rainbow.shortcut.colors.colorsByKey.get(e)}function NCe(t,e){if(t.rainbow.recent.isEnabled)return t.rainbow.recent.colors.colorsByKey.get(e)}function VS(t){let{ctx:e,itemKey:n,color:r,backgroundColor:o,allowRainbow:a=!0}=t,i=r,s=o,l=FCe(e,i,s);return l&&(i=l.color,s=l.backgroundColor),a?xP({ctx:e,shouldApply:!0,rainbowColor:CCe(e,n),colors:{color:i,backgroundColor:s}}):{color:i,backgroundColor:s}}function _re(t){let{ctx:e,itemKey:n,color:r,backgroundColor:o}=t,a=r,i=o,s=PCe(e,a,i);return s&&(a=s.color,i=s.backgroundColor),xP({ctx:e,shouldApply:!0,rainbowColor:NCe(e,n),colors:{color:a,backgroundColor:i}})}var XV=U(()=>{Ue();Mr();LM();Gm();JR()});function ICe(t,e){if(e===Oe)return Qe(t.settings.interfaceIcons,"nav-properties");let n=kn(e);return t.metadataService.getPropertyIcon(e)||(n?.valuePath?Qe(t.settings.interfaceIcons,"nav-property-value"):Qe(t.settings.interfaceIcons,"nav-property"))}function xCe(t,e){let n=e.folder?.path,r=n?t.getFolderDisplayData(n):void 0,o=n==="/"?"vault":"lucide-folder",a=VS({ctx:t,itemKey:e.key,color:r?.color,backgroundColor:void 0,allowRainbow:!e.isExcluded});return{...e,displayName:r?.displayName,icon:r?.icon||o,color:a.color,backgroundColor:a.backgroundColor}}function ECe(t,e){let n=t.metadataService.getTagColorData(e.tagPath),r=VS({ctx:t,itemKey:e.key,color:n.color,backgroundColor:void 0});return{...e,icon:t.metadataService.getTagIcon(e.tagPath)||Qe(t.settings.interfaceIcons,"nav-tag"),color:r.color,backgroundColor:r.backgroundColor}}function MCe(t,e){let n=e.propertyNodeId,r=t.metadataService.getPropertyColorData(n),o=VS({ctx:t,itemKey:e.key,color:r.color,backgroundColor:void 0});return{...e,icon:ICe(t,n),color:o.color,backgroundColor:o.backgroundColor}}function RCe(t,e){let n=e.note;if(!n)return e;let r=t.metadataService.getFileColor(n.path),o=t.metadataService.getFileIcon(n.path),a=xD(t,n,o),i=VS({ctx:t,itemKey:e.key,color:r,backgroundColor:void 0});return{...e,icon:a??void 0,color:i.color,backgroundColor:i.backgroundColor}}function DCe(t,e){let n=VS({ctx:t,itemKey:e.key,color:e.color,backgroundColor:void 0});return n.color===e.color&&n.backgroundColor===e.backgroundColor?e:{...e,color:n.color,backgroundColor:n.backgroundColor}}function Hre(t,e){switch(e.type){case he.SHORTCUT_FOLDER:return xCe(t,e);case he.SHORTCUT_TAG:return ECe(t,e);case he.SHORTCUT_PROPERTY:return MCe(t,e);case he.SHORTCUT_NOTE:return RCe(t,e);case he.SHORTCUT_SEARCH:return DCe(t,e);default:return null}}var Vre=U(()=>{Ue();cn();pr();XV()});function ACe(t,e){let n=t.getFolderDisplayData(e.data.path),r={color:n.color,backgroundColor:n.backgroundColor};return r=Lre({ctx:t,folderPath:e.data.path,color:r.color,backgroundColor:r.backgroundColor}),{...e,displayName:n.displayName,color:r.color,backgroundColor:r.backgroundColor,icon:n.icon,parsedExcludedFolders:t.parsedExcludedFolders}}function OCe(t,e){let n=e.data,r=t.metadataService.getTagColorData(n.path),o={color:r.color,backgroundColor:r.background},a=EP({ctx:t,enabled:t.settings.showAllTagsFolder&&t.settings.inheritTagColors,virtualFolderId:_n,color:o.color,backgroundColor:o.backgroundColor});a&&(o={color:a.color,backgroundColor:a.backgroundColor});let i=t.rainbow.tag;if(i.isEnabled){let s=i.colors.colorsByPath.get(n.path),l=s?void 0:i.colors.getInheritedColor(n.path),c=s??l,u=i.scope==="all"?!0:i.scope==="root"?e.level===i.rootLevel||!!l:e.level>i.rootLevel;o=xP({ctx:t,shouldApply:u,rainbowColor:c,colors:o})}return{...e,color:o.color,backgroundColor:o.backgroundColor,icon:t.metadataService.getTagIcon(n.path)}}function LCe(t,e){let n=e.data,r=n.id,o=t.metadataService.getPropertyColorData(r),a=t.metadataService.getPropertyIcon(r)||(n.kind==="value"?Qe(t.settings.interfaceIcons,"nav-property-value"):void 0),i={color:o.color,backgroundColor:o.background},s=EP({ctx:t,enabled:t.settings.showAllPropertiesFolder&&t.settings.inheritPropertyColors,virtualFolderId:Oe,color:i.color,backgroundColor:i.backgroundColor});s&&(i={color:s.color,backgroundColor:s.backgroundColor});let l=t.rainbow.property;if(l.isEnabled){let c=l.colors.colorsByNodeId.get(n.id),u=c||l.scope!=="root"||!t.settings.inheritPropertyColors||n.kind!=="value"?void 0:l.colors.rootColorsByKey.get(n.key),p=c??u,m=n.kind==="key"&&e.level===l.rootLevel,g=l.scope==="all"?!0:l.scope==="root"?m||!!u:!m;i=xP({ctx:t,shouldApply:g,rainbowColor:p,colors:i})}return{...e,color:i.color,backgroundColor:i.backgroundColor,icon:a}}function zCe(t,e){let n=e.data.id,r=t.settings.virtualFolderColors[n],o=t.settings.virtualFolderBackgroundColors[n],a=r||o?{...e,color:r??void 0,backgroundColor:o??void 0}:e,i;return e.data.id===_n?i=t.rainbow.tag.colors.rootColor:e.data.id===Oe?i=t.rainbow.property.colors.rootColor:e.data.id===yi?i=t.rainbow.shortcut.colors.rootColor:e.data.id===bi&&(i=t.rainbow.recent.colors.rootColor),Bre(t,a,i)}function BCe(t,e){let n=e.note,r=t.metadataService.getFileIcon(n.path),o=t.metadataService.getFileColor(n.path),a=_re({ctx:t,itemKey:e.key,color:o,backgroundColor:e.backgroundColor}),i=xD(t,n,r);return{...e,icon:i??void 0,color:a.color,backgroundColor:a.backgroundColor}}function _Ce(t,e){switch(e.type){case he.FOLDER:return ACe(t,e);case he.TAG:case he.UNTAGGED:return OCe(t,e);case he.PROPERTY_KEY:case he.PROPERTY_VALUE:return LCe(t,e);case he.VIRTUAL_FOLDER:return zCe(t,e);case he.RECENT_NOTE:return BCe(t,e);case he.SHORTCUT_FOLDER:case he.SHORTCUT_TAG:case he.SHORTCUT_PROPERTY:case he.SHORTCUT_NOTE:case he.SHORTCUT_SEARCH:return Hre(t,e)??e;default:return e}}function Ure(t){let{app:e,settings:n,navRainbow:r,fileNameIconNeedles:o,getFileDisplayName:a,metadataService:i,parsedExcludedFolders:s,folderDecorationModel:l,navRainbowPalettes:c,navRainbowColors:u}=t,p=Ore({app:e,settings:n,navRainbow:r,fileNameIconNeedles:o,getFileDisplayName:a,metadataService:i,parsedExcludedFolders:s,folderDecorationModel:l,navRainbowPalettes:c,navRainbowColors:u});return m=>_Ce(p,m)}var Kre=U(()=>{Ue();pr();XV();Vre()});function jre(t,e,n){if(e<=0)return t;let r=[],o=0,a=0,i=l=>l.type!==he.VIRTUAL_FOLDER?!1:l.data.id===_n?n.tagRootLevel>0:l.data.id===Oe?n.propertyRootLevel>0:!1,s=l=>l.type===he.TOP_SPACER||l.type===he.BOTTOM_SPACER||l.type===he.VIRTUAL_FOLDER?!0:l.type===he.LIST_SPACER?!HCe(l.key):!1;for(let l of t){if(s(l)){o=i(l)?1:0,r.push(l);continue}if(VCe(l,n)){o>0&&r.push({type:he.ROOT_SPACER,key:`root-spacer-${a++}`,spacing:e}),o+=1,r.push(l);continue}r.push(l)}return r}var Wre,HCe,VCe,Gre=U(()=>{Ue();JT();Wre=new Set([he.TOP_SPACER,he.LIST_SPACER,he.BOTTOM_SPACER,he.ROOT_SPACER]),HCe=t=>{let e=qh(t);return e?.type==="folder"||e?.type==="tag"||e?.type==="property"},VCe=(t,e)=>{if(t.type===he.FOLDER){if(e.showRootFolder&&t.data.path==="/")return!0;let n=e.showRootFolder?1:0;return t.level===n}return t.type===he.TAG||t.type===he.UNTAGGED?t.level===e.tagRootLevel:t.type===he.PROPERTY_KEY?t.level===e.propertyRootLevel:!1}});function Yre({app:t,settings:e,metadataService:n,fileNameIconNeedles:r,getFileDisplayName:o,folderDecorationModel:a,navRainbowState:i,sectionOrder:s,showHiddenItems:l,pinShortcuts:c,shouldPinRecentNotes:u,propertiesSectionActive:p,folderItems:m,tagItems:g,propertyItems:f,shortcutItems:h,recentNotesItems:b,parsedExcludedFolders:v,metadataDecorationVersion:y}){let S=(0,yo.useMemo)(()=>HS(s),[s]),{navRainbow:w,navRainbowPalettes:k}=i,{items:F,sectionSpacerMap:P,firstSectionId:T}=(0,yo.useMemo)(()=>{let $=[],j=new Map,J=null;$.push({type:he.TOP_SPACER,key:"top-spacer"});let re=e.showShortcuts&&h.length>0&&!c,oe=e.showRecentNotes&&b.length>0&&!u,Z=m.length>0,ce=e.showTags&&g.length>0,ae=p&&f.length>0,se=[];S.forEach(B=>{switch(B){case Dt.SHORTCUTS:re&&se.push({id:B,items:h});break;case Dt.RECENT:oe&&se.push({id:B,items:b});break;case Dt.FOLDERS:Z&&se.push({id:B,items:m});break;case Dt.TAGS:ce&&se.push({id:B,items:g});break;case Dt.PROPERTIES:ae&&se.push({id:B,items:f});break;default:break}});let ne=se.filter(B=>B.items.length>0);return ne.length>0&&(J=ne[0].id,j.set(ne[0].id,"top-spacer")),ne.forEach((B,q)=>{if($.push(...B.items),qn.getNavigationSeparatorsVersion());(0,yo.useEffect)(()=>n.subscribeToNavigationSeparatorChanges($=>{N($)}),[n]);let O=(0,yo.useMemo)(()=>({version:I,record:e.navigationSeparators||{}}),[I,e.navigationSeparators]),K=(0,yo.useMemo)(()=>{let $=O.record,j=new Set,J=new Set,re=new Set,oe=new Set,Z=!1;Object.entries($||{}).forEach(([ae,se])=>{if(!se)return;let ne=qh(ae);if(ne){if(ne.type==="section"){if(ne.id===Dt.TAGS&&!e.showAllTagsFolder||ne.id===Dt.PROPERTIES&&!p)return;oe.add(ne.id);return}if(ne.type==="folder"){ne.path==="/"?Z=e.showRootFolder:j.add(ne.path);return}if(ne.type==="tag"){J.add(ne.path);return}if(ne.type==="property"){let B=Gt(ne.nodeId);B&&re.add(B)}}});let ce=j.size>0||J.size>0||re.size>0||oe.size>0||Z;return{folderSeparators:j,tagSeparators:J,propertySeparators:re,sectionSeparatorIds:oe,useSectionSpacerForRootFolder:Z,hasAnySeparators:ce}},[O,p,e.showAllTagsFolder,e.showRootFolder]),G=(0,yo.useMemo)(()=>{let{folderSeparators:$,tagSeparators:j,propertySeparators:J,sectionSeparatorIds:re,useSectionSpacerForRootFolder:oe,hasAnySeparators:Z}=K;if(!Z)return F;let ce=new Set,ae=new Set(re);if(c&&(ae.delete(Dt.SHORTCUTS),T&&ae.delete(T)),ae.forEach(q=>{let ie=P.get(q);ie&&ce.add(ie)}),oe&&(!c||T!==Dt.FOLDERS)){let q=P.get(Dt.FOLDERS);q&&ce.add(q)}if(ce.size===0&&$.size===0&&j.size===0&&J.size===0)return F;let ne=q=>({type:he.LIST_SPACER,key:q,hasSeparator:!0}),B=[];return F.forEach(q=>{if(q.type===he.TOP_SPACER||q.type===he.LIST_SPACER){ce.has(q.key)?B.push({...q,hasSeparator:!0}):B.push(q);return}let ie=q.type===he.FOLDER&&q.isExcluded&&!l;q.type===he.FOLDER?!ie&&$.has(q.data.path)&&B.push(ne(Oy(q.data.path))):(q.type===he.TAG||q.type===he.UNTAGGED)&&j.has(q.data.path)?B.push(ne(ZT(q.data.path))):(q.type===he.PROPERTY_KEY||q.type===he.PROPERTY_VALUE)&&J.has(q.data.id)&&B.push(ne(Ly(q.data.id))),B.push(q)}),B},[T,F,K,c,P,l]),X=(0,yo.useMemo)(()=>{let $=k.tag;return $?VI({items:g,palette:$,scope:w.tags.scope,rootLevel:e.showAllTagsFolder?1:0,showAllTagsFolder:e.showAllTagsFolder,inheritColors:e.inheritTagColors}):{colorsByPath:new Map,rootColor:void 0,getInheritedColor:j=>{}}},[w.tags.scope,k.tag,e.inheritTagColors,e.showAllTagsFolder,g]),L=(0,yo.useMemo)(()=>{let $=k.property;return $?UI({items:f,palette:$,scope:w.properties.scope,showAllPropertiesFolder:e.showAllPropertiesFolder}):{colorsByNodeId:new Map,rootColor:void 0,rootColorsByKey:new Map}},[w.properties.scope,k.property,f,e.showAllPropertiesFolder]),V=(0,yo.useMemo)(()=>{let $=k.shortcut;return $?r$({items:h,palette:$}):{colorsByKey:new Map,rootColor:void 0}},[k.shortcut,h]),D=(0,yo.useMemo)(()=>{let $=k.recent;return $?o$({items:b,palette:$}):{colorsByKey:new Map,rootColor:void 0}},[k.recent,b]),A=(0,yo.useMemo)(()=>({tag:X,property:L,shortcut:V,recent:D}),[L,D,V,X]),_=(0,yo.useMemo)(()=>Ure({app:t,settings:e,navRainbow:w,fileNameIconNeedles:r,getFileDisplayName:o,metadataService:n,parsedExcludedFolders:v,folderDecorationModel:a,navRainbowPalettes:k,navRainbowColors:A}),[t,r,o,y,n,a,w,A,k,v,e]),E=(0,yo.useMemo)(()=>G.map(_),[_,G]),R=(0,yo.useMemo)(()=>E.filter(qre),[E]),M=(0,yo.useMemo)(()=>c?h.map(_):[],[_,c,h]),C=(0,yo.useMemo)(()=>u?R.length>0?R:b.map(_):[],[_,R,b,u]),x=(0,yo.useMemo)(()=>{let $=E.filter(j=>!(c&&UCe(j)||u&&qre(j)));return l?$:$.filter(j=>!(j.type===he.FOLDER&&j.isExcluded))},[E,c,u,l]),z=(0,yo.useMemo)(()=>{if(!c)return null;let $=null;for(let j of x)if(!Wre.has(j.type)){$=j;break}return $&&$.type===he.FOLDER?$.data.path:null},[x,c]),H=(0,yo.useMemo)(()=>{if(!c||!z)return x;let{folderSeparators:$}=K;if(!$.has(z))return x;let J=Oy(z),re=-1;for(let Z=0;Z{let $=e.showAllTagsFolder?1:0,j=e.showAllPropertiesFolder?1:0;return jre(H,e.rootLevelSpacing,{showRootFolder:e.showRootFolder,tagRootLevel:$,propertyRootLevel:j})},[H,e.rootLevelSpacing,e.showAllPropertiesFolder,e.showAllTagsFolder,e.showRootFolder]),ee=(0,yo.useMemo)(()=>eZ(Y),[Y]);return{items:Y,itemsWithMetadata:E,firstSectionId:T,firstInlineFolderPath:z,shortcutItemsWithMetadata:M,pinnedRecentNotesItems:C,pathToIndex:ee}}var yo,UCe,qre,$re=U(()=>{yo=ue(ze());Ue();Mg();Gm();ID();JT();cn();Kre();Gre();UCe=t=>t.type===he.VIRTUAL_FOLDER?t.data.id===yi:t.type===he.SHORTCUT_FOLDER||t.type===he.SHORTCUT_NOTE||t.type===he.SHORTCUT_SEARCH||t.type===he.SHORTCUT_TAG||t.type===he.SHORTCUT_PROPERTY||t.type===he.SHORTCUT_HEADER,qre=t=>t.type===he.VIRTUAL_FOLDER?t.data.id===bi:t.type===he.RECENT_NOTE});function Xre({app:t,settings:e,sourceState:n,hydratedShortcuts:r,recentNotes:o,shortcutsExpanded:a,recentNotesExpanded:i,pinShortcuts:s,propertiesSectionActive:l}){let{hiddenFileNames:c,hiddenFilePropertyMatcher:u,hiddenFileTags:p,hiddenFolders:m,hiddenMatcherHasRules:g,hiddenTagMatcher:f,metadataVisibilityVersion:h,propertyTree:b,recentNotesHiddenFileMatcher:v,tagDataVersion:y,tagTreeForOrdering:S}=n,w=(0,QV.useMemo)(()=>{if(!e.showShortcuts)return[];let P=0,T=P+1,I=new Map,N=new Map,O=Br(p,!1),K=O.hasHiddenRules,G=K?kt():null,X=[{type:he.VIRTUAL_FOLDER,key:yi,level:P,data:{id:yi,name:d.navigationPane.shortcutsHeader,icon:Qe(e.interfaceIcons,"nav-shortcuts")},hasChildren:r.length>0}];if(!a)return X;let L=D=>{if(I.has(D))return I.get(D)??!1;let A=t.vault.getAbstractFileByPath(D);return!(A instanceof ZV.TFile)||A.extension!=="md"||u.hasCriteria&&Xo(A,u,t)||c.length>0&&pT(A,c)||K&&Pr({app:t,file:A,db:G}).some(_=>!O.isTagVisible(_))||m.length>0&&A.parent!==null&&ei(A.parent,m)?(I.set(D,!1),!1):(I.set(D,!0),!0)},V=D=>{if(N.has(D))return N.get(D)??!1;if(Vs(D))return N.set(D,!0),!0;let A=Li(S,D);if(!A)return N.set(D,!1),!1;let _=[A],E=new Set;for(;_.length>0;){let R=_.pop();if(R&&!E.has(R)&&(E.add(R),!(g&&!Vs(R.path)&&ss(R.path,R.name,f)))){for(let M of R.notesWithTag)if(L(M))return N.set(D,!0),!0;for(let M of R.children.values())_.push(M)}}return N.set(D,!1),!1};return r.forEach(D=>{let{key:A,shortcut:_,folder:E,note:R,search:M,tagPath:C,propertyNodeId:x}=D;if(Zo(_)){if(!E){X.push({type:he.SHORTCUT_FOLDER,key:A,level:T,shortcut:_,folder:null,isMissing:!0,missingLabel:_.path});return}let z=m.length>0&&ei(E,m);X.push({type:he.SHORTCUT_FOLDER,key:A,level:T,shortcut:_,folder:E,isExcluded:z});return}if(Po(_)){if(!R){X.push({type:he.SHORTCUT_NOTE,key:A,level:T,shortcut:_,note:null,isMissing:!0,missingLabel:_.path});return}let z=R.extension==="md"&&u.hasCriteria&&Xo(R,u,t)||R.extension==="md"&&K&&Pr({app:t,file:R,db:G}).some(H=>!O.isTagVisible(H))||c.length>0&&pT(R,c)||m.length>0&&R.parent!==null&&ei(R.parent,m);X.push({type:he.SHORTCUT_NOTE,key:A,level:T,shortcut:_,note:R,isExcluded:z});return}if(Bi(_)){X.push({type:he.SHORTCUT_SEARCH,key:A,level:T,shortcut:_,searchShortcut:M??_});return}if(Co(_)){let z=C??_.tagPath;if(!z)return;let H=Vc(z,S);if(!H)return;let Y=Li(S,H),ee=Y?.displayPath??z,$=!Y,j=!V(H);Vs(H)&&(ee=rc(H).getLabel(),$=!1),X.push({type:he.SHORTCUT_TAG,key:A,level:T,shortcut:_,tagPath:H,displayName:ee,isMissing:$,isExcluded:j,missingLabel:$?z:void 0});return}if(la(_)){let z=x??_.nodeId,H=Kv(x,_.nodeId);if(H===Oe){let j=!l;X.push({type:he.SHORTCUT_PROPERTY,key:A,level:T,shortcut:_,propertyNodeId:Oe,displayName:d.navigationPane.properties,isMissing:j,missingLabel:j?d.navigationPane.properties:void 0});return}let Y=H?kn(H):null;if(!H||!Y){X.push({type:he.SHORTCUT_PROPERTY,key:A,level:T,shortcut:_,propertyNodeId:z,displayName:z,isMissing:!0,missingLabel:z});return}let ee=MN({nodeId:H,propertyTree:b});if(!ee){let j=b.get(Y.key);if(!j){let oe=Y.valuePath?.trim(),Z=oe&&oe.length>0?oe:Y.key;X.push({type:he.SHORTCUT_PROPERTY,key:A,level:T,shortcut:_,propertyNodeId:H,displayName:Z,isMissing:!0,missingLabel:Z});return}let J=Y.valuePath?.trim(),re=J&&J.length>0?J:j.name;X.push({type:he.SHORTCUT_PROPERTY,key:A,level:T,shortcut:_,propertyNodeId:H,displayName:re,isMissing:!0,missingLabel:re});return}let $=ee.node;X.push({type:he.SHORTCUT_PROPERTY,key:A,level:T,shortcut:_,propertyNodeId:$.id,displayName:$.name})}}),X},[t,c,u,p,m,g,f,r,h,b,l,e.interfaceIcons,e.showShortcuts,a,y,S]),k=(0,QV.useMemo)(()=>{if(!e.showRecentNotes)return[];let P=0,T=P+1,I=Math.max(1,e.recentNotesCount??1),N=o.slice(0,I),O=L=>{let V=t.vault.getAbstractFileByPath(L);return V instanceof ZV.TFile?v(V)?null:V:null},K=d.navigationPane.recentFilesHeader;if(!i){let L=!1;for(let V of N)if(O(V)){L=!0;break}return[{type:he.VIRTUAL_FOLDER,key:bi,level:P,data:{id:bi,name:K,icon:Qe(e.interfaceIcons,"nav-recent-files")},hasChildren:L}]}let G=[];N.forEach(L=>{let V=O(L);V&&G.push({type:he.RECENT_NOTE,key:`recent-${L}`,level:T,note:V})});let X=[{type:he.VIRTUAL_FOLDER,key:bi,level:P,data:{id:bi,name:K,icon:Qe(e.interfaceIcons,"nav-recent-files")},hasChildren:G.length>0}];return G.length===0||X.push(...G),X},[t,h,o,i,v,e.interfaceIcons,e.recentNotesCount,e.showRecentNotes,y]),F=s&&e.pinRecentNotesWithShortcuts&&e.showRecentNotes;return{shortcutItems:w,recentNotesItems:k,shouldPinRecentNotes:F}}var QV,ZV,Qre=U(()=>{QV=ue(ze()),ZV=require("obsidian");Ee();Ue();Ia();Yr();zn();Jm();Dr();Ba();Sn();cn();pr()});function Zre({settings:t,isVisible:e,sourceState:n,treeSections:r,folderDecorationModel:o,navRainbowState:a,shortcutsExpanded:i,recentNotesExpanded:s,pinShortcuts:l,sectionOrder:c}){let{app:u}=gt(),{fileNameIconNeedles:p}=_M(),{recentNotes:m}=Nre(),g=Ho(),{getFileDisplayName:f}=xo(),{hydratedShortcuts:h}=Td(),b=Xt(),v=b.includeDescendantNotes,y=b.showHiddenItems,{effectiveFrontmatterExclusions:S,hiddenFolders:w,hiddenFileTags:k,fileVisibility:F,navigationBannerPath:P,folderCountFileNameMatcher:T,rootLevelFolders:I,missingRootFolderPaths:N,untaggedCount:O,visibleTaggedCount:K,rootTagOrderMap:G,missingRootTagPaths:X,rootPropertyOrderMap:L,missingRootPropertyKeys:V,metadataDecorationVersion:D,metadataVisibilityVersion:A,tagDataVersion:_,fileChangeVersion:E}=n,{folderItems:R,tagItems:M,rootOrderingTagTree:C,resolvedRootTagKeys:x,tagsVirtualFolderHasChildren:z,renderPropertyTree:H,rootOrderingPropertyTree:Y,propertyItems:ee,propertiesSectionActive:$,resolvedRootPropertyKeys:j,propertyCollectionCount:J}=r,re=w,{shortcutItems:oe,recentNotesItems:Z,shouldPinRecentNotes:ce}=Xre({app:u,settings:t,sourceState:n,hydratedShortcuts:h,recentNotes:m,shortcutsExpanded:i,recentNotesExpanded:s,pinShortcuts:l,propertiesSectionActive:$}),{items:ae,itemsWithMetadata:se,firstSectionId:ne,firstInlineFolderPath:B,shortcutItemsWithMetadata:q,pinnedRecentNotesItems:ie,pathToIndex:le}=Yre({app:u,settings:t,metadataService:g,fileNameIconNeedles:p,getFileDisplayName:f,folderDecorationModel:o,navRainbowState:a,sectionOrder:c,showHiddenItems:y,pinShortcuts:l,shouldPinRecentNotes:ce,propertiesSectionActive:$,folderItems:R,tagItems:M,propertyItems:ee,shortcutItems:oe,recentNotesItems:Z,parsedExcludedFolders:re,metadataDecorationVersion:D}),{tagCounts:Te,propertyCounts:ke,folderCounts:Fe}=Ere({app:u,isVisible:e,settings:t,propertiesSectionActive:$,itemsWithMetadata:se,includeDescendantNotes:v,visibleTaggedCount:K,untaggedCount:O,renderPropertyTree:H,propertyCollectionCount:J,effectiveFrontmatterExclusions:S,hiddenFolders:w,hiddenFileTags:k,showHiddenItems:y,folderCountFileNameMatcher:T,fileVisibility:F,vaultChangeVersion:E,metadataVisibilityVersion:A,tagDataVersion:_});return{items:ae,firstSectionId:ne,firstInlineFolderPath:B,shortcutItems:q,pinnedRecentNotesItems:ie,shouldPinRecentNotes:ce,tagsVirtualFolderHasChildren:z,propertiesSectionActive:$,pathToIndex:le,tagCounts:Te,propertyCounts:ke,folderCounts:Fe,rootLevelFolders:I,missingRootFolderPaths:N,resolvedRootTagKeys:x,rootOrderingTagTree:C,rootTagOrderMap:G,missingRootTagPaths:X,resolvedRootPropertyKeys:j,rootOrderingPropertyTree:Y,rootPropertyOrderMap:L,missingRootPropertyKeys:V,vaultChangeVersion:E,navigationBannerPath:P}}var Jre=U(()=>{mn();qV();Xi();xg();Tr();on();Mre();$re();Qre()});function KCe(t,e){if(t===e)return!0;if(t.size!==e.size)return!1;for(let[n,r]of e)if(t.get(n)!==r)return!1;return!0}function WCe(t){return t.map(e=>e.type===he.ROOT_SPACER?`${e.type}:${e.spacing}`:e.type).join("")}function eoe({items:t,pathToIndex:e,isVisible:n,activeShortcutKey:r,scrollMargin:o,scrollPaddingEnd:a}){let{isMobile:i}=gt(),s=Ml(),l=d9(),c=Yn(),u=pt(),m=Xt().showHiddenItems,g=(0,Bn.useRef)(null),[f,h]=(0,Bn.useState)(null),[b,v]=(0,Bn.useState)(!1),y=(0,Bn.useCallback)(j=>{g.current=j,h(j),j||v(!1)},[]);(0,Bn.useEffect)(()=>{let j=f;if(!j){v(!1);return}let J=()=>{let oe=j.getBoundingClientRect(),Z=oe.width>0&&oe.height>0;v(ce=>ce===Z?ce:Z)};if(J(),typeof ResizeObserver>"u"){let oe=()=>J();return window.addEventListener("resize",oe),()=>{window.removeEventListener("resize",oe)}}let re=new ResizeObserver(oe=>{let Z=oe[0];if(!Z)return;let{width:ce,height:ae}=Z.contentRect,se=ce>0&&ae>0;v(ne=>ne===se?ne:se)});return re.observe(j),()=>re.disconnect()},[f]);let S=n&&b,w=(0,Bn.useCallback)((j,J)=>{if(!j)return;if(J)return Rl(e,J,j);let re=Rl(e,W.FOLDER,j);if(re!==void 0)return re;let oe=Rl(e,W.TAG,j);return oe!==void 0?oe:Rl(e,W.PROPERTY,j)},[e]),k=(0,Bn.useRef)(null),[F,P]=(0,Bn.useState)(0),T=(0,Bn.useRef)(0),I=(0,Bn.useRef)(null),N=(0,Bn.useRef)(null),O=(0,Bn.useRef)(!1),K=(0,Bn.useRef)(null),G=(0,Bn.useRef)(null),X=(0,Bn.useRef)(""),L=(0,Bn.useRef)(m),V=(0,Bn.useRef)(e.size),D=(0,Bn.useRef)(""),A=Number.isFinite(o)&&o>0?o:0,_=Number.isFinite(a)&&a>0?a:0,E=(0,Bn.useCallback)(j=>{let J=t[j];return J?vc(J):j},[t]),R=(0,Bn.useCallback)(j=>{let J=g.current;if(!J||_<=0)return;let re=J.querySelector(`[data-index="${j}"]`);if(!(re instanceof HTMLElement))return;let oe=J.getBoundingClientRect(),Z=re.getBoundingClientRect(),ce=oe.bottom-_;Z.bottom>ce&&(J.scrollTop+=Math.round(Z.bottom-ce))},[_]),M=kR({count:t.length,getItemKey:E,getScrollElement:()=>g.current,scrollMargin:A,scrollPaddingEnd:_,estimateSize:j=>{let J=t[j],re=i?u.navItemHeight+ol.mobileHeightIncrement:u.navItemHeight;switch(J.type){case he.TOP_SPACER:return ol.topSpacer;case he.BOTTOM_SPACER:return ol.bottomSpacer;case he.LIST_SPACER:return ol.listSpacer;case he.ROOT_SPACER:return J.spacing;case he.FOLDER:case he.VIRTUAL_FOLDER:return re;case he.TAG:case he.UNTAGGED:return re;default:return re}},overscan:GP}),C=(0,Bn.useMemo)(()=>WCe(t),[t]);(0,Bn.useEffect)(()=>{let j=I.current,J=j===null||!KCe(j,e),re=D.current!==C;if(J){let oe=T.current;T.current=oe+1,V.current=e.size,I.current=e,D.current=C,M.measure();return}re&&(D.current=C,M.measure()),(V.current!==e.size||I.current!==e)&&(V.current=e.size,I.current=e)},[C,e,e.size,M]);let x=(0,Bn.useCallback)((j,J)=>{M.scrollToIndex(j,{align:J});let re=0,oe=()=>{re+=1,R(j),re<3&&window.requestAnimationFrame(oe)};window.requestAnimationFrame(oe)},[R,M]),z=(0,Bn.useCallback)(()=>{i&&g.current&&g.current.scrollTo({top:0,behavior:"smooth"})},[i]),H=(0,Bn.useCallback)((j,J)=>{let re=Lp(J.itemType,j);k.current={path:re,align:J.align,intent:"external",minIndexVersion:T.current,itemType:J.itemType},P(oe=>oe+1)},[]),Y=s.selectionType===W.TAG?W.TAG:s.selectionType===W.PROPERTY?W.PROPERTY:s.selectionType===W.FOLDER?W.FOLDER:null,ee=s.selectionType===W.FOLDER&&s.selectedFolder?Lp(W.FOLDER,s.selectedFolder.path):s.selectionType===W.TAG&&s.selectedTag?Lp(W.TAG,s.selectedTag):s.selectionType===W.PROPERTY&&s.selectedProperty?s.selectedProperty:null;(0,Bn.useEffect)(()=>{if(!ee||!M||!S)return;if(l.isRevealOperation){N.current=ee,O.current=S,K.current=c.focusedPane;return}let j=Y??W.FOLDER,J=u.skipAutoScroll&&l.revealSource==="shortcut",re=N.current!==ee,oe=!O.current&&S,Z=K.current!=="navigation"&&c.focusedPane==="navigation";if(N.current=ee,O.current=S,K.current=c.focusedPane,J||!re&&!oe&&!Z||r)return;if(L.current!==m){k.current={path:ee,align:"auto",intent:"visibilityToggle",minIndexVersion:T.current+1,itemType:j},P(ae=>ae+1);return}let ce=w(ee,j);ce!==void 0&&ce>=0&&x(ce,FR("selection"))},[ee,M,S,l.isRevealOperation,c.focusedPane,m,Y,l.revealSource,w,r,u.skipAutoScroll,x]),(0,Bn.useEffect)(()=>{if(!ee||!Y||!M||!S)return;if(l.isRevealOperation){G.current=ee;return}if(Y!==W.TAG&&Y!==W.PROPERTY)return;if(r){G.current=ee;return}if(u.skipAutoScroll&&l.revealSource==="shortcut"){G.current=ee;return}let J=G.current!==ee;if(G.current=ee,!J)return;if(L.current!==m){k.current={path:ee,align:"auto",intent:"visibilityToggle",minIndexVersion:T.current+1,itemType:Y},P(oe=>oe+1);return}let re=w(ee,Y);re!==void 0&&re>=0&&x(re,FR("selection"))},[e,Y,ee,M,S,l.isRevealOperation,m,w,r,l.revealSource,u.skipAutoScroll,x]),(0,Bn.useEffect)(()=>{if(!M||!k.current||!S)return;let{path:j,align:J,intent:re,minIndexVersion:oe,itemType:Z}=k.current;if(L.current!==m&&re!=="visibilityToggle")return;let ce=oe??T.current;if(T.current{let q=w(B,Z);q!==void 0&&q!==ne&&(k.current={path:B,align:"auto",intent:"visibilityToggle",minIndexVersion:T.current+1,itemType:Z},P(ie=>ie+1))})}}},[M,S,F,m,w,x]),(0,Bn.useEffect)(()=>{if(!i)return;let j=()=>{if(r||!ee)return;let J=Y??W.FOLDER;if(M&&S){let re=w(ee,J);if(re!==void 0&&re>=0){x(re,"auto");return}}k.current={path:ee,align:"auto",intent:"mobile-visibility",minIndexVersion:T.current,itemType:J},P(re=>re+1)};return window.addEventListener("notebook-navigator-visible",j),()=>window.removeEventListener("notebook-navigator-visible",j)},[i,ee,M,Y,w,r,S,x]),(0,Bn.useEffect)(()=>{M&&M.measure()},[u.navItemHeight,u.rootLevelSpacing,M]),(0,Bn.useEffect)(()=>{let j=`${u.navItemHeight}-${u.rootLevelSpacing}`,J=X.current&&X.current!==j;if(r){X.current=j;return}if(J&&ee&&S&&M){let re=w(ee,Y??W.FOLDER);re!==void 0&&re>=0&&window.requestAnimationFrame(()=>{x(re,"auto")})}X.current=j},[u.navItemHeight,u.rootLevelSpacing,ee,S,M,w,Y,r,x]);let $=(0,Bn.useRef)(null);return(0,Bn.useEffect)(()=>{if(!S)return;let j=$.current,J={top:A,bottom:_};if($.current=J,!j||j.top===J.top&&j.bottom===J.bottom||r||!ee)return;let re=Y??W.FOLDER,oe=w(ee,re);oe===void 0||oe<0||window.requestAnimationFrame(()=>{x(oe,"auto")})},[r,A,_,S,w,x,ee,Y]),(0,Bn.useEffect)(()=>{L.current!==m&&(ee&&(Y===W.TAG||Y===W.PROPERTY)&&S&&M&&(k.current={path:ee,align:"auto",intent:"visibilityToggle",minIndexVersion:T.current+1,itemType:Y??W.FOLDER},P(j=>j+1)),L.current=m)},[Y,m,ee,S,M]),{rowVirtualizer:M,scrollContainerRef:g,scrollContainerRefCallback:y,handleScrollToTop:z,requestScroll:H,pendingScrollVersion:F}}var Bn,toe=U(()=>{Bn=ue(ze());QH();mn();Ur();pa();on();Tr();Ue();JH();Mg()});function noe(t){let{app:e,items:n,settings:r,showHiddenItems:o,updateSettings:a,sectionOrder:i,setSectionOrder:s,rootLevelFolders:l,missingRootFolderPaths:c,resolvedRootTagKeys:u,rootOrderingTagTree:p,missingRootTagPaths:m,resolvedRootPropertyKeys:g,rootOrderingPropertyTree:f,missingRootPropertyKeys:h,metadataService:b,foldersSectionExpanded:v,tagsSectionExpanded:y,propertiesSectionExpanded:S,propertiesSectionActive:w,handleToggleFoldersSection:k,handleToggleTagsSection:F,handleTogglePropertiesSection:P,activeProfile:T}=t,{showRootFolder:I,rootFolderOrder:N,rootTagOrder:O,rootPropertyOrder:K,showUntagged:G,tagSortOrder:X,propertySortOrder:L,showShortcuts:V,showRecentNotes:D,showTags:A,customVaultName:_}=r,{hiddenFolders:E,hiddenTags:R}=T,M=(0,lr.useMemo)(()=>Fm(R),[R]),C=(0,lr.useMemo)(()=>M.pathPatterns.length>0||M.prefixes.length>0||M.startsWithNames.length>0||M.endsWithNames.length>0,[M]),x=(0,lr.useMemo)(()=>{let ge=[];if(I){let Re=e.vault.getRoot();ge.push({key:Re.path,folder:Re,isVault:!0})}let be=new Map;l.forEach(Re=>{be.set(Re.path,Re)});let me=new Set(c),fe=N.length>0?N:l.map(Re=>Re.path),we=new Set;return fe.forEach(Re=>{if(we.has(Re))return;we.add(Re);let nt=be.get(Re);nt?ge.push({key:Re,folder:nt}):me.has(Re)&&ge.push({key:Re,folder:null,isMissing:!0})}),l.forEach(Re=>{we.has(Re.path)||ge.push({key:Re.path,folder:Re})}),ge},[e.vault,c,N,l,I]),z=(0,lr.useMemo)(()=>X==="frequency-asc"||X==="frequency-desc"?d.navigationPane.resetRootToFrequency:d.navigationPane.resetRootToAlpha,[X]),H=(0,lr.useMemo)(()=>L==="frequency-asc"||L==="frequency-desc"?d.navigationPane.resetRootToFrequency:d.navigationPane.resetRootToAlpha,[L]),Y=(0,lr.useMemo)(()=>{let ge=[],be=new Map;p.forEach((we,Re)=>{be.set(Re,we)});let me=new Set,fe=we=>{me.has(we.key)||(me.add(we.key),ge.push(we))};return be.size>0&&fe({key:jCe,tag:null,isVirtualRoot:!0}),u.forEach(we=>{if(we===bt){G&&fe({key:bt,tag:null,isUntagged:!0});return}let Re=be.get(we);Re&&fe({key:Re.path,tag:Re})}),O.forEach(we=>{we!==bt&&(me.has(we)||be.has(we)||fe({key:we,tag:null,isMissing:!0}))}),m.forEach(we=>{we!==bt&&(me.has(we)||fe({key:we,tag:null,isMissing:!0}))}),ge},[m,u,p,O,G]),ee=(0,lr.useMemo)(()=>{let ge=[],be=new Map;f.forEach((we,Re)=>{be.set(Re,we)});let me=new Set,fe=we=>{me.has(we.key)||(me.add(we.key),ge.push(we))};return g.forEach(we=>{let Re=be.get(we);Re&&fe({key:Re.key,node:Re})}),K.forEach(we=>{me.has(we)||be.has(we)||fe({key:we,node:null,isMissing:!0})}),h.forEach(we=>{me.has(we)||fe({key:we,node:null,isMissing:!0})}),ge},[h,g,f,K]),$=(0,lr.useMemo)(()=>x.filter(ge=>{if(ge.isVault)return!1;if(!o){let be=ge.folder?ge.folder.name:zc(ge.key);if(E.length>0&&qd(be,E,ge.key))return!1}return!0}),[E,x,o]),j=(0,lr.useMemo)(()=>Y.filter(ge=>!(ge.isVirtualRoot||!o&&C&&ge.tag&&ss(ge.tag.path,ge.tag.name,M))),[C,M,Y,o]),J=(0,lr.useMemo)(()=>ee.slice(),[ee]),re=(0,lr.useMemo)(()=>HS(i),[i]),oe=(0,lr.useMemo)(()=>o?re:re.filter(ge=>ge===Dt.SHORTCUTS?V:ge===Dt.RECENT?D:ge===Dt.FOLDERS?$.length>0:ge===Dt.TAGS?A&&j.length>0:ge===Dt.PROPERTIES?w:!0),[$.length,j.length,w,re,o,D,V,A]),Z=oe.length>1,ce=(0,lr.useCallback)(async ge=>{let be=Are(ge,re);go(be,re)||(s(be),ye.set(ut.navigationSectionOrderKey,be))},[re,s]),ae=$.length>1,se=j.length>1,ne=J.length>1,B=Z||ae||se||ne,q=$.length>0,ie=j.length>0,le=J.length>0,Te=(0,lr.useMemo)(()=>{let ge=new Map,be=new Map,me=new Map,fe=new Map,we=new Map,Re=new Map,nt=new Map;return n.forEach(ct=>{if(ct.type===he.FOLDER){let yt=ct.data.path;ge.set(yt,ct.icon),be.set(yt,ct.color),me.set(yt,ct.displayName);return}if(ct.type===he.TAG){let yt=ct.data.path;fe.set(yt,ct.icon),we.set(yt,ct.color);return}if(ct.type===he.PROPERTY_KEY){let yt=ct.data.key;Re.set(yt,ct.icon),nt.set(yt,ct.color)}}),{rootFolderIconMap:ge,rootFolderColorMap:be,rootFolderDisplayNameMap:me,rootTagIconMap:fe,rootTagColorMap:we,rootPropertyIconMap:Re,rootPropertyColorMap:nt}},[n]),{rootFolderIconMap:ke,rootFolderColorMap:Fe,rootFolderDisplayNameMap:te,rootTagIconMap:pe,rootTagColorMap:ve,rootPropertyIconMap:Ie,rootPropertyColorMap:qe}=Te,xe=(0,lr.useMemo)(()=>x.find(ge=>ge.isVault),[x]),Ce=(0,lr.useCallback)(async ge=>{let be=ge.slice();go(be,N)||await a(me=>{me.rootFolderOrder=be})},[N,a]),vt=(0,lr.useCallback)(async ge=>{let be=ge.slice();go(be,O)||await a(me=>{me.rootTagOrder=be})},[O,a]),Rt=(0,lr.useCallback)(async ge=>{let be=ge.slice();go(be,K)||await a(me=>{me.rootPropertyOrder=be})},[K,a]),Ve=(0,lr.useCallback)(async ge=>{await Ce(ge)},[Ce]),Ae=(0,lr.useCallback)(async ge=>{await vt(ge)},[vt]),Ke=(0,lr.useCallback)(async ge=>{await Rt(ge)},[Rt]),Be=(0,lr.useCallback)(async ge=>{ge&&await a(be=>{if(!Array.isArray(be.rootFolderOrder)){be.rootFolderOrder=[];return}be.rootFolderOrder.includes(ge)&&(be.rootFolderOrder=be.rootFolderOrder.filter(me=>me!==ge))})},[a]),wt=(0,lr.useCallback)(async ge=>{ge&&await a(be=>{if(!Array.isArray(be.rootTagOrder)){be.rootTagOrder=[];return}be.rootTagOrder.includes(ge)&&(be.rootTagOrder=be.rootTagOrder.filter(me=>me!==ge))})},[a]),Ct=(0,lr.useCallback)(async ge=>{ge&&await a(be=>{if(!Array.isArray(be.rootPropertyOrder)){be.rootPropertyOrder=[];return}be.rootPropertyOrder.includes(ge)&&(be.rootPropertyOrder=be.rootPropertyOrder.filter(me=>me!==ge))})},[a]),qt=(0,lr.useCallback)((ge,be)=>{let me=()=>{Q(()=>be(ge))};return(0,roe.jsx)("span",{role:"button",tabIndex:0,className:"nn-root-reorder-remove",onClick:fe=>{fe.preventDefault(),fe.stopPropagation(),me()},onKeyDown:fe=>{(fe.key==="Enter"||fe.key===" ")&&(fe.preventDefault(),fe.stopPropagation(),me())},children:GCe})},[]),lt=(0,lr.useMemo)(()=>$.map(ge=>{let be=ge.isMissing===!0,me=ge.folder?ge.folder.name:zc(ge.key),fe=E.length>0&&qd(me,E,ge.key),we=ge.folder===null?zc(ge.key):te.get(ge.key)||_s({app:e,metadataService:b,settings:{customVaultName:_},folderPath:ge.key,fallbackName:ge.folder.name}),Re=ke.get(ge.key)??(be?void 0:b.getFolderIcon(ge.key)),nt=Fe.get(ge.key)??(be?void 0:b.getFolderColor(ge.key)),ct=Qe(r.interfaceIcons,"nav-folder-closed");be?ct="lucide-folder-off":Re&&(ct=Re);let yt=be?qt(ge.key,Be):void 0;return{key:ge.key,props:{icon:ct,color:nt,label:we,level:1,dragHandlers:void 0,isDragSource:!1,isMissing:be,itemType:"folder",className:o&&fe?"nn-excluded":void 0,trailingAccessory:yt}}}),[e,$,ke,Fe,te,b,r.interfaceIcons,_,qt,Be,E,o]),Zt=(0,lr.useMemo)(()=>j.map(ge=>{let be=ge.isUntagged===!0,me=ge.isMissing===!0,fe=!be&&C&&ge.tag&&ss(ge.tag.path,ge.tag.name,M),we,Re;if(be)we=b.getTagIcon(ge.key)??Qe(r.interfaceIcons,"nav-tag"),Re=d.tagList.untaggedLabel;else{let bn=pe.get(ge.key),Kn=b.getTagIcon(ge.key);we=bn??Kn??(me?"lucide-tag-off":Qe(r.interfaceIcons,"nav-tag")),Re=ge.tag?`#${ge.tag.displayPath}`:`#${ge.key}`}let nt=be?void 0:b.getTagColor(ge.key),ct=ve.get(ge.key)??nt,yt=me?qt(ge.key,wt):void 0;return{key:ge.key,props:{icon:we,color:ct,label:Re,level:1,dragHandlers:void 0,isDragSource:!1,isMissing:me,itemType:"tag",className:o&&fe?"nn-excluded":void 0,trailingAccessory:yt}}}),[j,pe,ve,b,r.interfaceIcons,qt,wt,C,M,o]),Kt=(0,lr.useMemo)(()=>J.map(ge=>{let be=ge.isMissing===!0,me=ge.node?.id??Gn(ge.key),fe=Ie.get(ge.key),we=qe.get(ge.key),Re=b.getPropertyIcon(me),nt=b.getPropertyColor(me),ct=fe??Re??Qe(r.interfaceIcons,"nav-property"),yt=we??nt,bn=ge.node?ge.node.name:ge.key,Kn=be?qt(ge.key,Ct):void 0;return{key:ge.key,props:{icon:ct,color:yt,label:bn,level:1,dragHandlers:void 0,isDragSource:!1,isMissing:be,itemType:"property",trailingAccessory:Kn}}}),[J,Ie,qe,b,r.interfaceIcons,qt,Ct]),gn=(0,lr.useMemo)(()=>oe.map(ge=>{let be=ge===Dt.SHORTCUTS&&!V||ge===Dt.RECENT&&!D||ge===Dt.FOLDERS&&x.length===0||ge===Dt.TAGS&&!A||ge===Dt.PROPERTIES&&!w,me="lucide-circle",fe="",we,Re,nt;if(ge===Dt.SHORTCUTS)me=Qe(r.interfaceIcons,"nav-shortcuts"),fe=d.navigationPane.shortcutsHeader;else if(ge===Dt.RECENT)me=Qe(r.interfaceIcons,"nav-recent-files"),fe=d.navigationPane.recentFilesHeader;else if(ge===Dt.FOLDERS){if(xe){let ct=ke.get(xe.key);nt=Fe.get(xe.key),ct?me=ct:me=v?"open-vault":"vault",fe=_s({app:e,metadataService:b,settings:{customVaultName:_},folderPath:xe.key,fallbackName:xe.folder?.name??e.vault.getRoot().name})}else me=vi,fe=d.settings.sections.folders;we=v?"lucide-chevron-down":"lucide-chevron-right",Re=k}else ge===Dt.TAGS?(me=Qe(r.interfaceIcons,"nav-tags"),fe=d.settings.sections.tags,we=y?"lucide-chevron-down":"lucide-chevron-right",Re=F):ge===Dt.PROPERTIES&&(me=Qe(r.interfaceIcons,"nav-properties"),fe=d.navigationPane.properties,we=S?"lucide-chevron-down":"lucide-chevron-right",Re=P);return{key:ge,sectionId:ge,props:{icon:me,label:fe,level:0,dragHandlers:void 0,isDragSource:!1,color:nt,onClick:Re,chevronIcon:we,itemType:"section",className:be?"nn-excluded":void 0}}}),[oe,V,D,A,w,x.length,xe,ke,Fe,_,e,b,r.interfaceIcons,v,y,k,F,S,P]),fn=(0,lr.useCallback)(async()=>{await a(ge=>{ge.rootFolderOrder=[]})},[a]),an=(0,lr.useCallback)(async()=>{await a(ge=>{ge.rootTagOrder=[]})},[a]),Pe=(0,lr.useCallback)(async()=>{await a(ge=>{ge.rootPropertyOrder=[]})},[a]);return{reorderableRootFolders:$,reorderableRootTags:j,reorderableRootProperties:J,sectionReorderItems:gn,folderReorderItems:lt,tagReorderItems:Zt,propertyReorderItems:Kt,canReorderSections:Z,canReorderRootFolders:ae,canReorderRootTags:se,canReorderRootProperties:ne,canReorderRootItems:B,showRootFolderSection:q,showRootTagSection:ie,showRootPropertySection:le,resetRootTagOrderLabel:z,resetRootPropertyOrderLabel:H,vaultRootDescriptor:xe,handleResetRootFolderOrder:fn,handleResetRootTagOrder:an,handleResetRootPropertyOrder:Pe,reorderSectionOrder:ce,reorderRootFolderOrder:Ve,reorderRootTagOrder:Ae,reorderRootPropertyOrder:Ke}}var lr,roe,jCe,GCe,ooe=U(()=>{lr=ue(ze());Ue();Ee();Jr();Sl();ot();ID();$o();Yr();Dr();Ru();pr();Vm();cn();roe=ue(Ge()),jCe="__nn-tags-root__",GCe=d.common.remove});function aoe(t,e){let n=e?.enabled??!0,[r,o]=(0,ED.useState)(0);return(0,ED.useLayoutEffect)(()=>{if(!n){o(l=>l===0?l:0);return}let a=t.current;if(!a){o(l=>l===0?l:0);return}let i=()=>{let l=a.offsetHeight;o(c=>c===l?c:l)};if(i(),typeof ResizeObserver>"u"){let l=()=>i();return window.addEventListener("resize",l),()=>{window.removeEventListener("resize",l)}}let s=new ResizeObserver(()=>{i()});return s.observe(a),()=>{s.disconnect()}},[n,t]),r}var ED,ioe=U(()=>{ED=ue(ze())});function soe({app:t,commandQueue:e,isMobile:n,rootContainerRef:r,settings:o,uiState:a,uiDispatch:i,selectionType:s,selectedFolder:l,selectionDispatch:c,setActiveShortcut:u,onExecuteSearchShortcut:p,onNavigateToFolder:m,onRevealTag:g,onRevealProperty:f,onRevealFile:h,onRevealShortcutFile:b,openFolderNoteInRightSidebar:v,tagTree:y,hydratedShortcuts:S}){let w=(0,Js.useCallback)(D=>{!a.singlePane||D!=="right-sidebar"||(i({type:"SET_SINGLE_PANE_VIEW",view:"files"}),i({type:"SET_FOCUSED_PANE",pane:"files"}))},[i,a.singlePane]),k=(0,Js.useCallback)(()=>{let D=()=>u(null);if(typeof requestAnimationFrame<"u"){window.requestAnimationFrame(()=>{window.requestAnimationFrame(D)});return}window.setTimeout(D,0)},[u]),F=(0,Js.useCallback)(D=>{let A=()=>t.workspace.getLeaf(!1),_=async E=>{E&&await E.openFile(D,{active:!1})};if(e){Q(()=>e.executeOpenActiveFile(D,_,{active:!1,getLeaf:A}));return}Q(()=>_(A()))},[t.workspace,e]),P=(0,Js.useCallback)((D,A)=>{u(A),m(D.path,{skipScroll:o.skipAutoScroll,source:"shortcut"}),k();let _=r.current;_&&!a.singlePane&&_.focus()},[m,r,k,u,o.skipAutoScroll,a.singlePane]),T=(0,Js.useCallback)((D,A,_)=>{if(u(A),!o.enableFolderNotes||!o.enableFolderNoteLinks){P(D,A);return}let E=Pn(D,o);if(!E){P(D,A);return}let R=s===W.FOLDER&&l?.path===D.path;c({type:"SET_SELECTED_FOLDER",folder:D,autoSelectedFile:null});let M=Hc(_,o.folderNoteOpenLocation,o.multiSelectModifier,n);if(w(M),M==="right-sidebar"&&o.showNearestFolderNoteInSidebar&&!R){k();return}Q(()=>ri({app:t,commandQueue:e,folder:D,folderNote:E,context:M,openInRightSidebar:v})),k()},[t,e,w,P,n,v,k,l,c,u,s,o]),I=(0,Js.useCallback)((D,A)=>{if(A.button!==1||!o.enableFolderNotes||!o.enableFolderNoteLinks)return;let _=Pn(D,o);_&&(A.preventDefault(),A.stopPropagation(),c({type:"SET_SELECTED_FOLDER",folder:D,autoSelectedFile:null}),Q(()=>ri({app:t,commandQueue:e,folder:D,folderNote:_,context:"tab"})))},[t,e,c,o]),N=(0,Js.useCallback)((D,A)=>{u(A),s===W.TAG&&b?b(D):h(D),F(D),n&&t.workspace.leftSplit&&t.workspace.leftSplit.collapse();let _=a.singlePane?a.currentSinglePaneView:"files";i({type:"SET_FOCUSED_PANE",pane:_}),k()},[t,n,h,b,F,k,s,u,i,a.currentSinglePaneView,a.singlePane]),O=(0,Js.useCallback)((D,A)=>{D.button===1&&(D.preventDefault(),D.stopPropagation(),Q(()=>no({app:t,commandQueue:e,file:A,context:"tab"})))},[t,e]),K=(0,Js.useCallback)(D=>{s===W.TAG&&b?b(D):h(D),F(D),n&&t.workspace.leftSplit&&t.workspace.leftSplit.collapse();let A=a.singlePane?a.currentSinglePaneView:"files";i({type:"SET_FOCUSED_PANE",pane:A})},[t.workspace,n,h,b,F,s,i,a.currentSinglePaneView,a.singlePane]),G=(0,Js.useCallback)((D,A)=>{u(D),p&&Q(()=>p(D,A)),k()},[p,k,u]),X=(0,Js.useCallback)((D,A)=>{u(A);let _=Vc(D,y);if(!_){k();return}if(g(_,{skipScroll:o.skipAutoScroll,source:"shortcut"}),!a.singlePane){i({type:"SET_FOCUSED_PANE",pane:"navigation"});let E=r.current;E&&E.focus()}c({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!0}),k()},[g,r,k,c,u,o.skipAutoScroll,y,i,a.singlePane]),L=(0,Js.useCallback)((D,A)=>{if(u(A),!f(D,{skipScroll:o.skipAutoScroll,source:"shortcut"}))return k(),!1;if(!a.singlePane){i({type:"SET_FOCUSED_PANE",pane:"navigation"});let E=r.current;E&&E.focus()}return c({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!0}),k(),!0},[f,r,k,c,u,o.skipAutoScroll,i,a.singlePane]),V=(0,Js.useCallback)(async D=>{if(!Number.isInteger(D)||D<1)return!1;let A=S[D-1];if(!A||A.isMissing)return!1;let{key:_,shortcut:E,folder:R,note:M,search:C,tagPath:x,propertyNodeId:z}=A;if(Zo(E)&&R)return P(R,_),!0;if(Po(E)&&M)return N(M,_),!0;if(Bi(E))return G(_,C??E),!0;if(Co(E)){let H=x??E.tagPath;return H?(X(H,_),!0):!1}if(la(E)){let H=Kv(z,E.nodeId);return H?L(H,_):!1}return!1},[P,N,L,G,X,S]);return{handleShortcutFolderActivate:P,handleShortcutFolderNoteClick:T,handleShortcutFolderNoteMouseDown:I,handleShortcutNoteActivate:N,handleShortcutNoteMouseDown:O,handleRecentNoteActivate:K,handleShortcutSearchActivate:G,handleShortcutTagActivate:X,handleShortcutPropertyActivate:L,openShortcutByNumber:V}}var Js,loe=U(()=>{Js=ue(ze());Ia();cn();Sn();ot();Zc();Jc();td();Ue()});function doe({app:t,settings:e,includeDescendantNotes:n,showHiddenItems:r,fileVisibility:o,noteCountDB:a,hiddenFolders:i,effectiveFrontmatterExclusions:s,effectiveFrontmatterExclusionMatcher:l,folderCountFileNameMatcher:c,hiddenFileTagVisibility:u,getFolderCounts:p,getTagCounts:m,getPropertyCounts:g,tagTree:f,propertyTree:h,propertyTreeService:b,onToggleShortcutsPin:v,isShortcutsPinned:y,onConfigurePropertyKeys:S}){let w=e.pinRecentNotesWithShortcuts&&e.showRecentNotes,k=w?d.navigationPane.pinShortcutsAndRecentFiles:d.navigationPane.pinShortcuts,F=w?d.navigationPane.unpinShortcutsAndRecentFiles:d.navigationPane.unpinShortcuts,P=y?F:k,T=(0,Ug.useMemo)(()=>({actionLabel:P,icon:y?"lucide-pin-off":"lucide-pin",onClick:v}),[y,v,P]),I=(0,Ug.useMemo)(()=>({actionLabel:d.contextMenu.property.addKey,icon:"lucide-settings-2",onClick:S,labelMode:"note-count"}),[S]),N=(0,Ug.useCallback)(X=>{if(!e.showNoteCount)return US;let L=p().get(X.path);if(L)return L;let V=No({enableFolderNotes:e.enableFolderNotes,folderNoteName:e.folderNoteName,folderNoteNamePattern:e.folderNoteNamePattern});return IP(X,{app:t,db:a,fileVisibility:o,excludedFiles:s,excludedFileMatcher:l,excludedFolders:i,fileNameMatcher:c,hiddenFileTagVisibility:u,includeDescendants:n,showHiddenFolders:r,hideFolderNoteInList:e.hideFolderNoteInList,folderNoteSettings:V})},[t,l,s,o,c,p,u,i,n,a,e,r]),O=(0,Ug.useCallback)(X=>{let L=Vc(X,f);if(!L||!e.showNoteCount)return US;let V=m().get(L);if(V)return V;let D=Li(f,L);return D?pN(D,n):US},[m,n,e.showNoteCount,f]),K=(0,Ug.useCallback)(X=>{if(!e.showNoteCount)return US;let L=g().get(X);if(L)return L;if(X===Oe)return US;let D=MN({nodeId:X,propertyTreeService:b,propertyTree:h})?.node??null;if(!D)return US;if(D.kind==="key"){let M=jc(D);if(!n)return{current:M,descendants:0,total:M};let C=D.notesWithValue.size,x=Math.max(C-M,0);return{current:M,descendants:x,total:C}}let A=D.notesWithValue.size;if(!n||!D.valuePath)return{current:A,descendants:0,total:A};let _=b?.getKeyNode(D.key)??h.get(D.key)??null;if(!_)return{current:A,descendants:0,total:A};let E=Pm(_,D.valuePath),R=Math.max(E-A,0);return{current:A,descendants:R,total:E}},[g,n,h,b,e.showNoteCount]),G=(0,Ug.useCallback)(X=>{let L=zc(X);if(!L)return"";let V=L.lastIndexOf(".");if(V<=0)return L;let D=L.substring(0,V);return L.substring(V+1).toLowerCase()==="md"?D:L},[]);return{pinToggleLabel:P,shortcutHeaderTrailingAction:T,propertiesHeaderTrailingAction:I,getFolderShortcutCount:N,getTagShortcutCount:O,getPropertyShortcutCount:K,getMissingNoteLabel:G}}var Ug,US,coe=U(()=>{Ug=ue(ze());Ee();_a();YV();Ba();Ue();cn();$o();Sn();US={current:0,descendants:0,total:0}});function uoe({app:t,isMobile:e,isRootReorderMode:n,isShortcutContextMenuOpen:r,shortcutsExpanded:o,showShortcuts:a,hydratedShortcuts:i,hasFolderShortcut:s,hasNoteShortcut:l,reorderShortcuts:c,addTagShortcut:u,addPropertyShortcut:p,addShortcutsBatch:m}){let g=i.length,f=o&&g>0&&a,h=(0,Ni.useMemo)(()=>i.map(E=>E.key),[i]),b=RS(Vg(MS,{activationConstraint:lre})),v=f&&h.length>1&&!n&&!r,[y,S]=(0,Ni.useState)(null),w=v&&!!y,k=e&&f,F=(0,Ni.useMemo)(()=>{if(k)return{visible:!0,only:!0}},[k]),P=(0,Ni.useMemo)(()=>{let E=new Map;return i.forEach((R,M)=>{E.set(R.key,M)}),E},[i]),T=(0,Ni.useCallback)(E=>{S(String(E.active.id))},[]),I=(0,Ni.useCallback)(E=>{let R=String(E.active.id),M=E.over?String(E.over.id):void 0;if(S(null),!M||R===M)return;let C=h.indexOf(R),x=h.indexOf(M);if(C===-1||x===-1)return;let z=Kp(h,C,x);Q(async()=>{await c(z)})},[c,h]),N=(0,Ni.useCallback)(()=>{S(null)},[]),O=(0,Ni.useCallback)((E,R)=>{let M=P.get(R);if(M===void 0)return i.length;let C=E.currentTarget;if(!(C instanceof HTMLElement))return M;let x=C.getBoundingClientRect();return E.clientY-x.top{let{dataTransfer:R}=E;if(!R||!o||!a)return!1;let M=Array.from(R.types??[]);if(M.includes(Gv))return!1;let C=Vb(M),x=M.includes(Jg),z=M.includes(lw);return!C&&!x&&!z?!1:(E.preventDefault(),R.dropEffect="copy",!0)},[o,a]),X=(0,Ni.useCallback)(E=>{let R=t.vault.getAbstractFileByPath(E);return R instanceof KS.TFile?"file":R instanceof KS.TFolder?"folder":null},[t.vault]),L=(0,Ni.useCallback)((E,R)=>{let{dataTransfer:M}=E;if(!M||!o||!a||Array.from(M.types??[]).includes(Gv))return!1;let x=M.getData(Jg);if(x){let oe=w9(x);if(oe){E.preventDefault(),E.stopPropagation();let Z=O(E,R);return Q(async()=>{await u(oe,{index:Math.max(0,Z)})}),!0}}let z=M.getData(lw);if(z){let oe=T9(z);if(oe){E.preventDefault(),E.stopPropagation();let Z=O(E,R);return Q(async()=>{await p(oe,{index:Math.max(0,Z)})}),!0}}let H=xF(M,{getPathType:X,vaultName:t.vault.getName()});if(!H||H.length===0)return!1;let Y=new Set,ee=H.filter(oe=>Y.has(oe)?!1:(Y.add(oe),!0));if(ee.length===0)return!1;let $=[],j=0,J=0;if(ee.forEach(oe=>{let Z=t.vault.getAbstractFileByPath(oe);if(Z instanceof KS.TFolder){if(Z.path==="/")return;if(s(Z.path)){j+=1;return}$.push({type:Dn.FOLDER,path:Z.path})}else if(Z instanceof KS.TFile){if(l(Z.path)){J+=1;return}$.push({type:Dn.NOTE,path:Z.path})}}),j>0&&de(d.shortcuts.folderExists,{variant:"warning"}),J>0&&de(d.shortcuts.noteExists,{variant:"warning"}),$.length===0)return!1;E.preventDefault(),E.stopPropagation();let re=O(E,R);return Q(async()=>{await m($,{index:Math.max(0,re)})}),!0},[p,m,u,t.vault,O,X,s,l,a,o]),V=o&&a&&i.length===0,D=(0,Ni.useCallback)(E=>{V&&G(E)},[V,G]),A=(0,Ni.useCallback)(E=>{V&&L(E,K)},[V,L]),_=(0,Ni.useCallback)(E=>({onDragOver:R=>{G(R)},onDrop:R=>{L(R,E)}}),[G,L]);return{activeShortcutId:y,shouldUseShortcutDnd:v,allowEmptyShortcutDrop:V,shortcutDragHandleConfig:F,shortcutIds:h,shortcutSensors:b,handleShortcutDragStart:T,handleShortcutDragEnd:I,handleShortcutDragCancel:N,isShortcutSorting:w,handleShortcutRootDragOver:D,handleShortcutRootDrop:A,buildShortcutExternalHandlers:_}}var Ni,KS,poe=U(()=>{Ni=ue(ze()),KS=require("obsidian");Uf();zS();Fn();jM();ot();jr();FP();Ia();Ee()});function moe({settings:t,menuServices:e,selectionStateRef:n,expansionState:r,selectionDispatch:o,expansionDispatch:a,uiDispatch:i,removeShortcut:s,renameShortcut:l,setIsShortcutContextMenuOpen:c}){let u=(0,JV.useCallback)((m,g)=>{if(!t.showShortcuts)return;let f=m.target;if(f instanceof HTMLElement&&f.closest(".nn-drag-handle")){m.preventDefault(),m.stopPropagation();return}m.preventDefault(),m.stopPropagation();let h=new e1.Menu;if(h.onHide(()=>{c(!1)}),c(!0),g.type==="search"){Tu({app:e.app,menu:h,shortcutKey:g.key,defaultLabel:g.searchShortcut.name,existingShortcut:g.searchShortcut,title:d.shortcuts.rename,placeholder:d.searchInput.shortcutNamePlaceholder,renameShortcut:l,closeOnSubmit:!1}),h.addItem(y=>{y.setTitle(d.shortcuts.remove).setIcon(Hr(t.interfaceIcons,"nav-shortcuts","lucide-star-off")).onClick(()=>{Q(()=>s(g.key))})}),h.showAtMouseEvent(m.nativeEvent);return}if(g.type==="missing"){h.addItem(y=>{y.setTitle(d.shortcuts.remove).setIcon(Hr(t.interfaceIcons,"nav-shortcuts","lucide-star-off")).onClick(()=>{Q(()=>s(g.key))})}),h.showAtMouseEvent(m.nativeEvent);return}let b={selectionState:n.current,expandedFolders:r.expandedFolders,expandedTags:r.expandedTags,expandedProperties:r.expandedProperties},v={selectionDispatch:o,expansionDispatch:a,uiDispatch:i};g.type==="folder"?XF({folder:g.folder,menu:h,services:e,settings:t,state:b,dispatchers:v,options:{disableNavigationSeparatorActions:!0}}):g.type==="note"?(fS({file:g.file,menu:h,services:e,settings:t,state:b,dispatchers:v}),g.file.extension!=="md"&&(h.addSeparator(),h.addItem(y=>{y.setTitle(d.shortcuts.remove).setIcon(Hr(t.interfaceIcons,"nav-shortcuts","lucide-star-off")).onClick(()=>{Q(()=>s(g.key))})}))):g.type==="tag"?QF({tagPath:g.tagPath,menu:h,services:e,settings:t,state:b,dispatchers:v,options:{disableNavigationSeparatorActions:!0}}):g.type==="property"&&ZF({propertyNodeId:g.propertyNodeId,menu:h,services:e,settings:t,state:b,dispatchers:v,options:{disableNavigationSeparatorActions:!0}}),h.showAtMouseEvent(m.nativeEvent)},[a,r.expandedFolders,r.expandedProperties,r.expandedTags,e,s,l,o,n,c,t,i]),p=(0,JV.useCallback)((m,g)=>{m.preventDefault(),m.stopPropagation();let f=new e1.Menu,h={selectionState:n.current,expandedFolders:r.expandedFolders,expandedTags:r.expandedTags,expandedProperties:r.expandedProperties};fS({file:g,menu:f,services:e,settings:t,state:h,dispatchers:{selectionDispatch:o,expansionDispatch:a,uiDispatch:i}}),f.showAtMouseEvent(m.nativeEvent)},[a,r.expandedFolders,r.expandedProperties,r.expandedTags,e,o,n,t,i]);return{handleShortcutContextMenu:u,handleRecentFileContextMenu:p}}var JV,e1,goe=U(()=>{JV=ue(ze()),e1=require("obsidian");Ee();ot();pr();JF();dS()});function foe({app:t,settings:e,hydratedShortcuts:n,shortcutMap:r,selectionState:o,selectionStateRef:a,subscribeSelectionState:i}){let s=e.shortcutBadgeDisplay,l=s==="count",c=(0,Ps.useMemo)(()=>{if(s!=="index")return new Map;let w=new Map;return n.slice(0,9).forEach((k,F)=>{w.set(k.key,String(F+1))}),w},[s,n]),[u,p]=(0,Ps.useState)(null),m=(0,Ps.useCallback)(()=>{p(null)},[]),[g,f]=(0,Ps.useState)(!1),[h,b]=(0,Ps.useState)(()=>ye.get(ut.shortcutsExpandedKey)!=="0"),[v,y]=(0,Ps.useState)(()=>{let w=ye.get(ut.recentNotesExpandedKey);return w==="1"}),[,S]=(0,Ps.useReducer)(w=>w+1,0);return(0,Ps.useEffect)(()=>{if(!e.useFrontmatterMetadata)return;let w=t.metadataCache,k=new Set(n.map(N=>N.note?.path).filter(N=>!!N));if(k.size===0)return;let F=()=>{S()},P=N=>{k.has(N.path)&&S()},T=w.on("resolved",F),I=w.on("changed",N=>{N instanceof hoe.TFile&&P(N)});return()=>{w.offref(T),w.offref(I)}},[t.metadataCache,n,e.useFrontmatterMetadata]),(0,Ps.useEffect)(()=>{if(!u)return;let w=r.get(u);if(!w){p(null);return}if(w.type===Dn.FOLDER){let k=o.selectedFolder?.path;(!k||k!==w.path)&&p(null);return}if(w.type===Dn.NOTE){let k=a.current.selectedFile?.path;(!k||k!==w.path)&&p(null);return}if(w.type===Dn.TAG){let k=o.selectedTag;(!k||k!==w.tagPath)&&p(null);return}if(w.type===Dn.PROPERTY){let k=o.selectedProperty,F=Kv(null,w.nodeId);(!k||!F||k!==F)&&p(null)}},[u,o.selectedFolder,o.selectedProperty,o.selectedTag,a,r]),(0,Ps.useEffect)(()=>{if(!u)return;let w=r.get(u);if(!(!w||w.type!==Dn.NOTE))return i(k=>{let F=k.selectedFile?.path;(!F||F!==w.path)&&p(null)})},[u,r,i]),{activeShortcutKey:u,setActiveShortcut:p,clearActiveShortcut:m,isShortcutContextMenuOpen:g,setIsShortcutContextMenuOpen:f,shortcutsExpanded:h,setShortcutsExpanded:b,recentNotesExpanded:v,setRecentNotesExpanded:y,shortcutNumberBadgesByKey:c,shouldShowShortcutCounts:l}}var Ps,hoe,voe=U(()=>{Ps=ue(ze()),hoe=require("obsidian");Ue();Jr();Ia();cn()});function yoe({rootContainerRef:t,isRootReorderMode:e,onExecuteSearchShortcut:n,onNavigateToFolder:r,onRevealTag:o,onRevealProperty:a,onRevealFile:i,onRevealShortcutFile:s,getFolderCounts:l,getTagCounts:c,getPropertyCounts:u,onConfigurePropertyKeys:p}){let{app:m,isMobile:g,plugin:f,tagTreeService:h,propertyTreeService:b}=gt(),v=qs(),y=li(),S=Ho(),w=_b(),k=AM(),F=ta(),P=Ra(),T=Ml(),I=c9(),N=u9(),O=gr(),K=pt(),G=$s(),X=Xt(),L=Yn(),V=Vr(),{fileData:D}=xo(),A=Td(),{shortcuts:_,shortcutMap:E,tagShortcutKeysByPath:R,propertyShortcutKeysByNodeId:M,hydratedShortcuts:C,reorderShortcuts:x,addTagShortcut:z,addPropertyShortcut:H,addShortcutsBatch:Y,clearShortcuts:ee,removeShortcut:$,renameShortcut:j,hasFolderShortcut:J,hasNoteShortcut:re}=A,oe=X.includeDescendantNotes,Z=X.showHiddenItems,{hiddenFolders:ce,hiddenFileNames:ae,hiddenFileTags:se,fileVisibility:ne}=G,B=ng(K,Z),q=(0,Wp.useMemo)(()=>po(B),[B]),ie=(0,Wp.useMemo)(()=>Gd(ae,Z),[ae,Z]),le=(0,Wp.useMemo)(()=>Z?null:Br(se,!1),[se,Z]),Te=(0,Wp.useMemo)(()=>Z||!le||!le.hasHiddenRules?null:Sr(),[le,Z]),ke=(0,Wp.useMemo)(()=>({app:m,plugin:f,isMobile:g,fileSystemOps:y,metadataService:S,tagOperations:w,propertyOperations:k,tagTreeService:h,propertyTreeService:b,commandQueue:v,shortcuts:A,visibility:{includeDescendantNotes:oe,showHiddenItems:Z}}),[m,v,y,oe,g,S,f,k,b,A,Z,w,h]),Fe=foe({app:m,settings:K,hydratedShortcuts:C,shortcutMap:E,selectionState:T,selectionStateRef:I,subscribeSelectionState:N.subscribe}),te=uoe({app:m,isMobile:g,isRootReorderMode:e,isShortcutContextMenuOpen:Fe.isShortcutContextMenuOpen,shortcutsExpanded:Fe.shortcutsExpanded,showShortcuts:K.showShortcuts,hydratedShortcuts:C,hasFolderShortcut:J,hasNoteShortcut:re,reorderShortcuts:x,addTagShortcut:z,addPropertyShortcut:H,addShortcutsBatch:Y}),pe=(0,Wp.useCallback)(()=>{V({type:"SET_PIN_SHORTCUTS",value:!L.pinShortcuts})},[V,L.pinShortcuts]),ve=soe({app:m,commandQueue:v,isMobile:g,rootContainerRef:t,settings:K,uiState:L,uiDispatch:V,selectionType:T.selectionType,selectedFolder:T.selectedFolder,selectionDispatch:O,setActiveShortcut:Fe.setActiveShortcut,onExecuteSearchShortcut:n,onNavigateToFolder:r,onRevealTag:o,onRevealProperty:a,onRevealFile:i,onRevealShortcutFile:s,openFolderNoteInRightSidebar:xe=>f.openFolderNoteInRightSidebar(xe),tagTree:D.tagTree,hydratedShortcuts:C}),Ie=doe({app:m,settings:K,includeDescendantNotes:oe,showHiddenItems:Z,fileVisibility:ne,noteCountDB:Te,hiddenFolders:ce,effectiveFrontmatterExclusions:B,effectiveFrontmatterExclusionMatcher:q,folderCountFileNameMatcher:ie,hiddenFileTagVisibility:le,getFolderCounts:l,getTagCounts:c,getPropertyCounts:u,tagTree:D.tagTree,propertyTree:D.propertyTree,propertyTreeService:b,onToggleShortcutsPin:pe,isShortcutsPinned:L.pinShortcuts,onConfigurePropertyKeys:p}),qe=moe({settings:K,menuServices:ke,selectionStateRef:I,expansionState:F,selectionDispatch:O,expansionDispatch:P,uiDispatch:V,removeShortcut:$,renameShortcut:j,setIsShortcutContextMenuOpen:Fe.setIsShortcutContextMenuOpen});return(0,Wp.useMemo)(()=>({shortcutsExpanded:Fe.shortcutsExpanded,setShortcutsExpanded:Fe.setShortcutsExpanded,recentNotesExpanded:Fe.recentNotesExpanded,setRecentNotesExpanded:Fe.setRecentNotesExpanded,activeShortcutKey:Fe.activeShortcutKey,clearActiveShortcut:Fe.clearActiveShortcut,pinToggleLabel:Ie.pinToggleLabel,handleShortcutSplitToggle:pe,isShortcutSorting:te.isShortcutSorting,shortcutIds:te.shortcutIds,shortcutSensors:te.shortcutSensors,handleShortcutDragStart:te.handleShortcutDragStart,handleShortcutDragEnd:te.handleShortcutDragEnd,handleShortcutDragCancel:te.handleShortcutDragCancel,shortcutsCount:_.length,tagShortcutKeysByPath:R,propertyShortcutKeysByNodeId:M,clearShortcuts:ee,addTagShortcut:z,addPropertyShortcut:H,openShortcutByNumber:ve.openShortcutByNumber,activeShortcutId:te.activeShortcutId,shouldUseShortcutDnd:te.shouldUseShortcutDnd,allowEmptyShortcutDrop:te.allowEmptyShortcutDrop,shortcutDragHandleConfig:te.shortcutDragHandleConfig,shortcutHeaderTrailingAction:Ie.shortcutHeaderTrailingAction,propertiesHeaderTrailingAction:Ie.propertiesHeaderTrailingAction,shortcutNumberBadgesByKey:Fe.shortcutNumberBadgesByKey,shouldShowShortcutCounts:Fe.shouldShowShortcutCounts,removeShortcut:$,handleShortcutFolderActivate:ve.handleShortcutFolderActivate,handleShortcutFolderNoteClick:ve.handleShortcutFolderNoteClick,handleShortcutFolderNoteMouseDown:ve.handleShortcutFolderNoteMouseDown,handleShortcutNoteActivate:ve.handleShortcutNoteActivate,handleShortcutNoteMouseDown:ve.handleShortcutNoteMouseDown,handleRecentNoteActivate:ve.handleRecentNoteActivate,handleShortcutSearchActivate:ve.handleShortcutSearchActivate,handleShortcutTagActivate:ve.handleShortcutTagActivate,handleShortcutPropertyActivate:ve.handleShortcutPropertyActivate,handleShortcutContextMenu:qe.handleShortcutContextMenu,handleRecentFileContextMenu:qe.handleRecentFileContextMenu,handleShortcutRootDragOver:te.handleShortcutRootDragOver,handleShortcutRootDrop:te.handleShortcutRootDrop,buildShortcutExternalHandlers:te.buildShortcutExternalHandlers,getFolderShortcutCount:Ie.getFolderShortcutCount,getTagShortcutCount:Ie.getTagShortcutCount,getPropertyShortcutCount:Ie.getPropertyShortcutCount,getMissingNoteLabel:Ie.getMissingNoteLabel}),[H,z,ee,pe,M,$,ve.handleRecentNoteActivate,ve.handleShortcutFolderActivate,ve.handleShortcutFolderNoteClick,ve.handleShortcutFolderNoteMouseDown,ve.handleShortcutNoteActivate,ve.handleShortcutNoteMouseDown,ve.handleShortcutPropertyActivate,ve.handleShortcutSearchActivate,ve.handleShortcutTagActivate,ve.openShortcutByNumber,Ie.getFolderShortcutCount,Ie.getMissingNoteLabel,Ie.getPropertyShortcutCount,Ie.getTagShortcutCount,Ie.pinToggleLabel,Ie.propertiesHeaderTrailingAction,Ie.shortcutHeaderTrailingAction,te.activeShortcutId,te.allowEmptyShortcutDrop,te.buildShortcutExternalHandlers,te.handleShortcutDragCancel,te.handleShortcutDragEnd,te.handleShortcutDragStart,te.handleShortcutRootDragOver,te.handleShortcutRootDrop,te.isShortcutSorting,te.shortcutDragHandleConfig,te.shortcutIds,te.shortcutSensors,te.shouldUseShortcutDnd,qe.handleRecentFileContextMenu,qe.handleShortcutContextMenu,Fe.activeShortcutKey,Fe.clearActiveShortcut,Fe.recentNotesExpanded,Fe.setRecentNotesExpanded,Fe.setShortcutsExpanded,Fe.shortcutNumberBadgesByKey,Fe.shortcutsExpanded,Fe.shouldShowShortcutCounts,_.length,R])}var Wp,boe=U(()=>{Wp=ue(ze());mn();Qs();Ur();on();xg();Xi();pa();Tr();Yr();qy();Dr();zn();loe();coe();poe();goe();voe()});function Soe({app:t,commandQueue:e,isMobile:n,settings:r,uiState:o,expansionState:a,expansionDispatch:i,selectionState:s,selectionDispatch:l,uiDispatch:c,propertyTreeService:u,tagTree:p,propertyTree:m,tagsVirtualFolderHasChildren:g,setShortcutsExpanded:f,setRecentNotesExpanded:h,clearActiveShortcut:b,openFolderNoteInRightSidebar:v,onModifySearchWithTag:y,onModifySearchWithProperty:S}){let w=(0,ra.useCallback)(C=>{!o.singlePane||C!=="right-sidebar"||(c({type:"SET_SINGLE_PANE_VIEW",view:"files"}),c({type:"SET_FOCUSED_PANE",pane:"files"}))},[c,o.singlePane]),k=(0,ra.useCallback)(C=>{if(r.collapseOtherBranchesOnExpand){let x=t.vault.getFolderByPath(C);if(x){Fd({type:"folder",id:C,hasChildren:x.children.some(z=>z instanceof MD.TFolder),ancestorIds:Dp(x)},a,i,"toggle",{collapseOtherBranches:!0});return}}i({type:"TOGGLE_FOLDER_EXPANDED",folderPath:C})},[t.vault,i,a,r.collapseOtherBranchesOnExpand]),F=(0,ra.useCallback)((C,x)=>{x?.fromShortcut||b();let z=C.children.some(j=>j instanceof MD.TFolder),H=a.expandedFolders.has(C.path),Y=s.selectionType===W.FOLDER&&s.selectedFolder?.path===C.path,ee=r.autoExpandNavItems&&!o.singlePane&&z&&H&&Y,$=o.singlePane&&r.autoExpandNavItems&&z&&!H;if(l({type:"SET_SELECTED_FOLDER",folder:C}),ee){k(C.path),c({type:"SET_FOCUSED_PANE",pane:"navigation"});return}if(r.autoExpandNavItems&&z&&!H&&k(C.path),o.singlePane){$?c({type:"SET_FOCUSED_PANE",pane:"navigation"}):(c({type:"SET_SINGLE_PANE_VIEW",view:"files"}),c({type:"SET_FOCUSED_PANE",pane:"files"}));return}c({type:"SET_FOCUSED_PANE",pane:"navigation"})},[b,a.expandedFolders,k,l,s.selectedFolder,s.selectionType,r,c,o.singlePane]),P=(0,ra.useCallback)((C,x)=>{if(!r.enableFolderNotes||!r.enableFolderNoteLinks){F(C);return}let z=Pn(C,r);if(!z){F(C);return}let H=s.selectionType===W.FOLDER&&s.selectedFolder?.path===C.path;l({type:"SET_SELECTED_FOLDER",folder:C,autoSelectedFile:null});let Y=x?Hc(x,r.folderNoteOpenLocation,r.multiSelectModifier,n):lN(r.folderNoteOpenLocation);w(Y),!(Y==="right-sidebar"&&r.showNearestFolderNoteInSidebar&&!H)&&Q(()=>ri({app:t,commandQueue:e,folder:C,folderNote:z,context:Y,openInRightSidebar:v}))},[t,e,w,F,n,v,l,s.selectedFolder,s.selectionType,r]),T=(0,ra.useCallback)((C,x)=>{if(x.button!==1||!r.enableFolderNotes||!r.enableFolderNoteLinks)return;let z=Pn(C,r);z&&(x.preventDefault(),x.stopPropagation(),l({type:"SET_SELECTED_FOLDER",folder:C,autoSelectedFile:null}),Q(()=>ri({app:t,commandQueue:e,folder:C,folderNote:z,context:"tab"})))},[t,e,l,r]),I=(0,ra.useCallback)(C=>{if(r.collapseOtherBranchesOnExpand){let x=Li(p,C);if(x){Fd({type:"tag",id:x.path,hasChildren:x.children.size>0,ancestorIds:EF(x.path)},a,i,"toggle",{collapseOtherBranches:!0});return}}i({type:"TOGGLE_TAG_EXPANDED",tagPath:C})},[i,a,r.collapseOtherBranchesOnExpand,p]),N=(0,ra.useCallback)(C=>{if(r.collapseOtherBranchesOnExpand){let x=u?.findNode(C)??Array.from(m.values()).find(H=>H.id===C||H.children.has(C))??null,z=x?.id===C?x:x?.children.get(C);if(z){Fd({type:"property",id:z.id,hasChildren:z.children.size>0,ancestorIds:iH(z.id)},a,i,"toggle",{collapseOtherBranches:!0});return}}i({type:"TOGGLE_PROPERTY_EXPANDED",propertyNodeId:C})},[i,a,m,u,r.collapseOtherBranchesOnExpand]),O=(0,ra.useCallback)(C=>{if(C===yi){f(x=>{let z=!x;return ye.set(ut.shortcutsExpandedKey,z?"1":"0"),z});return}if(C===bi){h(x=>{let z=!x;return ye.set(ut.recentNotesExpandedKey,z?"1":"0"),z});return}i({type:"TOGGLE_VIRTUAL_FOLDER_EXPANDED",folderId:C})},[i,h,f]),K=(0,ra.useCallback)(C=>{let x=[],z=H=>{H.children.forEach(Y=>{Y instanceof MD.TFolder&&(x.push(Y.path),z(Y))})};return z(C),x},[]),G=(0,ra.useCallback)(()=>{let C=[],x=new Set,z=H=>{x.has(H)||(x.add(H),C.push(H.path),H.children.forEach(Y=>z(Y)))};return p.forEach(H=>z(H)),C},[p]),X=(0,ra.useCallback)(C=>{let x=[],z=Li(p,C);if(!z)return x;let H=Y=>{Y.children.forEach(ee=>{x.push(ee.path),H(ee)})};return H(z),x},[p]),L=(0,ra.useCallback)(()=>{let C=[],x=new Set,z=H=>{x.has(H)||(x.add(H),C.push(H.id),H.children.forEach(Y=>z(Y)))};return m.forEach(H=>z(H)),C},[m]),V=(0,ra.useCallback)(C=>{if((u?.findNode(C.id)??null)===C)return Array.from(u?.collectDescendantNodeIds(C.id)??[]);let z=[],H=Y=>{Y.children.forEach(ee=>{z.push(ee.id),H(ee)})};return H(C),z},[u]),D=(0,ra.useCallback)(C=>{if(o.singlePane){C?c({type:"SET_FOCUSED_PANE",pane:"navigation"}):(c({type:"SET_SINGLE_PANE_VIEW",view:"files"}),c({type:"SET_FOCUSED_PANE",pane:"files"}));return}c({type:"SET_FOCUSED_PANE",pane:"navigation"})},[c,o.singlePane]),A=(0,ra.useCallback)(C=>{let{hasChildren:x,isExpanded:z,isSelected:H,fromShortcut:Y,onSelect:ee,onToggleExpand:$}=C;if(Y||b(),ee(),r.autoExpandNavItems&&!o.singlePane&&x&&z&&H){$(),c({type:"SET_FOCUSED_PANE",pane:"navigation"});return}let J=o.singlePane&&r.autoExpandNavItems&&x&&!z;r.autoExpandNavItems&&x&&!z&&$(),D(J)},[b,D,r.autoExpandNavItems,c,o.singlePane]),_=(0,ra.useCallback)((C,x,z)=>{let H=Li(p,C),Y=Vc(C,p);if(!Y)return;let ee=Vs(Y),$=Av(x??null,r.multiSelectModifier,n);if($&&!ee&&Y!==bt){x&&(x.preventDefault(),x.stopPropagation()),y(Y,$);return}let j=r.showAllTagsFolder&&Y===zt,J=j?a.expandedVirtualFolders.has(_n):!!(H&&a.expandedTags.has(H.path)),re=s.selectionType===W.TAG&&s.selectedTag===Y,oe=j?g:!!(H&&H.children.size>0);A({hasChildren:oe,isExpanded:J,isSelected:re,fromShortcut:z?.fromShortcut,onSelect:()=>{l({type:"SET_SELECTED_TAG",tag:Y})},onToggleExpand:()=>{j?i({type:"TOGGLE_VIRTUAL_FOLDER_EXPANDED",folderId:_n}):H&&I(H.path)}})},[A,i,a.expandedTags,a.expandedVirtualFolders,I,n,y,l,s.selectedTag,s.selectionType,r.multiSelectModifier,r.showAllTagsFolder,p,g]),E=(0,ra.useCallback)((C,x)=>{_(C,x)},[_]),R=(0,ra.useCallback)(C=>{let x=Oe,z=s.selectionType===W.PROPERTY?s.selectedProperty:null;A({hasChildren:m.size>0,isExpanded:a.expandedVirtualFolders.has(x),isSelected:z===x,onSelect:()=>{l({type:"SET_SELECTED_PROPERTY",nodeId:x})},onToggleExpand:()=>{O(x)}})},[A,a.expandedVirtualFolders,O,m,l,s.selectedProperty,s.selectionType]),M=(0,ra.useCallback)((C,x,z)=>{let H=Av(x??null,r.multiSelectModifier,n);if(H){x&&(x.preventDefault(),x.stopPropagation());let j=C.kind==="value"&&C.valuePath?C.valuePath:null;S(C.key,j,H);return}let Y=C.children.size>0,ee=a.expandedProperties.has(C.id),$=s.selectionType===W.PROPERTY?s.selectedProperty:null;A({hasChildren:Y,isExpanded:ee,isSelected:$===C.id,fromShortcut:z?.fromShortcut,onSelect:()=>{l({type:"SET_SELECTED_PROPERTY",nodeId:C.id,source:z?.fromShortcut?"shortcut":void 0})},onToggleExpand:()=>{N(C.id)}})},[A,a.expandedProperties,N,n,S,l,s.selectedProperty,s.selectionType,r.multiSelectModifier]);return(0,ra.useMemo)(()=>({handleFolderToggle:k,handleFolderClick:F,handleFolderNameClick:P,handleFolderNameMouseDown:T,handleTagToggle:I,handlePropertyToggle:N,handleVirtualFolderToggle:O,getAllDescendantFolders:K,getAllTagPaths:G,getAllDescendantTags:X,getAllPropertyNodeIds:L,getAllDescendantPropertyNodeIds:V,handleTagClick:_,handleTagCollectionClick:E,handlePropertyCollectionClick:R,handlePropertyClick:M}),[K,V,X,L,G,F,P,T,k,M,R,N,_,E,I,O])}var ra,MD,woe=U(()=>{ra=ue(ze()),MD=require("obsidian");Jr();Ue();Jc();ot();td();Ba();Sn();Sn();Jm();hu()});function Poe({searchNavFilters:t}){let e=(0,Eo.useMemo)(()=>{let k=t?.tags.include;return!k||k.length===0?Toe:k},[t]),n=(0,Eo.useMemo)(()=>{let k=t?.tags.exclude;return!k||k.length===0?Toe:k},[t]),r=t?.tags.requireTagged??!1,o=t?.tags.excludeTagged??!1,a=t?.tags.includeUntagged??!1,i=(0,Eo.useMemo)(()=>RD(e,To),[e]),s=(0,Eo.useMemo)(()=>RD(n,To),[n]),l=(0,Eo.useMemo)(()=>RD(t?.properties.include,t1),[t]),c=(0,Eo.useMemo)(()=>RD(t?.properties.exclude,t1),[t]),u=(0,Eo.useMemo)(()=>t?.tags.includeOperators??koe,[t]),p=(0,Eo.useMemo)(()=>t?.properties.includeOperators??koe,[t]),m=(0,Eo.useRef)(new Map),g=(0,Eo.useRef)(new Map),f=(0,Eo.useCallback)(k=>{let F=m.current.get(k);if(F!==void 0)return F;let P=To(k);return Foe(m.current,k,P),P},[]),h=(0,Eo.useCallback)(k=>{let F=g.current.get(k);if(F!==void 0)return F;let P=t1(k);return Foe(g.current,k,P),P},[]);(0,Eo.useEffect)(()=>{m.current.clear()},[i,s]),(0,Eo.useEffect)(()=>{g.current.clear()},[l,c]);let b=(0,Eo.useCallback)(k=>{if(k===bt)return a?"include":o?"exclude":void 0;if(!i&&!s)return;let F=f(k);if(s?.has(F))return"exclude";if(i?.has(F))return"include"},[f,o,a,s,i]),v=(0,Eo.useCallback)(k=>{if(k===zt){if(o)return"exclude";if(r)return"include"}},[o,r]),y=(0,Eo.useCallback)(k=>{if(k===Oe||!l&&!c)return;let F=h(k);if(c?.has(F))return"exclude";if(l?.has(F))return"include"},[h,c,l]),S=(0,Eo.useCallback)(k=>{let F=f(k);return u[F]},[f,u]),w=(0,Eo.useCallback)(k=>{if(k===Oe)return;let F=h(k);return p[F]},[h,p]);return(0,Eo.useMemo)(()=>({getTagSearchMatch:b,getPropertySearchMatch:y,getTagCollectionSearchMatch:v,getTagInclusionOperator:S,getPropertyInclusionOperator:w}),[w,y,v,S,b])}var Eo,Toe,qCe,koe,RD,Foe,t1,Coe=U(()=>{Eo=ue(ze());Ue();Ot();cn();Toe=[],qCe=2048,koe=Object.freeze({}),RD=(t,e)=>{if(!t||t.length===0)return null;let n=new Set;return t.forEach(r=>{let o=e(r);o&&n.add(o)}),n.size>0?n:null},Foe=(t,e,n)=>{if(!t.has(e)&&t.size>=qCe)for(let r of t.keys()){t.delete(r);break}t.set(e,n)},t1=t=>{let e=kn(t);if(!e)return To(t);let n=To(e.key);return e.valuePath?sa(n,To(e.valuePath)):Gn(n)}});function Ioe({path:t,onHeightChange:e}){let{app:n}=gt(),r=(0,WS.useRef)(null),o=(0,WS.useMemo)(()=>{let a=n.vault.getAbstractFileByPath(t);if(a instanceof Noe.TFile)try{return{resourcePath:n.vault.getResourcePath(a),missing:!1}}catch{return{resourcePath:null,missing:!0}}return{resourcePath:null,missing:!0}},[n,t]);return(0,WS.useLayoutEffect)(()=>{let a=r.current;if(!a||!e)return;let i=()=>{e(a.getBoundingClientRect().height)};if(i(),typeof ResizeObserver>"u")return;let s=new ResizeObserver(()=>{i()});return s.observe(a),()=>{s.disconnect()}},[e,t]),o.resourcePath?(0,n1.jsx)("div",{className:"nn-nav-banner","aria-hidden":"true",ref:r,children:(0,n1.jsx)("img",{className:"nn-nav-banner-image",src:o.resourcePath,alt:""})}):null}var WS,Noe,n1,xoe=U(()=>{WS=ue(ze()),Noe=require("obsidian");mn();n1=ue(Ge())});function DD({icon:t,color:e,backgroundColor:n,label:r,level:o,itemType:a,description:i,isDisabled:s,isExcluded:l,onClick:c,onMouseDown:u,onContextMenu:p,dragHandlers:m,isDragSource:g,showCount:f,showCountLeader:h,count:b,countSlot:v,dragHandleConfig:y,className:S,chevronIcon:w,role:k="treeitem",tabIndex:F,ariaDisabled:P,labelClassName:T,onLabelClick:I,onLabelMouseDown:N,trailingAccessory:O,showIcon:K=!0,tooltip:G,dragRef:X,dragHandleRef:L,dragAttributes:V,dragListeners:D,dragStyle:A,isSorting:_,nativeDragData:E}){let R=pt(),M=(0,Aa.useRef)(null),C=(0,Aa.useRef)(null),x=(0,Aa.useRef)(null),z=Ki(),H=!!e&&!R.colorIconOnly,Y=(0,Aa.useMemo)(()=>H&&e?{color:e}:void 0,[H,e]),ee=(0,Aa.useMemo)(()=>{let xe=["nn-navitem","nn-drag-item"];return S&&xe.push(S),s&&xe.push("nn-shortcut-disabled"),l&&xe.push("nn-excluded"),y?.visible&&xe.push("nn-drag-item-has-handle"),n&&xe.push("nn-has-custom-background"),xe.join(" ")},[n,S,y?.visible,s,l]),$=(0,Aa.useMemo)(()=>{let xe=["nn-navitem-name"];return T&&xe.push(T),H&&e&&xe.push("nn-has-custom-color"),xe.join(" ")},[H,e,T]);(0,Aa.useEffect)(()=>{if(C.current){if(!w){C.current.empty();return}C.current.empty(),(0,jf.setIcon)(C.current,w)}},[w]),(0,Aa.useEffect)(()=>{if(!x.current)return;if(!K){x.current.textContent="";return}yn().renderIcon(x.current,t)},[t,z,K]);let j=!!D,J=!!y?.visible,re=y?.only===!0,oe=y?.disabled===!0,ce=J&&!oe&&j||y?.interactive===!0,se=re&&j,ne=typeof b=="number"?b>0:typeof b=="string"?b.length>0:!1,B=v!=null,q=!!(f&&(ne||B)),ie=h??!!f,le=(0,Aa.useCallback)(xe=>{I&&(xe.stopPropagation(),I(xe))},[I]),Te=(0,Aa.useCallback)(xe=>{N&&(xe.stopPropagation(),N(xe))},[N]),ke=(0,Aa.useMemo)(()=>n?{"--level":o,"--nn-navitem-custom-bg-color":n}:{"--level":o},[n,o]),Fe=(0,Aa.useMemo)(()=>A?{...ke,...A}:ke,[A,ke]),te=(0,Aa.useMemo)(()=>{if(!V)return;let{role:xe,tabIndex:Ce,...vt}=V;return vt},[V]),pe=(0,Aa.useCallback)(xe=>{M.current=xe,X&&X(xe)},[X]);(0,Aa.useEffect)(()=>{let xe=M.current;if(xe){if(jf.Platform.isMobile||!R.showTooltips||!G){(0,jf.setTooltip)(xe,"");return}(0,jf.setTooltip)(xe,G,{placement:Sm()})}},[R.showTooltips,G]);let ve=(0,Aa.useCallback)(xe=>{L&&L(xe)},[L]),Ie=g||_,qe=!!E?.path;return(0,el.jsx)("div",{ref:pe,className:ee,role:k,tabIndex:F,"aria-disabled":P||void 0,"data-nav-item-type":a,"data-nav-item-disabled":s?"true":void 0,"data-nav-item-excluded":l?"true":void 0,"data-nav-item-level":o,"data-drag-path":E?.path,"data-drag-type":E?.type,"data-draggable":qe?"true":void 0,"data-drag-icon":E?.icon,"data-drag-fallback-icon":E?.fallbackIcon,"data-drag-base-icon":E?.baseIcon,"data-drag-icon-color":E?.iconColor,"data-drag-allow-multi-file":E?.allowMultiFileDrag===!1?"false":void 0,"data-level":o,"aria-level":o+1,draggable:qe||void 0,onClick:c,onMouseDown:u,onContextMenu:p,onDragOver:m?.onDragOver,onDragLeave:m?.onDragLeave,onDrop:m?.onDrop,style:Fe,...se?void 0:te,...se?void 0:D,children:(0,el.jsxs)("div",{className:"nn-navitem-content",children:[(0,el.jsx)("span",{ref:C,className:`nn-navitem-chevron${w?"":" nn-navitem-chevron--no-children"}`,"aria-hidden":"true"}),K?(0,el.jsx)("span",{ref:x,className:"nn-navitem-icon","aria-hidden":"true","data-has-color":e?"true":"false",style:e?{color:e}:void 0}):null,(0,el.jsxs)("span",{className:$,onClick:I?le:void 0,onMouseDown:N?Te:void 0,children:[(0,el.jsx)("span",{className:"nn-shortcut-label","data-has-color":H?"true":void 0,style:Y,children:r}),i?(0,el.jsx)("span",{className:"nn-shortcut-description",children:i}):null]}),(0,el.jsx)("span",{className:`nn-navitem-spacer${ie?" nn-navitem-spacer--leader":""}`}),q?v??(0,el.jsx)("span",{className:"nn-navitem-count",children:b}):null,O?(0,el.jsx)("div",{className:"nn-navitem-accessory",children:O}):null,J?(0,el.jsx)("span",{className:`nn-drag-handle${ce?"":" nn-drag-handle-disabled"}${Ie?" nn-drag-handle-active":""}`,role:"button",tabIndex:-1,ref:ve,onClick:y?.events?.onClick,onContextMenu:y?.events?.onContextMenu,...se?V:void 0,...se?D:void 0,children:(0,el.jsx)(Bl,{name:y?.icon??"lucide-grip-horizontal"})}):null]})})}var Aa,jf,el,r1=U(()=>{Aa=ue(ze());on();Ha();Kf();jf=require("obsidian");os();el=ue(Ge())});function o1({icon:t,label:e,level:n,dragHandlers:r,isDragSource:o,onClick:a,chevronIcon:i,isMissing:s,color:l,itemType:c="folder",className:u,dragHandleConfig:p,trailingAccessory:m,dragRef:g,dragHandleRef:f,dragAttributes:h,dragListeners:b,dragStyle:v,isSorting:y}){let S=pt(),w=T=>{T.preventDefault(),T.stopPropagation(),a&&a(T)},k=p??(r?{visible:!0,icon:"lucide-grip-horizontal"}:void 0),F=(()=>{let T=["nn-root-reorder-item"];return c==="folder"?T.push("nn-folder"):c==="tag"?T.push("nn-tag"):c==="property"?T.push("nn-property"):c==="section"&&T.push("nn-section"),s&&T.push("nn-root-reorder-item--missing"),u&&T.push(u),T.join(" ")})(),P=(0,Eoe.useMemo)(()=>c==="section"?!0:c==="folder"?S.showFolderIcons:c==="tag"?S.showTagIcons:c==="property"?S.showPropertyIcons:!0,[c,S.showFolderIcons,S.showPropertyIcons,S.showTagIcons]);return(0,Moe.jsx)(DD,{icon:t,color:l,label:e,level:n,itemType:c,role:"listitem",onClick:w,dragHandlers:r,isDragSource:o,showCount:!1,className:F,tabIndex:-1,dragHandleConfig:k,chevronIcon:i,trailingAccessory:m,showIcon:P,dragRef:g,dragHandleRef:f,dragAttributes:h,dragListeners:b,dragStyle:v,isSorting:y})}var Eoe,Moe,Roe=U(()=>{Eoe=ue(ze());r1();on();Moe=ue(Ge())});function YCe({entry:t,canReorder:e,isMobile:n}){let{item:r,sortableId:o}=t,{attributes:a,listeners:i,setNodeRef:s,transform:l,transition:c,isSorting:u}=LS({id:o,disabled:!e,data:{type:r.props.itemType}}),p=l?{transform:Nd.Transform.toString(l),transition:c}:void 0,m=(0,va.useMemo)(()=>({visible:n&&e,icon:"lucide-grip-horizontal",interactive:n&&e,only:n}),[e,n]);return(0,Nn.jsx)(o1,{...r.props,dragRef:s,dragAttributes:a,dragListeners:i,dragStyle:p,isSorting:u,dragHandleConfig:m})}function jS({entries:t,canReorder:e,children:n,isMobile:r}){let o=(0,va.useMemo)(()=>t.map(a=>a.sortableId),[t]);return(0,Nn.jsxs)(Nn.Fragment,{children:[(0,Nn.jsx)(OS,{items:o,strategy:AS,children:t.map(a=>(0,Nn.jsx)(YCe,{entry:a,canReorder:e,isMobile:r},a.sortableId))}),n]})}function GS({label:t,onClick:e}){return(0,Nn.jsx)("div",{className:"nn-root-reorder-actions",children:(0,Nn.jsxs)("button",{type:"button",className:"nn-root-reorder-reset nn-support-button",onClick:e,children:[(0,Nn.jsx)("span",{className:"nn-root-reorder-reset-icon","aria-hidden":"true",children:"Aa"}),(0,Nn.jsx)("span",{children:t})]})})}function Aoe({sectionItems:t,folderItems:e,tagItems:n,propertyItems:r,isMobile:o,showRootFolderSection:a,showRootTagSection:i,showRootPropertySection:s,foldersSectionExpanded:l,tagsSectionExpanded:c,propertiesSectionExpanded:u,showRootFolderReset:p,showRootTagReset:m,showRootPropertyReset:g,resetRootTagOrderLabel:f,resetRootPropertyOrderLabel:h,onResetRootFolderOrder:b,onResetRootTagOrder:v,onResetRootPropertyOrder:y,onReorderSections:S,onReorderFolders:w,onReorderTags:k,onReorderProperties:F,canReorderSections:P,canReorderFolders:T,canReorderTags:I,canReorderProperties:N}){let O=(0,va.useCallback)(j=>{j.preventDefault(),j.stopPropagation(),Q(async()=>{await b()})},[b]),K=(0,va.useCallback)(j=>{j.preventDefault(),j.stopPropagation(),Q(async()=>{await v()})},[v]),G=(0,va.useCallback)(j=>{j.preventDefault(),j.stopPropagation(),Q(async()=>{await y()})},[y]),X=(0,va.useMemo)(()=>t.map(j=>({id:j.key,item:j})),[t]),L=(0,va.useMemo)(()=>e.map(j=>({sortableId:`folder:${j.key}`,item:j})),[e]),V=(0,va.useMemo)(()=>n.map(j=>({sortableId:`tag:${j.key}`,item:j})),[n]),D=(0,va.useMemo)(()=>r.map(j=>({sortableId:`property:${j.key}`,item:j})),[r]),A=(0,va.useMemo)(()=>{let j=new Map;return L.forEach(J=>{j.set(J.sortableId,{type:"folder",key:J.item.key})}),V.forEach(J=>{j.set(J.sortableId,{type:"tag",key:J.item.key})}),D.forEach(J=>{j.set(J.sortableId,{type:"property",key:J.item.key})}),j},[L,D,V]),_=(0,va.useMemo)(()=>X.map(j=>j.id),[X]),E=(0,va.useMemo)(()=>L.map(j=>j.item.key),[L]),R=(0,va.useMemo)(()=>V.map(j=>j.item.key),[V]),M=(0,va.useMemo)(()=>D.map(j=>j.item.key),[D]),C=(0,va.useMemo)(()=>new Map(_.map((j,J)=>[j,J])),[_]),x=RS(Vg(_f,{activationConstraint:dre}),Vg(Hf,{activationConstraint:cre})),z=(0,va.useCallback)((j,J)=>{if(!P)return;let re=_.indexOf(j),oe=re+J;if(re===-1||oe<0||oe>=_.length)return;let Z=Kp(_,re,oe);Q(async()=>{await S(Z)})},[P,S,_]),H=(0,va.useCallback)((j,J)=>re=>{re.preventDefault(),re.stopPropagation(),z(j,J)},[z]),Y=(0,va.useCallback)((j,J)=>{if(!N)return;let re=M.indexOf(j),oe=M.indexOf(J);if(re===-1||oe===-1||re===oe)return;let Z=Kp(M,re,oe);Q(async()=>{await F(Z)})},[N,F,M]),ee=X.length>0||a&&L.length>0||i&&V.length>0||s&&D.length>0,$=(0,va.useCallback)(j=>{let J=j.active.id,re=j.over?.id;if(!re)return;let oe=A.get(J),Z=A.get(re);if(!(!oe||!Z)&&oe.type===Z.type){if(oe.type==="folder"){if(!T)return;let ce=E.indexOf(oe.key),ae=E.indexOf(Z.key);if(ce===-1||ae===-1||ce===ae)return;let se=Kp(E,ce,ae);Q(async()=>{await w(se)});return}if(oe.type==="tag"){if(!I)return;let ce=R.indexOf(oe.key),ae=R.indexOf(Z.key);if(ce===-1||ae===-1||ce===ae)return;let se=Kp(R,ce,ae);Q(async()=>{await k(se)});return}Y(oe.key,Z.key)}},[T,I,E,Y,w,k,A,R]);return(0,Nn.jsxs)("div",{className:"nn-root-reorder-panel",children:[(0,Nn.jsxs)("div",{className:"nn-root-reorder-header",children:[(0,Nn.jsx)("span",{className:"nn-root-reorder-title",children:d.navigationPane.reorderRootFoldersTitle}),(0,Nn.jsx)("span",{className:"nn-root-reorder-hint",children:d.navigationPane.reorderRootFoldersHint})]}),(0,Nn.jsx)("div",{className:"nn-root-reorder-list",role:"presentation",children:ee?(0,Nn.jsx)(DS,{sensors:x,collisionDetection:TD,modifiers:[BS],onDragEnd:$,children:X.length>0?X.map(j=>{let J=j.item,re=j.id,oe=C.get(re)??-1,Z=P&&oe>0,ce=P&&oe>=0&&oe<_.length-1,se=P&&_.length>1?(0,Nn.jsxs)("div",{className:"nn-root-reorder-section-controls",children:[(0,Nn.jsx)("button",{type:"button",className:"nn-icon-button nn-root-reorder-section-button","aria-label":d.settings.items.vaultProfiles.moveUp,onClick:H(re,-1),disabled:!Z,children:(0,Nn.jsx)(Bl,{name:"lucide-arrow-up"})}),(0,Nn.jsx)("button",{type:"button",className:"nn-icon-button nn-root-reorder-section-button","aria-label":d.settings.items.vaultProfiles.moveDown,onClick:H(re,1),disabled:!ce,children:(0,Nn.jsx)(Bl,{name:"lucide-arrow-down"})})]}):void 0,ne=J.sectionId===Dt.FOLDERS&&l&&a,B=J.sectionId===Dt.TAGS&&c&&i,q=J.sectionId===Dt.PROPERTIES&&u&&s;return(0,Nn.jsxs)("div",{className:"nn-root-reorder-section",children:[(0,Nn.jsx)(o1,{...J.props,trailingAccessory:se}),ne&&L.length>0?(0,Nn.jsx)(jS,{entries:L,canReorder:T,isMobile:o,children:p?(0,Nn.jsx)(GS,{label:Doe,onClick:O}):null}):null,B&&V.length>0?(0,Nn.jsx)(jS,{entries:V,canReorder:I,isMobile:o,children:m?(0,Nn.jsx)(GS,{label:f,onClick:K}):null}):null,q&&D.length>0?(0,Nn.jsx)(jS,{entries:D,canReorder:N,isMobile:o,children:g?(0,Nn.jsx)(GS,{label:h,onClick:G}):null}):null]},`section:${J.key}`)}):(0,Nn.jsxs)(Nn.Fragment,{children:[a&&L.length>0?(0,Nn.jsx)("div",{className:"nn-root-reorder-section",children:(0,Nn.jsx)(jS,{entries:L,canReorder:T,isMobile:o,children:p?(0,Nn.jsx)(GS,{label:Doe,onClick:O}):null})}):null,i&&V.length>0?(0,Nn.jsx)("div",{className:"nn-root-reorder-section",children:(0,Nn.jsx)(jS,{entries:V,canReorder:I,isMobile:o,children:m?(0,Nn.jsx)(GS,{label:f,onClick:K}):null})}):null,s&&D.length>0?(0,Nn.jsx)("div",{className:"nn-root-reorder-section",children:(0,Nn.jsx)(jS,{entries:D,canReorder:N,isMobile:o,children:g?(0,Nn.jsx)(GS,{label:h,onClick:G}):null})}):null]})}):null})]})}var va,Nn,Doe,Ooe=U(()=>{va=ue(ze());Uf();zS();ES();Roe();Ee();Ue();ot();Kf();FP();Nn=ue(Ge()),Doe=d.navigationPane.resetRootToAlpha});function Loe({onTreeUpdateComplete:t,onToggleRootFolderReorder:e,rootReorderActive:n,rootReorderDisabled:r,useFloatingLayout:o=!1}){let a=pt(),i=Xt(),{toggleShowCalendar:s}=wd(),l=i.showHiddenItems,c=i.showCalendar,u=ar(),p=a.toolbarVisibility.navigation,{shouldCollapseItems:m,handleExpandCollapseAll:g,handleNewFolder:f,handleToggleShowExcludedFolders:h}=Gb(),b=p.expandCollapse,v=p.calendar&&a.calendarEnabled&&a.calendarPlacement!=="right-sidebar",y=p.hiddenItems,S=p.rootReorder,w=p.newFolder,k=[b,v,y,S].filter(Boolean).length,F=k+(w?1:0),P=k===1?"nn-mobile-toolbar-circle":"nn-mobile-toolbar-pill",T=k===1?"nn-mobile-toolbar-button nn-mobile-toolbar-button-circle":"nn-mobile-toolbar-button";if(F===0)return null;let I=[b?(0,ui.jsx)("button",{className:T,"aria-label":m()?d.paneHeader.collapseAllFolders:d.paneHeader.expandAllFolders,onClick:()=>{g(),t&&window.requestAnimationFrame(()=>{t()})},tabIndex:-1,children:(0,ui.jsx)(Qt,{iconId:Qe(a.interfaceIcons,m()?"nav-collapse-all":"nav-expand-all")})},"expand-collapse"):null,y?(0,ui.jsx)("button",{className:`${T}${l?" nn-mobile-toolbar-button-active":""}`,"aria-label":l?d.paneHeader.hideExcludedItems:d.paneHeader.showExcludedItems,onClick:()=>{h(),t&&window.requestAnimationFrame(()=>{t()})},tabIndex:-1,children:(0,ui.jsx)(Qt,{iconId:Qe(a.interfaceIcons,"nav-hidden-items")})},"hidden-items"):null,v?(0,ui.jsx)("button",{className:`${T}${c?" nn-mobile-toolbar-button-active":""}`,"aria-label":c?d.paneHeader.hideCalendar:d.paneHeader.showCalendar,onClick:s,tabIndex:-1,children:(0,ui.jsx)(Qt,{iconId:Qe(a.interfaceIcons,"nav-calendar")})},"calendar"):null,S?(0,ui.jsx)("button",{className:`${T}${n?" nn-mobile-toolbar-button-active":""}`,"aria-label":n?d.paneHeader.finishRootFolderReorder:d.paneHeader.reorderRootFolders,onClick:e,disabled:r,tabIndex:-1,children:(0,ui.jsx)(Qt,{iconId:Qe(a.interfaceIcons,"nav-root-reorder")})},"root-reorder"):null].filter(Boolean),N=w?(0,ui.jsx)("button",{className:"nn-mobile-toolbar-button nn-mobile-toolbar-button-circle","aria-label":d.paneHeader.newFolder,onClick:()=>{Q(()=>f())},disabled:!u.selectedFolder,tabIndex:-1,children:(0,ui.jsx)(Qt,{iconId:Qe(a.interfaceIcons,"nav-new-folder")})},"new-folder"):null;return o?(0,ui.jsxs)("div",{className:"nn-mobile-toolbar",children:[(0,ui.jsx)("div",{className:"nn-mobile-toolbar-left",children:k>0?(0,ui.jsx)("div",{className:P,children:I}):null}),w?(0,ui.jsx)("div",{className:"nn-mobile-toolbar-right",children:(0,ui.jsx)("div",{className:"nn-mobile-toolbar-circle",children:N})}):null]}):(0,ui.jsxs)("div",{className:"nn-mobile-toolbar",children:[I,N]})}var ui,zoe=U(()=>{Ur();on();Tr();Ee();Al();QM();ot();pr();ui=ue(Ge())});function Cu(t,e,n,r="•"){let o=Math.max(0,t?.current??0),a=e?Math.max(0,t?.descendants??0):0,i=o+a;if(n&&e){let c;return o===0&&a===0?c="":a===0?c=`${o}`:o===0?c=`${r} ${a}`:c=`${o} ${r} ${a}`,{shouldDisplay:c.length>0,label:c}}let s=e?i:o,l=s>0;return{shouldDisplay:l,label:l?`${s}`:""}}function qS(t,e){return e?t.shouldDisplay?{shouldDisplay:!0,label:`${e} ${t.label}`}:{shouldDisplay:!0,label:e}:t}var YS=U(()=>{});function OD({label:t,actionLabel:e,icon:n,onClick:r,reserveSpaceWhenHidden:o=!0}){let a=typeof t=="string"&&t.length>0,i=!a&&o,s=!a&&!o?"nn-navitem-hover-action-slot nn-navitem-hover-action-slot--overlay":"nn-navitem-hover-action-slot",l=(0,AD.useCallback)(p=>{p.preventDefault(),p.stopPropagation()},[]),c=(0,AD.useCallback)(p=>{p.preventDefault(),p.stopPropagation()},[]),u=(0,AD.useCallback)(p=>{p.preventDefault(),p.stopPropagation(),r()},[r]);return(0,Gf.jsxs)("span",{className:s,children:[a?(0,Gf.jsx)("span",{className:"nn-navitem-count nn-navitem-hover-action-count",children:t}):i?(0,Gf.jsx)("span",{className:"nn-navitem-count nn-navitem-hover-action-placeholder","aria-hidden":!0}):null,(0,Gf.jsx)("button",{type:"button",className:"nn-icon-button nn-navitem-hover-action-button","aria-label":e,tabIndex:-1,onPointerDown:l,onMouseDown:c,onClick:u,children:(0,Gf.jsx)(Bl,{name:n,"aria-hidden":!0})})]})}var AD,Gf,a1=U(()=>{AD=ue(ze());Kf();Gf=ue(Ge())});var jp,i1,Kg,Boe=U(()=>{jp=ue(ze());on();Tr();r1();YS();Ee();a1();i1=ue(Ge()),Kg=jp.default.memo(function({icon:e,color:n,backgroundColor:r,adjacentFilledClassName:o,label:a,description:i,level:s,isDisabled:l,isMissing:c,type:u,countInfo:p,badge:m,forceShowCount:g,isExcluded:f,onClick:h,onRemove:b,onMouseDown:v,onContextMenu:y,dragHandlers:S,isDragSource:w,dragHandleConfig:k,hasFolderNote:F,tooltip:P,onLabelClick:T,onLabelMouseDown:I,dragRef:N,dragHandleRef:O,dragAttributes:K,dragListeners:G,dragStyle:X,isSorting:L,nativeDragData:V}){let D=pt(),_=Xt().includeDescendantNotes,E=Cu(p,_,_&&D.separateNoteCounts),R=u==="folder"||u==="tag"||u==="property",M=typeof m=="string"&&m.length>0,C=!!b,x=M||R&&E.shouldDisplay&&(!!g||D.showNoteCount),z=M?m:E.label,H=!!l&&!c,Y=(0,jp.useMemo)(()=>{let oe=["nn-shortcut-item"];return c&&oe.push("nn-shortcut-item--missing"),C&&oe.push("nn-shortcut-item--removable"),o&&oe.push(o),oe.join(" ")},[o,C,c]),ee=(0,jp.useMemo)(()=>{if(!(H||c))return T},[c,T,H]),$=(0,jp.useMemo)(()=>{if(!(H||c))return I},[c,I,H]),j=(0,jp.useMemo)(()=>{if(!c)return r},[r,c]),J=(0,jp.useMemo)(()=>D.showSectionIcons,[D.showSectionIcons]),re=(0,jp.useMemo)(()=>{if(b)return(0,i1.jsx)(OD,{label:x?z:void 0,reserveSpaceWhenHidden:x,actionLabel:d.shortcuts.remove,icon:"lucide-x",onClick:b})},[z,b,x]);return(0,i1.jsx)(DD,{icon:e,color:n,backgroundColor:j,label:a,description:i,level:s,itemType:u,isDisabled:H,isExcluded:f,onClick:oe=>{if(H||c){oe.preventDefault();return}h(oe)},onMouseDown:oe=>{H||c||v?.(oe)},onContextMenu:y,dragHandlers:S,isDragSource:w,showCount:x||C,showCountLeader:M,count:z,countSlot:re,className:Y,tabIndex:-1,ariaDisabled:H||c,dragHandleConfig:k,labelClassName:F?"nn-has-folder-note":void 0,tooltip:P,onLabelClick:ee,onLabelMouseDown:$,showIcon:J,dragRef:N,dragHandleRef:O,dragAttributes:K,dragListeners:G,dragStyle:X,isSorting:L,nativeDragData:V})})});function MP({sortableId:t,canReorder:e,...n}){let{attributes:r,listeners:o,setNodeRef:a,setActivatorNodeRef:i,transform:s,transition:l,isSorting:c}=LS({id:t,disabled:!e}),u=s?{transform:Nd.Transform.toString(s),transition:l}:void 0;return(0,_l.jsx)(Kg,{...n,dragRef:a,dragHandleRef:i,dragAttributes:r,dragListeners:o,dragStyle:u,isSorting:c})}function _oe({item:t,context:e,adjacentFilledClassName:n}){let{app:r,settings:o,showHiddenItems:a,getFileDisplayName:i,getSolidBackground:s,shortcuts:l}=e,c=!e.isMobile&&o.showTooltips;switch(t.type){case he.SHORTCUT_FOLDER:{let u=t.folder,p=!!t.isMissing,m=!!u&&!p;if(!m&&!p)return null;let g=Zo(t.shortcut)?t.shortcut.path:"",h=g==="/"?t.displayName||o.customVaultName||r.vault.getName():m&&u?t.displayName||u.name:zc(g),b=m&&u&&l.shouldShowShortcutCounts?l.getFolderShortcutCount(u):void 0,v=m&&u&&o.enableFolderNotes&&o.enableFolderNoteLinks?Pn(u,o):null,y=Zo(t.shortcut)?t.shortcut.alias:void 0,S=y&&y.length>0?y:h,w=m&&u?{type:"folder",key:t.key,folder:u}:{type:"missing",key:t.key,kind:"folder"},k=l.shouldUseShortcutDnd&&l.activeShortcutId===t.key,F=p?void 0:s(t.backgroundColor),P=m&&u&&c?tD({app:r,folder:u,displayName:S,fileVisibility:e.fileVisibility,hiddenFolders:e.hiddenFolders,settings:o,showHiddenItems:a}):void 0,T={icon:p?"lucide-alert-triangle":t.isExcluded&&!a?"lucide-eye-off":t.icon??"lucide-folder",color:p?void 0:t.color,backgroundColor:F,adjacentFilledClassName:n,label:S,description:void 0,level:t.level,type:"folder",countInfo:p?void 0:b,badge:l.shortcutNumberBadgesByKey.get(t.key),tooltip:P,forceShowCount:l.shouldShowShortcutCounts,isExcluded:p?void 0:t.isExcluded,isDisabled:p,isMissing:p,onClick:()=>{u&&l.handleShortcutFolderActivate(u,t.key)},onRemove:()=>{Q(()=>l.removeShortcut(t.key))},onContextMenu:I=>l.handleShortcutContextMenu(I,w),dragHandlers:l.buildShortcutExternalHandlers(t.key),dragHandleConfig:l.shortcutDragHandleConfig,hasFolderNote:!p&&!!v,onLabelClick:u&&v?I=>{l.handleShortcutFolderNoteClick(u,t.key,I)}:void 0,onLabelMouseDown:u&&v?I=>l.handleShortcutFolderNoteMouseDown(u,I):void 0};return l.shouldUseShortcutDnd?(0,_l.jsx)(MP,{sortableId:t.key,canReorder:l.shouldUseShortcutDnd,isDragSource:k,...T}):(0,_l.jsx)(Kg,{...T,isDragSource:k})}case he.SHORTCUT_NOTE:{let u=t.note,p=!!t.isMissing,m=!!u&&!p,g=Po(t.shortcut)?t.shortcut.path:"",f=m&&u?i(u):"",h=m&&u&&tv(u)?ah(u):"",b=!u||!m?l.getMissingNoteLabel(g):h?`${f}${h}`:f,v=Po(t.shortcut)?t.shortcut.alias:void 0,y=v&&v.length>0?v:b,S=m&&u?{type:"note",key:t.key,file:u}:{type:"missing",key:t.key,kind:"note"},w=l.shouldUseShortcutDnd&&l.activeShortcutId===t.key,k=p?void 0:s(t.backgroundColor),F=m&&u&&c?uP({file:u,displayName:f,extensionSuffix:h,settings:o,getFileTimestamps:e.getFileTimestamps,wordCount:e.getFileWordCount(u)}):void 0,P={icon:p?"lucide-alert-triangle":t.isExcluded&&!a?"lucide-eye-off":t.icon??"lucide-file-text",color:p?void 0:t.color,backgroundColor:k,adjacentFilledClassName:n,label:y,description:void 0,level:t.level,type:"note",badge:l.shortcutNumberBadgesByKey.get(t.key),tooltip:F,forceShowCount:l.shouldShowShortcutCounts,isExcluded:p?void 0:t.isExcluded,isDisabled:p,isMissing:p,onClick:()=>{u&&l.handleShortcutNoteActivate(u,t.key)},onRemove:()=>{Q(()=>l.removeShortcut(t.key))},onMouseDown:T=>{!u||!m||l.handleShortcutNoteMouseDown(T,u)},onContextMenu:T=>l.handleShortcutContextMenu(T,S),dragHandlers:l.buildShortcutExternalHandlers(t.key),dragHandleConfig:l.shortcutDragHandleConfig};return l.shouldUseShortcutDnd?(0,_l.jsx)(MP,{sortableId:t.key,canReorder:l.shouldUseShortcutDnd,isDragSource:w,...P}):(0,_l.jsx)(Kg,{...P,isDragSource:w})}case he.SHORTCUT_SEARCH:{let u=t.searchShortcut,p=l.shouldUseShortcutDnd&&l.activeShortcutId===t.key,m={icon:"lucide-search",color:t.color,backgroundColor:s(t.backgroundColor),adjacentFilledClassName:n,label:u.name,level:t.level,type:"search",badge:l.shortcutNumberBadgesByKey.get(t.key),forceShowCount:l.shouldShowShortcutCounts,onRemove:()=>{Q(()=>l.removeShortcut(t.key))},onClick:()=>l.handleShortcutSearchActivate(t.key,u),onContextMenu:g=>l.handleShortcutContextMenu(g,{type:"search",key:t.key,searchShortcut:u}),dragHandlers:l.buildShortcutExternalHandlers(t.key),dragHandleConfig:l.shortcutDragHandleConfig};return l.shouldUseShortcutDnd?(0,_l.jsx)(MP,{sortableId:t.key,canReorder:l.shouldUseShortcutDnd,isDragSource:p,...m}):(0,_l.jsx)(Kg,{...m,isDragSource:p})}case he.SHORTCUT_TAG:{let u=!!t.isMissing,p=Co(t.shortcut)?t.shortcut.tagPath:t.tagPath,m=!u&&l.shouldShowShortcutCounts?l.getTagShortcutCount(p):void 0,g=Co(t.shortcut)?t.shortcut.alias:void 0,f=g&&g.length>0?g:t.displayName,h=u?{type:"missing",key:t.key,kind:"tag"}:{type:"tag",key:t.key,tagPath:p},b=l.shouldUseShortcutDnd&&l.activeShortcutId===t.key,v=u?void 0:s(t.backgroundColor),y={icon:u?"lucide-alert-triangle":t.isExcluded&&!a?"lucide-eye-off":t.icon??"lucide-tags",color:u?void 0:t.color,backgroundColor:v,adjacentFilledClassName:n,label:f,description:void 0,level:t.level,type:"tag",countInfo:m,badge:l.shortcutNumberBadgesByKey.get(t.key),forceShowCount:l.shouldShowShortcutCounts,isExcluded:u?void 0:t.isExcluded,isDisabled:u,isMissing:u,onClick:()=>{u||l.handleShortcutTagActivate(p,t.key)},onRemove:()=>{Q(()=>l.removeShortcut(t.key))},onContextMenu:S=>l.handleShortcutContextMenu(S,h),dragHandlers:l.buildShortcutExternalHandlers(t.key),dragHandleConfig:l.shortcutDragHandleConfig};return l.shouldUseShortcutDnd?(0,_l.jsx)(MP,{sortableId:t.key,canReorder:l.shouldUseShortcutDnd,isDragSource:b,...y}):(0,_l.jsx)(Kg,{...y,isDragSource:b})}case he.SHORTCUT_PROPERTY:{let u=!!t.isMissing,p=t.propertyNodeId,m=!u&&l.shouldShowShortcutCounts?l.getPropertyShortcutCount(p):void 0,g=la(t.shortcut)?t.shortcut.alias:void 0,f=g&&g.length>0?g:t.displayName,h=u?{type:"missing",key:t.key,kind:"property"}:{type:"property",key:t.key,propertyNodeId:p},b=l.shouldUseShortcutDnd&&l.activeShortcutId===t.key,v={icon:u?"lucide-alert-triangle":t.icon??Qe(o.interfaceIcons,"nav-property"),color:u?void 0:t.color,backgroundColor:u?void 0:s(t.backgroundColor),adjacentFilledClassName:n,label:f,description:void 0,level:t.level,type:"property",countInfo:m,badge:l.shortcutNumberBadgesByKey.get(t.key),forceShowCount:l.shouldShowShortcutCounts,isDisabled:u,isMissing:u,onClick:()=>{u||l.handleShortcutPropertyActivate(p,t.key)},onRemove:()=>{Q(()=>l.removeShortcut(t.key))},onContextMenu:y=>l.handleShortcutContextMenu(y,h),dragHandlers:l.buildShortcutExternalHandlers(t.key),dragHandleConfig:l.shortcutDragHandleConfig};return l.shouldUseShortcutDnd?(0,_l.jsx)(MP,{sortableId:t.key,canReorder:l.shouldUseShortcutDnd,isDragSource:b,...v}):(0,_l.jsx)(Kg,{...v,isDragSource:b})}case he.RECENT_NOTE:{let u=t.note,p=i(u),m=tv(u)?ah(u):"",g=m?`${p}${m}`:p,f=c?uP({file:u,displayName:p,extensionSuffix:m,settings:o,getFileTimestamps:e.getFileTimestamps,wordCount:e.getFileWordCount(u)}):void 0;return(0,_l.jsx)(Kg,{icon:t.icon??"lucide-file-text",color:t.color,backgroundColor:s(t.backgroundColor),adjacentFilledClassName:n,label:g,tooltip:f,level:t.level,type:"note",onClick:()=>l.handleRecentNoteActivate(u),onMouseDown:h=>l.handleShortcutNoteMouseDown(h,u),onContextMenu:h=>l.handleRecentFileContextMenu(h,u),nativeDragData:e.isMobile?void 0:{path:u.path,type:W.FILE,icon:t.icon??"lucide-file-text",fallbackIcon:"file-text",baseIcon:"file",iconColor:t.color,allowMultiFileDrag:!1}})}default:return null}}var _l,Hoe=U(()=>{ES();zS();Ue();Ia();ot();pr();_a();Mr();$o();nD();Boe();_l=ue(Ge())});function $Ce(t){let e=Voe.get(t);if(e)return e;let n={"--nn-indent-guide-level":t};return Voe.set(t,n),n}var Uoe,RP,Voe,Wg,DP=U(()=>{Uoe=ue(ze()),RP=ue(Ge()),Voe=new Map;Wg=Uoe.default.memo(function({levels:e}){return!e||e.length===0?null:(0,RP.jsx)(RP.Fragment,{children:e.map(n=>(0,RP.jsx)("span",{className:"nn-navitem-indent-guide",style:$Ce(n),"aria-hidden":"true"},n))})})});var Uo,LD,wc,Koe,Woe=U(()=>{Uo=ue(ze()),LD=require("obsidian");mn();on();Tr();eP();Ha();os();_a();Yr();DP();YS();on();pr();Ue();nD();mP();wc=ue(Ge()),Koe=Uo.default.memo(function({folder:e,displayName:n,level:r,indentGuideLevels:o,isExpanded:a,isSelected:i,isExcluded:s,onToggle:l,onClick:c,onNameClick:u,onNameMouseDown:p,onToggleAllSiblings:m,icon:g,color:f,backgroundColor:h,adjacentFilledClassName:b,countInfo:v,excludedFolders:y,vaultChangeVersion:S,disableContextMenu:w,disableNavigationSeparatorActions:k,inlineRename:F}){let{app:P,fileSystemOps:T,isMobile:I}=gt(),N=pt(),{fileVisibility:O}=$s(),K=Xt(),G=K.includeDescendantNotes,X=K.showHiddenItems,L=(0,Uo.useRef)(null),V=Uo.default.useRef(null),D=Uo.default.useRef(null),A=Ki(),_=v??{current:0,descendants:0,total:0},E=N.folderTreeSortOverrides,M=!!(E&&Object.prototype.hasOwnProperty.call(E,e.path))?E?.[e.path]:void 0,C=M==="alpha-desc"?"↓":M==="alpha-asc"?"↑":void 0,x=G&&N.separateNoteCounts,z=qS(Cu(_,G,x,"•"),C),H=z.label,Y=N.showNoteCount&&z.shouldDisplay,$=zv(e,y,X),j=f,J=!!j&&!N.colorIconOnly,re=N.enableFolderNotes&&N.enableFolderNoteLinks,oe=(0,Uo.useMemo)(()=>re?Pn(e,N)!==null:!1,[e,N,re,_.current,S]),Z=e.path==="/",ce=n||(Z?N.customVaultName||P.vault.getName():e.name),ae=N.showFolderIcons||Z,se=(0,Uo.useMemo)(()=>{if(!(I||!N.showTooltips))return tD({app:P,folder:e,displayName:ce,fileVisibility:O,hiddenFolders:y,settings:N,showHiddenItems:X})},[P,ce,y,O,e,I,N,X,S]),ne=(0,Uo.useMemo)(()=>Z?$&&a?"open-vault":"vault":$&&a?Qe(N.interfaceIcons,"nav-folder-open"):Qe(N.interfaceIcons,"nav-folder-closed"),[$,a,Z,N.interfaceIcons]),B=g??ne,q=h,ie=(0,Uo.useMemo)(()=>{let Ce=["nn-navitem","nn-folder"];return i&&Ce.push("nn-selected"),s&&Ce.push("nn-excluded"),q&&Ce.push("nn-has-custom-background"),b&&Ce.push(b),Ce.join(" ")},[b,q,i,s]),le=(0,Uo.useMemo)(()=>{let Ce=["nn-navitem-name"];return oe&&Ce.push("nn-has-folder-note"),J&&Ce.push("nn-has-custom-color"),Ce.join(" ")},[J,oe]),Te=(0,Uo.useMemo)(()=>F?T.getFolderDisplayNameRenameInput(e):null,[T,e,F]),ke=(0,Uo.useCallback)(()=>{$&&l()},[$,l]),Fe=(0,Uo.useCallback)(Ce=>{Ce.stopPropagation(),$&&(Ce.altKey&&m?m():l())},[$,l,m]),te=(0,Uo.useCallback)(Ce=>{Ce.stopPropagation(),Ce.preventDefault()},[]),pe=(0,Uo.useCallback)(Ce=>{u&&(Ce.stopPropagation(),u(Ce))},[u]),ve=(0,Uo.useCallback)(Ce=>{fV(),p&&(Ce.stopPropagation(),p(Ce))},[p]);(0,Uo.useEffect)(()=>{if(L.current&&!I){if(!N.showTooltips){(0,LD.setTooltip)(L.current,"");return}if(!se){(0,LD.setTooltip)(L.current,"");return}(0,LD.setTooltip)(L.current,se,{placement:Sm()})}},[N.showTooltips,I,se]),(0,Uo.useEffect)(()=>{if(V.current){let Ce=yn(),vt=Qe(N.interfaceIcons,a?"nav-tree-collapse":"nav-tree-expand");Ce.renderIcon(V.current,vt)}},[A,a,N.interfaceIcons]),(0,Uo.useEffect)(()=>{if(D.current&&ae){let Ce=yn();if(g)Ce.renderIcon(D.current,g);else if(Z){let vt=$&&a?"open-vault":"vault";Ce.renderIcon(D.current,vt)}else{let vt=$&&a?Qe(N.interfaceIcons,"nav-folder-open"):Qe(N.interfaceIcons,"nav-folder-closed");Ce.renderIcon(D.current,vt)}}},[$,g,A,a,Z,N.interfaceIcons,ae]);let Ie=w?null:{type:W.FOLDER,item:e,options:k?{disableNavigationSeparatorActions:!0}:void 0};Og(L,Ie);let qe=!I&&!Z,xe={"--level":r,...q?{"--nn-navitem-custom-bg-color":q}:{}};return(0,wc.jsx)("div",{ref:L,className:ie,"data-path":e.path,"data-drag-path":e.path,"data-drag-type":"folder","data-draggable":qe?"true":void 0,"data-drag-icon":B,"data-drag-fallback-icon":ne,"data-drag-icon-color":j||void 0,draggable:qe,"data-drop-zone":"folder","data-drop-path":e.path,"data-clickable":"folder","data-level":r,onClick:c,onDoubleClick:ke,style:xe,role:"treeitem","aria-expanded":$?a:void 0,"aria-level":r+1,children:(0,wc.jsxs)("div",{className:"nn-navitem-content",children:[(0,wc.jsx)(Wg,{levels:o}),(0,wc.jsx)("div",{className:`nn-navitem-chevron ${$?"nn-navitem-chevron--has-children":"nn-navitem-chevron--no-children"}`,ref:V,onClick:Fe,onDoubleClick:te,tabIndex:-1}),ae&&(0,wc.jsx)("span",{className:"nn-navitem-icon",ref:D,style:j?{color:j}:void 0}),F&&Te?(0,wc.jsx)(_g,{...F,...Te,className:"nn-navitem-inline-rename"}):(0,wc.jsx)("span",{className:le,style:J?{color:j}:void 0,onClick:pe,onMouseDown:ve,children:ce}),(0,wc.jsx)("span",{className:"nn-navitem-spacer nn-navitem-spacer--leader"}),Y&&(0,wc.jsx)("span",{className:"nn-navitem-count",children:H})]})})})});function $S(t,e){let n=[...t];return e==="include"?n.push(XCe):e==="exclude"&&n.push(QCe),n.join(" ")}var XCe,QCe,zD=U(()=>{XCe="nn-navitem-content--search-include",QCe="nn-navitem-content--search-exclude"});var Mo,Hl,joe,Goe=U(()=>{Mo=ue(ze());on();Tr();eP();Ha();Ue();YS();zD();pr();DP();Kf();mP();Hl=ue(Ge()),joe=Mo.default.memo((0,Mo.forwardRef)(function({propertyNode:e,level:n,indentGuideLevels:r,isExpanded:o,isSelected:a,onToggle:i,onClick:s,onToggleAllSiblings:l,countInfo:c,showFileCount:u,color:p,backgroundColor:m,adjacentFilledClassName:g,icon:f,searchMatch:h,inclusionOperator:b,isDraggable:v,inlineRename:y},S){let w=pt(),F=Xt().includeDescendantNotes,P=(0,Mo.useRef)(null),T=(0,Mo.useRef)(null),I=Ki(),N=(0,Mo.useRef)(null),O=(0,Mo.useMemo)(()=>{if(c)return c;let Z=e.notesWithValue.size;return{current:Z,descendants:0,total:Z}},[c,e.notesWithValue.size]),K=w.propertyTreeSortOverrides,X=e.kind==="key"&&!!(K&&Object.prototype.hasOwnProperty.call(K,e.id))?K?.[e.id]:void 0,L=X==="alpha-desc"?"↓":X==="alpha-asc"?"↑":void 0,V=F&&w.separateNoteCounts,D=qS(Cu(O,F,V,"•"),L),A=D.label,_=u&&D.shouldDisplay,E=b==="OR"?"lucide-squares-unite":b==="AND"?"lucide-squares-intersect":null,R=h==="include"&&E!==null,M=(0,Mo.useMemo)(()=>e.children.size>0,[e.children.size]),C=!!p&&!w.colorIconOnly,x=(0,Mo.useMemo)(()=>e.kind==="value"?Qe(w.interfaceIcons,"nav-property-value"):Qe(w.interfaceIcons,"nav-property"),[e.kind,w.interfaceIcons]),z=f??x,H=e.kind==="value"?"equal":"align-left",Y=(0,Mo.useMemo)(()=>{let Z=["nn-navitem","nn-property"];return a&&Z.push("nn-selected"),m&&Z.push("nn-has-custom-background"),h&&Z.push("nn-has-search-match"),g&&Z.push(g),Z.join(" ")},[g,m,a,h]),ee=(0,Mo.useMemo)(()=>{let Z=["nn-navitem-name"];return C&&Z.push("nn-has-custom-color"),Z.join(" ")},[C]),$=(0,Mo.useMemo)(()=>$S(["nn-navitem-content"],h),[h]),j=(0,Mo.useCallback)(Z=>{Z.preventDefault(),M&&i()},[M,i]),J=(0,Mo.useCallback)(Z=>{if(Z.stopPropagation(),!!M){if(Z.altKey&&l){l();return}i()}},[M,i,l]),re=(0,Mo.useCallback)(Z=>{Z.stopPropagation(),Z.preventDefault()},[]);(0,Mo.useEffect)(()=>{if(P.current){if(!M){P.current.empty();return}P.current.empty(),yn().renderIcon(P.current,Qe(w.interfaceIcons,o?"nav-tree-collapse":"nav-tree-expand"))}},[M,I,o,w.interfaceIcons]),(0,Mo.useEffect)(()=>{if(!T.current||!w.showPropertyIcons)return;T.current.empty();let Z=f??(e.kind==="value"?Qe(w.interfaceIcons,"nav-property-value"):Qe(w.interfaceIcons,"nav-property"));yn().renderIcon(T.current,Z)},[f,I,e.kind,w.interfaceIcons,w.showPropertyIcons]),(0,Mo.useImperativeHandle)(S,()=>N.current),Og(N,{type:W.PROPERTY,item:e.id});let oe={"--level":n,...m?{"--nn-navitem-custom-bg-color":m}:{}};return(0,Hl.jsx)("div",{ref:N,className:Y,"data-property-node":e.id,"data-drag-path":e.id,"data-drag-type":"property","data-draggable":v?"true":void 0,"data-drag-icon":z,"data-drag-fallback-icon":x,"data-drag-base-icon":H,"data-drag-icon-color":p||void 0,draggable:v,"data-drop-zone":"property","data-drop-path":e.id,"data-allow-external-drop":"false","data-search-match":h??void 0,"data-level":n,style:oe,role:"treeitem","aria-expanded":M?o:void 0,"aria-level":n+1,children:(0,Hl.jsxs)("div",{className:$,onClick:s,onDoubleClick:j,children:[(0,Hl.jsx)(Wg,{levels:r}),(0,Hl.jsx)("div",{ref:P,className:`nn-navitem-chevron ${M?"nn-navitem-chevron--has-children":"nn-navitem-chevron--no-children"}`,onClick:J,onDoubleClick:re,tabIndex:-1}),w.showPropertyIcons&&(0,Hl.jsx)("span",{className:"nn-navitem-icon",ref:T,style:p?{color:p}:void 0}),y?(0,Hl.jsx)(_g,{...y,className:"nn-navitem-inline-rename"}):(0,Hl.jsx)("span",{className:ee,style:C?{color:p}:void 0,children:e.name}),(0,Hl.jsx)("span",{className:"nn-navitem-spacer nn-navitem-spacer--leader"}),R?(0,Hl.jsx)("span",{className:"nn-navitem-count nn-navitem-operator-indicator","data-operator":b,children:(0,Hl.jsx)(Bl,{name:E,className:"nn-navitem-operator-icon","aria-hidden":!0})}):_?(0,Hl.jsx)("span",{className:"nn-navitem-count",children:A}):null]})})}))});var Oa,Vl,qoe,Yoe=U(()=>{Oa=ue(ze());on();Tr();eP();Ha();Ue();YS();zD();Ba();pr();DP();Kf();mP();Vl=ue(Ge()),qoe=Oa.default.memo((0,Oa.forwardRef)(function({tagNode:e,level:n,indentGuideLevels:r,isExpanded:o,isSelected:a,isHidden:i,onToggle:s,onClick:l,onToggleAllSiblings:c,countInfo:u,showFileCount:p,color:m,backgroundColor:g,adjacentFilledClassName:f,icon:h,searchMatch:b,inclusionOperator:v,isDraggable:y,inlineRename:S},w){let k=pt(),P=Xt().includeDescendantNotes,T=Oa.default.useRef(null),I=Oa.default.useRef(null),N=Ki(),O=Oa.default.useRef(null),K=Oa.default.useMemo(()=>{if(u)return u;let se=e.notesWithTag.size;if(!P)return{current:se,descendants:0,total:se};let ne=rT(e),B=Math.max(ne-se,0);return{current:se,descendants:B,total:ne}},[u,e,P]),G=k.tagTreeSortOverrides,L=!!(G&&Object.prototype.hasOwnProperty.call(G,e.path))?G?.[e.path]:void 0,V=L==="alpha-desc"?"↓":L==="alpha-asc"?"↑":void 0,D=P&&k.separateNoteCounts,A=qS(Cu(K,P,D,"•"),V),_=A.label,E=p&&A.shouldDisplay,R=v==="OR"?"lucide-squares-unite":v==="AND"?"lucide-squares-intersect":null,M=b==="include"&&R!==null,C=(0,Oa.useMemo)(()=>e.children.size>0,[e.children.size]),x=m,z=g,H=h,Y=!!x&&!k.colorIconOnly,ee=Qe(k.interfaceIcons,"nav-tag"),$=H||ee,j=(0,Oa.useMemo)(()=>{let se=["nn-navitem","nn-tag"];return a&&se.push("nn-selected"),i&&se.push("nn-excluded"),z&&se.push("nn-has-custom-background"),b&&se.push("nn-has-search-match"),f&&se.push(f),se.join(" ")},[f,a,i,z,b]),J=(0,Oa.useMemo)(()=>{let se=["nn-navitem-name"];return Y&&se.push("nn-has-custom-color"),se.join(" ")},[Y]),re=(0,Oa.useMemo)(()=>$S(["nn-navitem-content"],b),[b]),oe=(0,Oa.useCallback)(se=>{se.preventDefault(),C&&s()},[C,s]),Z=(0,Oa.useCallback)(se=>{se.stopPropagation(),C&&(se.altKey&&c?c():s())},[C,s,c]),ce=(0,Oa.useCallback)(se=>{se.stopPropagation(),se.preventDefault()},[]);Oa.default.useEffect(()=>{if(T.current){if(!C){T.current.empty();return}T.current.empty(),yn().renderIcon(T.current,Qe(k.interfaceIcons,o?"nav-tree-collapse":"nav-tree-expand"))}},[C,N,o,k.interfaceIcons]),Oa.default.useEffect(()=>{I.current&&k.showTagIcons&&yn().renderIcon(I.current,H||Qe(k.interfaceIcons,"nav-tag"))},[H,k.showTagIcons,N,k.interfaceIcons]),Oa.default.useImperativeHandle(w,()=>O.current),Og(O,{type:W.TAG,item:e.path});let ae={"--level":n,...z?{"--nn-navitem-custom-bg-color":z}:{}};return(0,Vl.jsx)("div",{ref:O,className:j,"data-tag":e.path,"data-search-match":b??void 0,"data-drop-zone":"tag","data-drop-path":e.displayPath,"data-drag-path":e.displayPath,"data-drag-canonical":e.path,"data-drag-type":"tag","data-draggable":y?"true":void 0,"data-drag-icon":$,"data-drag-fallback-icon":ee,"data-drag-icon-color":x||void 0,"data-level":n,draggable:y,style:ae,role:"treeitem","aria-expanded":C?o:void 0,"aria-level":n+1,children:(0,Vl.jsxs)("div",{className:re,onClick:l,onDoubleClick:oe,children:[(0,Vl.jsx)(Wg,{levels:r}),(0,Vl.jsx)("div",{ref:T,className:`nn-navitem-chevron ${C?"nn-navitem-chevron--has-children":"nn-navitem-chevron--no-children"}`,onClick:Z,onDoubleClick:ce,tabIndex:-1}),k.showTagIcons&&(0,Vl.jsx)("span",{className:"nn-navitem-icon",ref:I,style:x?{color:x}:void 0}),S?(0,Vl.jsx)(_g,{...S,className:"nn-navitem-inline-rename"}):(0,Vl.jsx)("span",{className:J,style:Y?{color:x}:void 0,children:e.name}),(0,Vl.jsx)("span",{className:"nn-navitem-spacer nn-navitem-spacer--leader"}),M?(0,Vl.jsx)("span",{className:"nn-navitem-count nn-navitem-operator-indicator","data-operator":v,children:(0,Vl.jsx)(Bl,{name:R,className:"nn-navitem-operator-icon","aria-hidden":!0})}):E?(0,Vl.jsx)("span",{className:"nn-navitem-count",children:_}):null]})})}))});var oa,Tc,$oe,Xoe=U(()=>{oa=ue(ze());on();Ha();Ue();Tr();YS();zD();pr();DP();a1();Tc=ue(Ge()),$oe=oa.default.memo(function({virtualFolder:e,level:n,color:r,backgroundColor:o,adjacentFilledClassName:a,indentGuideLevels:i,isExpanded:s,hasChildren:l,onToggleAllSiblings:c,onSelect:u,isSelected:p=!1,showFileCount:m=!1,showCountLeader:g=!0,countInfo:f,searchMatch:h,trailingAction:b,onToggle:v,onDragOver:y,onDrop:S,onDragLeave:w,dropConfig:k,onContextMenu:F}){let P=pt(),T=Xt(),I=(0,oa.useRef)(null),N=(0,oa.useRef)(null),O=(0,oa.useRef)(null),K=Ki(),G=T.includeDescendantNotes,X=!!r&&!P.colorIconOnly,L=(0,oa.useMemo)(()=>{if(!f)return null;let $=G&&P.separateNoteCounts;return Cu(f,G,$)},[f,G,P.separateNoteCounts]),V=(0,oa.useMemo)(()=>!m||!L||(e.id===_n||e.id===Oe)&&!G?!1:L.shouldDisplay,[G,L,m,e.id]),D=b?.labelMode,A=(0,oa.useMemo)(()=>{if(D==="note-count"&&!(!V||!L))return L.label},[L,V,D]),_=(0,oa.useMemo)(()=>!V||!L?!1:D!=="note-count",[L,V,D]),E=D!=="note-count"||typeof A=="string",R=(0,oa.useMemo)(()=>{let $=["nn-navitem"];return e.id===yi&&$.push("nn-shortcut-header-item"),e.id===Oe&&$.push("nn-properties-header-item"),p&&$.push("nn-selected"),o&&$.push("nn-has-custom-background"),h&&$.push("nn-has-search-match"),a&&$.push(a),$.join(" ")},[a,o,p,h,e.id]),M=(0,oa.useMemo)(()=>$S(["nn-navitem-content"],h),[h]),C=(0,oa.useMemo)(()=>{let $=["nn-navitem-name"];return X&&r&&$.push("nn-has-custom-color"),$.join(" ")},[X,r]),x=(0,oa.useCallback)(()=>{l&&v()},[l,v]),z=(0,oa.useCallback)($=>{if($.stopPropagation(),!!l){if($.altKey&&c){c();return}v()}},[l,v,c]),H=(0,oa.useCallback)($=>{$.stopPropagation(),$.preventDefault()},[]),Y=(0,oa.useCallback)($=>{if(u){$.preventDefault(),$.stopPropagation(),u($);return}v()},[u,v]);(0,oa.useEffect)(()=>{let $=N.current;if($){if(!l){$.replaceChildren();return}yn().renderIcon($,Qe(P.interfaceIcons,s?"nav-tree-collapse":"nav-tree-expand"))}},[l,K,s,P.interfaceIcons]),(0,oa.useEffect)(()=>{O.current&&e.icon&&yn().renderIcon(O.current,e.icon)},[e.icon,K]);let ee={"--level":n,...o?{"--nn-navitem-custom-bg-color":o}:{}};return(0,Tc.jsx)("div",{ref:I,className:R,"data-search-match":h??void 0,"data-path":e.id,"data-drop-zone":k?.zone,"data-drop-path":k?.path,"data-tag":k?.tag,"data-allow-internal-drop":k?.allowInternalDrop===!1?"false":void 0,"data-allow-external-drop":k?.allowExternalDrop===!1?"false":void 0,"data-level":n,style:ee,role:"treeitem","aria-expanded":l?s:void 0,"aria-selected":u?p:void 0,"aria-level":n+1,onDragOver:y,onDrop:S,onDragLeave:w,onContextMenu:F,children:(0,Tc.jsxs)("div",{className:M,onClick:Y,onDoubleClick:x,children:[(0,Tc.jsx)(Wg,{levels:i}),(0,Tc.jsx)("div",{className:`nn-navitem-chevron ${l?"nn-navitem-chevron--has-children":"nn-navitem-chevron--no-children"}`,ref:N,onClick:z,onDoubleClick:H,tabIndex:-1}),e.icon&&(0,Tc.jsx)("span",{className:"nn-navitem-icon",ref:O,style:r?{color:r}:void 0}),(0,Tc.jsx)("span",{className:C,style:X?{color:r}:void 0,children:e.name}),(0,Tc.jsx)("span",{className:`nn-navitem-spacer${g?" nn-navitem-spacer--leader":""}`}),_&&L&&(0,Tc.jsx)("span",{className:"nn-navitem-count",children:L.label}),b&&(0,Tc.jsx)(OD,{label:A,actionLabel:b.actionLabel,icon:b.icon,onClick:b.onClick,reserveSpaceWhenHidden:E})]})})})});function AP(t,e){switch(t.type){case he.VIRTUAL_FOLDER:return e.getTagCollectionSearchMatch(t.tagCollectionId??null);case he.TAG:case he.UNTAGGED:return e.getTagSearchMatch(t.data.path);case he.PROPERTY_KEY:case he.PROPERTY_VALUE:return e.getPropertySearchMatch(t.data.id);default:return}}function XS(t,e){switch(t.type){case he.FOLDER:return e.selectionType===W.FOLDER&&e.selectedFolder?.path===t.data.path;case he.VIRTUAL_FOLDER:{let n=t.tagCollectionId??null,r=t.propertyCollectionId??null;return n!==null&&e.selectionType===W.TAG&&e.selectedTag===n||r!==null&&e.selectionType===W.PROPERTY&&e.selectedProperty===r}case he.TAG:case he.UNTAGGED:return e.selectionType===W.TAG&&e.selectedTag===t.data.path;case he.PROPERTY_KEY:case he.PROPERTY_VALUE:return e.selectionType===W.PROPERTY&&e.selectedProperty===t.data.id;default:return!1}}function Qoe({item:t,selectionState:e,searchHighlights:n,getSolidBackground:r}){return(t.type===he.SHORTCUT_FOLDER||t.type===he.SHORTCUT_NOTE||t.type===he.SHORTCUT_TAG||t.type===he.SHORTCUT_PROPERTY)&&t.isMissing?!1:"backgroundColor"in t&&!!r(t.backgroundColor)||XS(t,e)||!!AP(t,n)}var s1=U(()=>{Ue()});function Zoe({item:t,context:e,adjacentFilledClassName:n}){let{settings:r,isMobile:o,expansionState:a,expansionDispatch:i,selectionState:s,indentGuideLevelsByKey:l,firstSectionId:c,firstInlineFolderPath:u,shouldPinShortcuts:p,shortcutsExpanded:m,recentNotesExpanded:g,folderCounts:f,tagCounts:h,propertyCounts:b,vaultChangeVersion:v,getSolidBackground:y,shortcuts:S,tree:w,searchHighlights:k,inlineRename:F,onSectionContextMenu:P}=e;switch(t.type){case he.FOLDER:{let T=t.data.path,I=f.get(T),N=l.get(vc(t)),O=p&&u!==null&&T===u,K=F.target?.type==="folder"&&F.target.id===T?F.target:null;return(0,Gp.jsx)(Koe,{folder:t.data,displayName:t.displayName,level:t.level,indentGuideLevels:N,isExpanded:a.expandedFolders.has(t.data.path),isSelected:XS(t,s),isExcluded:t.isExcluded,onToggle:()=>w.handleFolderToggle(t.data.path),onClick:()=>w.handleFolderClick(t.data),onNameClick:G=>w.handleFolderNameClick(t.data,G),onNameMouseDown:G=>w.handleFolderNameMouseDown(t.data,G),onToggleAllSiblings:()=>{let G=a.expandedFolders.has(t.data.path);w.handleFolderToggle(t.data.path);let X=w.getAllDescendantFolders(t.data);X.length>0&&i({type:"TOGGLE_DESCENDANT_FOLDERS",descendantPaths:X,expand:!G})},icon:t.icon,color:t.color,backgroundColor:y(t.backgroundColor),adjacentFilledClassName:n,countInfo:I,excludedFolders:t.parsedExcludedFolders||[],vaultChangeVersion:v,disableNavigationSeparatorActions:O,inlineRename:K?{initialValue:K.initialValue,ariaLabel:d.contextMenu.folder.renameFolder,onCommit:G=>F.commit(K,G),onCancel:F.cancel,onRestoreFocus:F.restoreFocus}:void 0})}case he.VIRTUAL_FOLDER:{let T=t.data,I=l.get(vc(t)),N=T.id===yi,O=T.id===bi,K=t.hasChildren??!1,G=N?m:O?g:a.expandedVirtualFolders.has(T.id),X=t.tagCollectionId??null,L=t.propertyCollectionId??null,V=!!X,D=!!L,A=XS(t,s),_=t.noteCount??(X?h.get(X):void 0),E=t.showFileCount??!1,R=AP(t,k),M=T.id===_n?{zone:"tag-root",path:"__nn-tag-root__",allowExternalDrop:!1}:void 0,C=N?Dt.SHORTCUTS:O?Dt.RECENT:T.id===_n?Dt.TAGS:T.id===Oe?Dt.PROPERTIES:null,H=(!N||!p)&&!(p&&C!==null&&c!==null&&C===c),Y=C!==null?J=>P(J,C,{allowSeparator:H}):void 0,ee=T.id===Oe,$=T.id===_n,j=N?S.shortcutHeaderTrailingAction:ee?S.propertiesHeaderTrailingAction:void 0;return(0,Gp.jsx)($oe,{virtualFolder:T,level:t.level,color:t.color,backgroundColor:y(t.backgroundColor),adjacentFilledClassName:n,indentGuideLevels:I,isExpanded:G,hasChildren:K,isSelected:!!A,showFileCount:E,showCountLeader:!N&&!O,countInfo:_,searchMatch:R,trailingAction:j,onSelect:V&&X?J=>w.handleTagCollectionClick(X,J):D?w.handlePropertyCollectionClick:void 0,onToggle:()=>w.handleVirtualFolderToggle(T.id),onToggleAllSiblings:$?()=>{let J=a.expandedVirtualFolders.has(T.id);w.handleVirtualFolderToggle(T.id);let re=w.getAllTagPaths();re.length>0&&i({type:"TOGGLE_DESCENDANT_TAGS",descendantPaths:re,expand:!J})}:ee?()=>{let J=a.expandedVirtualFolders.has(T.id);w.handleVirtualFolderToggle(T.id);let re=w.getAllPropertyNodeIds();re.length>0&&i({type:"TOGGLE_DESCENDANT_PROPERTIES",descendantNodeIds:re,expand:!J})}:void 0,onDragOver:N&&S.allowEmptyShortcutDrop?S.handleShortcutRootDragOver:void 0,onDrop:N&&S.allowEmptyShortcutDrop?S.handleShortcutRootDrop:void 0,dropConfig:M,onContextMenu:Y})}case he.TAG:case he.UNTAGGED:{let T=t.data,I=l.get(vc(t)),N=AP(t,k),O=N==="include"?k.getTagInclusionOperator(T.path):void 0,K=F.target?.type==="tag"&&F.target.id===T.path?F.target:null;return(0,Gp.jsx)(qoe,{tagNode:T,level:t.level??0,indentGuideLevels:I,isExpanded:a.expandedTags.has(T.path),isSelected:XS(t,s),isHidden:"isHidden"in t?t.isHidden:!1,onToggle:()=>w.handleTagToggle(T.path),onClick:G=>w.handleTagClick(T.path,G),color:t.color,backgroundColor:y(t.backgroundColor),adjacentFilledClassName:n,icon:t.icon,searchMatch:N,inclusionOperator:O,isDraggable:!o&&T.path!==bt&&T.path!==zt,onToggleAllSiblings:()=>{let G=a.expandedTags.has(T.path);w.handleTagToggle(T.path);let X=w.getAllDescendantTags(T.path);X.length>0&&i({type:"TOGGLE_DESCENDANT_TAGS",descendantPaths:X,expand:!G})},countInfo:t.noteCount??h.get(T.path),showFileCount:r.showNoteCount,inlineRename:K?{initialValue:K.initialValue,ariaLabel:d.modals.tagOperation.confirmRename,onCommit:G=>F.commit(K,G),onCancel:F.cancel,onRestoreFocus:F.restoreFocus}:void 0})}case he.PROPERTY_KEY:case he.PROPERTY_VALUE:{let T=t.data,I=l.get(vc(t)),N=AP(t,k),O=N==="include"?k.getPropertyInclusionOperator(T.id):void 0,K=F.target?.type==="property"&&F.target.id===T.id?F.target:null;return(0,Gp.jsx)(joe,{propertyNode:T,level:t.level??0,indentGuideLevels:I,isExpanded:a.expandedProperties.has(T.id),isSelected:XS(t,s),onToggle:()=>w.handlePropertyToggle(T.id),onClick:G=>w.handlePropertyClick(T,G),onToggleAllSiblings:()=>{let G=a.expandedProperties.has(T.id);w.handlePropertyToggle(T.id);let X=w.getAllDescendantPropertyNodeIds(T);X.length>0&&i({type:"TOGGLE_DESCENDANT_PROPERTIES",descendantNodeIds:X,expand:!G})},color:t.color,backgroundColor:y(t.backgroundColor),adjacentFilledClassName:n,icon:t.icon,searchMatch:N,inclusionOperator:O,isDraggable:!o,countInfo:b.get(T.id),showFileCount:r.showNoteCount,inlineRename:K?{initialValue:K.initialValue,ariaLabel:d.contextMenu.property.renameKey,onCommit:G=>F.commit(K,G),onCancel:F.cancel,onRestoreFocus:F.restoreFocus}:void 0})}case he.TOP_SPACER:{let T=t.hasSeparator?"nn-nav-top-spacer nn-nav-spacer--with-separator":"nn-nav-top-spacer";return(0,Gp.jsx)("div",{className:T})}case he.BOTTOM_SPACER:return(0,Gp.jsx)("div",{className:"nn-nav-bottom-spacer"});case he.LIST_SPACER:{let T=t.hasSeparator?"nn-nav-list-spacer nn-nav-spacer--with-separator":"nn-nav-list-spacer";return(0,Gp.jsx)("div",{className:T})}case he.ROOT_SPACER:return(0,Gp.jsx)("div",{className:"nn-nav-root-spacer",style:{height:`${t.spacing}px`},"aria-hidden":"true"});default:return null}}var Gp,Joe=U(()=>{Ue();Woe();Goe();Yoe();Xoe();s1();Mg();Ee();Gp=ue(Ge())});function eae({item:t,context:e,adjacentFilledClassName:n}){switch(t.type){case he.SHORTCUT_FOLDER:case he.SHORTCUT_NOTE:case he.SHORTCUT_SEARCH:case he.SHORTCUT_TAG:case he.SHORTCUT_PROPERTY:case he.RECENT_NOTE:return(0,l1.jsx)(_oe,{item:t,context:e,adjacentFilledClassName:n});default:return(0,l1.jsx)(Zoe,{item:t,context:e,adjacentFilledClassName:n})}}var l1,tae=U(()=>{Ue();Hoe();Joe();l1=ue(Ge())});function _D({plugin:t,vaultProfiles:e,activeProfileId:n}){let r=qc(),o=e.length>0,a=e.length>1,i=e.find(m=>m.id===n)??e[0]??null,s=i?.id??"",l=i?.name?.trim().length?i.name:r,c=(0,BD.useCallback)(()=>{let m=new nae.Menu;return e.forEach(g=>{m.addItem(f=>{let h=g.name?.trim().length?g.name:r;f.setTitle(h).setIcon(g.id===s?"lucide-check":"lucide-user").setDisabled(g.id===s).onClick(()=>{Q(()=>{t.setVaultProfile(g.id)})})})}),m},[t,r,s,e]),u=(0,BD.useCallback)(m=>{if(m.preventDefault(),m.stopPropagation(),!a)return;c().showAtMouseEvent(m.nativeEvent)},[c,a]),p=(0,BD.useCallback)(m=>{if(m.key!=="Enter"&&m.key!==" "||(m.preventDefault(),m.stopPropagation(),!a))return;let g=m.currentTarget.getBoundingClientRect();c().showAtPosition({x:g.left+g.width/2,y:g.bottom})},[c,a]);return{hasProfiles:o,hasMultipleProfiles:a,activeProfileName:l,handleTriggerClick:u,handleTriggerKeyDown:p}}var nae,BD,d1=U(()=>{nae=require("obsidian"),BD=ue(ze());ot();dn()});function rae({onTreeUpdateComplete:t,onToggleRootFolderReorder:e,rootReorderActive:n,rootReorderDisabled:r,showVaultTitleInHeader:o}){let{isMobile:a,plugin:i}=gt(),s=pt(),l=Xt(),{toggleShowCalendar:c}=wd(),u=l.showHiddenItems,p=l.showCalendar,m=Yn(),g=ar(),{hasProfiles:f,hasMultipleProfiles:h,activeProfileName:b,handleTriggerClick:v,handleTriggerKeyDown:y}=_D({plugin:i,vaultProfiles:s.vaultProfiles??[],activeProfileId:s.vaultProfile}),{shouldCollapseItems:S,handleExpandCollapseAll:w,handleNewFolder:k,handleToggleShowExcludedFolders:F}=Gb(),P=s.toolbarVisibility.navigation,T=P.toggleDualPane,I=P.expandCollapse,N=P.calendar&&s.calendarEnabled&&s.calendarPlacement!=="right-sidebar",O=P.hiddenItems,K=P.rootReorder,G=P.newFolder;if(!f)return null;let X=h&&(a||o),L=(0,$r.jsxs)($r.Fragment,{children:[(0,$r.jsx)("span",{className:"nn-pane-header-text",children:b}),(0,$r.jsx)(Qt,{className:"nn-pane-header-profile-chevron",iconId:Qe(s.interfaceIcons,"nav-profile-chevron"),"aria-hidden":!0})]}),V=X?a?(0,$r.jsx)("div",{className:"nn-pane-header-title nn-pane-header-profile","aria-label":d.navigationPane.profileMenuAria,role:"button",tabIndex:0,onClick:v,onKeyDown:y,children:L}):(0,$r.jsx)("div",{className:"nn-pane-header-title nn-pane-header-profile",children:(0,$r.jsx)("div",{className:"nn-pane-header-profile","aria-label":d.navigationPane.profileMenuAria,role:"button",tabIndex:0,onClick:v,onKeyDown:y,children:L})}):null;if(a)return V?(0,$r.jsx)("div",{className:"nn-pane-header nn-pane-header-simple",children:V}):null;if(!(!!V||T||I||O||N||K||G))return null;let A=i.useDualPane(),_=A&&m.singlePane;return(0,$r.jsx)("div",{className:"nn-pane-header",children:(0,$r.jsxs)("div",{className:"nn-header-actions nn-header-actions--space-between",children:[(0,$r.jsxs)("div",{className:"nn-header-actions nn-header-actions-profile",children:[T?(0,$r.jsx)("button",{className:"nn-icon-button","aria-label":A?d.paneHeader.showSinglePane:d.paneHeader.showDualPane,onClick:()=>{if(_){de(d.paneHeader.dualPaneAutoFallbackNotice,{variant:"warning"});return}i.setDualPanePreference(!A)},tabIndex:-1,type:"button",children:(0,$r.jsx)(Qt,{iconId:Qe(s.interfaceIcons,A?"nav-show-single-pane":"nav-show-dual-pane")})}):null,V]}),(0,$r.jsxs)("div",{className:"nn-header-actions",children:[I?(0,$r.jsx)("button",{className:"nn-icon-button","aria-label":S()?d.paneHeader.collapseAllFolders:d.paneHeader.expandAllFolders,onClick:()=>{w(),t&&window.requestAnimationFrame(()=>{t()})},tabIndex:-1,children:(0,$r.jsx)(Qt,{iconId:Qe(s.interfaceIcons,S()?"nav-collapse-all":"nav-expand-all")})}):null,O?(0,$r.jsx)("button",{className:`nn-icon-button ${u?"nn-icon-button-active":""}`,"aria-label":u?d.paneHeader.hideExcludedItems:d.paneHeader.showExcludedItems,onClick:()=>{F(),t&&window.requestAnimationFrame(()=>{t()})},tabIndex:-1,children:(0,$r.jsx)(Qt,{iconId:Qe(s.interfaceIcons,"nav-hidden-items")})}):null,N?(0,$r.jsx)("button",{className:`nn-icon-button ${p?"nn-icon-button-active":""}`,"aria-label":p?d.paneHeader.hideCalendar:d.paneHeader.showCalendar,onClick:c,tabIndex:-1,type:"button",children:(0,$r.jsx)(Qt,{iconId:Qe(s.interfaceIcons,"nav-calendar")})}):null,K?(0,$r.jsx)("button",{className:`nn-icon-button ${n?"nn-icon-button-active":""}`,"aria-label":n?d.paneHeader.finishRootFolderReorder:d.paneHeader.reorderRootFolders,onClick:e,disabled:r,tabIndex:-1,children:(0,$r.jsx)(Qt,{iconId:Qe(s.interfaceIcons,"nav-root-reorder")})}):null,G?(0,$r.jsx)("button",{className:"nn-icon-button","aria-label":d.paneHeader.newFolder,onClick:()=>{Q(()=>k())},disabled:!g.selectedFolder,tabIndex:-1,children:(0,$r.jsx)(Qt,{iconId:Qe(s.interfaceIcons,"nav-new-folder")})}):null]})]})})}var $r,oae=U(()=>{Ur();mn();on();Tr();pa();d1();Ee();Al();QM();ot();Fn();pr();$r=ue(Ge())});function aae(){let{isMobile:t,plugin:e}=gt(),n=pt(),{hasProfiles:r,hasMultipleProfiles:o,activeProfileName:a,handleTriggerClick:i,handleTriggerKeyDown:s}=_D({plugin:e,vaultProfiles:n.vaultProfiles??[],activeProfileId:n.vaultProfile});return t||!r||!o?null:(0,QS.jsx)("div",{className:"nn-vault-title-area",children:(0,QS.jsxs)("div",{className:"nn-vault-title-content nn-vault-title-trigger","aria-label":d.navigationPane.profileMenuAria,role:"button",tabIndex:0,onClick:i,onKeyDown:s,children:[(0,QS.jsx)("span",{className:"nn-vault-title-text",children:a}),(0,QS.jsx)(Qt,{className:"nn-vault-title-chevron",iconId:Qe(n.interfaceIcons,"nav-profile-chevron"),"aria-hidden":!0})]})})}var QS,iae=U(()=>{mn();on();d1();Ee();pr();Al();QS=ue(Ge())});function sae(t,e,n,r){if(!r(t))return;let o=[],a=e>0?n[e-1]:void 0,i=e0?o.join(" "):void 0}function dae({navigationPaneRef:t,navigationPaneStyle:e,shouldRenderCalendarOverlay:n,isShortcutSorting:r,isMobile:o,isPinnedShortcutsResizing:a,onTreeUpdateComplete:i,onToggleRootReorder:s,rootReorderActive:l,rootReorderDisabled:c,showVaultTitleInHeader:u,shouldShowVaultTitleInNavigationPane:p,showAndroidToolbar:m,navigationToolbar:g,pinNavigationBanner:f,navigationBannerContent:h,shouldRenderPinnedShortcuts:b,pinnedShortcutsContainerRef:v,pinnedShortcutsHasOverflow:y,pinnedShortcutsMaxHeight:S,allowEmptyShortcutDrop:w,onShortcutRootDragOver:k,onShortcutRootDrop:F,pinnedShortcutsScrollRefCallback:P,pinnedNavigationItems:T,renderNavigationItem:I,isNavigationItemFilled:N,onPinnedShortcutsResizePointerDown:O,scrollContainerRefCallback:K,hasNavigationBannerConfigured:G,navigationBannerRef:X,rootReorderContent:L,isRootReorderMode:V,items:D,rowVirtualizer:A,navigationScrollMargin:_,shouldRenderBottomToolbarInsidePanel:E,shouldRenderBottomToolbarOutsidePanel:R,calendarOverlay:M}){return(0,La.jsxs)("div",{ref:t,className:"nn-navigation-pane",style:e,"data-calendar":n?"true":void 0,"data-shortcut-sorting":r?"true":void 0,"data-shortcuts-resizing":!o&&a?"true":void 0,children:[(0,La.jsxs)("div",{className:"nn-navigation-pane-chrome",children:[(0,La.jsx)(rae,{onTreeUpdateComplete:i,onToggleRootFolderReorder:s,rootReorderActive:l,rootReorderDisabled:c,showVaultTitleInHeader:u}),p?(0,La.jsx)(aae,{}):null,m?g:null,f?h:null,b?(0,La.jsxs)("div",{className:"nn-shortcut-pinned",ref:v,role:"presentation","data-scroll":y?"true":void 0,style:S!==null?{maxHeight:S}:void 0,onDragOver:w?k:void 0,onDrop:w?F:void 0,children:[(0,La.jsx)("div",{className:"nn-shortcut-pinned-scroll",ref:P,children:(0,La.jsx)("div",{className:"nn-shortcut-pinned-inner",children:T.map((C,x)=>(0,La.jsx)(lae.default.Fragment,{children:I(C,sae(C,x,T,N))},vc(C)))})}),(0,La.jsx)("div",{className:"nn-shortcuts-resize-handle",role:"separator","aria-orientation":"horizontal","aria-label":"Resize pinned shortcuts",onPointerDown:O})]}):null]}),(0,La.jsxs)("div",{className:"nn-navigation-pane-panel",children:[(0,La.jsx)("div",{ref:K,className:"nn-navigation-pane-scroller","data-banner":G?"true":void 0,"data-pane":"navigation",tabIndex:-1,children:(0,La.jsxs)("div",{className:"nn-navigation-pane-content",children:[!f&&h?(0,La.jsx)("div",{className:"nn-navigation-pane-banner",ref:X,children:h}):null,(0,La.jsx)("div",{role:V?"list":"tree",children:V?L:D.length>0&&(0,La.jsx)("div",{className:"nn-virtual-container",style:{height:`${A.getTotalSize()}px`},children:A.getVirtualItems().map(C=>{let x=C.index>=0&&C.index{lae=ue(ze());Mg();oae();iae();La=ue(Ge())});function JCe(t){let e=t.lastIndexOf("/");return e>=0?t.slice(e+1):t}function eNe(t,e){let n=e.trim(),r=t.lastIndexOf("/");return r>=0?`${t.slice(0,r)}/${n}`:n}var Tt,ZS,Nu,ZCe,c1,uae=U(()=>{Tt=ue(ze());Uf();zS();ZS=require("obsidian");Qs();Ur();mn();on();Tr();Xi();pa();Fre();Jre();toe();ooe();ioe();cH();UV();boe();woe();Coe();Ue();Ue();lP();xoe();Ooe();zoe();Jr();ai();Mg();Ba();hu();ID();pp();dn();EO();KV();JF();FP();tae();cae();s1();os();Nu=ue(Ge()),ZCe=new Map;c1=Tt.default.memo((0,Tt.forwardRef)(function(e,n){let{app:r,isMobile:o,plugin:a,fileSystemOps:i,propertyTreeService:s,tagOperations:l,propertyOperations:c}=gt(),u=qs(),p=Ho(),m=ta(),g=Ra(),f=Ml(),h=gr(),b=pt(),v=$s(),y=Ys(),S=Xt(),w=Yn(),k=Vr(),{fileData:F,getFile:P,getFileDisplayName:T,getFileTimestamps:I,isStorageReady:N}=xo(),O=(0,Tt.useCallback)(Ye=>P(Ye.path)?.wordCount??null,[P]),{startPointerDrag:K}=$M(),{searchNavFilters:G,onExecuteSearchShortcut:X,rootContainerRef:L,onNavigateToFolder:V,onRevealTag:D,onRevealProperty:A,onRevealFile:_,onRevealShortcutFile:E,onModifySearchWithTag:R,onModifySearchWithProperty:M,onModifySearchWithDateFilter:C,uiScale:x}=e,z=S.showHiddenItems,H=S.showCalendar,Y=!w.singlePane&&w.effectiveDualPaneOrientation==="vertical",ee=b.calendarEnabled&&b.calendarPlacement==="left-sidebar"&&H&&(!w.singlePane&&!Y||w.singlePane&&b.calendarLeftPlacement==="navigation"&&w.currentSinglePaneView==="navigation"),[$,j]=(0,Tt.useState)(()=>b.calendarWeeksToShow);(0,Tt.useEffect)(()=>{b.calendarWeeksToShow!==6&&j(b.calendarWeeksToShow)},[b.calendarWeeksToShow]);let J=(0,Tt.useRef)(null),re=(0,Tt.useRef)(null),oe=(0,Tt.useRef)(null),[Z,ce]=(0,Tt.useState)(null),[ae,se]=(0,Tt.useState)(!1),ne=(0,Tt.useRef)(null),B=(0,Tt.useRef)(0),q=Number.isFinite(x)&&x>0?x:1,ie=(0,Tt.useCallback)(Ye=>{ce(Ye)},[]),[le,Te]=(0,Tt.useState)(()=>{let Ye=ye.get(ut.pinnedShortcutsMaxHeightKey);return typeof Ye!="number"||!Number.isFinite(Ye)||Ye<=0?null:Math.max(Ld.pinnedShortcutsMinHeight,Math.round(Ye))}),[ke,Fe]=(0,Tt.useState)(!1),te=(0,Tt.useCallback)(Ye=>{let xt=Ye??Z;if(!xt){se(!1);return}let Vn=xt.scrollHeight-xt.clientHeight>1;se(Qn=>Qn===Vn?Qn:Vn)},[Z]),pe=(0,Tt.useCallback)(Ye=>{B.current=Ye,ne.current===null&&(ne.current=window.requestAnimationFrame(()=>{ne.current=null,Te(B.current)}))},[]);(0,Tt.useEffect)(()=>()=>{ne.current!==null&&(cancelAnimationFrame(ne.current),ne.current=null)},[]),(0,Tt.useLayoutEffect)(()=>{let Ye=Z;if(!Ye){se(!1);return}if(te(Ye),typeof ResizeObserver>"u")return;let xt=new ResizeObserver(()=>{te(Ye)});return xt.observe(Ye),()=>{xt.disconnect()}},[Z,te]);let ve=(0,Tt.useCallback)(Ye=>{if(Ye.pointerType==="mouse"&&Ye.button!==0)return;let xt=oe.current,Vn=Z;if(!xt||!Vn)return;let Qn=!o,Or=Math.round(Ye.currentTarget.getBoundingClientRect().height/q),za=Math.round(Vn.scrollHeight+Or),om=Math.min(Ld.pinnedShortcutsMinHeight,za),Xg=Math.min(Math.round(xt.getBoundingClientRect().height/q),za),Qg=Ye.clientY,xc=Xg;Ye.preventDefault(),Ye.stopPropagation(),Qn&&Fe(!0);let rw=Ec=>Math.min(Math.max(Ec,om),za);pe(xc),K({event:Ye,onMove:Ec=>{let ow=(Ec.clientY-Qg)/q;xc=rw(Xg+ow),pe(xc)},onEnd:()=>{ne.current!==null&&(cancelAnimationFrame(ne.current),ne.current=null);let Ec=Math.round(Vn.scrollHeight+Or);xc>=Ec-2?(Te(null),ye.remove(ut.pinnedShortcutsMaxHeightKey)):(ye.set(ut.pinnedShortcutsMaxHeightKey,xc),Te(xc)),Qn&&Fe(!1)}})},[o,Z,q,pe,K]),[Ie,qe]=(0,Tt.useState)(()=>{let Ye=ye.get(ut.navigationSectionOrderKey);return $V(Ye)}),[xe,Ce]=(0,Tt.useState)(!0),[vt,Rt]=(0,Tt.useState)(!0),[Ve,Ae]=(0,Tt.useState)(!0),[Ke,Be]=(0,Tt.useState)(null),wt=(0,Tt.useCallback)(()=>{Ce(Ye=>!Ye)},[]),Ct=(0,Tt.useCallback)(()=>{Rt(Ye=>!Ye)},[]),qt=(0,Tt.useCallback)(()=>{Ae(Ye=>!Ye)},[]),[lt,Zt]=(0,Tt.useState)(!1),Kt=(0,Tt.useCallback)(()=>{let Ye=nn(a.settings);new $v(r,{initialKeys:Ye.propertyKeys,onSave:async Vn=>{Ye.propertyKeys=Vn,await a.saveSettingsAndUpdate()}}).open()},[r,a]),gn=(0,Tt.useRef)(new Map),fn=(0,Tt.useRef)(new Map),an=(0,Tt.useRef)(new Map),Pe=yoe({rootContainerRef:L,isRootReorderMode:lt,onExecuteSearchShortcut:X,onNavigateToFolder:V,onRevealTag:D,onRevealProperty:A,onRevealFile:_,onRevealShortcutFile:E,getFolderCounts:()=>gn.current,getTagCounts:()=>fn.current,getPropertyCounts:()=>an.current,onConfigurePropertyKeys:Kt}),ge=w.dualPane||w.currentSinglePaneView==="navigation",{items:be,firstSectionId:me,firstInlineFolderPath:fe,shortcutItems:we,pinnedRecentNotesItems:Re,shouldPinRecentNotes:nt,tagsVirtualFolderHasChildren:ct,propertiesSectionActive:yt,pathToIndex:bn,tagCounts:Kn,propertyCounts:kr,folderCounts:Wo,rootLevelFolders:co,missingRootFolderPaths:wn,resolvedRootTagKeys:Jt,rootOrderingTagTree:$n,missingRootTagPaths:Xn,resolvedRootPropertyKeys:Zn,rootOrderingPropertyTree:Ir,missingRootPropertyKeys:Jn,vaultChangeVersion:er,navigationBannerPath:On}=Zre({settings:b,isVisible:ge,sourceState:e.navigationSourceState,treeSections:e.navigationTreeSections,folderDecorationModel:e.folderDecorationModel,navRainbowState:e.navRainbowState,shortcutsExpanded:Pe.shortcutsExpanded,recentNotesExpanded:Pe.recentNotesExpanded,pinShortcuts:w.pinShortcuts&&b.showShortcuts,sectionOrder:Ie});gn.current=Wo,fn.current=Kn,an.current=kr;let Ro=Soe({app:r,commandQueue:u,isMobile:o,settings:b,uiState:w,expansionState:m,expansionDispatch:g,selectionState:f,selectionDispatch:h,uiDispatch:k,propertyTreeService:s,tagTree:e.navigationTreeSections.renderTagTree,propertyTree:e.navigationTreeSections.renderPropertyTree,tagsVirtualFolderHasChildren:ct,setShortcutsExpanded:Pe.setShortcutsExpanded,setRecentNotesExpanded:Pe.setRecentNotesExpanded,clearActiveShortcut:Pe.clearActiveShortcut,openFolderNoteInRightSidebar:Ye=>a.openFolderNoteInRightSidebar(Ye),onModifySearchWithTag:R,onModifySearchWithProperty:M}),je=Poe({searchNavFilters:G});(0,Tt.useEffect)(()=>{if(!N)return;let Ye=m.expandedTags.size>0,xt=m.expandedProperties.size>0;if(!Ye&&!xt)return;let Vn=Ye?new Set:null,Qn=xt?new Set:null;if(Vn){let Or=new Set;F.tagTree.forEach(za=>{ml(za,Vn,Or)})}Qn&&F.propertyTree.forEach(Or=>{Qn.add(Or.id),Or.children.forEach(za=>{Qn.add(za.id)})}),Vn&&g({type:"CLEANUP_DELETED_TAGS",existingTags:Vn}),Qn&&g({type:"CLEANUP_DELETED_PROPERTIES",existingPropertyNodeIds:Qn})},[g,m.expandedProperties.size,m.expandedTags.size,F.propertyTree,F.tagTree,N]);let rt=(0,Tt.useMemo)(()=>b.showIndentGuides?tZ(be,vc):ZCe,[be,b.showIndentGuides]),Et=(0,Tt.useMemo)(()=>{let Ye=w.pinShortcuts&&b.showShortcuts?we:[],xt=nt?Re:[],Vn=$V(Ie),Qn=[];return Vn.forEach(Or=>{Or===Dt.RECENT&&nt&&Qn.push(...xt),Or===Dt.SHORTCUTS&&w.pinShortcuts&&b.showShortcuts&&Qn.push(...Ye)}),Qn},[Re,Ie,b.showShortcuts,we,nt,w.pinShortcuts]),Ht=!!(On&&!lt)&&On?(0,Nu.jsx)(Ioe,{path:On}):null,vn=Et.length>0&&!lt;(0,Tt.useLayoutEffect)(()=>{te(Z)},[Et,Z,te]);let Yt=aoe(re,{enabled:!!Ht&&!b.pinNavigationBanner}),fr=!!On,{color:Do,version:ba}=PD(J,{app:r,rootContainerRef:L,variables:bre}),nl=e.navRainbowState.navRainbow,Cc=(0,Tt.useRef)(new Map);(0,Tt.useEffect)(()=>{Cc.current.clear()},[nl,Do,ba]);let Sa=(0,Tt.useCallback)(Ye=>{if(!Ye)return;let xt=Ye.trim();if(!xt)return;let Vn=Cc.current;if(Vn.has(xt))return Vn.get(xt);let Qn=J.current,Or=xy(Do,xt,{container:Qn??null});return Vn.set(xt,Or),Or},[Do]),{reorderableRootFolders:So,reorderableRootTags:qa,reorderableRootProperties:Iu,sectionReorderItems:Ul,folderReorderItems:Ya,tagReorderItems:Md,propertyReorderItems:$p,canReorderSections:$a,canReorderRootFolders:vr,canReorderRootTags:jo,canReorderRootProperties:Xr,canReorderRootItems:Wr,showRootFolderSection:Nc,showRootTagSection:pi,showRootPropertySection:Xp,resetRootTagOrderLabel:Qp,resetRootPropertyOrderLabel:Ns,handleResetRootFolderOrder:Yg,handleResetRootTagOrder:Qi,handleResetRootPropertyOrder:Zp,reorderSectionOrder:Jp,reorderRootFolderOrder:xu,reorderRootTagOrder:mi,reorderRootPropertyOrder:Ic}=noe({app:r,items:be,settings:b,showHiddenItems:z,updateSettings:y,sectionOrder:Ie,setSectionOrder:qe,rootLevelFolders:co,missingRootFolderPaths:wn,resolvedRootTagKeys:Jt,rootOrderingTagTree:$n,missingRootTagPaths:Xn,resolvedRootPropertyKeys:Zn,rootOrderingPropertyTree:Ir,missingRootPropertyKeys:Jn,metadataService:p,foldersSectionExpanded:xe,tagsSectionExpanded:vt,propertiesSectionExpanded:Ve,propertiesSectionActive:yt,handleToggleFoldersSection:wt,handleToggleTagsSection:Ct,handleTogglePropertiesSection:qt,activeProfile:v});(0,Tt.useEffect)(()=>{lt&&!Wr&&Zt(!1)},[Wr,lt]);let Rd=(0,Tt.useCallback)(()=>{Wr&&Zt(Ye=>!Ye)},[Wr]),Dd=ZS.Platform.isAndroidApp,Is=o&&ZS.Platform.isIosApp&&b.useFloatingToolbars,xs=(0,Tt.useMemo)(()=>Is?YP:0,[Is]),{rowVirtualizer:Ao,scrollContainerRef:Kl,scrollContainerRefCallback:$g,requestScroll:gi}=eoe({items:be,pathToIndex:bn,isVisible:ge,activeShortcutKey:Pe.activeShortcutKey,scrollMargin:Yt,scrollPaddingEnd:xs}),em=(0,Tt.useCallback)(()=>{let Ye=()=>{let xt=Kl.current??J.current??e.rootContainerRef.current;xt&&Di(xt)};if(typeof window.requestAnimationFrame=="function"){window.requestAnimationFrame(Ye);return}window.setTimeout(Ye,0)},[e.rootContainerRef,Kl]);(0,Tt.useEffect)(()=>{lt||Ao.measure()},[lt,Yt,So,Iu,qa,Ao,Ie]),(0,Tt.useEffect)(()=>{if(!lt)return;Ao.scrollToOffset(0,{align:"start",behavior:"auto"});let Ye=Kl.current;Ye&&Ye.scrollTo({top:0,behavior:"auto"})},[lt,Ao,Kl]);let Zi=(0,Tt.useCallback)(()=>{let Ye=yx(f);if(!Ye)return;let xt=f.selectionType===W.TAG?W.TAG:f.selectionType===W.PROPERTY?W.PROPERTY:W.FOLDER;gi(Lp(xt,Ye),{align:"auto",itemType:xt})},[gi,f]),tm=(0,Tt.useRef)(ee),nm=(0,Tt.useRef)($),rm=(0,Tt.useRef)(b.showAllTagsFolder);(0,Tt.useEffect)(()=>{let Ye=tm.current,xt=nm.current,Vn=ee&&!Ye,Qn=ee&&$!==xt;if(tm.current=ee,nm.current=$,!Vn&&!Qn)return;let Or=()=>Zi();if(typeof requestAnimationFrame<"u"){window.requestAnimationFrame(()=>{window.requestAnimationFrame(Or)});return}window.setTimeout(Or,0)},[$,Zi,ee]),(0,Tt.useEffect)(()=>{b.showAllTagsFolder&&!rm.current&&b.showAllTagsFolder&&!m.expandedVirtualFolders.has(_n)&&g({type:"TOGGLE_VIRTUAL_FOLDER_EXPANDED",folderId:_n}),rm.current=b.showAllTagsFolder},[g,m.expandedVirtualFolders,b.showAllTagsFolder]);let Es=(0,Tt.useCallback)(()=>{if(lt)return null;let Ye=(xt,Vn)=>{let Qn=Rl(bn,xt,Vn);return Qn===void 0?null:be[Qn]??null};return f.selectionType===W.FOLDER&&f.selectedFolder?.path?Ye(W.FOLDER,f.selectedFolder.path):f.selectionType===W.TAG&&f.selectedTag?Ye(W.TAG,f.selectedTag):f.selectionType===W.PROPERTY&&f.selectedProperty?Ye(W.PROPERTY,f.selectedProperty):null},[lt,be,bn,f.selectedFolder,f.selectedProperty,f.selectedTag,f.selectionType]),Se=(0,Tt.useCallback)(Ye=>{if(Ye.type===he.FOLDER){if(!(Ye.data instanceof ZS.TFolder))return null;let xt=Ye.data;return{type:"folder",id:xt.path,initialValue:i.getFolderDisplayNameRenameInput(xt).initialValue}}if(Ye.type===he.TAG){let xt=Ye.data;return xt.path===zt||xt.path===bt?null:{type:"tag",id:xt.path,displayPath:xt.displayPath,initialValue:JCe(xt.displayPath)}}if(Ye.type===he.PROPERTY_KEY){let xt=Ye.data;return xt.kind!=="key"||xt.notesWithValue.size===0?null:{type:"property",id:xt.id,normalizedKey:xt.key,initialValue:xt.name}}return null},[i]),Ne=(0,Tt.useCallback)(()=>{let Ye=Es();if(!Ye)return!1;let xt=Se(Ye);return xt?(Be(xt),!0):!1},[Se,Es]),He=(0,Tt.useCallback)(()=>{Be(null)},[]),ht=(0,Tt.useCallback)(async(Ye,xt)=>{let Vn=xt.trim();if(Ye.type==="folder"){let Or=Ye.id==="/"?r.vault.getRoot():r.vault.getFolderByPath(Ye.id);if(!(Or instanceof ZS.TFolder))return Be(null),!0;let za=await i.renameFolderDisplayName(Or,xt,b);return za&&Be(null),za}if(Ye.type==="tag"){if(!l)return!1;if(Vn===Ye.initialValue.trim())return Be(null),!0;let Or=await l.renameTag(Ye.id,eNe(Ye.displayPath,Vn));return Or&&Be(null),Or}if(!c)return!1;if(Vn===Ye.initialValue.trim())return Be(null),!0;let Qn=await c.renamePropertyKey(Ye.normalizedKey,xt);return Qn&&Be(null),Qn},[r.vault,i,c,b,l]);(0,Tt.useEffect)(()=>{lt&&Be(null)},[lt]);let sn=(0,Tt.useCallback)(()=>{let Ye=Es();if(!Ye)return!1;let xt=Eg(Ye,{showHiddenItems:z});return xt?Fd(xt,m,g,"toggle",{collapseOtherBranches:b.collapseOtherBranchesOnExpand}):!1},[g,m,Es,b.collapseOtherBranchesOnExpand,z]);(0,Tt.useImperativeHandle)(n,()=>({getIndexOfPath:(Ye,xt)=>Rl(bn,Ye,xt)??-1,virtualizer:Ao,scrollContainerRef:Kl.current,requestScroll:gi,triggerSelectedItemCollapse:sn,openShortcutByNumber:Pe.openShortcutByNumber}),[bn,gi,Ao,Kl,Pe.openShortcutByNumber,sn]);let yr=lt?[]:be,Qr=lt?new Map:bn;kre({items:yr,virtualizer:Ao,containerRef:e.rootContainerRef,pathToIndex:Qr,onStartRename:Ne});let hi=(0,Tt.useMemo)(()=>({...e.style??{},"--nn-calendar-week-count":$}),[$,e.style]),fi=(0,Tt.useMemo)(()=>(0,Nu.jsx)(Loe,{onTreeUpdateComplete:Zi,onToggleRootFolderReorder:Rd,rootReorderActive:lt,rootReorderDisabled:!Wr,useFloatingLayout:Is}),[Wr,Rd,Zi,lt,Is]),Fr=!o&&(b.vaultProfiles??[]).length>1&&(b.vaultTitle??"navigation")==="header",aa=!o&&(b.vaultProfiles??[]).length>1&&(b.vaultTitle??"navigation")==="navigation",Wn=(0,Tt.useCallback)((Ye,xt,Vn)=>{hV({app:r,event:Ye,sectionId:xt,allowSeparator:Vn?.allowSeparator,metadataService:p,settings:b,plugin:a,pinToggleLabel:Pe.pinToggleLabel,isShortcutsPinned:w.pinShortcuts,onToggleShortcutsPin:Pe.handleShortcutSplitToggle,onConfigurePropertyKeys:Kt,shortcutActions:{shortcutsCount:Pe.shortcutsCount,tagShortcutKeysByPath:Pe.tagShortcutKeysByPath,propertyShortcutKeysByNodeId:Pe.propertyShortcutKeysByNodeId,addTagShortcut:Pe.addTagShortcut,addPropertyShortcut:Pe.addPropertyShortcut,removeShortcut:Pe.removeShortcut,clearShortcuts:Pe.clearShortcuts}})},[r,Kt,p,a,b,Pe,w.pinShortcuts]),Ji=(0,Tt.useMemo)(()=>({app:r,settings:b,isMobile:o,expansionState:m,expansionDispatch:g,selectionState:f,indentGuideLevelsByKey:rt,firstSectionId:me,firstInlineFolderPath:fe,shouldPinShortcuts:w.pinShortcuts&&b.showShortcuts,showHiddenItems:z,shortcutsExpanded:Pe.shortcutsExpanded,recentNotesExpanded:Pe.recentNotesExpanded,folderCounts:Wo,tagCounts:Kn,propertyCounts:kr,vaultChangeVersion:er,fileVisibility:v.fileVisibility,hiddenFolders:v.hiddenFolders,getFileDisplayName:T,getFileTimestamps:I,getFileWordCount:O,getSolidBackground:Sa,shortcuts:Pe,tree:Ro,searchHighlights:je,inlineRename:{target:Ke,commit:ht,cancel:He,restoreFocus:em},onSectionContextMenu:Wn}),[r,g,m,fe,me,Wo,v.fileVisibility,v.hiddenFolders,T,I,O,Sa,Wn,He,ht,rt,Ke,o,kr,je,f,b,Pe,z,Kn,Ro,w.pinShortcuts,em,er]),Go=(0,Tt.useCallback)(Ye=>Qoe({item:Ye,selectionState:f,searchHighlights:je,getSolidBackground:Sa}),[Sa,je,f]),Ii=(0,Tt.useCallback)((Ye,xt)=>(0,Nu.jsx)(eae,{item:Ye,context:Ji,adjacentFilledClassName:xt}),[Ji]),es=(0,Nu.jsx)(Aoe,{sectionItems:Ul,folderItems:Ya,tagItems:Md,propertyItems:$p,showRootFolderSection:Nc,showRootTagSection:pi,showRootPropertySection:Xp,foldersSectionExpanded:xe,tagsSectionExpanded:vt,propertiesSectionExpanded:Ve,showRootFolderReset:b.rootFolderOrder.length>0,showRootTagReset:b.rootTagOrder.length>0,showRootPropertyReset:b.rootPropertyOrder.length>0,resetRootTagOrderLabel:Qp,resetRootPropertyOrderLabel:Ns,onResetRootFolderOrder:Yg,onResetRootTagOrder:Qi,onResetRootPropertyOrder:Zp,onReorderSections:Jp,onReorderFolders:xu,onReorderTags:mi,onReorderProperties:Ic,canReorderSections:$a,canReorderFolders:vr,canReorderTags:jo,canReorderProperties:Xr,isMobile:o});return(0,Nu.jsx)(DS,{sensors:Pe.shouldUseShortcutDnd?Pe.shortcutSensors:[],collisionDetection:Pe.shouldUseShortcutDnd?kP:void 0,modifiers:Pe.shouldUseShortcutDnd?[BS]:void 0,onDragStart:Pe.shouldUseShortcutDnd?Pe.handleShortcutDragStart:void 0,onDragEnd:Pe.shouldUseShortcutDnd?Pe.handleShortcutDragEnd:void 0,onDragCancel:Pe.shouldUseShortcutDnd?Pe.handleShortcutDragCancel:void 0,autoScroll:Pe.shouldUseShortcutDnd?!1:void 0,children:(0,Nu.jsx)(OS,{items:Pe.shouldUseShortcutDnd?Pe.shortcutIds:[],strategy:AS,children:(0,Nu.jsx)(dae,{navigationPaneRef:J,navigationPaneStyle:hi,shouldRenderCalendarOverlay:ee,isShortcutSorting:Pe.isShortcutSorting,isMobile:o,isPinnedShortcutsResizing:ke,onTreeUpdateComplete:Zi,onToggleRootReorder:Rd,rootReorderActive:lt,rootReorderDisabled:!Wr,showVaultTitleInHeader:Fr,shouldShowVaultTitleInNavigationPane:aa,showAndroidToolbar:o&&Dd,navigationToolbar:fi,pinNavigationBanner:b.pinNavigationBanner,navigationBannerContent:Ht,shouldRenderPinnedShortcuts:vn,pinnedShortcutsContainerRef:oe,pinnedShortcutsHasOverflow:ae,pinnedShortcutsMaxHeight:le,allowEmptyShortcutDrop:Pe.allowEmptyShortcutDrop,onShortcutRootDragOver:Pe.handleShortcutRootDragOver,onShortcutRootDrop:Pe.handleShortcutRootDrop,pinnedShortcutsScrollRefCallback:ie,pinnedNavigationItems:Et,renderNavigationItem:Ii,isNavigationItemFilled:Go,onPinnedShortcutsResizePointerDown:ve,scrollContainerRefCallback:$g,hasNavigationBannerConfigured:fr,navigationBannerRef:re,rootReorderContent:es,isRootReorderMode:lt,items:be,rowVirtualizer:Ao,navigationScrollMargin:Yt,shouldRenderBottomToolbarInsidePanel:o&&!Dd&&Is,shouldRenderBottomToolbarOutsidePanel:o&&!Dd&&!Is,calendarOverlay:ee?(0,Nu.jsx)("div",{className:"nn-navigation-calendar-overlay",children:(0,Nu.jsx)(Up,{onWeekCountChange:j,onAddDateFilter:C})}):null})})})}))});var pae=U(()=>{uae()});var mae=U(()=>{});function gae({isActive:t,resetKey:e,onDismiss:n}){let[r,o]=(0,JS.useState)(!1),[a,i]=(0,JS.useState)(!1);return(0,JS.useEffect)(()=>{if(!t){o(!1),i(!1);return}o(!0),i(!1);let s=window.setTimeout(()=>{i(!0)},5e3);return()=>{window.clearTimeout(s)}},[t,e]),(0,JS.useEffect)(()=>{if(!r||!a)return;let s=window.setTimeout(()=>{n&&n(),o(!1),i(!1)},500);return()=>{window.clearTimeout(s)}},[r,a,n]),{isVisible:r,isFading:a}}var JS,hae=U(()=>{JS=ue(ze());mae()});function fae({notice:t,onDismiss:e}){let[n,r]=(0,qf.useState)(null);(0,qf.useEffect)(()=>{t&&r(t)},[t]);let o=(0,qf.useCallback)(()=>{n&&(e(n.version),r(null))},[n,e]),a=(0,qf.useCallback)(()=>{window.open("obsidian://show-plugin?id=notebook-navigator"),o()},[o]),{isVisible:i,isFading:s}=gae({isActive:n!==null,resetKey:n?.version??null,onDismiss:o});return!i||!n?null:(0,ew.jsx)("button",{type:"button",className:`nn-update-banner${s?" fade-out":""}`,onClick:a,"aria-label":d.common.updateBannerTitle,title:d.common.updateBannerInstruction,children:(0,ew.jsxs)("div",{className:"nn-update-banner__text",children:[(0,ew.jsx)("span",{className:"nn-update-banner__label",children:d.common.updateBannerTitle}),(0,ew.jsx)("span",{className:"nn-update-banner__instruction",children:d.common.updateBannerInstruction})]})})}var qf,ew,vae=U(()=>{qf=ue(ze());Ee();hae();ew=ue(Ge())});function yae(t){if(!t)return!1;let e=cl(t);return e===u1?!1:!e.includes("/")}function rNe(t,e){let n=new Map;e.forEach(s=>{n.set(cl(s.path),s)});let r=new Set,o=[],a=[];return t.forEach(s=>{let l=cl(s);!l||l===u1||r.has(l)||(r.add(l),o.push(l),n.has(l)||a.push(l))}),e.filter(s=>!r.has(cl(s.path))).sort((s,l)=>Mt(s.name,l.name)).map(s=>cl(s.path)).forEach(s=>{r.has(s)||(r.add(s),o.push(s))}),{normalizedOrder:o,missingPaths:a}}function oNe(t,e){return t.slice().sort((n,r)=>NV(n,r,e))}function bae({settings:t,onFileChange:e}){let{app:n}=gt(),r=Ys(),[o,a]=(0,kc.useState)([]),[i,s]=(0,kc.useState)([]),[l,c]=(0,kc.useState)(new Map),[u,p]=(0,kc.useState)([]),m=(0,kc.useRef)({renames:new Map,removals:new Set,additions:new Set}),g=(0,kc.useRef)(t.rootFolderOrder);return(0,kc.useEffect)(()=>{g.current=t.rootFolderOrder.slice()},[t.rootFolderOrder]),(0,kc.useEffect)(()=>{let f=m.current,h=()=>{let P=n.vault.getRoot(),T=P.children.filter(X=>X instanceof Fc.TFolder),I=g.current.slice();if((f.renames.size>0||f.removals.size>0||f.additions.size>0)&&(f.renames.forEach((X,L)=>{let V=I.indexOf(L);V!==-1&&(I[V]=X)}),f.removals.size>0&&(I=I.filter(X=>!f.removals.has(X))),f.additions.forEach(X=>{I.includes(X)||I.push(X)}),f.renames.clear(),f.removals.clear(),f.additions.clear()),g.current.length===0){let X=t.folderSortOrder==="alpha-desc"?-1:1,L=T.slice().sort((V,D)=>Mt(V.name,D.name)*X);f.renames.clear(),f.removals.clear(),f.additions.clear(),s(L),t.showRootFolder?a([P]):a(L),c(new Map),p(V=>V.length===0?V:[]);return}let{normalizedOrder:N,missingPaths:O}=rNe(I,T),K=Ym(N),G=oNe(T,K);go(N,g.current)||(g.current=N,Q(async()=>{await r(X=>{X.rootFolderOrder=N})})),p(X=>go(X,O)?X:O),s(G),t.showRootFolder?a([P]):a(G),c(K)},b=F=>{e&&e(F)};h();let v=(0,Fc.debounce)(h,Lt.FILE_OPERATION_DELAY,!0),y=F=>{let P=cl(F.path);F.parent===n.vault.getRoot()&&P!==u1&&f.additions.add(P),v()},S=F=>{let P=cl(F.path);yae(P)&&f.removals.add(P),v()},w=(F,P)=>{let T=cl(P),I=cl(F.path),N=F.parent===n.vault.getRoot(),O=yae(T);O&&N?T!==I&&f.renames.set(T,I):O&&!N?f.removals.add(T):!O&&N&&f.additions.add(I),v()},k=[n.vault.on("create",F=>{F instanceof Fc.TFolder&&y(F),F instanceof Fc.TFile&&b({type:"create",path:F.path})}),n.vault.on("delete",F=>{F instanceof Fc.TFolder&&S(F),F instanceof Fc.TFile&&b({type:"delete",path:F.path})}),n.vault.on("rename",(F,P)=>{F instanceof Fc.TFolder&&w(F,P),F instanceof Fc.TFile&&b({type:"rename",path:F.path,oldPath:P})})];return()=>{k.forEach(F=>n.vault.offref(F)),v.cancel()}},[n,e,t.showRootFolder,t.rootFolderOrder,t.folderSortOrder,r]),{rootFolders:o,rootLevelFolders:i,rootFolderOrderMap:l,missingRootFolderPaths:u}}var kc,Fc,u1,Sae=U(()=>{kc=ue(ze()),Fc=require("obsidian");mn();on();Rn();Sl();PS();jr();$o();ot();u1="/"});function wae({app:t,settings:e,activeProfile:n,metadataService:r,onFileChange:o}){let{hiddenFolders:a,hiddenFileProperties:i,hiddenFileNames:s,hiddenFileTags:l}=n,c=(0,lo.useMemo)(()=>Gd(s,!1),[s]),u=(0,lo.useMemo)(()=>po(i),[i]),p=(0,lo.useMemo)(()=>No({enableFolderNotes:e.enableFolderNotes,folderNoteName:e.folderNoteName,folderNoteNamePattern:e.folderNoteNamePattern}),[e.enableFolderNotes,e.folderNoteName,e.folderNoteNamePattern]),m=(0,lo.useMemo)(()=>e.enableFolderNotes&&(u.hasCriteria||c!==null||l.length>0),[e.enableFolderNotes,u,l,c]),g=(0,lo.useCallback)(C=>{if(!m)return!1;let x=Ds(C);if(x==="/")return!1;let z=C.split("/").pop();if(!z)return!1;let H=z.lastIndexOf(".");if(H<=0||H===z.length-1)return!1;let Y=z.slice(0,H),ee=z.slice(H+1).toLowerCase(),$=zc(x),j=Xd($,p);return Y===j&&iNe.has(ee)?!0:ee==="md"&&Y===`${j}${Fa}`},[p,m]),[f,h]=(0,lo.useState)(0),[b,v]=(0,lo.useState)(0),y=(0,lo.useCallback)(()=>{v(C=>C+1)},[]),S=(0,lo.useCallback)(C=>{y(),o?.(C),(g(C.path)||C.oldPath!==void 0&&g(C.oldPath))&&h(x=>x+1)},[y,g,o]),{rootFolders:w,rootLevelFolders:k,rootFolderOrderMap:F,missingRootFolderPaths:P}=bae({settings:e,onFileChange:S}),[T,I]=(0,lo.useState)(()=>r.getFolderDisplayVersion()),[N,O]=(0,lo.useState)(()=>r.getFolderDisplayNameVersion());(0,lo.useEffect)(()=>{I(r.getFolderDisplayVersion());let C=(0,Yf.debounce)(z=>{I(z)},Lt.FILE_OPERATION_DELAY,!0),x=r.subscribeToFolderDisplayChanges(z=>{C(z)});return()=>{x(),C.cancel()}},[r]),(0,lo.useEffect)(()=>{O(r.getFolderDisplayNameVersion());let C=(0,Yf.debounce)(z=>{O(z)},Lt.FILE_OPERATION_DELAY,!0),x=r.subscribeToFolderDisplayNameChanges(z=>{C(z)});return()=>{x(),C.cancel()}},[r]);let[K,G]=(0,lo.useState)(0),[X,L]=(0,lo.useState)(0),[V,D]=(0,lo.useState)(0),[A,_]=(0,lo.useState)(0);(0,lo.useEffect)(()=>{let C=kt(),x=(0,Yf.debounce)(()=>{h(H=>H+1)},Lt.FILE_OPERATION_DELAY,!0),z=C.onContentChange(H=>{let Y=!1,ee=!1,$=!1,j=!1,J=!1,re=new Map;for(let oe of H){let Z=oe.changes.tags!==void 0,ce=oe.changes.properties!==void 0,ae=oe.metadataHiddenChanged===!0;if(oe.metadataDecorationChanged===!0&&(Y=!0),ae&&(ee=!0),Z&&($=!0),ce&&(j=!0),!m||J||!(u.hasCriteria&&ae||l.length>0&&Z))continue;let ne=Ds(oe.path),B=re.get(ne);if(B===void 0){let q=t.vault.getFolderByPath(ne);B=q?Pn(q,p)?.path??null:null,re.set(ne,B)}B===oe.path&&(J=!0)}Y&&G(oe=>oe+1),ee&&L(oe=>oe+1),$&&D(oe=>oe+1),j&&_(oe=>oe+1),J&&x()});return()=>{z(),x.cancel()}},[t,p,u.hasCriteria,l.length,m]);let E=(0,lo.useMemo)(()=>{let C=new Map,x=(z,H)=>(C.size>=aNe&&C.clear(),C.set(z,H),H);return z=>{let H=C.get(z.path);if(H!==void 0)return H;if(!e.useFrontmatterMetadata)return x(z.path,z.name);let Y=_s({app:t,metadataService:r,settings:{customVaultName:e.customVaultName},folderPath:z.path,fallbackName:z.name});return x(z.path,Y)}},[t,e.customVaultName,e.useFrontmatterMetadata,r,N]),R=(0,lo.useMemo)(()=>{if(!m)return;let C=Br(l,!1),x=C.hasHiddenRules,z=x?Sr():null,H=new Map,Y=new Map,ee=new Set,$=J=>{let re=H.get(J.path);if(re!==void 0)return re;let oe=Pn(J,p);if(!oe)return H.set(J.path,!1),!1;let Z=!1;return u.hasCriteria&&Xo(oe,u,t)&&(Z=!0),!Z&&c&&c.matches(oe)&&(Z=!0),!Z&&x&&Pr({app:t,file:oe,db:z}).some(ae=>!C.isTagVisible(ae))&&(Z=!0),H.set(J.path,Z),Z},j=J=>{if(J.path==="/")return!1;let re=Y.get(J.path);if(re!==void 0)return re;if(ee.has(J.path))return!1;ee.add(J.path);let oe=$(J);return!oe&&J.parent instanceof Yf.TFolder&&(oe=j(J.parent)),ee.delete(J.path),Y.set(J.path,oe),oe};return J=>j(J)},[t,f,p,c,u,l,m]),M=(0,lo.useCallback)(C=>{if(C==="/")return!1;let x=t.vault.getFolderByPath(C);return x instanceof Yf.TFolder?a.length>0&&ei(x,a)?!0:R?R(x):!1:!1},[t,R,a]);return(0,lo.useMemo)(()=>({hiddenFolders:a,rootFolders:w,rootLevelFolders:k,rootFolderOrderMap:F,missingRootFolderPaths:P,fileChangeVersion:b,folderDisplayVersion:T,metadataDecorationVersion:K,metadataVisibilityVersion:X,tagDataVersion:V,propertyDataVersion:A,getFolderSortName:E,folderExclusionByFolderNote:R,isFolderExcluded:M}),[R,T,b,E,a,M,K,X,P,A,w,F,k,V])}var lo,Yf,aNe,iNe,Tae=U(()=>{lo=ue(ze()),Yf=require("obsidian");zn();cy();jr();Yr();Vm();ap();_a();rs();$o();Sn();Dr();Sae();aNe=2e3,iNe=new Set(Object.values(Qd))});function kae(t,e){let n=(0,tw.useRef)(null),r=(0,tw.useMemo)(()=>{let a=jj(t),i=n.current;return i&&zN(i,a)?i:(n.current=a,a)},[t]),o=(0,tw.useMemo)(()=>e$(r,e),[e,r]);return(0,tw.useMemo)(()=>({navRainbow:r,navRainbowPalettes:o}),[r,o])}var tw,Fae=U(()=>{tw=ue(ze());Gm();dn()});function sNe({settings:t,navRainbowState:e,source:n}){let{navRainbow:r,navRainbowPalettes:o}=e,a=n.isFolderExcluded,i=n.folderDisplayVersion,s=o.folder!==null,l=r.folders.scope!=="root",c=(0,OP.useMemo)(()=>s?Bte({rootFolders:n.rootFolders,excludePatterns:n.hiddenFolders,rootOrderMap:n.rootFolderOrderMap,defaultSortOrder:t.folderSortOrder,childSortOrderOverrides:t.folderTreeSortOverrides,getFolderSortName:n.getFolderSortName,isFolderExcluded:n.folderExclusionByFolderNote,includeDescendantSiblingGroups:l}):{siblingPathsByParent:new Map},[t.folderSortOrder,t.folderTreeSortOverrides,n.folderExclusionByFolderNote,n.getFolderSortName,n.hiddenFolders,n.rootFolderOrderMap,n.rootFolders,s,l]),u=(0,OP.useMemo)(()=>{let p=new Map;return m=>{let g=p.get(m);if(g!==void 0)return g;let f=a(m);return p.set(m,f),f}},[a]);return(0,OP.useMemo)(()=>{let p=o.folder!==null?n$({siblingPathsByParent:c.siblingPathsByParent,palette:o.folder,scope:r.folders.scope,showRootFolder:t.showRootFolder,inheritColors:t.inheritFolderColors}):{colorsByPath:new Map,rootColor:void 0,getInheritedColor:m=>{}};return{isExcludedPath:u,folderRainbowColors:p,navRainbowMode:r.mode,folderRainbowScope:r.folders.scope,showRootFolder:t.showRootFolder}},[r.folders.scope,r.mode,o.folder,u,t.inheritFolderColors,t.showRootFolder,i,c])}function Pae(){let{app:t}=gt(),e=Ho(),n=pt(),r=$s(),o=wae({app:t,settings:n,activeProfile:r,metadataService:e}),a=sS(t)==="dark",i=kae(n,a),s=sNe({settings:n,navRainbowState:i,source:o});return(0,OP.useMemo)(()=>({folderNavigationSource:o,folderDecorationModel:s,navRainbowState:i}),[s,i,o])}var OP,Cae=U(()=>{OP=ue(ze());mn();on();Tae();Gm();PS();Fae();MR()});function Nae({sourceState:t,treeSections:e,includeDescendantNotes:n,navRainbowState:r}){let o=pt(),{navRainbow:a,navRainbowPalettes:i}=r,s=(0,HD.useMemo)(()=>{let c=i.tag;return c?Vte({visibleTagTree:e.renderTagTree,rootTagKeys:e.renderedRootTagKeys,rootTagOrderMap:t.rootTagOrderMap,tagComparator:t.tagComparator,palette:c,scope:a.tags.scope,showAllTagsFolder:o.showAllTagsFolder,inheritColors:o.inheritTagColors,childSortOrderOverrides:o.tagTreeSortOverrides}):{colorsByPath:new Map,rootColor:void 0,getInheritedColor:u=>{}}},[a.tags.scope,i.tag,o.inheritTagColors,o.showAllTagsFolder,o.tagTreeSortOverrides,e.renderedRootTagKeys,e.renderTagTree,t.rootTagOrderMap,t.tagComparator]),l=(0,HD.useMemo)(()=>{let c=i.property;return c?Ute({propertyTree:t.propertyTree,visiblePropertyNavigationKeySet:t.visiblePropertyNavigationKeySet,rootPropertyOrderMap:t.rootPropertyOrderMap,propertyKeyComparator:t.propertyKeyComparator,palette:c,scope:a.properties.scope,showAllPropertiesFolder:o.showAllPropertiesFolder,propertySortOrder:o.propertySortOrder,propertyTreeSortOverrides:o.propertyTreeSortOverrides,includeDescendantNotes:n}):{colorsByNodeId:new Map,rootColor:void 0,rootColorsByKey:new Map}},[n,a.properties.scope,i.property,o.propertySortOrder,o.propertyTreeSortOverrides,o.showAllPropertiesFolder,t.propertyKeyComparator,t.propertyTree,t.rootPropertyOrderMap,t.visiblePropertyNavigationKeySet]);return(0,HD.useMemo)(()=>({navRainbowMode:a.mode,tagRainbowColors:s,propertyRainbowColors:l,inheritPropertyColors:o.inheritPropertyColors}),[a.mode,l,o.inheritPropertyColors,s])}var HD,Iae=U(()=>{HD=ue(ze());on();IV()});function xae(t){return(e,n)=>-t(e,n)}function Eae(t){let{order:e,compareAlphabetically:n,getFrequency:r}=t;if(e==="alpha-asc")return;if(e==="alpha-desc")return xae(n);let o=(a,i)=>{let s=r(a)-r(i);return s!==0?s:n(a,i)};return e==="frequency-asc"?o:xae(o)}function Mae(t,e){return Eae({order:t,compareAlphabetically:LP,getFrequency:e?r=>rT(r):r=>r.notesWithTag.size})}function VD(t){let{order:e,compareAlphabetically:n,getFrequency:r}=t;return Eae({order:e,compareAlphabetically:n,getFrequency:r})??n}var LP,Rae,Dae,p1=U(()=>{Rn();Ba();LP=(t,e)=>{let n=Mt(t.name,e.name);return n!==0?n:t.path.localeCompare(e.path)};Rae=(t,e)=>{let n=Mt(t.name,e.name);return n!==0?n:t.key.localeCompare(e.key)},Dae=(t,e)=>{let n=Mt(t.name,e.name);return n!==0?n:(t.valuePath??"").localeCompare(e.valuePath??"")}});function lNe(t){let e=t.tagComparator??LP;return t.rootTagOrderMap.size===0?e:(n,r)=>kS(n,r,t.rootTagOrderMap,e)}function Aae(t){let e=Array.from(t.visibleTagTree.values()),n=e.length>0?e.slice().sort(t.comparator):e,r=new Map;n.forEach(s=>{r.set(s.path,s)}),t.hiddenRootTagNodes?.forEach((s,l)=>{r.set(l,s)});let o=n.map(s=>s.path),a=new Set(o);t.shouldIncludeUntagged&&a.add(bt),t.hiddenRootTagNodes?.forEach((s,l)=>{a.add(l),o.includes(l)||o.push(l)});let i=[];return t.rootTagOrder.forEach(s=>{!a.has(s)||i.includes(s)||i.push(s)}),o.forEach(s=>{i.includes(s)||i.push(s)}),t.shouldIncludeUntagged&&!i.includes(bt)&&i.push(bt),{rootNodeMap:r,resolvedRootTagKeys:i,hasVisibleTags:n.length>0}}function dNe(t){return t.rootPropertyOrderMap.size===0?t.propertyKeyComparator:(e,n)=>rD(e,n,t.rootPropertyOrderMap,t.propertyKeyComparator)}function Oae(t){let e=Array.from(t.propertyTree.values()),n=e.length>0?e.slice().sort(t.comparator):e,r=new Map;return n.forEach(o=>{r.set(o.key,o)}),{rootNodeMap:r,resolvedRootPropertyKeys:n.map(o=>o.key)}}function Lae({app:t,settings:e,expansionState:n,showHiddenItems:r,includeDescendantNotes:o,sourceState:a,selectionScope:i,tagTreeService:s,propertyTreeService:l}){let c=(0,Ko.useMemo)(()=>zte(a.rootFolders,n.expandedFolders,a.hiddenFolders,0,new Set,{rootOrderMap:a.rootFolderOrderMap,defaultSortOrder:e.folderSortOrder,childSortOrderOverrides:e.folderTreeSortOverrides,getFolderSortName:a.getFolderSortName,isFolderExcluded:a.folderExclusionByFolderNote}),[n.expandedFolders,e.folderSortOrder,e.folderTreeSortOverrides,a.folderExclusionByFolderNote,a.getFolderSortName,a.hiddenFolders,a.rootFolderOrderMap,a.rootFolders]),u=(0,Ko.useMemo)(()=>!e.showTags||!e.scopeTagsToCurrentContext?!1:i.selectionType===W.FOLDER?!!i.selectedFolder:i.selectionType===W.PROPERTY?!!i.selectedProperty:!1,[i.selectedFolder,i.selectedProperty,i.selectionType,e.scopeTagsToCurrentContext,e.showTags]),p=i.selectionType===W.PROPERTY?a.propertyDataVersion:0,m=i.selectionType===W.PROPERTY?a.propertyTree:null,g=(0,Ko.useMemo)(()=>{if(a.fileChangeVersion,a.tagDataVersion,a.metadataVisibilityVersion,!u)return null;let Y=Sr();if(!Y)return null;let $=ca(i,e,{includeDescendantNotes:o,showHiddenItems:r},t,s,l,{orderResults:!1}).filter(Z=>Z.extension==="md").map(Z=>Z.path),{tagTree:j,tagged:J,untagged:re}=UW(Y,$,a.hiddenTags,r,!1);return{visibleTagTree:r||!a.hiddenMatcherHasRules?j:mN(j,a.hiddenTagMatcher),visibleTaggedCount:J,untaggedCount:re}},[t,o,u,l,i,e,r,a.fileChangeVersion,a.hiddenMatcherHasRules,a.hiddenTagMatcher,a.hiddenTags,a.metadataVisibilityVersion,a.tagDataVersion,p,m,s]),f=(0,Ko.useMemo)(()=>e.showTags?g?.visibleTagTree??a.visibleTagTree:new Map,[g,e.showTags,a.visibleTagTree]),h=(0,Ko.useMemo)(()=>lNe({rootTagOrderMap:a.rootTagOrderMap,tagComparator:a.tagComparator}),[a.rootTagOrderMap,a.tagComparator]),b=(0,Ko.useMemo)(()=>e.showTags?Aae({visibleTagTree:a.visibleTagTree,hiddenRootTagNodes:a.hiddenRootTagNodes,shouldIncludeUntagged:e.showUntagged&&a.untaggedCount>0,rootTagOrder:e.rootTagOrder,comparator:h}):{rootNodeMap:new Map,resolvedRootTagKeys:[],hasVisibleTags:!1},[h,e.rootTagOrder,e.showTags,e.showUntagged,a.hiddenRootTagNodes,a.untaggedCount,a.visibleTagTree]),v=(0,Ko.useMemo)(()=>g?Aae({visibleTagTree:f,hiddenRootTagNodes:new Map,shouldIncludeUntagged:e.showUntagged&&g.untaggedCount>0,rootTagOrder:e.rootTagOrder,comparator:h}):b,[h,b,f,g,e.rootTagOrder,e.showUntagged]),y=(0,Ko.useMemo)(()=>b.rootNodeMap,[b.rootNodeMap]),S=(0,Ko.useMemo)(()=>b.resolvedRootTagKeys,[b.resolvedRootTagKeys]),w=g!==null,F=g?.untaggedCount??a.untaggedCount,P=w?void 0:a.hiddenRootTagNodes,T=v.rootNodeMap,I=v.resolvedRootTagKeys,N=(0,Ko.useMemo)(()=>{if(!e.showTags)return[];let Y=e.showUntagged&&F>0;return I.filter(ee=>P?.has(ee)&&!r?!1:ee===bt?Y:T.has(ee))},[P,T,F,I,e.showTags,e.showUntagged,r]),{tagItems:O,tagsVirtualFolderHasChildren:K}=(0,Ko.useMemo)(()=>{if(!e.showTags)return{tagItems:[],tagsVirtualFolderHasChildren:!1};let Y=[],ee=!r,$=a.hiddenMatcherHasRules,j=g,J=f,re=j?.visibleTaggedCount??a.visibleTaggedCount,oe=j?.untaggedCount??a.untaggedCount,Z=j?new Map:a.hiddenRootTagNodes,ce=v.resolvedRootTagKeys,ae=e.showUntagged&&oe>0,se=!ee&&$?a.hiddenTagMatcher:void 0,{rootNodeMap:ne,hasVisibleTags:B}=v,q=o?{current:re,descendants:0,total:re}:{current:0,descendants:0,total:0},ie=pe=>{if(!ae)return;let ve={path:bt,displayPath:bt,name:rc(Tl.UNTAGGED).getLabel(),children:new Map,notesWithTag:new Set};Y.push({type:he.UNTAGGED,data:ve,key:bt,level:pe,noteCount:{current:oe,descendants:0,total:oe}})},le=(pe,ve,Ie,qe)=>{let xe={id:pe,name:ve,icon:Ie};Y.push({type:he.VIRTUAL_FOLDER,data:xe,level:0,key:pe,isSelectable:!!(qe?.tagCollectionId||qe?.propertyCollectionId),tagCollectionId:qe?.tagCollectionId,propertyCollectionId:qe?.propertyCollectionId,hasChildren:qe?.hasChildren,showFileCount:qe?.showFileCount,noteCount:qe?.noteCount})};if(J.size===0){if(e.showAllTagsFolder){let pe=_n;return le(pe,d.tagList.tags,Qe(e.interfaceIcons,"nav-tags"),{tagCollectionId:zt,hasChildren:ae,showFileCount:e.showNoteCount,noteCount:q}),n.expandedVirtualFolders.has(pe)&&ae&&ie(1),{tagItems:Y,tagsVirtualFolderHasChildren:ae}}return ae?(ie(0),{tagItems:Y,tagsVirtualFolderHasChildren:!0}):{tagItems:Y,tagsVirtualFolderHasChildren:!1}}let Te=re>0,ke=B||ae||Te,Fe=B||ae,te=(pe,ve)=>{let Ie=FS([pe],n.expandedTags,ve,{hiddenMatcher:se,comparator:h,childSortOrderOverrides:e.tagTreeSortOverrides});Y.push(...Ie)};if(e.showAllTagsFolder){if(ke){let pe=_n;le(pe,d.tagList.tags,Qe(e.interfaceIcons,"nav-tags"),{tagCollectionId:zt,hasChildren:Fe,showFileCount:e.showNoteCount,noteCount:q}),n.expandedVirtualFolders.has(pe)&&ce.forEach(ve=>{if(Z.has(ve)&&!r)return;if(ve===bt){ie(1);return}let Ie=ne.get(ve);Ie&&te(Ie,1)})}}else ce.forEach(pe=>{if(Z.has(pe)&&!r)return;if(pe===bt){ie(0);return}let ve=ne.get(pe);ve&&te(ve,0)});return{tagItems:Y,tagsVirtualFolderHasChildren:Fe}},[h,n.expandedTags,n.expandedVirtualFolders,o,f,v,g,e.interfaceIcons,e.showAllTagsFolder,e.showNoteCount,e.showTags,e.showUntagged,e.tagTreeSortOverrides,r,a.hiddenMatcherHasRules,a.hiddenRootTagNodes,a.hiddenTagMatcher,a.untaggedCount,a.visibleTaggedCount]),G=(0,Ko.useMemo)(()=>{if(!e.showProperties)return new Map;let Y=new Map;return a.propertyTree.forEach((ee,$)=>{a.visiblePropertyNavigationKeySet.has(ee.key)&&Y.set($,ee)}),Y},[e.showProperties,a.propertyTree,a.visiblePropertyNavigationKeySet]),X=(0,Ko.useMemo)(()=>!e.showProperties||!e.scopePropertiesToCurrentContext?!1:i.selectionType===W.FOLDER?!!i.selectedFolder:i.selectionType===W.TAG?!!i.selectedTag:!1,[i.selectedFolder,i.selectedTag,i.selectionType,e.scopePropertiesToCurrentContext,e.showProperties]),L=i.selectionType===W.TAG||i.selectionType===W.FOLDER&&!r&&a.hiddenFileTags.length>0?a.tagDataVersion:0,V=i.selectionType===W.TAG?a.tagTree:null,D=(0,Ko.useMemo)(()=>{if(a.fileChangeVersion,a.propertyDataVersion,a.metadataVisibilityVersion,!X)return null;let Y=Sr();if(!Y)return null;let $=ca(i,e,{includeDescendantNotes:o,showHiddenItems:r},t,s,l,{orderResults:!1}).filter(j=>j.extension==="md").map(j=>j.path);return a.visiblePropertyNavigationKeySet.size===0?{propertyTree:new Map}:{propertyTree:Ij(Y,$,{includedPropertyKeys:a.visiblePropertyNavigationKeySet})}},[t,o,X,l,i,e,r,a.fileChangeVersion,a.metadataVisibilityVersion,a.propertyDataVersion,a.visiblePropertyNavigationKeySet,L,V,s]),A=(0,Ko.useMemo)(()=>e.showProperties?D?.propertyTree??G:new Map,[G,D,e.showProperties]),_=(0,Ko.useMemo)(()=>dNe({propertyKeyComparator:a.propertyKeyComparator,rootPropertyOrderMap:a.rootPropertyOrderMap}),[a.propertyKeyComparator,a.rootPropertyOrderMap]),E=(0,Ko.useMemo)(()=>e.showProperties?Oae({propertyTree:G,comparator:_}):{rootNodeMap:new Map,resolvedRootPropertyKeys:[]},[_,G,e.showProperties]),R=(0,Ko.useMemo)(()=>D?Oae({propertyTree:A,comparator:_}):E,[_,E,A,D]),M=(0,Ko.useMemo)(()=>E.rootNodeMap,[E.rootNodeMap]),C=(0,Ko.useMemo)(()=>E.resolvedRootPropertyKeys,[E.resolvedRootPropertyKeys]),x=(0,Ko.useMemo)(()=>{if(!e.showProperties)return{propertiesSectionActive:!1,keyNodes:[],collectionCount:void 0};let Y=R.resolvedRootPropertyKeys.map(J=>R.rootNodeMap.get(J)??null).filter(J=>J!==null),ee,$=e.showAllPropertiesFolder;if(e.showNoteCount&&($||a.hasRootPropertyShortcut))if(!o||Y.length===0)ee={current:0,descendants:0,total:0};else{let J=new Set;Y.forEach(oe=>{oe.notesWithValue.forEach(Z=>J.add(Z))});let re=J.size;ee={current:re,descendants:0,total:re}}return{propertiesSectionActive:!0,keyNodes:Y,collectionCount:ee}},[o,R,e.showAllPropertiesFolder,e.showNoteCount,e.showProperties,a.hasRootPropertyShortcut]),{propertyItems:z,propertiesSectionActive:H}=(0,Ko.useMemo)(()=>{if(!x.propertiesSectionActive)return{propertyItems:[],propertiesSectionActive:!1};let Y=Oe,ee=x.keyNodes,$=x.collectionCount,j=e.showAllPropertiesFolder,J=j?1:0,re=J+1,oe=[];if(j&&(oe.push({type:he.VIRTUAL_FOLDER,data:{id:Y,name:d.navigationPane.properties,icon:Qe(e.interfaceIcons,"nav-properties")},level:0,key:Y,isSelectable:!0,propertyCollectionId:Oe,hasChildren:ee.length>0,showFileCount:e.showNoteCount,noteCount:$}),!n.expandedVirtualFolders.has(Y)))return{propertyItems:oe,propertiesSectionActive:!0};let Z=(ce,ae)=>{let se=Array.from(ae);if(se.length<=1)return se;let ne=e.propertyTreeSortOverrides,q=!!(ne&&Object.prototype.hasOwnProperty.call(ne,ce.id))?ne?.[ce.id]:void 0,ie=VD({order:q??e.propertySortOrder,compareAlphabetically:Dae,getFrequency:le=>o&&le.valuePath?Pm(ce,le.valuePath):le.notesWithValue.size});return se.sort(ie)};return ee.forEach(ce=>{oe.push({type:he.PROPERTY_KEY,data:ce,level:J,key:ce.id}),n.expandedProperties.has(ce.id)&&ce.children.size>0&&Z(ce,ce.children.values()).forEach(ae=>{oe.push({type:he.PROPERTY_VALUE,data:ae,level:re,key:ae.id})})}),{propertyItems:oe,propertiesSectionActive:!0}},[n.expandedProperties,n.expandedVirtualFolders,o,x.collectionCount,x.keyNodes,x.propertiesSectionActive,e.interfaceIcons,e.propertySortOrder,e.propertyTreeSortOverrides,e.showAllPropertiesFolder,e.showNoteCount]);return{folderItems:c,tagItems:O,renderTagTree:f,renderedRootTagKeys:N,rootOrderingTagTree:y,resolvedRootTagKeys:S,tagsVirtualFolderHasChildren:K,renderPropertyTree:A,rootOrderingPropertyTree:M,propertyItems:z,propertiesSectionActive:H,resolvedRootPropertyKeys:C,propertyCollectionCount:x.collectionCount}}var Ko,zae=U(()=>{Ko=ue(ze());Ee();Ue();zn();ai();Ba();cn();PS();pr();Jm();p1()});function cNe(t,e){let n=Mt(t.name,e.name);return n!==0?n:t.key.localeCompare(e.key)}function uNe(t,e,n){let r=new Map;e.forEach(l=>{r.set(l.key,l)});let o=new Set,a=[],i=[];return t.forEach(l=>{let c=Me(l);c&&(o.has(c)||(o.add(c),a.push(c),r.has(c)||i.push(c)))}),e.filter(l=>!o.has(l.key)).slice().sort(n).forEach(l=>{o.has(l.key)||(o.add(l.key),a.push(l.key))}),{normalizedOrder:a,missingKeys:i}}function Bae({settings:t,propertyTree:e,comparator:n}){let r=Ys(),o=(0,jg.useMemo)(()=>n||cNe,[n]),a=(0,jg.useMemo)(()=>!e||e.size===0?[]:Array.from(e.values()),[e]),i=Array.isArray(t.rootPropertyOrder)&&t.rootPropertyOrder.length>0,s=(0,jg.useMemo)(()=>i?uNe(t.rootPropertyOrder,a,o):{normalizedOrder:[],missingKeys:[]},[o,i,a,t.rootPropertyOrder]);(0,jg.useEffect)(()=>{i&&(go(s.normalizedOrder,t.rootPropertyOrder)||Q(async()=>{await r(u=>{u.rootPropertyOrder=s.normalizedOrder})}))},[i,s.normalizedOrder,t.rootPropertyOrder,r]);let l=(0,jg.useMemo)(()=>i?Ym(s.normalizedOrder):new Map,[i,s.normalizedOrder]),c=(0,jg.useMemo)(()=>i?s.missingKeys:[],[i,s.missingKeys]);return{rootPropertyOrderMap:l,missingRootPropertyKeys:c}}var jg,_ae=U(()=>{jg=ue(ze());on();Sl();ot();Ot();Rn()});function pNe(t,e,n){let r=new Map;e.forEach(l=>{r.set(l.path,l)});let o=new Set,a=[],i=[];return t.forEach(l=>{let c=It(l);c.length!==0&&(o.has(c)||(o.add(c),a.push(c),r.has(c)||i.push(c)))}),e.filter(l=>!o.has(l.path)).slice().sort(n).forEach(l=>{o.has(l.path)||(o.add(l.path),a.push(l.path))}),{normalizedOrder:a,missingPaths:i}}function Hae({settings:t,tagTree:e,comparator:n}){let r=Ys(),o=(0,Gg.useMemo)(()=>n||((u,p)=>Mt(u.name,p.name)),[n]),a=(0,Gg.useMemo)(()=>!e||e.size===0?[]:Array.from(e.values()),[e]),i=Array.isArray(t.rootTagOrder)&&t.rootTagOrder.length>0,s=(0,Gg.useMemo)(()=>i?pNe(t.rootTagOrder,a,o):{normalizedOrder:[],missingPaths:[]},[o,i,a,t.rootTagOrder]);(0,Gg.useEffect)(()=>{i&&(go(s.normalizedOrder,t.rootTagOrder)||Q(async()=>{await r(u=>{u.rootTagOrder=s.normalizedOrder})}))},[i,s.normalizedOrder,t.rootTagOrder,r]);let l=(0,Gg.useMemo)(()=>i?Ym(s.normalizedOrder):new Map,[i,s.normalizedOrder]),c=(0,Gg.useMemo)(()=>i?s.missingPaths:[],[i,s.missingPaths]);return{rootTagOrderMap:l,missingRootTagPaths:c}}var Gg,Vae=U(()=>{Gg=ue(ze());on();Sl();Dr();Rn();ot()});function Uae({app:t,settings:e,activeProfile:n,folderNavigationSource:r,fileData:o,hydratedShortcuts:a,showHiddenItems:i,includeDescendantNotes:s}){let{hiddenFolders:l,hiddenFileProperties:c,hiddenFileNames:u,hiddenTags:p,hiddenFileTags:m,fileVisibility:g,navigationBanner:f}=n,h=f,b=ng(e,i),v=(0,Cs.useMemo)(()=>Gd(u,i),[u,i]),y=(0,Cs.useMemo)(()=>po(c),[c]),{hiddenFolders:S,rootFolders:w,rootLevelFolders:k,rootFolderOrderMap:F,missingRootFolderPaths:P,fileChangeVersion:T,metadataDecorationVersion:I,metadataVisibilityVersion:N,tagDataVersion:O,propertyDataVersion:K,getFolderSortName:G,folderExclusionByFolderNote:X}=r,L=(0,Cs.useMemo)(()=>o.tagTree??new Map,[o.tagTree]),V=(0,Cs.useMemo)(()=>o.propertyTree??new Map,[o.propertyTree]),D=o.untagged,A=(0,Cs.useMemo)(()=>Br(p,i),[p,i]),_=A.matcher,E=A.hasHiddenRules,R=(0,Cs.useMemo)(()=>!E||i?L:mN(L,_),[L,E,i,_]),M=o.tagged??0,C=(0,Cs.useMemo)(()=>a.some(({shortcut:Z,propertyNodeId:ce})=>la(Z)?ce===Oe||Z.nodeId===Oe:!1),[a]),x=(0,Cs.useMemo)(()=>Mae(e.tagSortOrder,s),[e.tagSortOrder,s]),z=(0,Cs.useMemo)(()=>!e.showTags||i?new Map:o.hiddenRootTags??new Map,[o.hiddenRootTags,i,e.showTags]),H=(0,Cs.useMemo)(()=>{if(z.size===0)return L;let Z=new Map(L);return z.forEach((ce,ae)=>{Z.has(ae)||Z.set(ae,ce)}),Z},[z,L]),{rootTagOrderMap:Y,missingRootTagPaths:ee}=Hae({settings:e,tagTree:H,comparator:x??LP}),$=(0,Cs.useMemo)(()=>VD({order:e.propertySortOrder,compareAlphabetically:Rae,getFrequency:Z=>s?Z.notesWithValue.size:jc(Z)}),[s,e.propertySortOrder]),{rootPropertyOrderMap:j,missingRootPropertyKeys:J}=Bae({settings:e,propertyTree:V,comparator:$}),re=(0,Cs.useMemo)(()=>qv(n.propertyKeys,"navigation"),[n.propertyKeys]),oe=(0,Cs.useMemo)(()=>Oz({hiddenFileProperties:c,hiddenFolders:l,hiddenFileNames:u,hiddenFileTags:m,hideDrawingPreviewImages:e.hideDrawingPreviewImages},t,i),[t,i,c,l,u,m,e.hideDrawingPreviewImages]);return(0,Cs.useMemo)(()=>({effectiveFrontmatterExclusions:b,hiddenFolders:S,hiddenTags:p,hiddenFileProperties:c,hiddenFileNames:u,hiddenFileTags:m,fileVisibility:g,navigationBannerPath:h,folderCountFileNameMatcher:v,hiddenFilePropertyMatcher:y,rootFolders:w,rootLevelFolders:k,rootFolderOrderMap:F,missingRootFolderPaths:P,tagTree:L,propertyTree:V,untaggedCount:D,visibleTaggedCount:M,hiddenTagMatcher:_,hiddenMatcherHasRules:E,visibleTagTree:R,hasRootPropertyShortcut:C,tagComparator:x,hiddenRootTagNodes:z,tagTreeForOrdering:H,rootTagOrderMap:Y,missingRootTagPaths:ee,propertyKeyComparator:$,rootPropertyOrderMap:j,missingRootPropertyKeys:J,visiblePropertyNavigationKeySet:re,metadataDecorationVersion:I,metadataVisibilityVersion:N,tagDataVersion:O,propertyDataVersion:K,getFolderSortName:G,folderExclusionByFolderNote:X,recentNotesHiddenFileMatcher:oe,fileChangeVersion:T}),[b,S,p,c,u,m,g,h,v,y,w,k,F,P,L,V,D,M,_,E,R,C,x,z,H,Y,ee,$,j,J,re,I,N,O,K,G,X,oe,T])}var Cs,Kae=U(()=>{Cs=ue(ze());Ue();Ia();qy();Yr();cn();Dr();Ba();dn();_ae();Vae();p1()});var Ut,jae,qp,UD,Wae,Gae,qae=U(()=>{Ut=ue(ze()),jae=require("obsidian");Qs();Ur();mn();on();pa();xg();Tr();sH();R9();V9();K9();W9();QM();Y9();Xi();Ee();ot();X9();Tz();Z9();hH();Ue();ai();Mg();Sl();JM();vH();Jv();SH();wH();iR();Sn();Xc();cn();TH();CH();Xb();NH();Tre();pae();lP();vae();Fn();yR();iS();Cae();Iae();GR();zae();Kae();qp=ue(Ge()),UD=(t,e)=>{if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n{if(t===e)return!0;let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let o of n)if(t[o]!==e[o])return!1;return!0},Gae=Ut.default.memo((0,Ut.forwardRef)(function(e,n){let{app:r,isMobile:o,fileSystemOps:a,plugin:i,tagTreeService:s,propertyTreeService:l,commandQueue:c,tagOperations:u}=gt(),p=pt(),m=$s(),g=ta(),f=Xt(),h=Yn(),b=Vr(),v=(0,Ut.useRef)(f);(0,Ut.useEffect)(()=>{v.current=f},[f]);let y=h.effectiveDualPaneOrientation,S=p.desktopBackground??"separate",{scale:w,style:k,dataAttr:F}=cR({isMobile:o,desktopScale:p.desktopScale,mobileScale:p.mobileScale}),P=Yd("horizontal"),T=Yd("vertical"),I=y==="vertical"?T:P,N=ar(),O=gr(),K=N.selectionType===W.FOLDER?N.selectedFolder:null,G=bS(r.vault,K,p.enableFolderNotes&&p.folderNoteOpenLocation==="right-sidebar"&&p.showNearestFolderNoteInSidebar,{includeAncestors:!0});(0,Ut.useEffect)(()=>{Q(()=>i.syncFolderNoteSidebarToFolder(K))},[i,G,K,p.enableFolderNotes,p.folderNoteName,p.folderNoteNamePattern,p.folderNoteOpenLocation,p.showNearestFolderNoteInSidebar]);let{folderShortcutKeysByPath:X,noteShortcutKeysByPath:L,tagShortcutKeysByPath:V,propertyShortcutKeysByNodeId:D,addFolderShortcut:A,addNoteShortcut:_,addTagShortcut:E,addPropertyShortcut:R,removeShortcut:M,hydratedShortcuts:C}=Td(),x=(0,Ut.useMemo)(()=>({selectionType:N.selectionType,selectedFolder:N.selectedFolder,selectedTag:N.selectedTag,selectedProperty:N.selectedProperty}),[N.selectedFolder,N.selectedProperty,N.selectedTag,N.selectionType]),{stopAllProcessing:z,rebuildCache:H,fileData:Y}=xo(),{bannerNotice:ee,markAsDisplayed:$}=$9(),j=(0,Ut.useRef)(z);(0,Ut.useEffect)(()=>{j.current=z},[z]);let J=(0,Ut.useRef)(H);(0,Ut.useEffect)(()=>{J.current=H},[H]);let re=(0,Ut.useRef)(null),[oe,Z]=(0,Ut.useState)(!1),[ce,ae]=(0,Ut.useState)(oS),[se,ne]=(0,Ut.useState)(!1),[B,q]=(0,Ut.useState)(!1),ie=(0,Ut.useRef)(null),le=(0,Ut.useRef)(null),Te=(0,Ut.useRef)(h.dualPane),ke=(0,Ut.useRef)({mouseBackForwardAction:p.mouseBackForwardAction,singlePane:h.singlePane,focusedPane:h.focusedPane,currentSinglePaneView:h.currentSinglePaneView,navigateSelectionHistory:()=>!1}),Fe=(0,Ut.useCallback)(je=>{ae(rt=>rt.tags.excludeTagged===je.tags.excludeTagged&&rt.tags.includeUntagged===je.tags.includeUntagged&&rt.tags.requireTagged===je.tags.requireTagged&&UD(rt.tags.include,je.tags.include)&&UD(rt.tags.exclude,je.tags.exclude)&&Wae(rt.tags.includeOperators,je.tags.includeOperators)&&UD(rt.properties.include,je.properties.include)&&UD(rt.properties.exclude,je.properties.exclude)&&Wae(rt.properties.includeOperators,je.properties.includeOperators)?rt:{tags:{include:je.tags.include.slice(),exclude:je.tags.exclude.slice(),includeOperators:{...je.tags.includeOperators},excludeTagged:je.tags.excludeTagged,includeUntagged:je.tags.includeUntagged,requireTagged:je.tags.requireTagged},properties:{include:je.properties.include.slice(),exclude:je.properties.exclude.slice(),includeOperators:{...je.properties.includeOperators}}})},[]),te=(0,Ut.useCallback)(async(je,rt)=>{let Et=le.current;Et&&await Et.executeSearchShortcut({searchShortcut:rt})},[]),pe=(0,Ut.useCallback)(()=>({preserveSinglePaneView:h.singlePane&&h.currentSinglePaneView==="navigation",focusSearch:!1}),[h.currentSinglePaneView,h.singlePane]),ve=(0,Ut.useCallback)((je,rt)=>{le.current?.modifySearchWithTag(je,rt,pe())},[pe]),Ie=(0,Ut.useCallback)((je,rt,Et)=>{le.current?.modifySearchWithProperty(je,rt,Et,pe())},[pe]),qe=(0,Ut.useCallback)(je=>{le.current?.modifySearchWithDateToken(je,pe())},[pe]),xe=uH({orientation:"horizontal",initialSize:P.defaultSize,min:P.minSize,storageKey:P.storageKey,scale:w}),Ce=uH({orientation:"vertical",initialSize:T.defaultSize,min:T.minSize,storageKey:T.storageKey,scale:w}),vt=y==="vertical"?Ce:xe,Rt=vt.paneSize,Ve=vt.isResizing,Ae=vt.resizeHandleProps,Ke=(0,Ut.useCallback)(je=>{re.current=je},[]);(0,Ut.useEffect)(()=>{b({type:"SET_PANE_WIDTH",width:xe.paneSize})},[xe.paneSize,b]),(0,Ut.useLayoutEffect)(()=>{let je=re.current;if(!je)return;let rt=Xe=>{b({type:"SET_CONTAINER_WIDTH",width:Xe})};if(rt(je.offsetWidth),typeof ResizeObserver>"u"){let Xe=()=>rt(je.offsetWidth);return window.addEventListener("resize",Xe),()=>{window.removeEventListener("resize",Xe)}}let Et=new ResizeObserver(Xe=>{let Ht=Xe[0];Ht&&rt(Ht.contentRect.width)});return Et.observe(je),()=>Et.disconnect()},[b]);let Be=["nn-split-container"],wt=(0,Ut.useRef)(!1),Ct=(0,Ut.useRef)(p.startView==="navigation"?"navigation":"files");(0,Ut.useLayoutEffect)(()=>{let je=Te.current;if(Te.current=h.dualPane,o)return;if(h.dualPane){wt.current=!1;return}if(wt.current)return;if(wt.current=!0,je){q(!0);let Et=window.requestAnimationFrame(()=>{q(!1)});return b({type:"SET_SINGLE_PANE_VIEW",view:"files"}),b({type:"SET_FOCUSED_PANE",pane:"files"}),()=>{window.cancelAnimationFrame(Et)}}let rt=Ct.current;b({type:"SET_SINGLE_PANE_VIEW",view:rt}),b({type:"SET_FOCUSED_PANE",pane:rt})},[o,b,h.dualPane]),(0,Ut.useEffect)(()=>{if(!h.singlePane){ne(!1);return}ne(!0);let je=window.setTimeout(()=>{ne(!1)},p.paneTransitionDuration+20);return()=>{window.clearTimeout(je)}},[p.paneTransitionDuration,h.currentSinglePaneView,h.singlePane]),x9(re);let qt=(0,Ut.useCallback)(()=>{h.singlePane&&(b({type:"SET_SINGLE_PANE_VIEW",view:"navigation"}),b({type:"SET_FOCUSED_PANE",pane:"navigation"}))},[b,h.singlePane]),lt=(0,Ut.useCallback)(()=>{h.singlePane&&h.currentSinglePaneView==="navigation"&&(b({type:"SET_SINGLE_PANE_VIEW",view:"files"}),b({type:"SET_FOCUSED_PANE",pane:"files"}))},[b,h.singlePane,h.currentSinglePaneView]);M9({containerRef:re,isMobile:o,isSinglePane:h.singlePane,isFilesView:h.currentSinglePaneView==="files",onActivateNavigation:qt,onRestoreFiles:lt}),q9(re,o),U9({app:r,containerRef:re,setIsNavigatorFocused:Z});let{handleExpandCollapseAll:Zt}=Gb(),Kt=(0,Ut.useCallback)((je,rt)=>{let Et=c?.isOpeningVersionHistory()||!1,Xe=c?.isOpeningInNewContext()||!1;h.singlePane&&rt?.updateSinglePaneView&&h.currentSinglePaneView!==je&&b({type:"SET_SINGLE_PANE_VIEW",view:je}),h.focusedPane!==je&&b({type:"SET_FOCUSED_PANE",pane:je}),!Et&&!Xe&&re.current?.focus()},[c,b,h.singlePane,h.currentSinglePaneView,h.focusedPane]),gn=(0,Ut.useCallback)(je=>{let rt=je?.updateSinglePaneView??h.singlePane;Kt("navigation",{updateSinglePaneView:rt})},[Kt,h.singlePane]),fn=(0,Ut.useCallback)(je=>{let rt=je?.updateSinglePaneView??h.singlePane;Kt("files",{updateSinglePaneView:rt})},[Kt,h.singlePane]),{revealFileInActualFolder:an,revealFileInNearestFolder:Pe,navigateToFolder:ge,navigateToTag:be,navigateToProperty:me,revealTag:fe,revealProperty:we}=H9({app:r,navigationPaneRef:ie,focusNavigationPane:gn,focusFilesPane:fn}),Re=(0,Ut.useCallback)(je=>{if(je.type===W.FOLDER){let rt=r.vault.getFolderByPath(je.value);return rt?{type:W.FOLDER,value:rt.path}:null}if(je.type===W.TAG){if(!p.showTags)return null;let rt=Ze(je.value);if(!rt)return null;if(rt===zt||rt===bt)return{type:W.TAG,value:rt};if(!s)return null;let Et=s.resolveSelectionTagPath(rt);return Et?{type:W.TAG,value:Et}:null}if(je.type===W.PROPERTY){if(!p.showProperties)return null;let rt=je.value===Oe?Oe:Gt(je.value);if(!rt)return null;if(rt===Oe)return{type:W.PROPERTY,value:Oe};if(!l)return null;let Et=l.resolveSelectionNodeId(rt);return Et!==Oe?{type:W.PROPERTY,value:Et}:null}return null},[r.vault,l,p.showProperties,p.showTags,s]),nt=(0,Ut.useCallback)(je=>{let{navigationHistory:rt}=N;if(rt.length===0)return null;let Et=Math.min(Math.max(N.navigationHistoryIndex,0),rt.length-1),Xe=je==="back"?-1:1;for(let Ht=Et+Xe;Ht>=0&&Ht{let rt=nt(je);if(!rt)return!1;if(rt.entry.type===W.FOLDER){let Et=r.vault.getFolderByPath(rt.entry.value);return Et?ge(Et,{historyIndex:rt.index,skipFocus:!0,source:"manual"}):!1}return rt.entry.type===W.TAG?be(rt.entry.value,{historyIndex:rt.index,skipFocus:!0,source:"manual"})!==null:me(rt.entry.value,{historyIndex:rt.index,skipFocus:!0,source:"manual"})!==null},[r.vault,nt,ge,me,be]),yt=!h.singlePane||h.currentSinglePaneView==="navigation";(0,Ut.useEffect)(()=>{ke.current={mouseBackForwardAction:p.mouseBackForwardAction,singlePane:h.singlePane,focusedPane:h.focusedPane,currentSinglePaneView:h.currentSinglePaneView,navigateSelectionHistory:ct}},[ct,p.mouseBackForwardAction,h.currentSinglePaneView,h.focusedPane,h.singlePane]),(0,Ut.useEffect)(()=>{if(o)return;let je=re.current;if(!je)return;let rt=Et=>{if(Et.button!==3&&Et.button!==4)return;let{mouseBackForwardAction:Xe,singlePane:Ht,focusedPane:vn,currentSinglePaneView:it,navigateSelectionHistory:Yt}=ke.current,fr=Et.button===3?"back":"forward";if(Xe==="none")return;if(Xe==="history"){Et.preventDefault(),Yt(fr);return}if(!Ht||(Et.preventDefault(),vn==="search"))return;let Do=fr==="back"?"navigation":"files";it!==Do&&(b({type:"SET_SINGLE_PANE_VIEW",view:Do}),b({type:"SET_FOCUSED_PANE",pane:Do}))};return je.addEventListener("auxclick",rt),()=>{je.removeEventListener("auxclick",rt)}},[re,o,b]);let bn=(0,Ut.useCallback)(je=>{Pe(je,{source:"shortcut"})},[Pe]),Kn=(0,Ut.useCallback)(()=>{let je=yx(N);if(!je)return;let rt=N.selectionType===W.TAG?W.TAG:N.selectionType===W.PROPERTY?W.PROPERTY:W.FOLDER,Et=Lp(rt,je);ie.current?.requestScroll(Et,{align:"auto",itemType:rt})},[N]),kr=(0,Ut.useCallback)(()=>{let je=le.current;if(!je)return;let rt=fc(r,N);if(!rt)return;let Et=je.getIndexOfPath(rt.path);Et<0||je.virtualizer?.scrollToIndex(Et,{align:"auto"})},[r,N]),Wo=(0,Ut.useCallback)(()=>{let je=()=>{Kn(),kr()};if(typeof requestAnimationFrame<"u"){window.requestAnimationFrame(()=>{window.requestAnimationFrame(je)});return}window.setTimeout(je,0)},[kr,Kn]),co=(0,Ut.useRef)(null),wn=(0,Ut.useCallback)(je=>{if(!h.singlePane)return;let rt=co.current;co.current=je,rt!==je&&Wo()},[Wo,h.singlePane]);(0,Ut.useImperativeHandle)(n,()=>{let je=()=>{let Xe=Array.from(N.selectedFiles).map(Ht=>r.vault.getFileByPath(Ht)).filter(Ht=>!!Ht);return Xe.length===0&&N.selectedFile&&Xe.push(N.selectedFile),Xe},rt=()=>{let Xe=je(),Ht=le.current?.getOrderedFiles()??[];return wx(Xe,Ht)},Et=Xe=>{let Ht=le.current;return Ht?Ht.selectAdjacentFile(Xe):!1};return{navigateToFile:(Xe,Ht)=>an(Xe,Ht),revealFileInNearestFolder:(Xe,Ht)=>{Pe(Xe,Ht)},focusVisiblePane:()=>{h.singlePane?Kt(h.currentSinglePaneView):Kt("files")},focusNavigationPane:gn,stopContentProcessing:()=>{try{j.current?.()}catch(Xe){console.error("Failed to stop content processing:",Xe)}},rebuildCache:async()=>{await J.current?.()},selectNextFile:async()=>Et("next"),selectPreviousFile:async()=>Et("previous"),navigateBack:async()=>ct("back"),navigateForward:async()=>ct("forward"),openShortcutByNumber:Xe=>{let Ht=ie.current;return Ht?Ht.openShortcutByNumber(Xe):Promise.resolve(!1)},isDualPaneAutoFallbackActive:()=>i.useDualPane()&&!o&&h.singlePane,deleteSelectedFiles:()=>{Q(async()=>{!N.selectedFile&&N.selectedFiles.size===0||await ZM({app:r,fileSystemOps:a,settings:p,visibility:{includeDescendantNotes:v.current.includeDescendantNotes,showHiddenItems:v.current.showHiddenItems},selectionState:N,selectionDispatch:O,tagTreeService:s,propertyTreeService:l,orderedFiles:le.current?.getOrderedFiles()??void 0})})},mergeSelectedFiles:async()=>{let Xe=rt(),Ht=zp(Xe);if(Ht.length<2){de(d.fileSystem.notifications.mergeNotesRequireMultipleMarkdown,{variant:"warning"});return}let vn=Ht[0],it=vn.parent instanceof jae.TFolder?vn.parent:r.vault.getRoot();await dR({app:r,commandQueue:c,fileSystemOps:a,files:Ht,outputFolder:it,defaultOutputName:d.modals.mergeNotes.outputNamePlaceholder})},createNoteInSelectedFolder:async(Xe=!1)=>{let Ht=le.current?.getManualSortNewFileContext()??null;if(N.selectedFolder){await a.createNewFile(N.selectedFolder,Xe,Ht);return}if(N.selectionType===W.TAG&&N.selectedTag&&N.selectedTag!==zt&&N.selectedTag!==bt){let vn=N.selectedFile?.path??r.workspace.getActiveFile()?.path??"";await a.createNewFileForTag(N.selectedTag,vn,Xe,Ht);return}if(N.selectionType===W.PROPERTY&&N.selectedProperty&&N.selectedProperty!==Oe){let vn=N.selectedFile?.path??r.workspace.getActiveFile()?.path??"";await a.createNewFileForProperty(N.selectedProperty,vn,Xe,Ht);return}de(d.fileSystem.errors.noFolderSelected,{variant:"warning"})},createNoteFromTemplateInSelectedFolder:async()=>{if(!N.selectedFolder){de(d.fileSystem.errors.noFolderSelected,{variant:"warning"});return}let Xe=ty(r);Xe&&await Xe(N.selectedFolder)},moveSelectedFiles:async()=>{let Xe=je();if(Xe.length===0){de(d.fileSystem.errors.noFileSelected,{variant:"warning"});return}let Ht=N3(N,p,{includeDescendantNotes:v.current.includeDescendantNotes,showHiddenItems:v.current.showHiddenItems},r,s,l);await a.moveFilesWithModal(Xe,{selectedFile:N.selectedFile,dispatch:O,allFiles:Ht})},addShortcutForCurrentSelection:async()=>{let Xe=async(it,Yt)=>{if(it){await M(it);return}await Yt()},Ht=je();if(Ht.length>0){let it=Ht[0].path;await Xe(L.get(it),()=>_(it));return}if(N.selectedTag){let it=N.selectedTag,Yt=Ze(it);await Xe(Yt?V.get(Yt):void 0,()=>E(it));return}if(N.selectedProperty){let it=N.selectedProperty,Yt=it===Oe?Oe:Gt(it);await Xe(Yt?D.get(Yt):void 0,()=>R(it));return}if(N.selectedFolder){let it=N.selectedFolder.path;await Xe(X.get(it),()=>A(it));return}let vn=r.workspace.getActiveFile();if(vn){await Xe(L.get(vn.path),()=>_(vn.path));return}de(d.common.noSelection,{variant:"warning"})},navigateToFolder:ge,navigateToTag:be,navigateToProperty:me,addDateFilterToSearch:qe,navigateToFolderWithModal:()=>{new $h(r,Ht=>{ge(Ht,{preserveNavigationFocus:yt})},d.modals.folderSuggest.navigatePlaceholder,d.modals.folderSuggest.instructions.select,void 0).open()},navigateToTagWithModal:()=>{new Yb(r,i,Ht=>{be(Ht,{preserveNavigationFocus:yt})},d.modals.tagSuggest.navigatePlaceholder,d.modals.tagSuggest.instructions.select,!1).open()},navigateToPropertyWithModal:()=>{let Xe=l?Q9(l.getPropertyTree()):[];new AF(r,Xe,vn=>{me(vn,{preserveNavigationFocus:yt})},d.modals.propertySuggest.navigatePlaceholder,d.modals.propertySuggest.instructions.navigate).open()},addTagToSelectedFiles:async()=>{if(!u){de(d.fileSystem.notifications.tagOperationsNotAvailable,{variant:"warning"});return}let Xe=je();if(Xe.length===0){de(d.fileSystem.notifications.noFilesSelected,{variant:"warning"});return}$b({app:r,plugin:i,tagOperations:u,files:Xe})},setPropertyOnSelectedFiles:async()=>{let Xe=je();if(Xe.length===0){de(d.fileSystem.notifications.noFilesSelected,{variant:"warning"});return}if(!Xe.every(Yt=>Yt.extension==="md")){de(d.fileSystem.notifications.propertiesRequireMarkdown,{variant:"warning"});return}let vn=sR(p,l).map(Yt=>({nodeId:Yt.nodeId,label:Yt.label,searchText:Yt.label,noteCount:0}));if(vn.length===0){de(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"});return}new AF(r,vn,async Yt=>{await a.applyPropertyNodeToFiles(Yt,Xe)},d.modals.propertySuggest.placeholder,d.modals.propertySuggest.instructions.select).open()},removeTagFromSelectedFiles:async()=>{if(!u){de(d.fileSystem.notifications.tagOperationsNotAvailable,{variant:"warning"});return}let Xe=je();if(Xe.length===0){de(d.fileSystem.notifications.noFilesSelected,{variant:"warning"});return}await oR({app:r,tagOperations:u,files:Xe})},removeAllTagsFromSelectedFiles:async()=>{if(!u){de(d.fileSystem.notifications.tagOperationsNotAvailable,{variant:"warning"});return}let Xe=je();if(Xe.length===0){de(d.fileSystem.notifications.noFilesSelected,{variant:"warning"});return}aR({app:r,tagOperations:u,files:Xe})},toggleSearch:()=>{le.current?.toggleSearch()},triggerCollapse:()=>{Zt(),window.requestAnimationFrame(()=>{Kn()})},triggerSelectedItemCollapse:()=>{let Xe=ie.current?.triggerSelectedItemCollapse()??!1;return Xe&&window.requestAnimationFrame(()=>{Kn()}),Xe}}},[an,Pe,N,a,c,O,ge,be,me,ct,h.singlePane,h.currentSinglePaneView,yt,o,r,p,i,s,l,Kt,gn,u,Zt,Kn,ie,X,L,V,A,_,E,D,R,M,qe]),o?Be.push("nn-mobile"):(Be.push("nn-desktop"),Be.push(...nR(S))),h.singlePane?(Be.push("nn-single-pane"),Be.push(h.currentSinglePaneView==="navigation"?"show-navigation":"show-files")):(Be.push("nn-dual-pane"),Be.push(`nn-orientation-${y}`)),h.singlePane&&B&&Be.push("nn-suppress-pane-transitions"),h.singlePane&&se&&Be.push("nn-pane-transitioning"),Ve&&Be.push("nn-resizing"),(0,Ut.useEffect)(()=>{if(re.current){let je=p.navItemHeight,rt=ol.defaultItemHeight,Et=ol.defaultFontSize,Xe=p.navItemHeightScaleText,Ht=re.current.closest(".notebook-navigator"),vn=oZ(Ht),it=Et;Xe&&(je<=rt-6?it=Et-2:je<=rt-4&&(it=Et-1));let Yt=je+ol.mobileHeightIncrement,fr=it+ol.mobileFontSizeIncrement,Do=it/vn,ba=fr/vn;re.current.style.setProperty("--nn-setting-nav-item-height",`${je}px`),re.current.style.setProperty("--nn-setting-nav-item-height-mobile",`${Yt}px`),re.current.style.setProperty("--nn-setting-nav-font-size",`${Do}px`),re.current.style.setProperty("--nn-setting-nav-font-size-mobile",`${ba}px`),re.current.style.setProperty("--nn-setting-nav-indent",`${p.navIndent}px`),re.current.style.setProperty("--nn-nav-root-spacing",`${p.rootLevelSpacing}px`);let nl=VJ(p.featureImageSize);re.current.style.setProperty("--nn-file-thumbnail-max-size",`${nl.listMaxSize}px`);let{titleLineHeight:Cc}=aS(o),Sa=eR({compactItemHeight:p.compactItemHeight,scaleText:p.compactItemHeightScaleText,titleLineHeight:Cc}),So=Sa.fontSize/vn,qa=Sa.mobileFontSize/vn;re.current.style.setProperty("--nn-file-padding-vertical-compact",`${Sa.desktopPadding}px`),re.current.style.setProperty("--nn-file-padding-vertical-compact-mobile",`${Sa.mobilePadding}px`),re.current.style.setProperty("--nn-compact-font-size",`${So}px`),re.current.style.setProperty("--nn-compact-font-size-mobile",`${qa}px`)}},[p.navItemHeight,p.navItemHeightScaleText,p.navIndent,p.rootLevelSpacing,p.featureImageSize,p.compactItemHeight,p.compactItemHeightScaleText,o]),(0,Ut.useEffect)(()=>{re.current&&re.current.style.setProperty("--nn-pane-transition-duration",`${p.paneTransitionDuration}ms`)},[re,p.paneTransitionDuration]);let Jt=(0,Ut.useMemo)(()=>h.singlePane?{width:"100%",height:"100%"}:y==="vertical"?{width:"100%",flexBasis:`${Rt}px`,minHeight:`${I.minSize}px`}:{width:`${Rt}px`,height:"100%"},[h.singlePane,y,Rt,I.minSize]),$n=h.singlePane&&p.calendarEnabled&&f.showCalendar&&p.calendarPlacement==="left-sidebar"&&p.calendarLeftPlacement==="below",{folderNavigationSource:Xn,folderDecorationModel:Zn,navRainbowState:Ir}=Pae(),Jn=Uae({app:r,settings:p,activeProfile:m,folderNavigationSource:Xn,fileData:Y,hydratedShortcuts:C,showHiddenItems:f.showHiddenItems,includeDescendantNotes:f.includeDescendantNotes}),er=Lae({app:r,settings:p,expansionState:g,showHiddenItems:f.showHiddenItems,includeDescendantNotes:f.includeDescendantNotes,sourceState:Jn,selectionScope:x,tagTreeService:s,propertyTreeService:l}),On=Nae({sourceState:Jn,treeSections:er,includeDescendantNotes:f.includeDescendantNotes,navRainbowState:Ir}),Ro=(0,Ut.useMemo)(()=>({tagTree:Jn.tagTreeForOrdering,rootTagOrderMap:Jn.rootTagOrderMap,tagComparator:Jn.tagComparator,rootPropertyNavigationOrderMap:Ym(er.resolvedRootPropertyKeys)}),[er.resolvedRootPropertyKeys,Jn.rootTagOrderMap,Jn.tagComparator,Jn.tagTreeForOrdering]);return(0,qp.jsx)("div",{className:"nn-scale-wrapper","data-ui-scale":F,style:k,children:(0,qp.jsxs)("div",{ref:Ke,className:Be.join(" "),"data-focus-pane":h.singlePane?h.currentSinglePaneView==="navigation"?"navigation":"files":h.focusedPane,"data-navigator-focused":o?"true":oe,"data-nav-count-leader-style":p.navCountLeaderStyle,tabIndex:-1,onKeyDown:()=>{},children:[p.checkForUpdatesOnStart&&(0,qp.jsx)(fae,{notice:ee,onDismiss:$}),(0,qp.jsx)(c1,{ref:ie,style:Jt,uiScale:w,rootContainerRef:re,navigationSourceState:Jn,navigationTreeSections:er,folderDecorationModel:Zn,navRainbowState:Ir,searchNavFilters:ce,onExecuteSearchShortcut:te,onNavigateToFolder:ge,onRevealTag:fe,onRevealProperty:we,onRevealFile:Pe,onRevealShortcutFile:bn,onModifySearchWithTag:ve,onModifySearchWithProperty:Ie,onModifySearchWithDateFilter:qe}),(0,qp.jsx)(wre,{ref:le,rootContainerRef:re,folderDecorationModel:Zn,fileItemPillDecorationModel:On,fileItemPillOrderModel:Ro,onSearchTokensChange:Fe,onNavigateToFolder:ge,onRevealTag:fe,onRevealProperty:we,resizeHandleProps:h.singlePane?void 0:Ae}),$n?(0,qp.jsx)("div",{className:"nn-single-pane-calendar",children:(0,qp.jsx)(Up,{onWeekCountChange:wn,onAddDateFilter:qe})}):null]})})}))});var Yae,bo,$ae,Xae=U(()=>{Yae=ue(ze()),bo=ue(Ge()),$ae=Yae.default.memo(function({paneSize:e,singlePane:n,searchActive:r,orientation:o}){let a=r?"nn-skeleton-list-pane nn-search-active":"nn-skeleton-list-pane";return n?(0,bo.jsxs)("div",{className:a,children:[(0,bo.jsx)("div",{className:"nn-skeleton-list-header"}),r&&(0,bo.jsx)("div",{className:"nn-skeleton-search-bar"}),(0,bo.jsx)("div",{className:"nn-skeleton-content"})]}):o==="vertical"?(0,bo.jsxs)(bo.Fragment,{children:[(0,bo.jsxs)("div",{className:"nn-skeleton-navigation-pane nn-skeleton-navigation-pane-vertical",style:{flexBasis:`${e}px`},children:[(0,bo.jsx)("div",{className:"nn-skeleton-nav-header"}),(0,bo.jsx)("div",{className:"nn-skeleton-content"})]}),(0,bo.jsxs)("div",{className:`${a} nn-skeleton-list-pane-vertical`,children:[(0,bo.jsx)("div",{className:"nn-skeleton-list-header"}),r&&(0,bo.jsx)("div",{className:"nn-skeleton-search-bar"}),(0,bo.jsx)("div",{className:"nn-skeleton-content"})]})]}):(0,bo.jsxs)(bo.Fragment,{children:[(0,bo.jsxs)("div",{className:"nn-skeleton-navigation-pane",style:{width:`${e}px`},children:[(0,bo.jsx)("div",{className:"nn-skeleton-nav-header"}),(0,bo.jsx)("div",{className:"nn-skeleton-content"})]}),(0,bo.jsxs)("div",{className:a,children:[(0,bo.jsx)("div",{className:"nn-skeleton-list-header"}),r&&(0,bo.jsx)("div",{className:"nn-skeleton-search-bar"}),(0,bo.jsx)("div",{className:"nn-skeleton-content"})]})]})})});var qg,zP,Qae,Zae=U(()=>{qg=ue(ze());Xi();pa();on();mn();qae();Xae();Jr();Jv();wH();NH();Tr();zP=ue(Ge()),Qae=qg.default.memo((0,qg.forwardRef)(function(e,n){let{isStorageReady:r}=xo(),o=Yn(),a=pt(),i=Xt(),{isMobile:s}=gt(),l=o.effectiveDualPaneOrientation,c=a.desktopBackground??"separate",{style:u,dataAttr:p}=cR({isMobile:s,desktopScale:a.desktopScale,mobileScale:a.mobileScale}),{defaultSize:m,minSize:g,storageKey:f}=Yd(l),[h,b]=(0,qg.useState)(m);if((0,qg.useEffect)(()=>{let v=ye.get(f);if(typeof v=="number"&&Number.isFinite(v)){b(Math.max(g,v));return}if(typeof v=="string"){let y=Number(v);if(!Number.isNaN(y)&&Number.isFinite(y)){b(Math.max(g,y));return}}b(m)},[m,g,f]),!r){let v=["nn-split-container"];return s?v.push("nn-mobile"):(v.push("nn-desktop"),v.push(...nR(c))),o.singlePane?(v.push("nn-single-pane"),v.push(o.currentSinglePaneView==="navigation"?"show-navigation":"show-files")):(v.push("nn-dual-pane"),v.push(`nn-orientation-${l}`)),(0,zP.jsx)("div",{className:"nn-scale-wrapper","data-ui-scale":p,style:u,children:(0,zP.jsx)("div",{className:v.join(" "),children:(0,zP.jsx)($ae,{paneSize:h,singlePane:o.singlePane,searchActive:i.searchActive,orientation:l})})})}return(0,zP.jsx)(Gae,{ref:n})}))});function $f(t){return activeDocument.createElementNS(mNe,t)}function hNe(t){let e=$f("defs");if(!e.instanceOf(SVGDefsElement))return;let n=$f("filter");if(!n.instanceOf(SVGFilterElement))return;let r=n;r.setAttribute("id",gNe),r.setAttribute("x","-20%"),r.setAttribute("y","-20%"),r.setAttribute("width","140%"),r.setAttribute("height","140%"),r.setAttribute("color-interpolation-filters","sRGB");let o=$f("feGaussianBlur");if(!o.instanceOf(SVGFEGaussianBlurElement))return;let a=o;a.setAttribute("in","SourceGraphic"),a.setAttribute("stdDeviation","8"),a.setAttribute("result","blurred");let i=$f("feTurbulence");if(!i.instanceOf(SVGFETurbulenceElement))return;let s=i;s.setAttribute("type","fractalNoise"),s.setAttribute("baseFrequency","0.015"),s.setAttribute("numOctaves","2"),s.setAttribute("seed","2"),s.setAttribute("result","noise");let l=$f("feDisplacementMap");if(!l.instanceOf(SVGFEDisplacementMapElement))return;let c=l;c.setAttribute("in","blurred"),c.setAttribute("in2","noise"),c.setAttribute("scale","25"),c.setAttribute("xChannelSelector","R"),c.setAttribute("yChannelSelector","G"),c.setAttribute("result","displaced");let u=$f("feGaussianBlur");if(!u.instanceOf(SVGFEGaussianBlurElement))return;let p=u;p.setAttribute("in","displaced"),p.setAttribute("stdDeviation","1.5"),r.append(a,s,c,p),e.append(r),t.append(e)}function eie(){if(activeDocument.getElementById(Jae))return;let t=$f("svg");if(!t.instanceOf(SVGSVGElement))return;let e=t;e.setAttribute("id",Jae),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.classList.add("nn-svg-filters"),hNe(e),activeDocument.body.append(e)}var mNe,Jae,gNe,tie=U(()=>{mNe="http://www.w3.org/2000/svg",Jae="notebook-navigator-svg-filters",gNe="notebook-navigator-frosted"});var aie={};In(aie,{IOS_FLOATING_TOOLBARS_CLASS:()=>nw,NotebookNavigatorView:()=>BP,setupNotebookNavigatorViewContainer:()=>KD,teardownNotebookNavigatorViewContainer:()=>WD});function KD(t,e){t.empty(),t.classList.add("notebook-navigator");let n=Yp.Platform.isMobile;return n&&(t.classList.add("notebook-navigator-mobile"),Yp.Platform.isAndroidApp?(t.classList.add("notebook-navigator-android"),rZ(t)):Yp.Platform.isIosApp&&(t.classList.add("notebook-navigator-ios"),(e?.useFloatingToolbars??!0)&&t.classList.add(nw))),eie(),{isMobile:n}}function WD(t){bH(t),t.classList.remove("notebook-navigator"),t.classList.remove("notebook-navigator-mobile"),t.classList.remove("notebook-navigator-android"),t.classList.remove("notebook-navigator-ios"),t.classList.remove(nw),t.empty()}var rie,oie,Yp,Ed,nw,nie,BP,jD=U(()=>{rie=ue(ze()),oie=ue(i_()),Yp=require("obsidian");Zae();Qs();Ur();mn();on();Xi();pa();xg();qV();Ee();Ru();Ue();Tr();SH();tie();Ed=ue(Ge()),nw="notebook-navigator-ios-floating-toolbars",nie=0;BP=class extends Yp.ItemView{constructor(n,r){super(n);this.componentHandle=null;this.root=null;this.viewContainer=null;this.readyWaiters=new Set;this.wasMobileContainerVisible=!1;this.setComponentHandle=n=>{this.componentHandle=n,n&&this.resolveReadyWaiters(!0)};this.plugin=r,nie+=1,this.settingsUpdateListenerId=`notebook-navigator-view-${nie}`}resolveReadyWaiters(n){if(this.readyWaiters.size!==0){for(let r of this.readyWaiters)r(n);this.readyWaiters.clear()}}updatePlatformClasses(){let n=this.viewContainer;if(!n)return;let r=Yp.Platform.isIosApp&&this.plugin.settings.useFloatingToolbars;n.classList.toggle(nw,r)}getViewType(){return wa}getDisplayText(){return d.plugin.viewName}getIcon(){return vi}async onOpen(){let n=this.containerEl.children[1];if(!n.instanceOf(HTMLElement))return;this.componentHandle=null,this.viewContainer=n,this.wasMobileContainerVisible=!1;let{isMobile:r}=KD(n,{useFloatingToolbars:this.plugin.settings.useFloatingToolbars});if(this.plugin.registerSettingsUpdateListener(this.settingsUpdateListenerId,()=>{this.updatePlatformClasses()}),this.updatePlatformClasses(),this.root=(0,oie.createRoot)(n),this.root.render((0,Ed.jsx)(rie.default.StrictMode,{children:(0,Ed.jsx)(BM,{plugin:this.plugin,children:(0,Ed.jsx)(x7,{plugin:this.plugin,children:(0,Ed.jsx)(Cre,{plugin:this.plugin,children:(0,Ed.jsx)(DM,{plugin:this.plugin,children:(0,Ed.jsx)(m9,{children:(0,Ed.jsx)(D7,{app:this.plugin.app,api:this.plugin.api,children:(0,Ed.jsx)(K7,{children:(0,Ed.jsx)(l9,{app:this.plugin.app,api:this.plugin.api,tagTreeService:this.plugin.tagTreeService,propertyTreeService:this.plugin.propertyTreeService,onFileRename:(o,a)=>this.plugin.registerFileRenameListener(o,a),onFileRenameUnsubscribe:o=>this.plugin.unregisterFileRenameListener(o),isMobile:r,children:(0,Ed.jsx)(B7,{isMobile:r,children:(0,Ed.jsx)(Qae,{ref:this.setComponentHandle})})})})})})})})})})})),Yp.Platform.isAndroidApp){let o=()=>n.querySelector(".nn-split-container.nn-mobile")instanceof HTMLElement?(aZ(n),!0):!1,a=()=>!!o();if(!a()){let i=new MutationObserver(()=>{a()&&i.disconnect()});i.observe(n,{childList:!0,subtree:!0}),window.requestAnimationFrame(()=>{a()&&i.disconnect()}),window.setTimeout(()=>{if(a()){i.disconnect();return}window.setTimeout(()=>{if(a()){i.disconnect();return}window.setTimeout(()=>{a(),i.disconnect()},500)},200)},100),window.setTimeout(()=>i.disconnect(),500)}}}async onClose(){let n=this.containerEl.children[1];n.instanceOf(HTMLElement)&&(this.plugin.unregisterSettingsUpdateListener(this.settingsUpdateListenerId),this.viewContainer=null,this.wasMobileContainerVisible=!1,this.root?.unmount(),WD(n),this.componentHandle=null,this.resolveReadyWaiters(!1),this.root=null)}async whenReady(){return this.componentHandle?!0:this.root?new Promise(n=>{this.readyWaiters.add(n)}):!1}stopContentProcessing(){this.componentHandle?.stopContentProcessing()}async rebuildCache(){let n=this.componentHandle;if(!n)throw new Error("Navigator not ready");await n.rebuildCache()}navigateToFile(n,r){return this.componentHandle?.navigateToFile(n,r)??!1}navigateToFolder(n,r){return this.componentHandle?.navigateToFolder(n,r)??!1}navigateToTag(n,r){return this.componentHandle?.navigateToTag(n,r)??null}navigateToProperty(n,r){return this.componentHandle?.navigateToProperty(n,r)??null}revealFileInNearestFolder(n,r){this.componentHandle?.revealFileInNearestFolder(n,r)}focusVisiblePane(){this.componentHandle?.focusVisiblePane()}focusNavigationPane(){this.componentHandle?.focusNavigationPane()}isDualPaneAutoFallbackActive(){return this.componentHandle?.isDualPaneAutoFallbackActive()??!1}deleteSelectedFiles(){this.componentHandle?.deleteSelectedFiles()}async mergeSelectedFiles(){await this.componentHandle?.mergeSelectedFiles()}async createNoteInSelectedFolder(n=!1){await this.componentHandle?.createNoteInSelectedFolder(n)}async createNoteFromTemplateInSelectedFolder(){await this.componentHandle?.createNoteFromTemplateInSelectedFolder()}async moveSelectedFiles(){await this.componentHandle?.moveSelectedFiles()}async navigateBack(){return await this.componentHandle?.navigateBack()??!1}async navigateForward(){return await this.componentHandle?.navigateForward()??!1}async selectNextFileInCurrentView(){return await this.componentHandle?.selectNextFile()??!1}async selectPreviousFileInCurrentView(){return await this.componentHandle?.selectPreviousFile()??!1}async addShortcutForCurrentSelection(){await this.componentHandle?.addShortcutForCurrentSelection()}async openShortcutByNumber(n){return await this.componentHandle?.openShortcutByNumber(n)??!1}async navigateToFolderWithModal(){this.componentHandle?.navigateToFolderWithModal()}async navigateToTagWithModal(){this.componentHandle?.navigateToTagWithModal()}async navigateToPropertyWithModal(){this.componentHandle?.navigateToPropertyWithModal()}addDateFilterToSearch(n){this.componentHandle?.addDateFilterToSearch(n)}async addTagToSelectedFiles(){await this.componentHandle?.addTagToSelectedFiles()}async setPropertyOnSelectedFiles(){await this.componentHandle?.setPropertyOnSelectedFiles()}async removeTagFromSelectedFiles(){await this.componentHandle?.removeTagFromSelectedFiles()}async removeAllTagsFromSelectedFiles(){await this.componentHandle?.removeAllTagsFromSelectedFiles()}toggleSearch(){this.componentHandle?.toggleSearch()}triggerCollapse(){this.componentHandle?.triggerCollapse()}triggerSelectedItemCollapse(){return this.componentHandle?.triggerSelectedItemCollapse()??!1}onResize(){if(!Yp.Platform.isMobile)return;let n=this.containerEl.getBoundingClientRect();if(!(n.width>0&&n.height>0)){this.wasMobileContainerVisible=!1;return}this.wasMobileContainerVisible||(this.wasMobileContainerVisible=!0,window.dispatchEvent(new CustomEvent("notebook-navigator-visible")))}}});function sie(){let{app:t,plugin:e}=gt(),n=pt(),r=(0,ya.useRef)(!0),o=(0,ya.useRef)(n);o.current=n;let a=(0,ya.useRef)(n),i=(0,ya.useRef)(null),s=(0,ya.useRef)([]),l=(0,ya.useRef)(new Set),[c,u]=(0,ya.useState)(()=>Ig()),p=(0,ya.useCallback)(()=>{if(!i.current){let b=new Db(t),v=new Rb;v.registerProvider(new Ob(t,b)),i.current=v}return i.current},[t]),m=(0,ya.useCallback)(b=>{if(c||Ig()||b.length===0)return;let v=b.filter(y=>y.extension==="md");v.length!==0&&p().queueFilesForAllProviders(v,o.current,{include:["markdownPipeline"]})},[p,c]);(0,ya.useEffect)(()=>(r.current=!0,()=>{r.current=!1,i.current?.stopAllProcessing(),i.current=null}),[]),(0,ya.useEffect)(()=>R7(u),[]),(0,ya.useEffect)(()=>{if(c){i.current?.stopAllProcessing();return}m(s.current)},[m,c]),(0,ya.useEffect)(()=>{let b=t.vault.on("modify",v=>{c||!(v instanceof iie.TFile)||v.extension!=="md"||l.current.has(v.path)&&m([v])});return()=>{t.vault.offref(b)}},[t.vault,m,c]),(0,ya.useEffect)(()=>{let b=a.current;if(a.current=n,b===n||c||Ig())return;let{shouldClearFeatureImage:v,shouldClearPreview:y}=CM({oldSettings:b,newSettings:n}),S=b.showFeatureImage!==n.showFeatureImage&&n.showFeatureImage;if(!v&&!y&&!S)return;let w=new Map;s.current.forEach(P=>{P.extension==="md"&&w.set(P.path,P)});let k=Array.from(w.values());if(k.length===0)return;let F=i.current;F?.stopAllProcessing(),Q(async()=>{if(await F?.getProvider("markdownPipeline")?.waitForIdle(),!r.current||Ig())return;let P=kt(),T=k.map(I=>I.path);y&&await P.batchClearFileContent(T,"preview"),v&&await P.batchClearFileContent(T,"featureImage"),!(!r.current||Ig())&&m(k)})},[m,n,c]);let g=(0,ya.useCallback)(b=>{Q(async()=>{let v=e.getNavigatorLeaves(),y=!0;v.length===0&&(await e.activateView(),v=e.getNavigatorLeaves(),y=!1);let S=v[0];if(!S)return;let w=S.view;w instanceof BP&&(w.addDateFilterToSearch(b),y&&await t.workspace.revealLeaf(S))})},[t.workspace,e]),f=(0,ya.useCallback)(b=>{s.current=b,l.current=new Set(b.map(v=>v.path)),m(b)},[m]),h=(0,ya.useCallback)(b=>{Q(async()=>{c||!n.showFeatureImage||b.file.extension!=="md"||(await kt().clearFileContent(b.file.path,"featureImage"),!r.current||Ig())||m([b.file])})},[m,n.showFeatureImage,c]);return(0,GD.jsx)("div",{className:"nn-calendar-right-sidebar nn-list-pane",children:(0,GD.jsx)("div",{className:"nn-calendar-right-sidebar-content",children:(0,GD.jsx)(Up,{weeksToShowOverride:6,onAddDateFilter:g,onMissingFeatureImage:h,onVisibleCalendarNoteFilesChange:f,isRightSidebar:!0})})})}var ya,iie,GD,lie=U(()=>{ya=ue(ze()),iie=require("obsidian");mn();on();Xi();ot();zn();x_();E_();B_();jD();lP();GD=ue(Ge())});var pie={};In(pie,{NotebookNavigatorCalendarView:()=>m1});var cie,uie,qD,_P,die,m1,mie=U(()=>{cie=ue(ze()),uie=ue(i_()),qD=require("obsidian");on();mn();lie();Ru();Ee();Ue();jD();_P=ue(Ge()),die=0,m1=class extends qD.ItemView{constructor(n,r){super(n);this.root=null;this.viewContainer=null;this.plugin=r,die+=1,this.settingsUpdateListenerId=`notebook-navigator-calendar-view-${die}`}updatePlatformClasses(){let n=this.viewContainer;if(!n)return;let r=qD.Platform.isIosApp&&this.plugin.settings.useFloatingToolbars;n.classList.toggle(nw,r)}getViewType(){return Au}getDisplayText(){return d.plugin.calendarViewName}getIcon(){return vi}async onOpen(){if(!this.plugin.settings.calendarEnabled){this.leaf.detach();return}let n=this.containerEl.children[1];n.instanceOf(HTMLElement)&&(this.viewContainer=n,KD(n,{useFloatingToolbars:this.plugin.settings.useFloatingToolbars}),this.plugin.registerSettingsUpdateListener(this.settingsUpdateListenerId,()=>{this.updatePlatformClasses()}),this.updatePlatformClasses(),this.root=(0,uie.createRoot)(n),this.root.render((0,_P.jsx)(cie.default.StrictMode,{children:(0,_P.jsx)(BM,{plugin:this.plugin,children:(0,_P.jsx)(DM,{plugin:this.plugin,children:(0,_P.jsx)(sie,{})})})})))}async onClose(){this.plugin.unregisterSettingsUpdateListener(this.settingsUpdateListenerId),this.viewContainer=null;let n=this.containerEl.children[1];n.instanceOf(HTMLElement)&&(this.root?.unmount(),WD(n),this.root=null)}stopContentProcessing(){this.root?.unmount(),this.root=null}}});var hie={};In(hie,{FolderNoteSidebarPlaceholderView:()=>g1});var gie,g1,fie=U(()=>{gie=require("obsidian");Ru();Ee();Ue();g1=class extends gie.ItemView{constructor(e){super(e)}getViewType(){return ih}getDisplayText(){return d.plugin.folderNoteSidebarViewName}getIcon(){return vi}async onOpen(){let e=this.containerEl.children[1];e.instanceOf(HTMLElement)&&e.empty()}}});var yie={};In(yie,{WelcomeModal:()=>h1});var vie,h1,bie=U(()=>{vie=require("obsidian");jl();Ee();Ql();h1=class extends vie.Modal{constructor(){super(...arguments);this.domDisposers=[];this.openVideoButton=null}onOpen(){let n=d.plugin.viewName,r=hU();this.modalEl.addClass("nn-welcome-modal"),this.titleEl.setText(d.modals.welcome.title.replace("{pluginName}",n)),this.contentEl.empty(),this.attachCloseButtonHandler();let o=this.contentEl.createDiv({cls:"nn-welcome-body"});[d.modals.welcome.introText,d.modals.welcome.continueText,d.modals.welcome.thanksText].forEach(p=>{o.createEl("p",{text:p,cls:"nn-welcome-text"})}),o.createEl("a",{cls:"nn-welcome-thumbnail-link",attr:{href:r,target:"_blank",rel:"noopener noreferrer"}}).createDiv({cls:"nn-welcome-thumbnail-frame"}).createEl("img",{cls:"nn-welcome-thumbnail",attr:{src:fU,alt:d.modals.welcome.videoAlt,width:"1920",height:"1080"}});let l=this.contentEl.createDiv({cls:"nn-welcome-buttons"}),c=l.createEl("button",{text:d.modals.welcome.openVideoButton,cls:"mod-cta"});c.setAttr("type","button"),this.domDisposers.push(St(c,"click",()=>{window.open(r),this.close()})),this.openVideoButton=c;let u=l.createEl("button",{text:d.modals.welcome.closeButton});u.setAttr("type","button"),this.domDisposers.push(St(u,"click",()=>{this.close()}))}open(){super.open(),window.requestAnimationFrame(()=>{this.openVideoButton?.focus()})}onClose(){this.contentEl.empty(),this.modalEl.removeClass("nn-welcome-modal"),this.openVideoButton=null,this.domDisposers.length&&(this.domDisposers.forEach(n=>{try{n()}catch(r){console.error("Error disposing welcome modal listener:",r)}}),this.domDisposers=[])}attachCloseButtonHandler(){let n=this.modalEl.querySelector(".modal-close-button");if(!n)return;let r=o=>{o.preventDefault(),this.close()};this.domDisposers.push(St(n,"click",r)),this.domDisposers.push(St(n,"pointerdown",r))}}});function HP(t,e){return t instanceof Error?t:new Error(e)}function Sie(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.id=="string"&&typeof e.version=="string"&&typeof e.mimeType=="string"&&e.data instanceof ArrayBuffer&&e.metadataFormat==="json"&&typeof e.metadata=="string"&&typeof e.updated=="number"}var YD,wie=U(()=>{YD=class t{constructor(e){this.db=null;this.initPromise=null;let n=e.appId||"default";this.dbName=`notebooknavigator/icons/${n}`}static{this.STORE_NAME="providers"}async init(){if(!this.db)return this.initPromise?this.initPromise:(this.initPromise=this.openDatabase().catch(e=>{throw this.initPromise=null,e}),this.initPromise)}close(){this.db&&(this.db.close(),this.db=null)}async get(e){return await this.init(),new Promise((n,r)=>{if(!this.db){r(new Error("Icon asset database not initialized"));return}let i=this.db.transaction([t.STORE_NAME],"readonly").objectStore(t.STORE_NAME).get(e);i.onsuccess=()=>{let s=i.result;if(s==null){n(null);return}if(Sie(s)){n(s);return}n(null)},i.onerror=()=>{r(HP(i.error,"Failed to fetch icon asset"))}})}async put(e){return await this.init(),new Promise((n,r)=>{if(!this.db){r(new Error("Icon asset database not initialized"));return}let i=this.db.transaction([t.STORE_NAME],"readwrite").objectStore(t.STORE_NAME).put(e);i.onsuccess=()=>n(),i.onerror=()=>{r(HP(i.error,"Failed to store icon asset"))}})}async delete(e){return await this.init(),new Promise((n,r)=>{if(!this.db){r(new Error("Icon asset database not initialized"));return}let i=this.db.transaction([t.STORE_NAME],"readwrite").objectStore(t.STORE_NAME).delete(e);i.onsuccess=()=>n(),i.onerror=()=>{r(HP(i.error,"Failed to delete icon asset"))}})}async getAll(){return await this.init(),new Promise((e,n)=>{if(!this.db){n(new Error("Icon asset database not initialized"));return}let a=this.db.transaction([t.STORE_NAME],"readonly").objectStore(t.STORE_NAME).getAll();a.onsuccess=()=>{let i=a.result;if(!Array.isArray(i)){e([]);return}let s=[];for(let l of i)Sie(l)&&s.push(l);e(s)},a.onerror=()=>{n(HP(a.error,"Failed to fetch icon assets"))}})}async openDatabase(){return new Promise((e,n)=>{let r=indexedDB.open(this.dbName,1);r.onupgradeneeded=o=>{let a=o.target.result;a.objectStoreNames.contains(t.STORE_NAME)||a.createObjectStore(t.STORE_NAME,{keyPath:"id"})},r.onsuccess=()=>{this.db=r.result,this.db&&(this.db.onversionchange=()=>{try{this.db?.close()}catch{}this.db=null}),e()},r.onerror=()=>{n(HP(r.error,"Failed to open icon asset database"))},r.onblocked=()=>{n(new Error("Icon asset database open blocked"))}})}}});var tl,Xf=U(()=>{Sy();tl=class{constructor(e){this.fontFace=null;this.fontLoadPromise=null;this.iconDefinitions=[];this.iconLookup=new Map;this.fontFamily=e.fontFamily,this.version=e.record?.version??null,this.parseMetadata(e.record.metadata),this.ensureFontLoaded(e.record.data)}dispose(){if(this.fontFace){try{this.removeFontFromDocument(this.fontFace)}catch(e){console.error(`${this.getLogPrefix()} Failed to delete font face`,e)}this.fontFace=null}}isAvailable(){return this.iconDefinitions.length>0}render(e,n,r){let o=this.iconLookup.get(n);return _m(e),o?(e.addClass("nn-iconfont"),e.addClass(this.getCssClass()),e.setText(this.unicodeToGlyph(o.unicode)),r?(e.style.fontSize=`${r}px`,e.style.width=`${r}px`,e.style.height=`${r}px`,e.style.lineHeight=`${r}px`):(e.style.removeProperty("font-size"),e.style.removeProperty("width"),e.style.removeProperty("height"),e.style.removeProperty("line-height")),this.fontLoadPromise?.catch(()=>{}),"rendered"):"not-found"}search(e){let n=e.trim().toLowerCase();if(!n)return[];let r=[];for(let o of this.iconDefinitions){let s=(this.iconLookup.get(o.id)?.keywords??[]).map(p=>p.toLowerCase()),l=o.displayName?.toLowerCase()??"",c=o.id.toLowerCase(),u=this.resolveMatchScore(n,c,l,s);u!==null&&r.push({icon:o,score:u,name:l||c,id:o.id})}return r.sort((o,a)=>{if(o.score!==a.score)return o.score-a.score;let i=o.name.localeCompare(a.name);return i!==0?i:o.id.localeCompare(a.id)}),r.map(o=>o.icon)}getAll(){return this.iconDefinitions}getVersion(){return this.version}setIconData(e,n){this.iconDefinitions=e,this.iconLookup=n}clearIconData(){this.iconDefinitions=[],this.iconLookup.clear()}logParseError(e,n){console.error(`${this.getLogPrefix()} ${e}`,n)}ensureFontLoaded(e){if(typeof document>"u"||typeof FontFace>"u")return;let n=new FontFace(this.fontFamily,e);this.fontLoadPromise=n.load().then(r=>(this.addFontToDocument(r),this.fontFace=r,r)).catch(r=>{throw console.error(`${this.getLogPrefix()} Failed to load font`,r),r})}unicodeToGlyph(e){try{return String.fromCodePoint(parseInt(e,16))}catch{return""}}addFontToDocument(e){if(typeof document>"u")return;activeDocument.fonts.add?.(e)}removeFontFromDocument(e){if(typeof document>"u")return;activeDocument.fonts.delete?.(e)}resolveMatchScore(e,n,r,o){return n===e?0:r&&r===e?1:o.includes(e)?2:n.startsWith(e)?3:r&&r.startsWith(e)?4:o.some(a=>a.startsWith(e))?5:n.includes(e)?6:r&&r.includes(e)?7:o.some(a=>a.includes(e))?8:null}getLogPrefix(){return`[${this.name}]`}}});var $D,Tie=U(()=>{Xf();$D=class extends tl{constructor(n){super(n);this.id="fontawesome-solid";this.name="Font Awesome"}getCssClass(){return"nn-iconfont-fa-solid"}parseMetadata(n){try{let r=JSON.parse(n),o=[],a=new Map;for(let[i,s]of Object.entries(r)){if(!s||!s.unicode||Array.isArray(s.styles)&&!s.styles.includes("solid"))continue;let l=new Set;l.add(i),s.search?.terms?.forEach(u=>l.add(u.toLowerCase())),s.aliases?.names?.forEach(u=>l.add(u.toLowerCase()));let c=s.label||this.formatDisplayName(i);o.push({id:i,displayName:c,keywords:Array.from(l)}),a.set(i,{unicode:s.unicode,keywords:Array.from(l)})}this.setIconData(o,a)}catch(r){this.logParseError("Failed to parse metadata",r),this.clearIconData()}}formatDisplayName(n){return n.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}}});var XD,kie=U(()=>{Xf();XD=class extends tl{constructor(n){super(n);this.id="rpg-awesome";this.name="RPG Awesome"}getCssClass(){return"nn-iconfont-rpg-awesome"}parseMetadata(n){try{let r=JSON.parse(n),o=[],a=new Map;Array.isArray(r)?r.forEach(i=>this.addEntry(i,o,a)):Object.entries(r).forEach(([i,s])=>{if(typeof s=="string"){this.addEntry({id:i,unicode:s},o,a);return}let l=s;this.addEntry({id:l.id??i,name:l.name,unicode:l.unicode||"",keywords:l.keywords,categories:l.categories},o,a)}),this.setIconData(o,a)}catch(r){this.logParseError("Failed to parse metadata",r),this.clearIconData()}}addEntry(n,r,o){if(!n||!n.id||!n.unicode)return;let a=new Set;a.add(n.id),n.keywords?.forEach(s=>a.add(s.toLowerCase())),n.categories?.forEach(s=>a.add(s.toLowerCase()));let i=n.name||this.formatDisplayName(n.id);r.push({id:n.id,displayName:i,keywords:Array.from(a)}),o.set(n.id,{unicode:n.unicode,keywords:Array.from(a)})}formatDisplayName(n){return n.replace(/^ra-/,"").split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}}});var QD,Fie=U(()=>{Xf();QD=class extends tl{constructor(n){super(n);this.id="bootstrap-icons";this.name="Bootstrap Icons"}getCssClass(){return"nn-iconfont-bootstrap-icons"}parseMetadata(n){try{let r=JSON.parse(n),o=[],a=new Map;Object.entries(r).forEach(([i,s])=>{let l=this.normalizeUnicodeValue(s);if(!l)return;let c=new Set;c.add(i),i.split("-").forEach(p=>{p&&c.add(p.toLowerCase())});let u=this.formatDisplayName(i);o.push({id:i,displayName:u,keywords:Array.from(c)}),a.set(i,{unicode:l,keywords:Array.from(c)})}),this.setIconData(o,a)}catch(r){this.logParseError("Failed to parse metadata",r),this.clearIconData()}}normalizeUnicodeValue(n){if(typeof n=="number")return!Number.isFinite(n)||n<=0?null:n.toString(16);let r=n.trim();if(!r)return null;if(/^[0-9]+$/.test(r)){let o=parseInt(r,10);return Number.isNaN(o)||o<=0?null:o.toString(16)}return/^0x[0-9a-f]+$/i.test(r)?r.slice(2).toLowerCase():/^[0-9a-f]+$/i.test(r)?r.toLowerCase():null}formatDisplayName(n){return n.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}}});var ZD,Pie=U(()=>{Xf();ZD=class extends tl{constructor(n){super(n);this.id="material-icons";this.name="Material Icons"}getCssClass(){return"nn-iconfont-material-icons"}parseMetadata(n){try{let r=JSON.parse(n),o=[],a=new Map;Object.entries(r).forEach(([i,s])=>{if(!s||!s.unicode)return;let l=new Set;l.add(i),s.search?.forEach(u=>l.add(u.toLowerCase())),i.split(/[-_]/g).forEach(u=>{u&&l.add(u.toLowerCase())}),s.label&&l.add(s.label.toLowerCase());let c=s.label||this.formatDisplayName(i);o.push({id:i,displayName:c,keywords:Array.from(l)}),a.set(i,{unicode:s.unicode,keywords:Array.from(l)})}),this.setIconData(o,a)}catch(r){this.logParseError("Failed to parse metadata",r),this.clearIconData()}}formatDisplayName(n){return n.split(/[-_]/g).map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}}});var JD,Cie=U(()=>{Xf();JD=class extends tl{constructor(n){super(n);this.id="phosphor";this.name="Phosphor Icons"}getCssClass(){return"nn-iconfont-phosphor"}parseMetadata(n){try{let r=JSON.parse(n),o=[],a=new Map;r.forEach(i=>{if(!i||!i.id||!i.unicode)return;let s=new Set;s.add(i.id),i.keywords?.forEach(c=>s.add(c.toLowerCase())),i.categories?.forEach(c=>s.add(c.toLowerCase()));let l=i.name||this.formatDisplayName(i.id);o.push({id:i.id,displayName:l,keywords:Array.from(s)}),a.set(i.id,{unicode:i.unicode,keywords:Array.from(s)})}),this.setIconData(o,a)}catch(r){this.logParseError("Failed to parse metadata",r),this.clearIconData()}}formatDisplayName(n){return n.replace(/^ph-/,"").split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}}});var eA,Nie=U(()=>{Xf();eA=class extends tl{constructor(n){super(n);this.id="simple-icons";this.name="Simple Icons"}getCssClass(){return"nn-iconfont-simple-icons"}parseMetadata(n){try{let r=JSON.parse(n),o=[],a=new Map;Object.entries(r).forEach(([i,s])=>{if(!this.isValidRecord(s))return;let l=s.unicode.trim();if(!l)return;let c=new Set;c.add(i);let u=this.normalizeLabel(s.label);u&&c.add(u.toLowerCase()),this.normalizeSearchTerms(s.search).forEach(g=>{c.add(g.toLowerCase())}),i.split("-").forEach(g=>{let f=g.trim().toLowerCase();f&&c.add(f)});let p=u||this.formatDisplayName(i),m=Array.from(c);o.push({id:i,displayName:p,keywords:m}),a.set(i,{unicode:l,keywords:m})}),this.setIconData(o,a)}catch(r){this.logParseError("Failed to parse metadata",r),this.clearIconData()}}formatDisplayName(n){return n.split("-").map(r=>r.charAt(0).toUpperCase()+r.slice(1)).join(" ")}isValidRecord(n){return n?typeof n.unicode=="string":!1}normalizeLabel(n){if(n==null||typeof n!="string")return null;let r=n.trim();return r||null}normalizeSearchTerms(n){if(n==null)return[];if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"){let r=String(n).trim();return r?[r]:[]}return Array.isArray(n)?this.collectKeywordsFromArray(n):typeof n=="object"?this.collectKeywordsFromObject(n):[]}collectKeywordsFromArray(n){let r=[];return n.forEach(o=>{if(Array.isArray(o)){o.forEach(i=>{let s=this.normalizePrimitiveValue(i);s&&r.push(s)});return}let a=this.normalizePrimitiveValue(o);a&&r.push(a)}),r}collectKeywordsFromObject(n){let r=[];return Object.values(n).forEach(o=>{if(Array.isArray(o)){o.forEach(i=>{let s=this.normalizePrimitiveValue(i);s&&r.push(s)});return}let a=this.normalizePrimitiveValue(o);a&&r.push(a)}),r}normalizePrimitiveValue(n){return n===null?null:String(n).trim()||null}}});var Iie,xie=U(()=>{Iie={"bootstrap-icons":{version:"1.13.1",font:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/bootstrap-icons/bootstrap-icons.woff2",metadata:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/bootstrap-icons/bootstrap-icons.json",fontMimeType:"font/woff2",metadataFormat:"json"},"fontawesome-solid":{version:"7.2.0",font:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/fontawesome/fa-solid-900.woff2",metadata:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/fontawesome/icons-solid.json",fontMimeType:"font/woff2",metadataFormat:"json"},"material-icons":{version:"145",font:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/material-icons/MaterialIcons-Regular.woff2",metadata:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/material-icons/icons.json",fontMimeType:"font/woff2",metadataFormat:"json"},phosphor:{version:"2.1.2",font:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/phosphor/phosphor-regular.woff2",metadata:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/phosphor/icons.json",fontMimeType:"font/woff2",metadataFormat:"json"},"rpg-awesome":{version:"0.2.0",font:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/rpg-awesome/rpgawesome-webfont.woff",metadata:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/rpg-awesome/icons.json",fontMimeType:"font/woff",metadataFormat:"json"},"simple-icons":{version:"16.22.0",font:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/simple-icons/SimpleIcons.woff2",metadata:"https://raw.githubusercontent.com/johansan/notebook-navigator/main/icon-assets/simple-icons/simple-icons.json",fontMimeType:"font/woff2",metadataFormat:"json"}}});var Eie={};In(Eie,{ExternalIconProviderController:()=>f1});var tA,f1,Mie=U(()=>{tA=require("obsidian");wie();Mh();Tie();kie();Fie();Pie();Cie();Nie();Ee();Kw();xie();Fn();Ot();f1=class{constructor(e,n,r){this.downloadChain=Promise.resolve();this.downloadTasks=new Map;this.installedProviders=new Set;this.providerVersions=new Map;this.activeProviders=new Map;this.failedActivationNoticeProviders=new Set;this.removalNoticeProviders=new Set;this.recoveryTasks=new Map;this.recoveryAttempts=new Map;this.updateNoticeProviders=new Set;this.isInitialized=!1;this.iconService=n,this.settingsProvider=r,this.database=new YD(e)}async initialize(){if(this.isInitialized)return;await this.database.init(),(await this.database.getAll()).forEach(n=>{let r=n.id;Bs[r]&&(this.installedProviders.add(r),this.providerVersions.set(r,n.version))}),await this.removeDisabledProviders(),this.isInitialized=!0,await this.applyBundledUpdates()}dispose(){this.activeProviders.forEach(e=>{e.provider.dispose?.()}),this.activeProviders.clear(),this.database.close(),this.isInitialized=!1}isProviderInstalled(e){return this.installedProviders.has(e)}isProviderDownloading(e){return this.downloadTasks.has(e)}getProviderVersion(e){return this.providerVersions.get(e)??null}async installProvider(e,n={}){await this.ensureInitialized();let r=this.downloadTasks.get(e);if(r)return r;let o=this.enqueue(async()=>{let a=this.requireProviderConfig(e),i=n.manifest??await this.fetchManifest(a),s=await this.downloadAssets(a,i);await this.database.put(s),this.installedProviders.add(e),this.providerVersions.set(e,s.version),this.removalNoticeProviders.delete(e),n.persistSetting!==!1&&this.markProviderSetting(e,!0);let l=await this.activateIfEnabled(a,s);l&&!n.suppressDownloadNotice&&this.showDownloadNotice(a),n.persistSetting!==!1?await this.settingsProvider.saveSettingsAndUpdate():l&&this.settingsProvider.notifySettingsUpdate()});this.downloadTasks.set(e,o);try{await o}finally{this.downloadTasks.delete(e)}}async applyBundledUpdates(){let e=[];Object.entries(Iie).forEach(([n,r])=>{if(!this.installedProviders.has(n))return;let o=this.providerVersions.get(n);if(!o||_d(r.version,o)<=0)return;let a=this.requireProviderConfig(n);e.push(this.installProvider(n,{persistSetting:!1,manifest:r,suppressDownloadNotice:!0}).then(async()=>{let i=this.providerVersions.get(n);!i||_d(i,o)<=0||this.updateNoticeProviders.has(n)||(this.updateNoticeProviders.add(n),this.showUpdateNotice(a,i))}).catch(i=>{console.error(`[IconProviders] Failed to update ${n} to version ${r.version}:`,i)}))}),e.length!==0&&await Promise.all(e)}async removeProvider(e,n={}){await this.ensureInitialized();let r=this.requireProviderConfig(e),o=this.downloadTasks.get(e);if(o)try{await o}catch{}await this.enqueue(async()=>{let a=this.deactivateProvider(r.id);await this.database.delete(r.id),this.installedProviders.delete(r.id),this.providerVersions.delete(r.id),this.updateNoticeProviders.delete(r.id),this.showRemovalNotice(r),n.persistSetting!==!1?(this.markProviderSetting(r.id,!1),await this.settingsProvider.saveSettingsAndUpdate()):a&&this.settingsProvider.notifySettingsUpdate()})}async syncWithSettings(){await this.ensureInitialized();let e=this.settingsProvider.settings,n=De(e.externalIconProviders),r=[],o=!1;Object.keys(Bs).forEach(a=>{if(!!n[a]){let s=this.requireProviderConfig(a);r.push(this.ensureProviderAvailable(s,{persistSetting:!1}).catch(l=>{console.error(`[IconProviders] Failed to initialize provider ${a}:`,l)}))}else this.installedProviders.has(a)?(o=!0,r.push(this.removeProvider(a,{persistSetting:!1}).catch(s=>{console.error(`[IconProviders] Failed to remove provider ${a}:`,s)}))):this.deactivateProvider(a)&&(o=!0)}),await Promise.all(r),o&&this.settingsProvider.notifySettingsUpdate()}async ensureProviderAvailable(e,n){if(!this.isProviderInstalled(e.id)){await this.installProvider(e.id,n);return}let r=await this.database.get(e.id);if(!r){this.installedProviders.delete(e.id),this.providerVersions.delete(e.id),await this.installProvider(e.id,n);return}this.providerVersions.set(e.id,r.version),await this.activateIfEnabled(e,r)&&n.persistSetting===!1&&this.settingsProvider.notifySettingsUpdate()}markProviderSetting(e,n){let{settings:r}=this.settingsProvider,o=De(r.externalIconProviders);o[e]=n,r.externalIconProviders=o}deactivateProvider(e){let n=this.activeProviders.get(e),r=!1;return n&&(n.provider.dispose?.(),this.activeProviders.delete(e),r=!0),this.iconService.unregisterProvider(e),r}async activateIfEnabled(e,n){let r=this.settingsProvider.settings;if(!r.externalIconProviders||!r.externalIconProviders[e.id])return!1;let o=this.activeProviders.get(e.id);if(o&&o.version===n.version)return!1;o&&this.deactivateProvider(e.id);let a=this.createProvider(e,n);return a?a.isAvailable()?(this.iconService.registerProvider(a),this.iconService.getProvider(e.id)!==a?(a.dispose?.(),this.showActivationFailureNotice(e),this.scheduleRecovery(e),!1):(this.activeProviders.set(e.id,{provider:a,version:n.version}),this.failedActivationNoticeProviders.delete(e.id),this.recoveryAttempts.delete(e.id),this.removalNoticeProviders.delete(e.id),!0)):(a.dispose?.(),this.showActivationFailureNotice(e),this.scheduleRecovery(e),!1):(this.showActivationFailureNotice(e),this.scheduleRecovery(e),!1)}createProvider(e,n){switch(e.id){case"bootstrap-icons":return new QD({record:n,fontFamily:e.fontFamily});case"fontawesome-solid":return new $D({record:n,fontFamily:e.fontFamily});case"material-icons":return new ZD({record:n,fontFamily:e.fontFamily});case"phosphor":return new JD({record:n,fontFamily:e.fontFamily});case"rpg-awesome":return new XD({record:n,fontFamily:e.fontFamily});case"simple-icons":return new eA({record:n,fontFamily:e.fontFamily});default:return null}}async fetchManifest(e){let n=await(0,tA.requestUrl)({url:e.manifestUrl,method:"GET",headers:{"User-Agent":"NotebookNavigator/1.0 (Obsidian Plugin)",Accept:"application/json"},throw:!1});if(n.status!==200)throw new Error(`Manifest request for ${e.id} failed with status ${n.status}`);if(!n.json)throw new Error(`Manifest response for ${e.id} is empty`);return n.json}async downloadAssets(e,n){let r=await(0,tA.requestUrl)({url:n.font,method:"GET",headers:{"User-Agent":"NotebookNavigator/1.0 (Obsidian Plugin)"},throw:!1}),o=await(0,tA.requestUrl)({url:n.metadata,method:"GET",headers:{"User-Agent":"NotebookNavigator/1.0 (Obsidian Plugin)",Accept:"application/json"},throw:!1});if(r.status!==200)throw new Error(`Font download for ${e.id} failed with status ${r.status}`);if(o.status!==200)throw new Error(`Metadata download for ${e.id} failed with status ${o.status}`);let a=r.arrayBuffer,i=o.text;if(!a)throw new Error(`Failed to download font for provider ${e.id}`);if(!i)throw new Error(`Failed to download metadata for provider ${e.id}`);return{id:e.id,version:n.version,mimeType:n.fontMimeType??"font/woff2",data:a,metadataFormat:n.metadataFormat??"json",metadata:i,updated:Date.now()}}async ensureInitialized(){this.isInitialized||await this.initialize()}async removeDisabledProviders(){if(this.installedProviders.size===0)return;let n=this.settingsProvider.settings.externalIconProviders||{},r=[];this.installedProviders.forEach(o=>{n[o]||r.push(o)}),r.length!==0&&await Promise.all(r.map(async o=>{this.deactivateProvider(o),this.installedProviders.delete(o),this.providerVersions.delete(o),this.updateNoticeProviders.delete(o);try{await this.database.delete(o)}catch(a){console.error(`[IconProviders] Failed to delete cached assets for ${o}:`,a)}}))}enqueue(e){let n=async()=>{await e()},r=this.downloadChain.then(n);return this.downloadChain=r.then(()=>{}).catch(()=>{}),r}requireProviderConfig(e){let n=Bs[e];if(!n)throw new Error(`Unknown external icon provider: ${e}`);return n}showActivationFailureNotice(e){if(this.failedActivationNoticeProviders.has(e.id))return;this.failedActivationNoticeProviders.add(e.id);let n=d.fileSystem.notifications.iconPackLoadFailed.replace("{provider}",e.name);de(n,{variant:"warning"})}scheduleRecovery(e){let n=this.recoveryAttempts.get(e.id)??0;if(n>=1||this.recoveryTasks.has(e.id))return;this.recoveryAttempts.set(e.id,n+1);let r=this.enqueue(async()=>{this.deactivateProvider(e.id),this.installedProviders.delete(e.id),this.providerVersions.delete(e.id);try{await this.database.delete(e.id)}catch(o){console.error(`[IconProviders] Failed to delete cached assets for ${e.id} during recovery:`,o)}try{await this.installProvider(e.id,{persistSetting:!1})}catch(o){console.error(`[IconProviders] Failed to reinstall provider ${e.id} after activation failure:`,o)}}).catch(o=>{console.error(`[IconProviders] Recovery task for ${e.id} failed:`,o)}).finally(()=>{this.recoveryTasks.delete(e.id)});this.recoveryTasks.set(e.id,r)}showDownloadNotice(e){let n=d.fileSystem.notifications.iconPackDownloaded.replace("{provider}",e.name);de(n,{variant:"success"})}showRemovalNotice(e){if(this.removalNoticeProviders.has(e.id))return;this.removalNoticeProviders.add(e.id);let n=d.fileSystem.notifications.iconPackRemoved.replace("{provider}",e.name);de(n)}showUpdateNotice(e,n){let r=d.fileSystem.notifications.iconPackUpdated.replace("{provider}",e.name).replace("{version}",n);de(r,{variant:"success"})}}});var vNe={};In(vNe,{default:()=>nA});module.exports=Lr(vNe);var Pc=require("obsidian");var WI=require("obsidian");Ru();var KI=class extends WI.PluginSettingTab{constructor(n,r){super(n,r);this.delegate=null;this.plugin=r,this.icon=vi}getSettingDefinitions(){return(0,WI.requireApiVersion)("1.13.0")?this.getDelegate().getSettingDefinitions():[]}getControlValue(n){return this.getDelegate().getControlValue(n)}async setControlValue(n,r){await this.getDelegate().setControlValue(n,r)}display(){this.getDelegate().display()}hide(){if(this.delegate){this.syncDelegateContainer(),this.delegate.hide();return}super.hide()}getDelegate(){return this.delegate||(this.delegate=this.createDelegate()),this.syncDelegateContainer(),this.delegate}createDelegate(){let{NotebookNavigatorSettingTab:n}=(S$(),Lr(b$));return new n(this.app,this.plugin)}syncDelegateContainer(){this.delegate&&(this.delegate.containerEl=this.containerEl)}};Ue();var D$=require("obsidian");var tz=require("obsidian");zn();Ue();Ia();Si();$o();Ay();Ot();xn();Ue();dn();Si();Ot();var pd=class{constructor(e,n){this.app=e;this.updateQueue=Promise.resolve();this.settingsProvider=n}async saveAndUpdate(e){return this.updateQueue=this.updateQueue.then(async()=>{e(this.settingsProvider.settings)!==!1&&await this.settingsProvider.saveSettingsAndUpdate()}).catch(n=>{throw console.error("Failed to save metadata:",n),n}),this.updateQueue}updateShortcuts(e,n){return _N(e.vaultProfiles,r=>{let o=!1,a=[];for(let i of r){let s=n(i);if(s===void 0){a.push(i);continue}o=!0,s!==null&&a.push(s)}return o?a:null})}validateColor(e){return/^(#[0-9A-Fa-f]{3,8}|rgb\(|rgba\(|hsl\(|hsla\(|[a-zA-Z]+)$/.test(e)}async setEntityColor(e,n,r){await this.setEntityColorVariant(e,n,r,"color")}async removeEntityColor(e,n){await this.removeEntityColorVariant(e,n,"color")}getEntityColor(e,n){return this.getEntityColorVariant(e,n,"color")}async setEntityBackgroundColor(e,n,r){await this.setEntityColorVariant(e,n,r,"background")}async removeEntityBackgroundColor(e,n){await this.removeEntityColorVariant(e,n,"background")}getEntityBackgroundColor(e,n){return this.getEntityColorVariant(e,n,"background")}getColorRecordKey(e,n){return e===W.FOLDER?n==="color"?"folderColors":"folderBackgroundColors":e===W.TAG?n==="color"?"tagColors":"tagBackgroundColors":e===W.PROPERTY?n==="color"?"propertyColors":"propertyBackgroundColors":n==="color"?"fileColors":"fileBackgroundColors"}ensureColorRecord(e,n){let r=ln(e[n],Ln);return e[n]=r,r}async setEntityColorVariant(e,n,r,o){this.validateColor(r)&&await this.saveAndUpdate(a=>{let i=this.getColorRecordKey(e,o),s=this.ensureColorRecord(a,i);s[n]=r})}async removeEntityColorVariant(e,n,r){let o=this.getColorRecordKey(e,r),a=this.settingsProvider.settings[o];!a||!(n in a)||await this.saveAndUpdate(i=>{let s=i[o];s&&delete s[n]})}getEntityColorVariant(e,n,r){let o=this.getColorRecordKey(e,r);return this.settingsProvider.settings[o]?.[n]}async setEntityIcon(e,n,r){let o=qn(r);o&&await this.saveAndUpdate(a=>{if(e===W.FOLDER){let i=ln(a.folderIcons,Ln);i[n]=o,a.folderIcons=i}else if(e===W.TAG){let i=ln(a.tagIcons,Ln);i[n]=o,a.tagIcons=i}else if(e===W.PROPERTY){let i=ln(a.propertyIcons,Ln);i[n]=o,a.propertyIcons=i}else{let i=ln(a.fileIcons,Ln);i[n]=o,a.fileIcons=i}})}async removeEntityIcon(e,n){e===W.FOLDER&&this.settingsProvider.settings.folderIcons?.[n]?await this.saveAndUpdate(r=>{r.folderIcons&&delete r.folderIcons[n]}):e===W.TAG&&this.settingsProvider.settings.tagIcons?.[n]?await this.saveAndUpdate(r=>{r.tagIcons&&delete r.tagIcons[n]}):e===W.PROPERTY&&this.settingsProvider.settings.propertyIcons?.[n]?await this.saveAndUpdate(r=>{r.propertyIcons&&delete r.propertyIcons[n]}):e===W.FILE&&this.settingsProvider.settings.fileIcons?.[n]&&await this.saveAndUpdate(r=>{r.fileIcons&&delete r.fileIcons[n]})}readIconRecord(e,n){if(!e||!Object.prototype.hasOwnProperty.call(e,n))return;let r=e[n];if(typeof r=="string")return qn(r)}getEntityIcon(e,n){return e===W.FOLDER?this.readIconRecord(this.settingsProvider.settings.folderIcons,n):e===W.TAG?this.readIconRecord(this.settingsProvider.settings.tagIcons,n):e===W.PROPERTY?this.readIconRecord(this.settingsProvider.settings.propertyIcons,n):this.readIconRecord(this.settingsProvider.settings.fileIcons,n)}async setEntitySortOverride(e,n,r){await this.saveAndUpdate(o=>{let a=Oc(r);if(!a)return!1;if(e===W.FOLDER){let i=ln(o.folderSortOverrides),s=De(i);s[n]=a,o.folderSortOverrides=s;return}if(e===W.TAG){let i=ln(o.tagSortOverrides),s=De(i);s[n]=a,o.tagSortOverrides=s;return}if(e===W.PROPERTY){let i=ln(o.propertySortOverrides),s=De(i);s[n]=a,o.propertySortOverrides=s;return}return!1})}async removeEntitySortOverride(e,n){e===W.FOLDER&&this.settingsProvider.settings.folderSortOverrides?.[n]?await this.saveAndUpdate(r=>{let o=ln(r.folderSortOverrides),a=De(o);delete a[n],r.folderSortOverrides=a}):e===W.TAG&&this.settingsProvider.settings.tagSortOverrides?.[n]?await this.saveAndUpdate(r=>{let o=ln(r.tagSortOverrides),a=De(o);delete a[n],r.tagSortOverrides=a}):e===W.PROPERTY&&this.settingsProvider.settings.propertySortOverrides?.[n]&&await this.saveAndUpdate(r=>{let o=ln(r.propertySortOverrides),a=De(o);delete a[n],r.propertySortOverrides=a})}getEntitySortOverride(e,n){if(e===W.FOLDER)return this.settingsProvider.settings.folderSortOverrides?.[n];if(e===W.TAG)return this.settingsProvider.settings.tagSortOverrides?.[n];if(e===W.PROPERTY)return this.settingsProvider.settings.propertySortOverrides?.[n]}async setEntityChildSortOrderOverride(e,n,r){await this.saveAndUpdate(o=>{if(e===W.FOLDER){let a=ln(o.folderTreeSortOverrides),i=De(a);i[n]=r,o.folderTreeSortOverrides=i}else if(e===W.TAG){let a=ln(o.tagTreeSortOverrides),i=De(a);i[n]=r,o.tagTreeSortOverrides=i}else{let a=ln(o.propertyTreeSortOverrides),i=De(a);i[n]=r,o.propertyTreeSortOverrides=i}})}async removeEntityChildSortOrderOverride(e,n){if(e===W.FOLDER){let o=this.settingsProvider.settings.folderTreeSortOverrides;if(!o||!Object.prototype.hasOwnProperty.call(o,n))return;await this.saveAndUpdate(a=>{let i=ln(a.folderTreeSortOverrides),s=De(i);delete s[n],a.folderTreeSortOverrides=s});return}if(e===W.TAG){let o=this.settingsProvider.settings.tagTreeSortOverrides;if(!o||!Object.prototype.hasOwnProperty.call(o,n))return;await this.saveAndUpdate(a=>{let i=ln(a.tagTreeSortOverrides),s=De(i);delete s[n],a.tagTreeSortOverrides=s});return}let r=this.settingsProvider.settings.propertyTreeSortOverrides;!r||!Object.prototype.hasOwnProperty.call(r,n)||await this.saveAndUpdate(o=>{let a=ln(o.propertyTreeSortOverrides),i=De(a);delete i[n],o.propertyTreeSortOverrides=i})}getEntityChildSortOrderOverride(e,n){if(e===W.FOLDER){let o=this.settingsProvider.settings.folderTreeSortOverrides;return o&&Object.prototype.hasOwnProperty.call(o,n)?o[n]:void 0}if(e===W.TAG){let o=this.settingsProvider.settings.tagTreeSortOverrides;return o&&Object.prototype.hasOwnProperty.call(o,n)?o[n]:void 0}let r=this.settingsProvider.settings.propertyTreeSortOverrides;return r&&Object.prototype.hasOwnProperty.call(r,n)?r[n]:void 0}async cleanupMetadata(e,n,r){let o=e[n];if(!o||typeof o!="object"||Array.isArray(o))return!1;let a=!1,i=o,s=Object.keys(i);for(let l of s)r(l)||(delete i[l],a=!0);return a}updateNestedPaths(e,n,r,o=!1){if(!e)return!1;let a=`${n}/`,i=[];Object.prototype.hasOwnProperty.call(e,n)&&i.push({oldPath:n,newPath:r,value:e[n]});let s=Object.keys(e);for(let c of s)if(c.startsWith(a)){let u=`${r}/${c.slice(a.length)}`;i.push({oldPath:c,newPath:u,value:e[c]})}let l=!1;for(let c of i){if(c.oldPath===c.newPath)continue;if(!!Object.prototype.hasOwnProperty.call(e,c.newPath)&&o){c.oldPath!==c.newPath&&(delete e[c.oldPath],l=!0);continue}e[c.newPath]=c.value,delete e[c.oldPath],l=!0}return l}deleteNestedPaths(e,n){if(!e)return!1;let r=!1;for(let o in e)(o===n||o.startsWith(`${n}/`))&&(delete e[o],r=!0);return r}};Ot();var Fge=1e3,jI=class{constructor(){this.dataByKey=new Map;this.keysByFolderPath=new Map;this.folderPathByKey=new Map;this.folderNotePathByFolderPath=new Map;this.folderPathsByFolderNotePath=new Map;this.settingsSnapshot=null;this.styleSnapshot={icons:null,colors:null,backgrounds:null};this.styleSnapshotInitialized=!1}hasEntries(){return this.dataByKey.size>0}hasTrackedFolderNotePath(e){return this.folderPathsByFolderNotePath.has(e)}getTrackedFolderPaths(e){return this.folderPathsByFolderNotePath.get(e)}clear(){this.dataByKey.clear(),this.keysByFolderPath.clear(),this.folderPathByKey.clear(),this.folderNotePathByFolderPath.clear(),this.folderPathsByFolderNotePath.clear(),this.resetStyleSnapshot()}hasSettingsSnapshotChanged(e){return this.settingsSnapshot?this.settingsSnapshot.useFrontmatterMetadata!==e.useFrontmatterMetadata||this.settingsSnapshot.enableFolderNotes!==e.enableFolderNotes||this.settingsSnapshot.inheritFolderColors!==e.inheritFolderColors||this.settingsSnapshot.folderNoteName!==e.folderNoteName||this.settingsSnapshot.folderNoteNamePattern!==e.folderNoteNamePattern||this.settingsSnapshot.frontmatterNameField!==e.frontmatterNameField||this.settingsSnapshot.frontmatterIconField!==e.frontmatterIconField||this.settingsSnapshot.frontmatterColorField!==e.frontmatterColorField||this.settingsSnapshot.frontmatterBackgroundField!==e.frontmatterBackgroundField:!0}hasDisplayNameSettingsSnapshotChanged(e){return this.settingsSnapshot?this.settingsSnapshot.useFrontmatterMetadata!==e.useFrontmatterMetadata||this.settingsSnapshot.enableFolderNotes!==e.enableFolderNotes||this.settingsSnapshot.folderNoteName!==e.folderNoteName||this.settingsSnapshot.folderNoteNamePattern!==e.folderNoteNamePattern||this.settingsSnapshot.frontmatterNameField!==e.frontmatterNameField:!0}captureSettingsSnapshot(e){this.settingsSnapshot={...e}}isStyleSnapshotInitialized(){return this.styleSnapshotInitialized}hasStyleSnapshotChanged(e){return!this.areStringRecordsEqual(this.styleSnapshot.icons,e.icons)||!this.areStringRecordsEqual(this.styleSnapshot.colors,e.colors)||!this.areStringRecordsEqual(this.styleSnapshot.backgrounds,e.backgrounds)}captureStyleSnapshot(e){this.styleSnapshot={icons:this.cloneStringRecord(e.icons),colors:this.cloneStringRecord(e.colors),backgrounds:this.cloneStringRecord(e.backgrounds)},this.styleSnapshotInitialized=!0}get(e,n){let r=this.createCacheKey(e,n),o=this.dataByKey.get(r);if(o)return this.dataByKey.delete(r),this.dataByKey.set(r,o),o}set(e,n,r,o){let a=this.createCacheKey(e,n);this.removeEntry(a),this.dataByKey.set(a,r),this.styleSnapshotInitialized||this.captureStyleSnapshot(o);let i=this.keysByFolderPath.get(e);if(i?i.add(a):this.keysByFolderPath.set(e,new Set([a])),this.folderPathByKey.set(a,e),this.dataByKey.size<=Fge)return;let s=this.dataByKey.entries().next();if(!s.done){let[l]=s.value;this.removeEntry(l)}}trackFolderNotePath(e,n){let r=this.folderNotePathByFolderPath.get(e);r!==n&&(r!==void 0&&(this.folderNotePathByFolderPath.delete(e),r&&this.removeFolderPathFromTrackedFolderNotePath(r,e)),this.folderNotePathByFolderPath.set(e,n),n&&this.addFolderPathForTrackedFolderNotePath(n,e))}untrackFolderNotePathForFolder(e){let n=this.folderNotePathByFolderPath.get(e);n!==void 0&&(this.folderNotePathByFolderPath.delete(e),n&&this.removeFolderPathFromTrackedFolderNotePath(n,e))}invalidateFolder(e){let n=this.keysByFolderPath.get(e);if(!n||n.size===0){this.untrackFolderNotePathForFolder(e);return}Array.from(n).forEach(r=>{this.removeEntry(r)})}invalidateFolderAndDescendants(e){if(e==="/"){this.clear();return}Array.from(this.keysByFolderPath.keys()).forEach(n=>{this.isFolderPathWithinSubtree(e,n)&&this.invalidateFolder(n)})}resetStyleSnapshot(){this.styleSnapshot={icons:null,colors:null,backgrounds:null},this.styleSnapshotInitialized=!1}createCacheKey(e,n){return[e,n.includeDisplayName?"1":"0",n.includeColor?"1":"0",n.includeBackgroundColor?"1":"0",n.includeIcon?"1":"0",n.includeInheritedColors?"1":"0"].join("|")}removeEntry(e){this.dataByKey.delete(e),this.dataByKey.size===0&&this.resetStyleSnapshot();let n=this.folderPathByKey.get(e);if(!n)return;this.folderPathByKey.delete(e);let r=this.keysByFolderPath.get(n);r&&(r.delete(e),r.size===0&&(this.keysByFolderPath.delete(n),this.untrackFolderNotePathForFolder(n)))}addFolderPathForTrackedFolderNotePath(e,n){let r=this.folderPathsByFolderNotePath.get(e);if(r){r.add(n);return}this.folderPathsByFolderNotePath.set(e,new Set([n]))}removeFolderPathFromTrackedFolderNotePath(e,n){let r=this.folderPathsByFolderNotePath.get(e);r&&(r.delete(n),r.size===0&&this.folderPathsByFolderNotePath.delete(e))}cloneStringRecord(e){if(!e)return null;let n=Object.keys(e);if(n.length===0)return null;let r=De(void 0);return n.forEach(o=>{r[o]=e[o]}),r}areStringRecordsEqual(e,n){let r=n?Object.keys(n):[],o=e?Object.keys(e):[];return o.length!==r.length?!1:o.length===0&&r.length===0?!0:!e||!n?!1:r.every(a=>e[a]===n[a])}isFolderPathWithinSubtree(e,n){return e==="/"?!0:n===e||n.startsWith(`${e}/`)}};zn();Si();$o();Ot();_a();ap();var Pge=new Set(["md","canvas","base"]),Cge=".excalidraw",GI=class{constructor(e,n){this.app=e;this.settingsProvider=n}getFolderFrontmatterFields(){let e=this.settingsProvider.settings,n=e.frontmatterIconField.trim(),r=e.frontmatterColorField.trim(),o=e.frontmatterBackgroundField.trim();return{iconField:n.length>0?n:void 0,colorField:r.length>0?r:void 0,backgroundField:o.length>0?o:void 0}}getFolderNoteFile(e){let n=this.settingsProvider.settings;if(!n.enableFolderNotes)return null;let r=this.getFolderByPath(e);if(!r)return null;let o=No(n),a=Pn(r,o);return!a||a.extension!=="md"?null:a}getCurrentFolderNotePath(e){let n=this.getFolderNoteFile(e);return n?n.path:null}getFolderNoteMetadata(e){let n=this.getFolderNoteFile(e);if(!n)return null;let r=Sr();if(!r)return null;let o=r.getFile(n.path);if(!o||!o.metadata)return null;let a=typeof o.metadata.name=="string"?o.metadata.name.trim():void 0,i=typeof o.metadata.icon=="string"?qn(o.metadata.icon.trim()):void 0,s=typeof o.metadata.color=="string"?o.metadata.color.trim():void 0,l=typeof o.metadata.background=="string"?o.metadata.background.trim():void 0;return!a&&!i&&!s&&!l?null:{name:a||void 0,icon:i||void 0,color:s||void 0,backgroundColor:l||void 0}}async writeFolderStyleToFrontmatter(e,n,r){if(!this.settingsProvider.settings.useFrontmatterMetadata)return{icon:!1,color:!1,backgroundColor:!1};let a=this.getFolderNoteFile(e);if(!a)return{icon:!1,color:!1,backgroundColor:!1};let i=this.getFolderFrontmatterFields(),s=n.icon!==void 0&&!!i.iconField,l=n.color!==void 0&&!!i.colorField,c=n.backgroundColor!==void 0&&!!i.backgroundField;if(!s&&!l&&!c)return{icon:!1,color:!1,backgroundColor:!1};let u={icon:r.icon,color:r.color,backgroundColor:r.backgroundColor};if(s){if(n.icon===null)u.icon=void 0;else if(typeof n.icon=="string"){let F=qn(n.icon.trim());u.icon=F||void 0}}if(l){if(n.color===null)u.color=void 0;else if(typeof n.color=="string"){let F=n.color.trim();u.color=F.length>0?F:void 0}}if(c){if(n.backgroundColor===null)u.backgroundColor=void 0;else if(typeof n.backgroundColor=="string"){let F=n.backgroundColor.trim();u.backgroundColor=F.length>0?F:void 0}}let p=u.icon?oi(u.icon):null,m=u.color?.trim()||null,g=u.backgroundColor?.trim()||null,f=i.iconField,h=i.colorField,b=i.backgroundField,v=!!f&&(s||r.icon!==void 0),y=!!h&&(l||r.color!==void 0),S=!!b&&(c||r.backgroundColor!==void 0);try{await this.app.fileManager.processFrontMatter(a,F=>{f&&v&&this.updateFrontmatterField(F,f,p),h&&y&&this.updateFrontmatterField(F,h,m),b&&S&&this.updateFrontmatterField(F,b,g)})}catch(F){return console.error("Failed to update folder note frontmatter metadata",{folderPath:e,folderNotePath:a.path,error:F}),{icon:!1,color:!1,backgroundColor:!1}}let w={};v&&(w.icon=u.icon&&u.icon.length>0?u.icon:void 0),y&&(w.color=m??void 0),S&&(w.background=g??void 0);let k=Sr();if(k)try{await k.updateFileMetadata(a.path,w)}catch(F){console.error("Failed to sync folder note metadata to IndexedDB cache",{folderPath:e,folderNotePath:a.path,error:F})}return{icon:v,color:y,backgroundColor:S}}hasFolderDisplayNameMetadataChanges(e,n){let r=this.settingsProvider.settings;if(!r.useFrontmatterMetadata||!r.enableFolderNotes)return!1;let o=No(r),a=new Set,i=new Map;for(let s of e){if(s.changes.metadata===void 0||s.metadataNameChanged!==!0)continue;if(n(s.path))return!0;if(!this.isFolderNoteCandidatePath(s.path)||a.has(s.path))continue;a.add(s.path);let l=Ds(s.path),c=i.get(l);if(c===void 0){let u=this.getFolderNoteSourceNameFromPath(l);c=Xd(u,o),i.set(l,c)}if(this.isFolderNotePathForExpectedName(s.path,c))return!0}return!1}isFolderNotePathForFolder(e,n){let r=this.getFolderByPath(n);if(!r)return!1;let o=ip(r,No(this.settingsProvider.settings));return this.isFolderNotePathForExpectedName(e,o)}updateFrontmatterField(e,n,r){let o=Yo(e,n)??n;if(r!==null){e[o]!==r&&(e[o]=r);return}Reflect.has(e,o)&&delete e[o]}getFolderByPath(e){return e==="/"?this.app.vault.getRoot():this.app.vault.getFolderByPath(e)}getFolderNoteSourceNameFromPath(e){if(e==="/")return uy(this.app.vault.getRoot(),this.app.vault);let n=e.lastIndexOf("/");return n===-1?e:e.slice(n+1)}getPathExtension(e){let n=e.split("/").pop()??"",r=n.lastIndexOf(".");return r===-1||r===n.length-1?"":n.slice(r+1).toLowerCase()}getPathBasename(e){let n=e.split("/").pop()??"",r=n.lastIndexOf(".");return r===-1?n:n.slice(0,r)}isFolderNoteCandidatePath(e){return Pge.has(this.getPathExtension(e))}isFolderNotePathForExpectedName(e,n){if(!this.isFolderNoteCandidatePath(e))return!1;let r=this.getPathExtension(e),o=this.getPathBasename(e);return o===n?!0:r==="md"&&o===`${n}${Cge}`}};function C$({folderPath:t,inheritFolderColors:e,needs:n,getFolderDisplayData:r}){if(!e||!n.color&&!n.backgroundColor||t==="/")return{};let o,a,i=t.split("/");for(let l=i.length-1;l>0;l-=1){let c=i.slice(0,l).join("/");if(!c)continue;let u=r(c,{includeDisplayName:!1,includeColor:n.color&&!o,includeBackgroundColor:n.backgroundColor&&!a,includeIcon:!1,includeInheritedColors:!1});if(!o&&u.color&&(o=u.color),!a&&u.backgroundColor&&(a=u.backgroundColor),(!n.color||o)&&(!n.backgroundColor||a))return{color:o,backgroundColor:a}}let s=r("/",{includeDisplayName:!1,includeColor:n.color&&!o,includeBackgroundColor:n.backgroundColor&&!a,includeIcon:!1,includeInheritedColors:!1});return!o&&s.color&&(o=s.color),!a&&s.backgroundColor&&(a=s.backgroundColor),{color:o,backgroundColor:a}}function N$({folderPath:t,resolveOptions:e,useFrontmatterMetadata:n,directStyle:r,frontmatterFields:o,getFolderNoteMetadata:a,resolveInheritedFolderStyleValues:i}){let s=e.includeDisplayName&&n,l=e.includeIcon&&n&&!!o.iconField,c=e.includeColor&&n&&!!o.colorField,u=e.includeBackgroundColor&&n&&!!o.backgroundField,m=s||l||c||u?a(t):null,g=l?m?.icon:void 0,f=c?m?.color:void 0,h=u?m?.backgroundColor:void 0,b=e.includeColor?f||r.color:void 0,v=e.includeBackgroundColor?h||r.backgroundColor:void 0;if(e.includeInheritedColors&&(e.includeColor&&!b||e.includeBackgroundColor&&!v)){let y=i({color:e.includeColor&&!b,backgroundColor:e.includeBackgroundColor&&!v});b||(b=y.color),v||(v=y.backgroundColor)}return{displayName:s?m?.name:void 0,color:b,backgroundColor:v,icon:e.includeIcon?g||r.icon:void 0}}function Nge(t){return typeof t!="object"||t===null?!1:typeof Reflect.get(t,"registerSettingsUpdateListener")=="function"&&typeof Reflect.get(t,"unregisterSettingsUpdateListener")=="function"}var qT=class t extends pd{constructor(...n){super(...n);this.folderStyleChangeListener=null;this.folderDisplayCache=new jI;this.folderDisplayCacheVaultEventRefs=[];this.folderDisplayCacheSettingsListenerProvider=null;this.folderDisplayCacheUnsubscribe=null;this.folderDisplayVersion=0;this.folderDisplayListeners=new Set;this.folderDisplayNameVersion=0;this.folderDisplayNameListeners=new Set;this.folderNoteMetadataAdapter=new GI(this.app,this.settingsProvider),t.folderDisplayCacheSettingsListenerCounter+=1,this.folderDisplayCacheSettingsListenerId=`folder-display-cache-${t.folderDisplayCacheSettingsListenerCounter}`}static{this.folderDisplayCacheSettingsListenerCounter=0}getCurrentFolderDisplayCacheSettingsSnapshot(){let n=this.settingsProvider.settings;return{useFrontmatterMetadata:n.useFrontmatterMetadata,enableFolderNotes:n.enableFolderNotes,inheritFolderColors:n.inheritFolderColors,folderNoteName:n.folderNoteName.trim(),folderNoteNamePattern:n.folderNoteNamePattern.trim(),frontmatterNameField:n.frontmatterNameField.trim(),frontmatterIconField:n.frontmatterIconField.trim(),frontmatterColorField:n.frontmatterColorField.trim(),frontmatterBackgroundField:n.frontmatterBackgroundField.trim()}}getCurrentFolderStyleRecordSource(){let n=this.settingsProvider.settings;return{icons:n.folderIcons,colors:n.folderColors,backgrounds:n.folderBackgroundColors}}getSettingsUpdateListenerProvider(){return Nge(this.settingsProvider)?this.settingsProvider:null}handleFolderDisplayCacheSettingsUpdate(){let n=!1,r=this.getCurrentFolderDisplayCacheSettingsSnapshot(),o=this.folderDisplayCache.hasDisplayNameSettingsSnapshotChanged(r);this.folderDisplayCache.hasSettingsSnapshotChanged(r)&&(this.folderDisplayCache.captureSettingsSnapshot(r),n=!0),this.folderDisplayCache.hasEntries()&&this.folderDisplayCache.isStyleSnapshotInitialized()&&this.hasFolderStyleRecordSnapshotChanged()&&(n=!0),n&&this.folderDisplayCache.clear(),o?this.markFolderDisplayNamesChanged():n&&this.markFolderDisplayChanged()}ensureFolderDisplayCacheSettingsListener(){if(this.folderDisplayCacheSettingsListenerProvider)return;let n=this.getSettingsUpdateListenerProvider();n&&(n.registerSettingsUpdateListener(this.folderDisplayCacheSettingsListenerId,()=>{this.handleFolderDisplayCacheSettingsUpdate()}),this.folderDisplayCacheSettingsListenerProvider=n)}invalidateFolderDisplayCacheForContentChanges(n){let r=this.settingsProvider.settings;if(!r.useFrontmatterMetadata||!r.enableFolderNotes)return{hasFolderDisplayChanges:!1,hasFolderDisplayNameChanges:!1};let o=this.hasFolderDisplayNameMetadataChanges(n);if(!this.folderDisplayCache.hasEntries())return{hasFolderDisplayChanges:o,hasFolderDisplayNameChanges:o};let a=new Set;return n.forEach(i=>{let s=this.folderDisplayCache.getTrackedFolderPaths(i.path);s&&s.forEach(l=>{a.add(l)})}),a.forEach(i=>{this.folderDisplayCache.invalidateFolderAndDescendants(i)}),{hasFolderDisplayChanges:a.size>0||o,hasFolderDisplayNameChanges:o}}hasFolderDisplayNameMetadataChanges(n){return this.folderNoteMetadataAdapter.hasFolderDisplayNameMetadataChanges(n,r=>this.folderDisplayCache.hasTrackedFolderNotePath(r))}invalidateFolderDisplayCacheForVaultFilePath(n){this.invalidateFolderDisplayCacheForContentChanges([{path:n,changes:{}}]);let r=Ds(n);this.folderNoteMetadataAdapter.isFolderNotePathForFolder(n,r)&&this.folderDisplayCache.invalidateFolderAndDescendants(r)}handleFolderDisplayCacheVaultCreateOrDelete(n){if(!(n instanceof tz.TFile))return;let r=this.settingsProvider.settings;if(!r.useFrontmatterMetadata||!r.enableFolderNotes)return;let o=Ds(n.path),a=this.folderDisplayCache.hasTrackedFolderNotePath(n.path),i=this.folderNoteMetadataAdapter.isFolderNotePathForFolder(n.path,o);this.invalidateFolderDisplayCacheForVaultFilePath(n.path),(a||i)&&this.markFolderDisplayNamesChanged()}handleFolderDisplayCacheVaultRename(n,r){if(!(n instanceof tz.TFile)||typeof r!="string")return;let o=this.settingsProvider.settings;if(!o.useFrontmatterMetadata||!o.enableFolderNotes)return;let a=Ds(r),i=Ds(n.path),s=this.folderDisplayCache.hasTrackedFolderNotePath(r),l=this.folderDisplayCache.hasTrackedFolderNotePath(n.path),c=this.folderNoteMetadataAdapter.isFolderNotePathForFolder(r,a),u=this.folderNoteMetadataAdapter.isFolderNotePathForFolder(n.path,i);this.invalidateFolderDisplayCacheForVaultFilePath(r),this.invalidateFolderDisplayCacheForVaultFilePath(n.path),(s||l||c||u)&&this.markFolderDisplayNamesChanged()}ensureFolderDisplayCacheVaultListeners(){if(this.folderDisplayCacheVaultEventRefs.length>0)return;let n=this.app.vault.on("create",a=>{this.handleFolderDisplayCacheVaultCreateOrDelete(a)}),r=this.app.vault.on("delete",a=>{this.handleFolderDisplayCacheVaultCreateOrDelete(a)}),o=this.app.vault.on("rename",(a,i)=>{this.handleFolderDisplayCacheVaultRename(a,i)});this.folderDisplayCacheVaultEventRefs.push(n,r,o)}ensureFolderDisplayCacheState(){let n=this.getCurrentFolderDisplayCacheSettingsSnapshot();if(this.folderDisplayCache.hasSettingsSnapshotChanged(n)&&(this.folderDisplayCache.captureSettingsSnapshot(n),this.folderDisplayCache.clear()),this.ensureFolderDisplayCacheSettingsListener(),!this.folderDisplayCacheUnsubscribe){let r=Sr();r&&(this.folderDisplayCacheUnsubscribe=r.onContentChange(o=>{let{hasFolderDisplayChanges:a,hasFolderDisplayNameChanges:i}=this.invalidateFolderDisplayCacheForContentChanges(o);i?this.markFolderDisplayNamesChanged():a&&this.markFolderDisplayChanged()}))}this.ensureFolderDisplayCacheVaultListeners()}markFolderDisplayChanged(){this.folderDisplayVersion+=1,this.folderDisplayListeners.forEach(n=>n(this.folderDisplayVersion))}markFolderDisplayNamesChanged(){this.markFolderDisplayChanged(),this.folderDisplayNameVersion+=1,this.folderDisplayNameListeners.forEach(n=>n(this.folderDisplayNameVersion))}getFolderDisplayVersion(){return this.folderDisplayVersion}subscribeToFolderDisplayChanges(n){return this.folderDisplayListeners.add(n),()=>this.folderDisplayListeners.delete(n)}getFolderDisplayNameVersion(){return this.folderDisplayNameVersion}subscribeToFolderDisplayNameChanges(n){return this.folderDisplayNameListeners.add(n),()=>this.folderDisplayNameListeners.delete(n)}dispose(){this.folderDisplayCacheUnsubscribe&&(this.folderDisplayCacheUnsubscribe(),this.folderDisplayCacheUnsubscribe=null),this.folderDisplayListeners.size>0&&this.folderDisplayListeners.clear(),this.folderDisplayNameListeners.size>0&&this.folderDisplayNameListeners.clear(),this.folderDisplayCacheSettingsListenerProvider&&(this.folderDisplayCacheSettingsListenerProvider.unregisterSettingsUpdateListener(this.folderDisplayCacheSettingsListenerId),this.folderDisplayCacheSettingsListenerProvider=null),this.folderDisplayCacheVaultEventRefs.length>0&&(this.folderDisplayCacheVaultEventRefs.forEach(n=>{this.app.vault.offref(n)}),this.folderDisplayCacheVaultEventRefs.length=0),this.folderDisplayCache.clear()}setFolderStyleChangeListener(n){this.folderStyleChangeListener=n}isFolderStyleEventBridgeEnabled(){return this.folderStyleChangeListener!==null}hasFolderDisplayStyleChanged(n,r){return n.color!==r.color||n.backgroundColor!==r.backgroundColor||n.icon!==r.icon}validateFolder(n){return this.getFolderByPath(n)!==null}getFolderByPath(n){return n==="/"?this.app.vault.getRoot():this.app.vault.getFolderByPath(n)}getFolderStyleFromSettings(n){return{icon:this.getEntityIcon(W.FOLDER,n),color:this.getEntityColor(W.FOLDER,n),backgroundColor:this.getEntityBackgroundColor(W.FOLDER,n)}}trackFolderNotePathForCachedFolder(n){let r=this.settingsProvider.settings;if(!r.useFrontmatterMetadata||!r.enableFolderNotes){this.folderDisplayCache.untrackFolderNotePathForFolder(n);return}this.folderDisplayCache.trackFolderNotePath(n,this.folderNoteMetadataAdapter.getCurrentFolderNotePath(n))}hasOwnFolderStyleEntry(n,r){return!!(n&&Object.prototype.hasOwnProperty.call(n,r))}hasFolderStyleRecordSnapshotChanged(){return this.folderDisplayCache.hasStyleSnapshotChanged(this.getCurrentFolderStyleRecordSource())}async syncFolderStyleSettings(n,r,o){if(r.icon===void 0&&r.color===void 0&&r.backgroundColor===void 0&&!o.icon&&!o.color&&!o.backgroundColor)return!1;let a=!1;return await this.saveAndUpdate(i=>{let s=!1;if(o.icon)this.hasOwnFolderStyleEntry(i.folderIcons,n)&&(delete i.folderIcons[n],s=!0);else if(r.icon!==void 0){let l=this.hasOwnFolderStyleEntry(i.folderIcons,n)?i.folderIcons[n]:void 0,c=r.icon===null?void 0:typeof r.icon=="string"?qn(r.icon)??void 0:void 0;if(c!==l){let u=ln(i.folderIcons,Ln);c===void 0?delete u[n]:u[n]=c,i.folderIcons=u,s=!0}}if(o.color)this.hasOwnFolderStyleEntry(i.folderColors,n)&&(delete i.folderColors[n],s=!0);else if(r.color!==void 0){let l=this.hasOwnFolderStyleEntry(i.folderColors,n)?i.folderColors[n]:void 0,c=r.color===null?void 0:r.color;if(c!==l){let u=ln(i.folderColors,Ln);c===void 0?delete u[n]:u[n]=c,i.folderColors=u,s=!0}}if(o.backgroundColor)this.hasOwnFolderStyleEntry(i.folderBackgroundColors,n)&&(delete i.folderBackgroundColors[n],s=!0);else if(r.backgroundColor!==void 0){let l=this.hasOwnFolderStyleEntry(i.folderBackgroundColors,n)?i.folderBackgroundColors[n]:void 0,c=r.backgroundColor===null?void 0:r.backgroundColor;if(c!==l){let u=ln(i.folderBackgroundColors,Ln);c===void 0?delete u[n]:u[n]=c,i.folderBackgroundColors=u,s=!0}}return a=s,s}),a}async setFolderStyle(n,r){if(!this.validateFolder(n))return;let o={icon:r.icon,color:r.color,backgroundColor:r.backgroundColor};typeof o.color=="string"&&!this.validateColor(o.color)&&(o.color=void 0),typeof o.backgroundColor=="string"&&!this.validateColor(o.backgroundColor)&&(o.backgroundColor=void 0);let a=o.icon!==void 0,i=o.color!==void 0,s=o.backgroundColor!==void 0;if(!a&&!i&&!s)return;let l=this.folderStyleChangeListener!==null?this.resolveFolderDisplayData(n,{includeDisplayName:!1,includeColor:!0,includeBackgroundColor:!0,includeIcon:!0,includeInheritedColors:!1}):null,c=()=>{if(i||s){this.folderDisplayCache.invalidateFolderAndDescendants(n);return}this.folderDisplayCache.invalidateFolder(n)};c();let u=await this.folderNoteMetadataAdapter.writeFolderStyleToFrontmatter(n,o,this.getFolderStyleFromSettings(n)),p=await this.syncFolderStyleSettings(n,o,u),m=u.icon||u.color||u.backgroundColor;if(p&&c(),this.folderStyleChangeListener&&l&&m&&!p){let g=this.resolveFolderDisplayData(n,{includeDisplayName:!1,includeColor:!0,includeBackgroundColor:!0,includeIcon:!0,includeInheritedColors:!1});this.hasFolderDisplayStyleChanged(l,g)&&(this.markFolderDisplayChanged(),this.folderStyleChangeListener(n))}}async setFolderColor(n,r){return this.setFolderStyle(n,{color:r})}async setFolderBackgroundColor(n,r){return this.setFolderStyle(n,{backgroundColor:r})}async removeFolderColor(n){return this.setFolderStyle(n,{color:null})}async removeFolderBackgroundColor(n){return this.setFolderStyle(n,{backgroundColor:null})}resolveFolderDisplayData(n,r){let o=this.settingsProvider.settings;return N$({folderPath:n,resolveOptions:r,useFrontmatterMetadata:o.useFrontmatterMetadata,directStyle:this.getFolderStyleFromSettings(n),frontmatterFields:this.folderNoteMetadataAdapter.getFolderFrontmatterFields(),getFolderNoteMetadata:a=>this.folderNoteMetadataAdapter.getFolderNoteMetadata(a),resolveInheritedFolderStyleValues:a=>C$({folderPath:n,inheritFolderColors:o.inheritFolderColors,needs:a,getFolderDisplayData:(i,s)=>this.getFolderDisplayData(i,s)})})}getFolderDisplayData(n,r){this.ensureFolderDisplayCacheState();let o={includeDisplayName:r?.includeDisplayName??!0,includeColor:r?.includeColor??!0,includeBackgroundColor:r?.includeBackgroundColor??!0,includeIcon:r?.includeIcon??!0,includeInheritedColors:r?.includeInheritedColors??!0},a=this.folderDisplayCache.get(n,o);if(a)return{...a};let i=this.resolveFolderDisplayData(n,o);return this.trackFolderNotePathForCachedFolder(n),this.folderDisplayCache.set(n,o,i,this.getCurrentFolderStyleRecordSource()),{...i}}getFolderColor(n){return this.getFolderDisplayData(n,{includeDisplayName:!1,includeColor:!0,includeBackgroundColor:!1,includeIcon:!1,includeInheritedColors:!0}).color}getFolderBackgroundColor(n){return this.getFolderDisplayData(n,{includeDisplayName:!1,includeColor:!1,includeBackgroundColor:!0,includeIcon:!1,includeInheritedColors:!0}).backgroundColor}async setFolderIcon(n,r){return this.setFolderStyle(n,{icon:r})}async removeFolderIcon(n){return this.setFolderStyle(n,{icon:null})}getFolderIcon(n){return this.getFolderDisplayData(n,{includeDisplayName:!1,includeColor:!1,includeBackgroundColor:!1,includeIcon:!0,includeInheritedColors:!0}).icon}async setFolderSortOverride(n,r){if(this.validateFolder(n))return this.setEntitySortOverride(W.FOLDER,n,r)}async removeFolderSortOverride(n){return this.removeEntitySortOverride(W.FOLDER,n)}getFolderSortOverride(n){return this.getEntitySortOverride(W.FOLDER,n)}async setFolderChildSortOrderOverride(n,r){if(this.validateFolder(n))return this.setEntityChildSortOrderOverride(W.FOLDER,n,r)}async removeFolderChildSortOrderOverride(n){return this.removeEntityChildSortOrderOverride(W.FOLDER,n)}getFolderChildSortOrderOverride(n){return this.getEntityChildSortOrderOverride(W.FOLDER,n)}async handleFolderRename(n,r,o){this.folderDisplayCache.clear();let a=Dy(this.app,"folder",n,r);await this.saveAndUpdate(i=>{let s=!1;return s=this.updateNestedPaths(i.folderColors,n,r)||s,s=this.updateNestedPaths(i.folderBackgroundColors,n,r)||s,s=this.updateNestedPaths(i.folderIcons,n,r)||s,s=this.updateNestedPaths(i.folderSortOverrides,n,r)||s,s=this.updateNestedPaths(i.folderTreeSortOverrides,n,r)||s,s=this.updateNestedPaths(i.folderAppearances,n,r)||s,s=pv(i.collapsedPinnedContexts,W.FOLDER,n,r,{descendantDelimiter:"/"})||s,s=this.updateShortcuts(i,c=>{if(!(!Zo(c)||!a(c.path)))return{...c,path:r}})||s,o&&(s=o(i)||s),s})}async handleFolderDelete(n,r){this.folderDisplayCache.clear();let o=Dy(this.app,"folder",n);await this.saveAndUpdate(a=>{let i=!1;return i=this.deleteNestedPaths(a.folderColors,n)||i,i=this.deleteNestedPaths(a.folderBackgroundColors,n)||i,i=this.deleteNestedPaths(a.folderIcons,n)||i,i=this.deleteNestedPaths(a.folderSortOverrides,n)||i,i=this.deleteNestedPaths(a.folderTreeSortOverrides,n)||i,i=this.deleteNestedPaths(a.folderAppearances,n)||i,i=mv(a.collapsedPinnedContexts,W.FOLDER,n,{descendantDelimiter:"/"})||i,i=this.updateShortcuts(a,l=>{if(Zo(l))return o(l.path)?null:void 0})||i,r&&(i=r(a)||i),i})}async cleanupFolderMetadata(n=this.settingsProvider.settings){this.folderDisplayCache.clear();let r=i=>this.getFolderByPath(i)!==null,o=ym(n.collapsedPinnedContexts,W.FOLDER,r),a=await Promise.all([this.cleanupMetadata(n,"folderColors",r),this.cleanupMetadata(n,"folderBackgroundColors",r),this.cleanupMetadata(n,"folderIcons",r),this.cleanupMetadata(n,"folderSortOverrides",r),this.cleanupMetadata(n,"folderTreeSortOverrides",r),this.cleanupMetadata(n,"folderAppearances",r)]);return o||a.some(i=>i)}async cleanupWithValidators(n,r=this.settingsProvider.settings){this.folderDisplayCache.clear();let o=s=>n.vaultFolders.has(s),a=ym(r.collapsedPinnedContexts,W.FOLDER,o),i=await Promise.all([this.cleanupMetadata(r,"folderColors",o),this.cleanupMetadata(r,"folderBackgroundColors",o),this.cleanupMetadata(r,"folderIcons",o),this.cleanupMetadata(r,"folderSortOverrides",o),this.cleanupMetadata(r,"folderTreeSortOverrides",o),this.cleanupMetadata(r,"folderAppearances",o)]);return a||i.some(s=>s)}};Ue();Sn();Ot();dn();function I$(t,e){return t===zt||t===bt||e(t)}var YT=class extends pd{constructor(n,r,o){super(n,r);this.getTagTreeProvider=o}async setTagColor(n,r){let o=Ze(n);return o?this.setEntityColor(W.TAG,o,r):Promise.resolve()}async setTagBackgroundColor(n,r){let o=Ze(n);return o?this.setEntityBackgroundColor(W.TAG,o,r):Promise.resolve()}async removeTagColor(n){let r=Ze(n);return r?this.removeEntityColor(W.TAG,r):Promise.resolve()}async removeTagBackgroundColor(n){let r=Ze(n);return r?this.removeEntityBackgroundColor(W.TAG,r):Promise.resolve()}resolveTagColorData(n,r,o){let a=r?this.getEntityColor(W.TAG,n):void 0,i=o?this.getEntityBackgroundColor(W.TAG,n):void 0;if(!(this.settingsProvider.settings.inheritTagColors&&(r&&!a||o&&!i)))return{color:a,background:i};let l=n;for(;l.includes("/");){let c=l.lastIndexOf("/");if(c<=0)break;if(l=l.slice(0,c),r&&!a){let u=this.getEntityColor(W.TAG,l);u&&(a=u)}if(o&&!i){let u=this.getEntityBackgroundColor(W.TAG,l);u&&(i=u)}if((!r||a)&&(!o||i))break}return{color:a,background:i}}getTagColorData(n){let r=Ze(n);return r?this.resolveTagColorData(r,!0,!0):{}}getTagColor(n){let r=Ze(n);if(r)return this.resolveTagColorData(r,!0,!1).color}getTagBackgroundColor(n){let r=Ze(n);if(r)return this.resolveTagColorData(r,!1,!0).background}async setTagIcon(n,r){let o=Ze(n);return o?this.setEntityIcon(W.TAG,o,r):Promise.resolve()}async removeTagIcon(n){let r=Ze(n);return r?this.removeEntityIcon(W.TAG,r):Promise.resolve()}getTagIcon(n){let r=Ze(n);if(r)return this.getEntityIcon(W.TAG,r)}async setTagSortOverride(n,r){let o=Ze(n);return o?this.setEntitySortOverride(W.TAG,o,r):Promise.resolve()}async removeTagSortOverride(n){let r=Ze(n);return r?this.removeEntitySortOverride(W.TAG,r):Promise.resolve()}getTagSortOverride(n){let r=Ze(n);if(r)return this.getEntitySortOverride(W.TAG,r)}async setTagChildSortOrderOverride(n,r){let o=Ze(n);return o?this.setEntityChildSortOrderOverride(W.TAG,o,r):Promise.resolve()}async removeTagChildSortOrderOverride(n){let r=Ze(n);return r?this.removeEntityChildSortOrderOverride(W.TAG,r):Promise.resolve()}getTagChildSortOrderOverride(n){let r=Ze(n);if(r)return this.getEntityChildSortOrderOverride(W.TAG,r)}hasTagMetadataForPath(n,r){let o=`${r}/`,a=[n.tagColors,n.tagBackgroundColors,n.tagIcons,n.tagSortOverrides,n.tagTreeSortOverrides,n.tagAppearances];for(let i of a)if(i){if(Object.prototype.hasOwnProperty.call(i,r))return!0;for(let s in i)if(s.startsWith(o))return!0}return!1}removeTagMetadataForPath(n,r,o){if(!n)return!1;let a=!1,i=Object.keys(n);for(let s of i)(s===r||s.startsWith(o))&&(delete n[s],a=!0);return a}willUpdateNestedPaths(n,r,o,a){if(!n)return!1;let i={...n};return this.updateNestedPaths(i,r,o,a)}async handleTagRename(n,r,o=!1,a){let i=Ze(n),s=Ze(r);if(!i||!s||i===s){a&&await this.saveAndUpdate(f=>!!a(f));return}let l=this.settingsProvider.settings,c=this.hasTagMetadataForPath(l,i),u=IO(l,i),p=xO(l,i),m=wA(l.collapsedPinnedContexts,W.TAG,i,{descendantDelimiter:"/"}),g=c?this.willUpdateNestedPaths(l.tagColors,i,s,o)||this.willUpdateNestedPaths(l.tagBackgroundColors,i,s,o)||this.willUpdateNestedPaths(l.tagIcons,i,s,o)||this.willUpdateNestedPaths(l.tagSortOverrides,i,s,o)||this.willUpdateNestedPaths(l.tagTreeSortOverrides,i,s,o)||this.willUpdateNestedPaths(l.tagAppearances,i,s,o):!1;!g&&!u&&!p&&!m&&!a||await this.saveAndUpdate(f=>{let h=!1;return g&&(h=this.updateNestedPaths(f.tagColors,i,s,o)||h,h=this.updateNestedPaths(f.tagBackgroundColors,i,s,o)||h,h=this.updateNestedPaths(f.tagIcons,i,s,o)||h,h=this.updateNestedPaths(f.tagSortOverrides,i,s,o)||h,h=this.updateNestedPaths(f.tagTreeSortOverrides,i,s,o)||h,h=this.updateNestedPaths(f.tagAppearances,i,s,o)||h),h=pv(f.collapsedPinnedContexts,W.TAG,i,s,{descendantDelimiter:"/",preserveExisting:o})||h,h=Gj(f,i,s)||h,h=qj(f,i,s)||h,a&&(h=a(f)||h),h})}async handleTagDelete(n,r){let o=Ze(n);if(!o){r&&await this.saveAndUpdate(l=>!!r(l));return}let a=this.settingsProvider.settings,i=this.hasTagMetadataForPath(a,o)||IO(a,o)||xO(a,o)||wA(a.collapsedPinnedContexts,W.TAG,o,{descendantDelimiter:"/"});if(!i&&!r)return;let s=`${o}/`;await this.saveAndUpdate(l=>{let c=!1;return i&&(c=this.removeTagMetadataForPath(l.tagColors,o,s)||c,c=this.removeTagMetadataForPath(l.tagBackgroundColors,o,s)||c,c=this.removeTagMetadataForPath(l.tagIcons,o,s)||c,c=this.removeTagMetadataForPath(l.tagSortOverrides,o,s)||c,c=this.removeTagMetadataForPath(l.tagTreeSortOverrides,o,s)||c,c=this.removeTagMetadataForPath(l.tagAppearances,o,s)||c),c=mv(l.collapsedPinnedContexts,W.TAG,o,{descendantDelimiter:"/"})||c,c=Yj(l,o)||c,c=$j(l,o)||c,r&&(c=r(l)||c),c})}async cleanupTagMetadata(n=this.settingsProvider.settings){let o=this.getTagTreeProvider()?.getAllTagPaths()||[],a=new Set(o.map(u=>Ze(u)).filter(u=>u!==null)),i=u=>{let p=Ze(u);return p?a.has(p):!1},s=u=>I$(u,i),l=ym(n.collapsedPinnedContexts,W.TAG,s),c=await Promise.all([this.cleanupMetadata(n,"tagColors",i),this.cleanupMetadata(n,"tagBackgroundColors",i),this.cleanupMetadata(n,"tagIcons",i),this.cleanupMetadata(n,"tagSortOverrides",i),this.cleanupMetadata(n,"tagTreeSortOverrides",i),this.cleanupMetadata(n,"tagAppearances",i)]);return l||c.some(u=>u)}async cleanupWithValidators(n,r=this.settingsProvider.settings){let o=n.dbFiles.some(({data:p})=>p.tags!==null);if(n.tagTree.size===0&&!o)return!1;let a=[];for(let p of n.tagTree.values()){let m=g=>{a.push(g.path);for(let f of g.children.values())m(f)};m(p)}let i=new Set(a.map(p=>Ze(p)).filter(p=>p!==null)),s=p=>{let m=Ze(p);return m?i.has(m):!1},l=p=>I$(p,s),c=ym(r.collapsedPinnedContexts,W.TAG,l),u=await Promise.all([this.cleanupMetadata(r,"tagColors",s),this.cleanupMetadata(r,"tagBackgroundColors",s),this.cleanupMetadata(r,"tagIcons",s),this.cleanupMetadata(r,"tagSortOverrides",s),this.cleanupMetadata(r,"tagTreeSortOverrides",s),this.cleanupMetadata(r,"tagAppearances",s)]);return c||u.some(p=>p)}};Ue();zn();cn();Ot();dn();var $T=class extends pd{constructor(e,n){super(e,n)}async setPropertyColor(e,n){let r=Gt(e);return r?this.setEntityColor(W.PROPERTY,r,n):Promise.resolve()}async setPropertyBackgroundColor(e,n){let r=Gt(e);return r?this.setEntityBackgroundColor(W.PROPERTY,r,n):Promise.resolve()}async removePropertyColor(e){let n=Gt(e);return n?this.removeEntityColor(W.PROPERTY,n):Promise.resolve()}async removePropertyBackgroundColor(e){let n=Gt(e);return n?this.removeEntityBackgroundColor(W.PROPERTY,n):Promise.resolve()}resolvePropertyColorData(e,n,r){let o=n?this.getEntityColor(W.PROPERTY,e):void 0,a=r?this.getEntityBackgroundColor(W.PROPERTY,e):void 0;if(!(this.settingsProvider.settings.inheritPropertyColors&&(n&&!o||r&&!a)))return{color:o,background:a};let s=zi(e);return!s||s===e?{color:o,background:a}:(n&&!o&&(o=this.getEntityColor(W.PROPERTY,s)),r&&!a&&(a=this.getEntityBackgroundColor(W.PROPERTY,s)),{color:o,background:a})}getPropertyColorData(e){let n=Gt(e);return n?this.resolvePropertyColorData(n,!0,!0):{}}getPropertyColor(e){let n=Gt(e);if(n)return this.resolvePropertyColorData(n,!0,!1).color}getPropertyBackgroundColor(e){let n=Gt(e);if(n)return this.resolvePropertyColorData(n,!1,!0).background}async setPropertyIcon(e,n){let r=Gt(e);return r?this.setEntityIcon(W.PROPERTY,r,n):Promise.resolve()}async removePropertyIcon(e){let n=Gt(e);return n?this.removeEntityIcon(W.PROPERTY,n):Promise.resolve()}getPropertyIcon(e){let n=Gt(e);if(n)return this.getEntityIcon(W.PROPERTY,n)}async setPropertySortOverride(e,n){let r=e===Oe?e:Gt(e);return r?this.setEntitySortOverride(W.PROPERTY,r,n):Promise.resolve()}async removePropertySortOverride(e){let n=e===Oe?e:Gt(e);return n?this.removeEntitySortOverride(W.PROPERTY,n):Promise.resolve()}getPropertySortOverride(e){let n=e===Oe?e:Gt(e);if(n)return this.getEntitySortOverride(W.PROPERTY,n)}async setPropertyChildSortOrderOverride(e,n){let r=Wv(e);return r?this.setEntityChildSortOrderOverride(W.PROPERTY,r,n):Promise.resolve()}async removePropertyChildSortOrderOverride(e){let n=Wv(e);return n?this.removeEntityChildSortOrderOverride(W.PROPERTY,n):Promise.resolve()}getPropertyChildSortOrderOverride(e){let n=Wv(e);if(n)return this.getEntityChildSortOrderOverride(W.PROPERTY,n)}createPropertyNodeValidator(e,n){let r=Vv({propertyFields:Oi(e),dbFiles:n.dbFiles})??(()=>!1);return o=>o===Oe||r(o)}collectExistingPropertyKeys(e){let n=new Set;return e.dbFiles.forEach(r=>{let o=r.data.properties;!o||o.length===0||o.forEach(a=>{let i=Me(a.fieldKey);i&&n.add(i)})}),n}pruneConfiguredPropertyKeys(e,n){if(!Array.isArray(e.vaultProfiles)||e.vaultProfiles.length===0)return!1;let r=!1;return e.vaultProfiles.forEach(o=>{if(!Array.isArray(o.propertyKeys)||o.propertyKeys.length===0)return;let a=o.propertyKeys.filter(i=>{let s=typeof i?.key=="string"?Me(i.key):"";return s.length>0&&n.has(s)});a.length!==o.propertyKeys.length&&(o.propertyKeys=a,r=!0)}),r}async cleanupPropertyMetadata(e=this.settingsProvider.settings){let n={dbFiles:kt().getAllFiles(),tagTree:new Map,vaultFiles:new Set,vaultFolders:new Set};return this.cleanupWithValidators(n,e)}async cleanupWithValidators(e,n=this.settingsProvider.settings){let r=this.createPropertyNodeValidator(n,e),o=this.collectExistingPropertyKeys(e),a=ym(n.collapsedPinnedContexts,W.PROPERTY,r),i=await Promise.all([this.cleanupMetadata(n,"propertyColors",r),this.cleanupMetadata(n,"propertyBackgroundColors",r),this.cleanupMetadata(n,"propertyIcons",r),this.cleanupMetadata(n,"propertySortOverrides",r),this.cleanupMetadata(n,"propertyTreeSortOverrides",r),this.cleanupMetadata(n,"propertyAppearances",r)]),s=this.pruneConfiguredPropertyKeys(n,o);return a||s||i.some(l=>l)}};var x$=require("obsidian");Ue();Ia();zn();Si();Ot();Ay();var XT=class t extends pd{static{this.VAULT_ICON_PROVIDER_ID="vault"}getFile(e){let n=this.app.vault.getAbstractFileByPath(e);return n instanceof x$.TFile?n:null}shouldUseFrontmatterForFiles(){return this.settingsProvider.settings.useFrontmatterMetadata}isVaultSvgIconPath(e){return e.trim().toLowerCase().endsWith(".svg")}formatVaultIconId(e){return`${t.VAULT_ICON_PROVIDER_ID}:${e}`}replaceIconValues(e,n,r){if(!e)return!1;let o=!1;return Object.entries(e).forEach(([a,i])=>{i===n&&(e[a]=r,o=!0)}),o}updateVaultIconReferencesInSettings(e,n,r){let o=!1;o=this.replaceIconValues(e.folderIcons,n,r)||o,o=this.replaceIconValues(e.tagIcons,n,r)||o,o=this.replaceIconValues(e.fileIcons,n,r)||o,o=this.replaceIconValues(e.interfaceIcons,n,r)||o,o=this.replaceIconValues(e.fileNameIconMap,n,r)||o,o=this.replaceIconValues(e.fileTypeIconMap,n,r)||o;let a=`${t.VAULT_ICON_PROVIDER_ID}:`;if(n.startsWith(a)&&r.startsWith(a)){let i=n.substring(a.length),s=r.substring(a.length);o=this.replaceIconValues(e.fileNameIconMap,i,s)||o,o=this.replaceIconValues(e.fileTypeIconMap,i,s)||o}return o}updateVaultIconReferencesInRecents(e,n){let r=this.settingsProvider.getRecentIcons(),o=r[t.VAULT_ICON_PROVIDER_ID];if(o===void 0)return;if(!Array.isArray(o)){delete r[t.VAULT_ICON_PROVIDER_ID],this.settingsProvider.setRecentIcons(r);return}let a=!1,i=!1,s=o.filter(c=>typeof c=="string"?!0:(i=!0,!1));if(s.length===0){i&&(delete r[t.VAULT_ICON_PROVIDER_ID],this.settingsProvider.setRecentIcons(r));return}let l=s.map(c=>c!==e?c:(a=!0,n));!a&&!i||(l.length===0?delete r[t.VAULT_ICON_PROVIDER_ID]:r[t.VAULT_ICON_PROVIDER_ID]=l,this.settingsProvider.setRecentIcons(r))}async updateVaultIconReferencesInFrontmatter(e,n){if(!this.shouldUseFrontmatterForFiles())return;let o=this.settingsProvider.settings.frontmatterIconField?.trim();if(!o)return;let a=kt(),i=[];if(a.forEachFile((l,c)=>{c.metadata?.icon===e&&i.push(l)}),i.length===0)return;let s=oi(n);if(s)for(let l of i){let c=this.getFile(l);if(!c||c.extension!=="md")continue;let u=!1;try{await this.app.fileManager.processFrontMatter(c,p=>{let m=Yo(p,o);if(!m)return;let g=p[m];if(typeof g=="string"){if(Lh(g)!==e)return;p[m]=s,u=!0;return}if(Array.isArray(g)){let h=g.map(b=>typeof b!="string"||Lh(b)!==e?b:(u=!0,s));u&&(p[m]=h)}})}catch(p){console.error("Failed to update vault icon reference in frontmatter",{path:c.path,field:o,error:p});continue}u&&await a.updateFileMetadata(c.path,{icon:n})}}async writeFrontmatterValue(e,n,r,o){let a=n.trim();if(!a)return{success:!1,normalized:null};let i=null,s=null;if(r!==null)if(o==="icon"){let c=qn(r.trim());if(i=c&&c.length>0?c:null,i){let u=oi(i);if(!u)return{success:!1,normalized:null};s=u}}else{let c=r.trim();i=c.length>0?c:null,s=i}let l=s===null?null:s.trim();try{await this.app.fileManager.processFrontMatter(e,p=>{let m=Yo(p,a)??a;if(l&&l.length>0){p[m]=l;return}Reflect.has(p,m)&&delete p[m]});let c=kt(),u={};return o==="icon"?u.icon=i&&i.length>0?i:void 0:o==="background"?u.background=i&&i.length>0?i:void 0:u.color=i&&i.length>0?i:void 0,await c.updateFileMetadata(e.path,u),{success:!0,normalized:l??null}}catch(c){return console.error("Failed to update frontmatter metadata",{path:e.path,field:a,error:c}),{success:!1,normalized:null}}}async clearSettingsEntry(e,n){let r=this.settingsProvider.settings[e];!r||r[n]===void 0||await this.saveAndUpdate(o=>{let a=o[e];a&&delete a[n]})}async togglePinnedNote(e,n){await this.saveAndUpdate(r=>{r.pinnedNotes||(r.pinnedNotes={});let o=r.pinnedNotes[e];if(!o)r.pinnedNotes[e]={folder:n==="folder",tag:n==="tag",property:n==="property"};else{let a=Yl(o);r.pinnedNotes[e]=a,a[n]=!a[n],!a.folder&&!a.tag&&!a.property&&delete r.pinnedNotes[e]}})}async pinNotes(e,n){let r=Array.from(new Set(e)).filter(a=>a.length>0);if(r.length===0)return 0;let o=0;return await this.saveAndUpdate(a=>{a.pinnedNotes||(a.pinnedNotes={});let i=!1;for(let s of r){let l=a.pinnedNotes[s];if(!l){a.pinnedNotes[s]={folder:n==="folder",tag:n==="tag",property:n==="property"},i=!0,o+=1;continue}let c=Yl(l);c[n]||(c[n]=!0,a.pinnedNotes[s]=c,i=!0,o+=1)}return i}),o}isPinned(e,n){let r=this.settingsProvider.settings.pinnedNotes?.[e];if(!r)return!1;let o=Yl(r);return n?o[n]||!1:o.folder||o.tag||o.property}getPinnedNotes(e){let n=this.settingsProvider.settings.pinnedNotes||{};return e?Object.entries(n).filter(([r,o])=>Yl(o)[e]).map(([r])=>r):Object.keys(n)}async handleFileDelete(e){let n=Dy(this.app,"note",e);await this.saveAndUpdate(r=>{r.pinnedNotes?.[e]&&delete r.pinnedNotes[e],r.fileIcons?.[e]&&delete r.fileIcons[e],r.fileColors?.[e]&&delete r.fileColors[e],r.fileBackgroundColors?.[e]&&delete r.fileBackgroundColors[e],this.updateShortcuts(r,o=>{if(Po(o))return n(o.path)?null:void 0})})}async handleFileRename(e,n){let r=this.isVaultSvgIconPath(e)&&this.isVaultSvgIconPath(n),o=r?this.formatVaultIconId(e):null,a=r?this.formatVaultIconId(n):null,i=Dy(this.app,"note",e,n);await this.saveAndUpdate(s=>{let l=!1;if(s.pinnedNotes?.[e]){let c=s.pinnedNotes[e];delete s.pinnedNotes[e],s.pinnedNotes[n]=c,l=!0}return l=this.updateNestedPaths(s.fileIcons,e,n)||l,l=this.updateNestedPaths(s.fileColors,e,n)||l,l=this.updateNestedPaths(s.fileBackgroundColors,e,n)||l,o&&a&&(l=this.updateVaultIconReferencesInSettings(s,o,a)||l),l=this.updateShortcuts(s,c=>{if(Po(c)&&i(c.path))return{...c,path:n}})||l,l}),!(!o||!a)&&(this.updateVaultIconReferencesInRecents(o,a),await this.updateVaultIconReferencesInFrontmatter(o,a))}async setFileIcon(e,n){let r=this.getFile(e);if(r){if(this.shouldUseFrontmatterForFiles()&&r.extension==="md"){let o=this.settingsProvider.settings.frontmatterIconField,{success:a}=await this.writeFrontmatterValue(r,o,n,"icon");if(a){await this.clearSettingsEntry("fileIcons",e);return}}await this.setEntityIcon(W.FILE,e,n)}}async removeFileIcon(e){let n=this.getFile(e);if(n&&this.shouldUseFrontmatterForFiles()&&n.extension==="md"){let r=this.settingsProvider.settings.frontmatterIconField,{success:o}=await this.writeFrontmatterValue(n,r,null,"icon");if(o){await this.clearSettingsEntry("fileIcons",e);return}}await this.removeEntityIcon(W.FILE,e)}getFileIcon(e){return this.getEntityIcon(W.FILE,e)}async setFileColor(e,n){if(!this.validateColor(n))return;let r=this.getFile(e);if(r){if(this.shouldUseFrontmatterForFiles()&&r.extension==="md"){let o=this.settingsProvider.settings.frontmatterColorField,{success:a}=await this.writeFrontmatterValue(r,o,n,"color");if(a){await this.clearSettingsEntry("fileColors",e);return}}await this.setEntityColor(W.FILE,e,n)}}async removeFileColor(e){let n=this.getFile(e);if(n&&this.shouldUseFrontmatterForFiles()&&n.extension==="md"){let r=this.settingsProvider.settings.frontmatterColorField,{success:o}=await this.writeFrontmatterValue(n,r,null,"color");if(o){await this.clearSettingsEntry("fileColors",e);return}}await this.removeEntityColor(W.FILE,e)}async setFileBackgroundColor(e,n){if(!this.validateColor(n))return;let r=this.getFile(e);if(r){if(this.shouldUseFrontmatterForFiles()&&r.extension==="md"){let o=this.settingsProvider.settings.frontmatterBackgroundField,{success:a}=await this.writeFrontmatterValue(r,o,n,"background");if(a){await this.clearSettingsEntry("fileBackgroundColors",e);return}}await this.setEntityBackgroundColor(W.FILE,e,n)}}async removeFileBackgroundColor(e){let n=this.getFile(e);if(n&&this.shouldUseFrontmatterForFiles()&&n.extension==="md"){let r=this.settingsProvider.settings.frontmatterBackgroundField,{success:o}=await this.writeFrontmatterValue(n,r,null,"background");if(o){await this.clearSettingsEntry("fileBackgroundColors",e);return}}await this.removeEntityBackgroundColor(W.FILE,e)}async migrateSettingsToFrontmatter(){let e=this.settingsProvider.settings,n=Object.keys(e.fileIcons||{}).length,r=Object.keys(e.fileColors||{}).length+Object.keys(e.fileBackgroundColors||{}).length;if(!this.shouldUseFrontmatterForFiles())return{iconsBefore:n,colorsBefore:r,migratedIcons:0,migratedColors:0,filesUpdated:0,failures:0};let o=Object.entries(e.fileIcons||{}),a=Object.entries(e.fileColors||{}),i=Object.entries(e.fileBackgroundColors||{}),s=new Set,l=0,c=0,u=0,p=e.frontmatterIconField.trim(),m=e.frontmatterColorField.trim(),g=e.frontmatterBackgroundField.trim(),f=p.length>0,h=m.length>0,b=g.length>0;if(f)for(let[v,y]of o){let S=this.getFile(v);if(!S||S.extension!=="md"){u+=1;continue}let{success:w}=await this.writeFrontmatterValue(S,p,y,"icon");w?(await this.clearSettingsEntry("fileIcons",v),s.add(v),l+=1):u+=1}if(h)for(let[v,y]of a){let S=this.getFile(v);if(!S||S.extension!=="md"){u+=1;continue}let{success:w}=await this.writeFrontmatterValue(S,m,y,"color");w?(await this.clearSettingsEntry("fileColors",v),s.add(v),c+=1):u+=1}if(b)for(let[v,y]of i){let S=this.getFile(v);if(!S||S.extension!=="md"){u+=1;continue}let{success:w}=await this.writeFrontmatterValue(S,g,y,"background");w?(await this.clearSettingsEntry("fileBackgroundColors",v),s.add(v),c+=1):u+=1}return{iconsBefore:n,colorsBefore:r,migratedIcons:l,migratedColors:c,filesUpdated:s.size,failures:u}}getFileColor(e){return this.getEntityColor(W.FILE,e)??void 0}getFileBackgroundColor(e){return this.getEntityBackgroundColor(W.FILE,e)??void 0}async cleanupWithValidators(e,n=this.settingsProvider.settings){let r=!1,o=n.pinnedNotes;if(o&&Object.keys(o).length>0){let l=Object.keys(o).filter(c=>!e.vaultFiles.has(c));l.length>0&&(n===this.settingsProvider.settings?await this.saveAndUpdate(c=>{l.forEach(u=>{c.pinnedNotes&&delete c.pinnedNotes[u]})}):l.forEach(c=>{n.pinnedNotes&&delete n.pinnedNotes[c]}),r=!0)}let a=await this.cleanupMetadata(n,"fileIcons",l=>e.vaultFiles.has(l)),i=await this.cleanupMetadata(n,"fileColors",l=>e.vaultFiles.has(l)),s=await this.cleanupMetadata(n,"fileBackgroundColors",l=>e.vaultFiles.has(l));return r||a||i||s}async cleanupPinnedNotes(e=this.settingsProvider.settings){let n=new Set(this.app.vault.getFiles().map(r=>r.path));return this.cleanupWithValidators({vaultFiles:n,vaultFolders:new Set,dbFiles:[],tagTree:new Map},e)}};var R$=require("obsidian");JT();cn();Sn();Ue();Ot();zn();dn();Ba();var E$="folder:",M$="tag:",Mge=new Set([zt,bt]),ek=class extends pd{constructor(n,r,o,a){super(n,r);this.getTagTreeProvider=o;this.getPropertyTreeProvider=a;this.separatorsVersion=0;this.separatorListeners=new Set}getSeparators(){return{...this.settingsProvider.settings.navigationSeparators||{}}}hasSeparator(n){let r=this.getKeyForTarget(n);return r?!!this.settingsProvider.settings.navigationSeparators?.[r]:!1}async setSeparator(n){let r=this.getKeyForTarget(n);r&&await this.saveAndUpdate(o=>{let a=this.ensureStore(o);return a[r]?!1:(a[r]=!0,this.markSeparatorsChanged(),!0)})}async removeSeparator(n){let r=this.getKeyForTarget(n);r&&await this.saveAndUpdate(o=>{let a=o.navigationSeparators;return!a||!a[r]?!1:(delete a[r],this.markSeparatorsChanged(),!0)})}async handleFolderRename(n,r,o=!1){await this.saveAndUpdate(a=>this.applyFolderRename(a,n,r,o))}async handleFolderDelete(n){await this.saveAndUpdate(r=>this.applyFolderDelete(r,n))}async handleTagRename(n,r,o=!1){await this.saveAndUpdate(a=>this.applyTagRename(a,n,r,o))}async handleTagDelete(n){await this.saveAndUpdate(r=>this.applyTagDelete(r,n))}applyFolderRename(n,r,o,a=!1){let i=n.navigationSeparators;if(!i)return!1;let s=this.updatePrefixedPaths(i,E$,r,o,a);return s&&this.markSeparatorsChangedIfLive(n),s}applyFolderDelete(n,r){let o=n.navigationSeparators;if(!o)return!1;let a=this.deletePrefixedPaths(o,E$,r);return a&&this.markSeparatorsChangedIfLive(n),a}applyTagRename(n,r,o,a=!1){let i=n.navigationSeparators;if(!i)return!1;let s=Ze(r),l=Ze(o);if(!s||!l)return!1;let c=this.updatePrefixedPaths(i,M$,s,l,a);return c&&this.markSeparatorsChangedIfLive(n),c}applyTagDelete(n,r){let o=n.navigationSeparators;if(!o)return!1;let a=Ze(r);if(!a)return!1;let i=this.deletePrefixedPaths(o,M$,a);return i&&this.markSeparatorsChangedIfLive(n),i}async cleanupSeparators(n=this.settingsProvider.settings){let r=this.getKnownTagPaths(),o=this.createPropertyNodeValidator(n),a=await this.removeInvalidEntries(n,i=>this.folderExists(i),i=>this.tagExists(i,r),o??void 0);return a&&this.markSeparatorsChangedIfLive(n),a}async cleanupWithValidators(n,r=this.settingsProvider.settings){let o=c=>n.vaultFolders.has(c),a=this.collectValidatorTagPaths(n.tagTree),i=c=>this.isVirtualTag(c)||a.has(c),s=this.createPropertyNodeValidator(r,n),l=await this.removeInvalidEntries(r,o,i,s??void 0);return l&&this.markSeparatorsChangedIfLive(r),l}getKeyForTarget(n){if(n.type==="section")return QT(n.id);if(n.type==="folder"){let o=this.normalizeFolderPath(n.path);return o?Oy(o):null}if(n.type==="property"){let o=Gt(n.nodeId);return o?Ly(o):null}let r=Ze(n.path);return r?ZT(r):null}normalizeFolderPath(n){let r=n?.trim()??"";if(r.length===0||r==="/")return"/";try{let o=(0,R$.normalizePath)(r);return o.length===0?"/":o}catch(o){return console.error("[Notebook Navigator] Invalid folder path for navigation separator:",n,o),null}}ensureStore(n){let r=ln(n.navigationSeparators,fm);return n.navigationSeparators=r,r}updatePrefixedPaths(n,r,o,a,i){let s=`${r}${o}`,l=`${r}${o}/`,c=[];if(Object.prototype.hasOwnProperty.call(n,s)&&c.push({from:s,to:`${r}${a}`}),Object.keys(n).forEach(p=>{if(p.startsWith(l)){let m=p.slice(l.length);c.push({from:p,to:`${r}${a}/${m}`})}}),c.length===0)return!1;let u=!1;return c.forEach(({from:p,to:m})=>{if(p===m)return;if(Object.prototype.hasOwnProperty.call(n,m)===!0&&i){delete n[p],u=!0;return}n[m]=!0,delete n[p],u=!0}),u}deletePrefixedPaths(n,r,o){let a=`${r}${o}`,i=`${a}/`,s=!1;return Object.prototype.hasOwnProperty.call(n,a)&&(delete n[a],s=!0),Object.keys(n).forEach(l=>{l.startsWith(i)&&(delete n[l],s=!0)}),s}folderExists(n){return this.app.vault.getFolderByPath(n)!==null}tagExists(n,r){return this.isVirtualTag(n)||!r?!0:r.has(n)}isVirtualTag(n){return Mge.has(n)}getKnownTagPaths(){let n=this.getTagTreeProvider?.();return n?new Set(n.getAllTagPaths()):null}collectValidatorTagPaths(n){let r=new Set;return n.forEach(o=>ml(o,r)),r}createPropertyNodeValidator(n,r){if(r)return Vv({propertyFields:Oi(n),dbFiles:r.dbFiles});let o=Vv({propertyFields:Oi(n),propertyTreeProvider:this.getPropertyTreeProvider?.()??null});if(o)return o;let a=Sr();if(!a)return null;let i=a.getAllFiles();return i.length===0?null:Vv({propertyFields:Oi(n),dbFiles:i})}async removeInvalidEntries(n,r,o,a){let i=n.navigationSeparators;if(!i)return!1;let s=!1;return Object.keys(i).forEach(l=>{let c=qI(l);if(!c){delete i[l],s=!0;return}let u=qh(c);if(!u){delete i[l],s=!0;return}if(u.type==="folder"&&!r(u.path)){delete i[l],c!==l&&Object.prototype.hasOwnProperty.call(i,c)&&delete i[c],s=!0;return}if(u.type==="tag"&&!o(u.path)){delete i[l],c!==l&&Object.prototype.hasOwnProperty.call(i,c)&&delete i[c],s=!0;return}if(u.type==="property"){let p=Gt(u.nodeId);if(!p){delete i[l],c!==l&&Object.prototype.hasOwnProperty.call(i,c)&&delete i[c],s=!0;return}let m=Ly(p);if(a&&!a(p)){Object.prototype.hasOwnProperty.call(i,l)&&(delete i[l],s=!0),m!==l&&Object.prototype.hasOwnProperty.call(i,m)&&(delete i[m],s=!0);return}m!==l&&(Object.prototype.hasOwnProperty.call(i,m)||(i[m]=i[l]),delete i[l],s=!0);return}c!==l&&(Object.prototype.hasOwnProperty.call(i,c)||(i[c]=i[l]),delete i[l],s=!0)}),s}markSeparatorsChanged(){this.separatorsVersion+=1,this.separatorListeners.forEach(n=>n(this.separatorsVersion))}markSeparatorsChangedIfLive(n){n===this.settingsProvider.settings&&this.markSeparatorsChanged()}getVersion(){return this.separatorsVersion}subscribe(n){return this.separatorListeners.add(n),()=>this.separatorListeners.delete(n)}};zn();cn();Ot();Ba();var YI=class t{constructor(e,n,r,o){this.app=e;this.settingsProvider=n,this.folderService=new qT(e,n),this.tagService=new YT(e,n,r),this.propertyService=new $T(e,n),this.fileService=new XT(e,n),this.navigationSeparatorService=new ek(e,n,r,o)}getSettingsProvider(){return this.settingsProvider}dispose(){this.folderService.dispose()}setFolderStyleChangeListener(e){this.folderService.setFolderStyleChangeListener(e)}isFolderStyleEventBridgeEnabled(){return this.folderService.isFolderStyleEventBridgeEnabled()}async setFolderColor(e,n){return this.folderService.setFolderColor(e,n)}async setFolderBackgroundColor(e,n){return this.folderService.setFolderBackgroundColor(e,n)}async setFolderStyle(e,n){return this.folderService.setFolderStyle(e,n)}async removeFolderColor(e){return this.folderService.removeFolderColor(e)}async removeFolderBackgroundColor(e){return this.folderService.removeFolderBackgroundColor(e)}getFolderColor(e){return this.folderService.getFolderColor(e)}getFolderBackgroundColor(e){return this.folderService.getFolderBackgroundColor(e)}async setFolderIcon(e,n){return this.folderService.setFolderIcon(e,n)}async removeFolderIcon(e){return this.folderService.removeFolderIcon(e)}getFolderIcon(e){return this.folderService.getFolderIcon(e)}getFolderDisplayData(e,n){return this.folderService.getFolderDisplayData(e,n)}getFolderDisplayVersion(){return this.folderService.getFolderDisplayVersion()}subscribeToFolderDisplayChanges(e){return this.folderService.subscribeToFolderDisplayChanges(e)}getFolderDisplayNameVersion(){return this.folderService.getFolderDisplayNameVersion()}subscribeToFolderDisplayNameChanges(e){return this.folderService.subscribeToFolderDisplayNameChanges(e)}async setFolderSortOverride(e,n){return this.folderService.setFolderSortOverride(e,n)}async removeFolderSortOverride(e){return this.folderService.removeFolderSortOverride(e)}getFolderSortOverride(e){return this.folderService.getFolderSortOverride(e)}async setFolderChildSortOrderOverride(e,n){return this.folderService.setFolderChildSortOrderOverride(e,n)}async removeFolderChildSortOrderOverride(e){return this.folderService.removeFolderChildSortOrderOverride(e)}getFolderChildSortOrderOverride(e){return this.folderService.getFolderChildSortOrderOverride(e)}async handleFolderRename(e,n){await this.folderService.handleFolderRename(e,n,r=>this.navigationSeparatorService.applyFolderRename(r,e,n))}async handleFolderDelete(e){await this.folderService.handleFolderDelete(e,n=>this.navigationSeparatorService.applyFolderDelete(n,e))}async setTagColor(e,n){return this.tagService.setTagColor(e,n)}async setTagBackgroundColor(e,n){return this.tagService.setTagBackgroundColor(e,n)}async removeTagColor(e){return this.tagService.removeTagColor(e)}async removeTagBackgroundColor(e){return this.tagService.removeTagBackgroundColor(e)}getTagColor(e){return this.tagService.getTagColor(e)}getTagBackgroundColor(e){return this.tagService.getTagBackgroundColor(e)}getTagColorData(e){return this.tagService.getTagColorData(e)}async setTagIcon(e,n){return this.tagService.setTagIcon(e,n)}async removeTagIcon(e){return this.tagService.removeTagIcon(e)}getTagIcon(e){return this.tagService.getTagIcon(e)}async handleTagRename(e,n,r=!1){await this.tagService.handleTagRename(e,n,r,o=>this.navigationSeparatorService.applyTagRename(o,e,n,r))}async handleTagDelete(e){await this.tagService.handleTagDelete(e,n=>this.navigationSeparatorService.applyTagDelete(n,e))}async setTagSortOverride(e,n){return this.tagService.setTagSortOverride(e,n)}async removeTagSortOverride(e){return this.tagService.removeTagSortOverride(e)}getTagSortOverride(e){return this.tagService.getTagSortOverride(e)}async setTagChildSortOrderOverride(e,n){return this.tagService.setTagChildSortOrderOverride(e,n)}async removeTagChildSortOrderOverride(e){return this.tagService.removeTagChildSortOrderOverride(e)}getTagChildSortOrderOverride(e){return this.tagService.getTagChildSortOrderOverride(e)}async setPropertyColor(e,n){return this.propertyService.setPropertyColor(e,n)}async setPropertyBackgroundColor(e,n){return this.propertyService.setPropertyBackgroundColor(e,n)}async removePropertyColor(e){return this.propertyService.removePropertyColor(e)}async removePropertyBackgroundColor(e){return this.propertyService.removePropertyBackgroundColor(e)}getPropertyColor(e){return this.propertyService.getPropertyColor(e)}getPropertyBackgroundColor(e){return this.propertyService.getPropertyBackgroundColor(e)}getPropertyColorData(e){return this.propertyService.getPropertyColorData(e)}async setPropertyIcon(e,n){return this.propertyService.setPropertyIcon(e,n)}async removePropertyIcon(e){return this.propertyService.removePropertyIcon(e)}getPropertyIcon(e){return this.propertyService.getPropertyIcon(e)}async setPropertySortOverride(e,n){return this.propertyService.setPropertySortOverride(e,n)}async removePropertySortOverride(e){return this.propertyService.removePropertySortOverride(e)}getPropertySortOverride(e){return this.propertyService.getPropertySortOverride(e)}async setPropertyChildSortOrderOverride(e,n){return this.propertyService.setPropertyChildSortOrderOverride(e,n)}async removePropertyChildSortOrderOverride(e){return this.propertyService.removePropertyChildSortOrderOverride(e)}getPropertyChildSortOrderOverride(e){return this.propertyService.getPropertyChildSortOrderOverride(e)}getNavigationSeparators(){return this.navigationSeparatorService.getSeparators()}hasNavigationSeparator(e){return this.navigationSeparatorService.hasSeparator(e)}async addNavigationSeparator(e){return this.navigationSeparatorService.setSeparator(e)}async removeNavigationSeparator(e){return this.navigationSeparatorService.removeSeparator(e)}getNavigationSeparatorsVersion(){return this.navigationSeparatorService.getVersion()}subscribeToNavigationSeparatorChanges(e){return this.navigationSeparatorService.subscribe(e)}async togglePin(e,n){return this.fileService.togglePinnedNote(e,n)}async pinNotes(e,n){return this.fileService.pinNotes(e,n)}isFilePinned(e,n){return this.fileService.isPinned(e,n)}getPinnedNotes(e){return this.fileService.getPinnedNotes(e)}async setFileIcon(e,n){return this.fileService.setFileIcon(e,n)}async removeFileIcon(e){return this.fileService.removeFileIcon(e)}getFileIcon(e){if(this.settingsProvider.settings.useFrontmatterMetadata){let a=kt().getFile(e)?.metadata?.icon?.trim();if(a)return a}return this.fileService.getFileIcon(e)}async setFileColor(e,n){return this.fileService.setFileColor(e,n)}async removeFileColor(e){return this.fileService.removeFileColor(e)}async setFileBackgroundColor(e,n){return this.fileService.setFileBackgroundColor(e,n)}async removeFileBackgroundColor(e){return this.fileService.removeFileBackgroundColor(e)}getFileColor(e){if(this.settingsProvider.settings.useFrontmatterMetadata){let a=kt().getFile(e)?.metadata?.color?.trim();if(a)return a}return this.fileService.getFileColor(e)}getFileBackgroundColor(e){if(this.settingsProvider.settings.useFrontmatterMetadata){let a=kt().getFile(e)?.metadata?.background?.trim();if(a)return a}return this.fileService.getFileBackgroundColor(e)}async migrateFileMetadataToFrontmatter(){return this.fileService.migrateSettingsToFrontmatter()}async handleFileDelete(e){return this.fileService.handleFileDelete(e)}async handleFileRename(e,n){return this.fileService.handleFileRename(e,n)}async cleanupAllMetadata(e=this.settingsProvider.settings){let n=t.prepareCleanupValidators(this.app);return this.runUnifiedCleanup(n,e)}async cleanupTagMetadata(e=this.settingsProvider.settings){return this.tagService.cleanupTagMetadata(e)}async runUnifiedCleanup(e,n=this.settingsProvider.settings){let[r,o,a,i,s]=await Promise.all([this.folderService.cleanupWithValidators(e,n),this.tagService.cleanupWithValidators(e,n),this.propertyService.cleanupWithValidators(e,n),this.fileService.cleanupWithValidators(e,n),this.navigationSeparatorService.cleanupWithValidators(e,n)]);return r||o||a||i||s}async getCleanupSummary(){let e=t.cloneSettings(this.settingsProvider.settings),n=t.computeMetadataCounts(e);await this.cleanupAllMetadata(e);let r=t.computeMetadataCounts(e),o=Math.max(0,n.folders-r.folders),a=Math.max(0,n.tags-r.tags),i=Math.max(0,n.properties-r.properties),s=Math.max(0,n.files-r.files),l=Math.max(0,n.pinnedNotes-r.pinnedNotes),c=Math.max(0,n.separators-r.separators),u=o+a+i+s+l+c;return{folders:o,tags:a,properties:i,files:s,pinnedNotes:l,separators:c,total:u}}static cloneSettings(e){return JSON.parse(JSON.stringify(e))}static computeMetadataCounts(e){let n=t.collectUniqueKeys([e.folderColors,e.folderBackgroundColors,e.folderIcons,e.folderSortOverrides,e.folderAppearances]),r=t.collectUniqueKeys([e.tagColors,e.tagBackgroundColors,e.tagIcons,e.tagSortOverrides,e.tagAppearances]),o=t.collectUniqueKeys([e.fileIcons,e.fileColors,e.fileBackgroundColors]),a=t.collectUniqueKeys([e.propertyColors,e.propertyBackgroundColors,e.propertyIcons,e.propertySortOverrides,e.propertyAppearances,e.propertyTreeSortOverrides]);e.vaultProfiles.forEach(l=>{!Array.isArray(l.propertyKeys)||l.propertyKeys.length===0||l.propertyKeys.forEach(c=>{let u=typeof c?.key=="string"?Me(c.key):"";u&&a.add(Gn(u))})}),Object.keys(e.collapsedPinnedContexts??{}).forEach(l=>{let c=vm(l,"folder");if(c!==null){n.add(c);return}let u=vm(l,"tag");if(u!==null){r.add(u);return}let p=vm(l,"property");p!==null&&a.add(p)});let i=e.pinnedNotes?Object.keys(e.pinnedNotes).length:0,s=e.navigationSeparators?Object.keys(e.navigationSeparators).length:0;return{folders:n.size,tags:r.size,properties:a.size,files:o.size,pinnedNotes:i,separators:s}}static collectUniqueKeys(e){let n=new Set;return e.forEach(r=>{r&&Object.keys(r).forEach(o=>{n.add(o)})}),n}static prepareCleanupValidators(e,n){let r=kt(),o=n??uN(r,void 0,void 0,[],!0,!1).tagTree,a=new Set(e.vault.getFiles().map(l=>l.path)),i=new Set,s=l=>{i.add(l.path),l.children.forEach(c=>{c instanceof D$.TFolder&&s(c)})};return s(e.vault.getRoot()),{dbFiles:r.getAllFiles(),tagTree:o,vaultFiles:a,vaultFolders:i}}};var QI=require("obsidian");xn();Ee();Ai();var O$=require("obsidian");Ee();ot();By();var $I=class extends O$.Modal{constructor(e,n){super(e),this.propertyKey=n.propertyKey,this.affectedCount=n.affectedCount,this.sampleFiles=n.sampleFiles,this.initialValue=n.initialValue??n.propertyKey,this.onSubmit=n.onSubmit}onOpen(){let e=this.affectedCount===1?d.modals.tagOperation.file:d.modals.tagOperation.files;this.titleEl.setText(d.modals.propertyOperation.renameTitle.replace("{property}",this.propertyKey)),this.contentEl.createDiv("nn-tag-rename-description").setText(d.modals.propertyOperation.renameWarning.replace("{property}",this.propertyKey).replace("{count}",this.affectedCount.toString()).replace("{files}",e));let r=this.contentEl.createDiv("nn-tag-rename-input-container"),o=r.createEl("label",{text:d.modals.propertyOperation.newKeyPrompt});o.htmlFor="nn-property-rename-input",this.inputEl=r.createEl("input",{type:"text",attr:{id:"nn-property-rename-input"},value:this.initialValue,placeholder:d.modals.propertyOperation.newKeyPlaceholder}),this.inputEl.addClass("nn-input"),this.inputEl.addEventListener("input",()=>this.updateSubmitState()),this.contentEl.createEl("p",{text:d.modals.tagOperation.modificationWarning}).addClass("nn-tag-rename-warning"),mp(this.contentEl,{total:this.affectedCount,sample:this.sampleFiles});let i=this.contentEl.createDiv("nn-button-container");i.createEl("button",{text:d.common.cancel}).addEventListener("click",()=>this.close()),this.submitBtn=i.createEl("button",{text:d.modals.propertyOperation.confirmRename,cls:"mod-cta"}),this.submitBtn.addEventListener("click",()=>{Q(()=>this.handleSubmit())}),this.scope.register([],"Enter",l=>{activeDocument.activeElement===this.inputEl&&(l.preventDefault(),Q(()=>this.handleSubmit()))}),this.updateSubmitState(),this.inputEl.focus(),this.inputEl.select()}onClose(){this.contentEl.empty()}updateSubmitState(){if(!this.submitBtn)return;let n=this.inputEl.value.trim().length===0;this.submitBtn.toggleClass("mod-disabled",n),this.submitBtn.disabled=n}async handleSubmit(){let e=this.inputEl.value.trim();if(e.length===0)return;await this.onSubmit(e)&&this.close()}};Ud();Ot();Fn();ot();ed();Zr();cn();Rn();By();Ot();var XI=class{constructor(e){this.app=e}isMarkdownFile(e){return e.extension==="md"}async deletePropertyKeyFromFile(e,n){if(!this.isMarkdownFile(e))return!1;let r=Me(n);if(!r)return!1;let o=!1;try{await this.app.fileManager.processFrontMatter(e,a=>{let i=Object.keys(a);for(let s of i)Me(s)===r&&(delete a[s],o=!0)})}catch(a){throw console.error(`[Notebook Navigator] Failed to delete property key "${n}" from ${e.path}`,a),a}return o}async renamePropertyKeyInFile(e,n){if(!this.isMarkdownFile(e))return!1;let r=Me(n.oldKey),o=n.newKeyDisplay.trim(),a=Me(o);if(!r||!a||o.length===0)return!1;let i=!1;try{await this.app.fileManager.processFrontMatter(e,s=>{let l=Object.keys(s),c=l.filter(h=>Me(h)===r);if(c.length===0)return;let u=l.filter(h=>Me(h)===a),p=new Set([...c,...u]);p.delete(o);let g=(()=>{let h=c.find(v=>v===n.oldKey);return h||(c.slice().sort((v,y)=>v.localeCompare(y))[0]??c[0]??n.oldKey)})(),f=s[g];s[o]=f,p.forEach(h=>{delete s[h]}),i=!0})}catch(s){throw console.error(`[Notebook Navigator] Failed to rename property key "${n.oldKey}" → "${n.newKeyDisplay}" in ${e.path}`,s),s}return i}};dn();Ue();var L$=$t.operations.metadataMutationYieldBatchSize,z$=[{read:t=>t.propertyColors,write:(t,e)=>{t.propertyColors=e}},{read:t=>t.propertyBackgroundColors,write:(t,e)=>{t.propertyBackgroundColors=e}},{read:t=>t.propertyIcons,write:(t,e)=>{t.propertyIcons=e}},{read:t=>t.propertySortOverrides,write:(t,e)=>{t.propertySortOverrides=e}},{read:t=>t.propertyAppearances,write:(t,e)=>{t.propertyAppearances=e}}],B$=[{read:t=>t.propertyTreeSortOverrides,write:(t,e)=>{t.propertyTreeSortOverrides=e}}];function _$(t,e,n){if(!t.propertySortKey.trim())return!1;let r=YK(t.propertySortKey,e,n);return r===t.propertySortKey?!1:(t.propertySortKey=r,!0)}function H$(t,e,n){let r=t.manualSortPropertyKey.trim();return!r||Me(r)!==e?!1:(t.manualSortPropertyKey=n??"",!0)}function V$(t,e,n){let r=t.manualSortGroupHeaderProperty.trim();return!r||Me(r)!==e?!1:(t.manualSortGroupHeaderProperty=n??"",!0)}function Dge(t,e,n){if(!t)return!1;let r=!1;for(let o of Object.keys(t)){let a=Oc(t[o]);!a||typeof a=="string"||Me(a.propertyKey??"")===e&&(n?t[o]={...a,propertyKey:n}:delete t[o],r=!0)}return r}function U$(t,e,n){let r=!1;return KA.forEach(o=>{r=Dge(t[o],e,n)||r}),r}var ZI=class{constructor(e,n,r,o){this.app=e;this.getSettings=n;this.saveSettingsAndUpdate=r;this.getPropertyTreeService=o;this.propertyKeyRenameListeners=new Set;this.propertyKeyDeleteListeners=new Set;this.fileMutations=new XI(this.app)}addPropertyKeyRenameListener(e){return this.propertyKeyRenameListeners.add(e),()=>{this.propertyKeyRenameListeners.delete(e)}}addPropertyKeyDeleteListener(e){return this.propertyKeyDeleteListeners.add(e),()=>{this.propertyKeyDeleteListeners.delete(e)}}async promptRenamePropertyKey(e){let n=this.getPropertyTreeService();if(!n){de(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"});return}let r=n.getKeyNode(e);if(!r){de(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"});return}let o=this.collectPropertyKeyPathsFromVault(e),a=zy(this.app,o),i=Promise.resolve().then(()=>this.collectRenameConflictSnapshot(e,o));new $I(this.app,{propertyKey:r.name,affectedCount:a.total,sampleFiles:a.sample,initialValue:r.name,onSubmit:async l=>this.submitPropertyKeyRename({normalizedKey:e,keyNodeName:r.name,newKey:l,affectedPaths:o,conflictSnapshotPromise:i})}).open()}async renamePropertyKey(e,n){let r=this.getPropertyTreeService();if(!r)return de(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"}),!1;let o=r.getKeyNode(e);if(!o)return de(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"}),!1;let a=this.collectPropertyKeyPathsFromVault(e),i=Promise.resolve().then(()=>this.collectRenameConflictSnapshot(e,a));return this.submitPropertyKeyRename({normalizedKey:e,keyNodeName:o.name,newKey:n,affectedPaths:a,conflictSnapshotPromise:i})}async submitPropertyKeyRename(e){let n=e.newKey.trim();if(!n||n.includes(`
`)||n.includes("\r"))return de(d.modals.propertyOperation.invalidKeyName,{variant:"warning"}),!1;let r=Me(n);if(!r)return de(d.modals.propertyOperation.invalidKeyName,{variant:"warning"}),!1;let o=await e.conflictSnapshotPromise,a=this.collectRenameConflictPathsFromSnapshot(e.normalizedKey,r,o);return a.size>0&&!await this.confirmRenameConflicts({oldKeyDisplay:e.keyNodeName,newKeyDisplay:n,conflictPaths:a})?!1:await this.runPropertyKeyRename({oldKeyNormalized:e.normalizedKey,oldKeyDisplay:e.keyNodeName,newKeyDisplay:n,affectedPaths:e.affectedPaths})}async promptDeletePropertyKey(e){let n=this.getPropertyTreeService();if(!n){de(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"});return}let r=n.getKeyNode(e);if(!r){de(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"});return}let o=this.collectPropertyKeyPathsFromVault(e),a=zy(this.app,o),i=a.total===1?d.modals.tagOperation.file:d.modals.tagOperation.files;new En(this.app,d.modals.propertyOperation.deleteTitle.replace("{property}",r.name),d.modals.propertyOperation.deleteWarning.replace("{property}",r.name).replace("{count}",a.total.toString()).replace("{files}",i),()=>{Q(()=>this.runPropertyKeyDelete({keyNodeName:r.name,normalizedKey:e,affectedPaths:o}))},d.modals.propertyOperation.confirmDelete,{buildContent:l=>mp(l,a)}).open()}async runPropertyKeyRename(e){let n=Me(e.oldKeyNormalized),r=e.oldKeyDisplay.trim(),o=e.newKeyDisplay.trim(),a=Me(o);if(!n||!a||!o)return de(d.modals.propertyOperation.invalidKeyName,{variant:"warning"}),!1;if(r===o)return de(d.modals.propertyOperation.renameNoChanges.replace("{oldKey}",r).replace("{newKey}",o),{variant:"warning"}),!1;let i=0,s=0,l=0,c=0;for(let m of e.affectedPaths){let g=this.app.vault.getAbstractFileByPath(m);if(!(g instanceof QI.TFile)){c+=1;continue}try{if(!this.fileMutations.isMarkdownFile(g)){c+=1;continue}l+=1,await this.fileMutations.renamePropertyKeyInFile(g,{oldKey:r,newKeyDisplay:o})&&(i+=1)}catch(f){s+=1,console.error(`[Notebook Navigator] Failed to rename property key ${r} → ${o} in ${m}`,f)}c+=1,c%L$===0&&await qm()}if(!(s===0&&i>0))return de(`${d.modals.propertyOperation.confirmRename}: ${r} → ${o} (${i}/${l})`,{variant:"warning"}),!0;let p=!1;try{await this.updateSettingsAfterRename(n,o)}catch(m){p=!0,console.error("[Notebook Navigator] Failed to update settings after property key rename",m)}return this.notifyPropertyKeyRenamed({oldKey:n,newKey:a}),p?de(d.modals.propertyOperation.renameSettingsUpdateFailed.replace("{oldKey}",r).replace("{newKey}",o),{variant:"warning"}):de(`${d.modals.propertyOperation.confirmRename}: ${r} → ${o} (${i}/${l})`,{variant:"success"}),!0}async runPropertyKeyDelete(e){let n=Me(e.normalizedKey);if(!n)return!1;let r=0,o=0,a=0,i=0;for(let c of e.affectedPaths){let u=this.app.vault.getAbstractFileByPath(c);if(!(u instanceof QI.TFile)){i+=1;continue}try{if(!this.fileMutations.isMarkdownFile(u)){i+=1;continue}a+=1,await this.fileMutations.deletePropertyKeyFromFile(u,n)&&(r+=1)}catch(p){o+=1,console.error(`[Notebook Navigator] Failed to delete property key ${e.keyNodeName} in ${c}`,p)}i+=1,i%L$===0&&await qm()}if(!(o===0&&r>0))return de(`${d.modals.propertyOperation.confirmDelete}: ${e.keyNodeName} (${r}/${a})`,{variant:"warning"}),!0;let l=!1;try{await this.updateSettingsAfterDelete(n)}catch(c){l=!0,console.error("[Notebook Navigator] Failed to update settings after property key delete",c)}return this.notifyPropertyKeyDeleted({key:n}),l?de(d.modals.propertyOperation.deleteSettingsUpdateFailed.replace("{property}",e.keyNodeName),{variant:"warning"}):r===1?de(d.modals.propertyOperation.deleteSingleSuccess.replace("{property}",e.keyNodeName),{variant:"success"}):de(d.modals.propertyOperation.deleteMultipleSuccess.replace("{property}",e.keyNodeName).replace("{count}",r.toString()),{variant:"success"}),!0}renamePropertyNodeMetadataRecord(e,n,r){if(!e||n===r)return{changed:!1,next:e};let o=`${n}=`,a=Object.keys(e),i,s=!1;return a.forEach(l=>{if(!(l!==n&&!l.startsWith(o))){if(i||(i=De(e)),l===n){i[r]=i[l],delete i[l],s=!0;return}if(l.startsWith(o)){let c=`${r}${l.slice(n.length)}`;i[c]=i[l],delete i[l],s=!0}}}),s&&i?{changed:!0,next:i}:{changed:!1,next:e}}renamePropertyKeyMetadataRecord(e,n,r){if(!e||n===r||!Object.prototype.hasOwnProperty.call(e,n))return{changed:!1,next:e};let o=De(e);return o[r]=o[n],delete o[n],{changed:!0,next:o}}removePropertyNodeMetadataRecord(e,n){if(!e)return{changed:!1,next:e};let r=`${n}=`,o=Object.keys(e),a,i=!1;return o.forEach(s=>{s!==n&&!s.startsWith(r)||(a||(a=De(e)),delete a[s],i=!0)}),i&&a?{changed:!0,next:a}:{changed:!1,next:e}}removePropertyKeyMetadataRecord(e,n){if(!e||!Object.prototype.hasOwnProperty.call(e,n))return{changed:!1,next:e};let r=De(e);return delete r[n],{changed:!0,next:r}}mutatePropertyMetadataRecords(e,n,r){let o=!1;return n.forEach(a=>{let i=r(a.read(e));!i.changed||!i.next||(a.write(e,i.next),o=!0)}),o}renamePropertyNodeMetadataFields(e,n,r){return this.mutatePropertyMetadataRecords(e,z$,o=>this.renamePropertyNodeMetadataRecord(o,n,r))}renamePropertyKeyMetadataFields(e,n,r){return this.mutatePropertyMetadataRecords(e,B$,o=>this.renamePropertyKeyMetadataRecord(o,n,r))}removePropertyNodeMetadataFields(e,n){return this.mutatePropertyMetadataRecords(e,z$,r=>this.removePropertyNodeMetadataRecord(r,n))}removePropertyKeyMetadataFields(e,n){return this.mutatePropertyMetadataRecords(e,B$,r=>this.removePropertyKeyMetadataRecord(r,n))}migratePropertyMetadataAfterRename(e,n,r){let o=Gn(n),a=Gn(r),i=this.renamePropertyNodeMetadataFields(e,o,a),s=this.renamePropertyKeyMetadataFields(e,o,a),l=pv(e.collapsedPinnedContexts,W.PROPERTY,o,a,{descendantDelimiter:"="});return i||s||l}removePropertyMetadataForDeletedKey(e,n){let r=Gn(n),o=this.removePropertyNodeMetadataFields(e,r),a=this.removePropertyKeyMetadataFields(e,r),i=mv(e.collapsedPinnedContexts,W.PROPERTY,r,{descendantDelimiter:"="});return o||a||i}async updateSettingsAfterRename(e,n){let r=this.getSettings(),o=!1,a=Oi(r),i=Me(n),s=oW(a,e,n,!1);o=NO(r,s)||o,o=_$(r,e,n)||o,o=H$(r,e,n)||o,o=V$(r,e,n)||o,o=U$(r,e,n)||o,i&&(o=this.migratePropertyMetadataAfterRename(r,e,i)||o),o&&await this.saveSettingsAndUpdate()}async updateSettingsAfterDelete(e){let n=this.getSettings(),r=!1,o=Oi(n),a=rW(o,e);r=NO(n,a)||r,r=_$(n,e,null)||r,r=H$(n,e,null)||r,r=V$(n,e,null)||r,r=U$(n,e,null)||r,r=this.removePropertyMetadataForDeletedKey(n,e)||r,r&&await this.saveSettingsAndUpdate()}collectRenameConflictPaths(e,n,r){let o=this.collectRenameConflictSnapshot(e,r);return this.collectRenameConflictPathsFromSnapshot(e,n,o)}collectRenameConflictSnapshot(e,n){let r=Me(e);if(!r)return new Map;let o=new Map;for(let a of n){let i=this.app.vault.getAbstractFileByPath(a);if(!(!(i instanceof QI.TFile)||!this.fileMutations.isMarkdownFile(i)))try{let s=this.app.metadataCache.getFileCache(i)?.frontmatter;if(!mt(s))continue;let l=Object.keys(s);if(l.length===0)continue;let c=new Set,u=!1;if(l.forEach(p=>{let m=Me(p);m&&(c.add(m),m===r&&(u=!0))}),!u)continue;o.set(a,c)}catch(s){console.error(`[Notebook Navigator] Failed to analyze property rename conflict in ${a}`,s)}}return o}collectPropertyKeyPathsFromVault(e){let n=Me(e);if(!n)return new Set;let r=new Set,o=this.app.vault.getMarkdownFiles();for(let a of o){let i=this.app.metadataCache.getFileCache(a)?.frontmatter;if(!mt(i))continue;Object.keys(i).some(l=>Me(l)===n)&&r.add(a.path)}return r}collectRenameConflictPathsFromSnapshot(e,n,r){let o=Me(e),a=Me(n);if(!o||!a||o===a)return new Set;let i=new Set;return r.forEach((s,l)=>{s.has(a)&&i.add(l)}),i}async confirmRenameConflicts(e){let n=zy(this.app,e.conflictPaths),r=n.total===1?d.modals.tagOperation.file:d.modals.tagOperation.files;return await new Promise(o=>{new En(this.app,d.modals.propertyOperation.renameTitle.replace("{property}",e.oldKeyDisplay),d.modals.propertyOperation.renameConflictWarning.replace("{oldKey}",e.oldKeyDisplay).replace("{newKey}",e.newKeyDisplay).replace("{count}",n.total.toString()).replace("{files}",r),()=>o(!0),d.modals.propertyOperation.confirmRename,{buildContent:i=>mp(i,n),onCancel:()=>o(!1)}).open()})}notifyPropertyKeyRenamed(e){if(this.propertyKeyRenameListeners.size!==0)for(let n of this.propertyKeyRenameListeners)try{n(e)}catch(r){console.error("[Notebook Navigator] Property key rename listener failed",r)}}notifyPropertyKeyDeleted(e){if(this.propertyKeyDeleteListeners.size!==0)for(let n of this.propertyKeyDeleteListeners)try{n(e)}catch(r){console.error("[Notebook Navigator] Property key delete listener failed",r)}}};var JI=class{constructor(e){this.fileMutations=e}async addTagToFiles(e,n){let r=0,o=0;for(let a of n){if(!this.fileMutations.isMarkdownFile(a)){o++;continue}if(await this.fileMutations.fileHasTagOrAncestor(a,e)){o++;continue}await this.fileMutations.addTagToFile(a,e),r++}return{added:r,skipped:o}}async removeTagFromFiles(e,n){let r=0;for(let o of n)if(this.fileMutations.isMarkdownFile(o))try{await this.fileMutations.removeTagFromFile(o,e)&&r++}catch(a){console.error(`[Notebook Navigator] Failed to remove tag ${e} from ${o.path}`,a)}return r}async clearAllTagsFromFiles(e){let n=0;for(let r of e)this.fileMutations.isMarkdownFile(r)&&await this.fileMutations.clearAllTagsFromFile(r)&&n++;return n}getTagsFromFiles(e){return this.fileMutations.getTagsFromFiles(e)}};var W$=require("obsidian");Ud();Ee();Ai();Ue();nx();tk();ot();Fn();By();var Oge=$t.operations.metadataMutationYieldBatchSize,Lge=8,ox=class{constructor(e,n,r,o,a){this.app=e;this.fileMutations=n;this.getTagTreeService=r;this.getMetadataService=o;this.getHooks=a}async promptDeleteTag(e){if(e===zt||e===bt)return;let n=this.getHooks(),r=this.getTagTreeService(),o=n.resolveDisplayTagPath(e);if(o.length===0)return;let a=new Wi(o),i=dz(this.app,a,r),s=Array.from(new Set(i)),l=cz(this.app,s);if(l.total===0){de(`#${o}: ${d.listPane.emptyStateNoNotes}`,{variant:"warning"});return}let c=l.total===1?d.modals.tagOperation.file:d.modals.tagOperation.files;new En(this.app,d.modals.tagOperation.deleteTitle.replace("{tag}",`#${o}`),d.modals.tagOperation.deleteWarning.replace("{tag}",`#${o}`).replace("{count}",l.total.toString()).replace("{files}",c),()=>{Q(()=>this.runTagDelete(o))},d.modals.tagOperation.confirmDelete,{buildContent:p=>mp(p,l)}).open()}async runTagDelete(e,n){let r=this.getHooks(),o=new Wi(e),a=new Set;if(n&&n.length>0)n.forEach(b=>{typeof b=="string"&&b.length>0&&a.add(b)});else{let b=this.getTagTreeService();dz(this.app,o,b).forEach(y=>{typeof y=="string"&&y.length>0&&a.add(y)})}if(a.size===0)return de(`#${o.name}: ${d.listPane.emptyStateNoNotes}`,{variant:"warning"}),!1;let i=a.size,s=0,l=0,c=0,u=0,p={"file-missing":0,"not-markdown":0,"no-op":0},m={"file-missing":[],"not-markdown":[],"no-op":[]},g=(b,v)=>{b.length>=Lge||b.push(v)};for(let b of a){u+=1;let v=this.app.vault.getAbstractFileByPath(b);if(!(v instanceof W$.TFile))l+=1,p["file-missing"]+=1,g(m["file-missing"],b);else if(!this.fileMutations.isMarkdownFile(v))l+=1,p["not-markdown"]+=1,g(m["not-markdown"],v.path);else try{await r.deleteTagFromFile(v,o)?s+=1:(l+=1,p["no-op"]+=1,g(m["no-op"],v.path))}catch(y){c+=1,console.error(`[Notebook Navigator] Failed to delete tag ${o.tag} in ${b}`,y)}u%Oge===0&&await qm()}l>0&&console.warn("[Notebook Navigator] Tag delete skipped files",{skipped:l,total:i,skippedByReason:p,samples:m});let f=l>0||c>0,h=()=>{let b=l+c;return d.modals.tagOperation.deleteBatchNotFinalized.replace("{removed}",s.toString()).replace("{total}",i.toString()).replace("{notUpdated}",b.toString())};if(s===0){let b=f?h():d.fileSystem.notifications.noTagsToRemove,v=f&&c>0?`${b} ${d.modals.tagOperation.checkConsoleForDetails}`:b;return de(`${d.modals.tagOperation.confirmDelete}: ${o.tag}. ${v}`,{variant:"warning"}),!1}if(f){let b=h(),v=c>0?`${b} ${d.modals.tagOperation.checkConsoleForDetails}`:b;return de(`${d.modals.tagOperation.confirmDelete}: ${o.tag}. ${v}`,{variant:"warning"}),!0}return await r.removeTagMetadataAfterDelete(o.name),await r.removeTagShortcutsAfterDelete(o.name),r.notifyTagDeleted({path:o.name,canonicalPath:o.canonicalName}),s===1?de(d.fileSystem.notifications.tagRemovedFromNote,{variant:"success"}):de(d.fileSystem.notifications.tagRemovedFromNotes.replace("{count}",s.toString()),{variant:"success"}),!0}async deleteTagFromFile(e,n){if(!this.fileMutations.isMarkdownFile(e))return!1;let r=n.canonicalName;if(r.length===0)return!1;let o=this.fileMutations.collectDescendantTags(e,n.name),a=o?.normalizedSet??new Set,i=o?.tags??[],s=new Set(a);s.add(r);let l=i.length>0?[n.name,...i]:[n.name];return this.fileMutations.stripTagsFromFile(e,c=>s.has(c),l,"remove tag hierarchy from frontmatter")}async removeTagMetadataAfterDelete(e){let n=this.getMetadataService();if(!n)return;let r=e.trim();if(r.length!==0)try{await n.handleTagDelete(r)}catch(o){console.error("[Notebook Navigator] Failed to remove tag metadata after delete",o)}}};var n3=require("obsidian");zn();Dr();Sn();iz();Sl();Hy();As();vz();Ot();var e3="[^\\S\\r\\n]",t3=`#[^${Ch}]+`,Gge=`(?=$|[${Ch}])`,ax=class t{constructor(e,n){this.app=e;this.getSettings=n}static{this.INLINE_TAG_PATTERN=new RegExp(`(${e3})?${t3}`,"gu")}static{this.INLINE_TAG_TEST_PATTERN=new RegExp(`(?:^|\\s)${t3}`,"u")}isMarkdownFile(e){return e.extension==="md"}isValidTagName(e){return gN(e)}getTagLeaf(e){let n=e.split("/");return n[n.length-1]??e}async fileHasTagOrAncestor(e,n){if(!this.isMarkdownFile(e))return!1;let r=kt(),o=Pr({app:this.app,file:e,db:r}),a=It(n);return a.length===0?!1:o.some(i=>{let s=It(i);return s.length===0?!1:s===a?!0:a.startsWith(`${s}/`)})}async addTagToFile(e,n){if(this.isMarkdownFile(e)){await this.removeDescendantTagsFromFile(e,n);try{await this.app.fileManager.processFrontMatter(e,r=>{let o=this.resolveFrontmatterTagFieldKey(r)??"tags",a=r[o],i=typeof a=="string"&&a.trim().length===0;if(a==null||i){r[o]=[n];return}if(Array.isArray(a)){let s=a.filter(l=>typeof l=="string").map(l=>l.trim()).filter(l=>l.length>0);r[o]=this.dedupeCanonicalTagValues([...s,n]);return}if(typeof a=="string"){let s=Fo(a);r[o]=this.dedupeCanonicalTagValues([...s,n]);return}r[o]=[n]})}catch(r){throw console.error("[Notebook Navigator] Error adding tag to frontmatter",r),r}}}async removeTagFromFile(e,n){if(!this.isMarkdownFile(e))return!1;let r=It(n);return r.length===0?!1:this.stripTagsFromFile(e,o=>o===r,[n],"remove tag from frontmatter")}async removeDescendantTagsFromFile(e,n){if(!this.isMarkdownFile(e))return!1;let r=this.collectDescendantTags(e,n);return r?this.stripTagsFromFile(e,o=>r.normalizedSet.has(o),r.tags,"remove descendant tags from frontmatter"):!1}collectDescendantTags(e,n){let r=It(n);if(r.length===0)return null;let a=this.getTagsFromFiles([e]).filter(s=>It(s).startsWith(`${r}/`));if(a.length===0)return null;let i=new Set(a.map(s=>It(s)).filter(s=>s.length>0));return i.size===0?null:{tags:a,normalizedSet:i}}async clearAllTagsFromFile(e){if(!this.isMarkdownFile(e))return!1;let n=!1;try{await this.app.fileManager.processFrontMatter(e,o=>{let a=this.resolveFrontmatterTagFieldKey(o);if(!a)return;let i=o[a];(typeof i=="string"?i.trim().length>0:Array.isArray(i)?i.length>0:i)&&(n=!0,this.cleanupFrontmatterTags(o,a))})}catch(o){throw console.error("[Notebook Navigator] Error clearing frontmatter tags",o),o}let r=await this.app.vault.read(e);return this.hasInlineTags(r)&&await this.app.vault.process(e,o=>{let{content:a}=this.removeInlineTagsWithPattern(o,t.INLINE_TAG_PATTERN);return a!==o&&(n=!0),a}),n}async stripTagsFromFile(e,n,r,o){let a=!1,i=null;try{a=await this.stripTagsFromFrontmatter(e,n,o)}catch(l){i=l instanceof Error?l:new Error(String(l))}let s=r.length>0?await this.stripInlineTags(e,r):!1;if(i!==null)throw i;return a||s}getTagsFromFiles(e){let n=new Map,r=kt();for(let o of e){if(!this.isMarkdownFile(o))continue;Pr({app:this.app,file:o,db:r}).forEach(i=>{let s=It(i);s.length!==0&&(n.has(s)||n.set(s,i))})}return Array.from(n.values()).sort()}async stripTagsFromFrontmatter(e,n,r){let o=!1;try{await this.app.fileManager.processFrontMatter(e,a=>{let i=null,s=ex(a,l=>{if(Array.isArray(l.value)){if(l.isAlias){let m=this.filterAliasValues(l.value,n);if(!m.changed)return;m.nextValue===void 0?l.remove():l.set(m.nextValue);return}let p=this.filterFrontmatterTags(l.value,n);if(!p.changed)return;p.nextValue===void 0?(l.remove(),(l.lowerKey==="tags"||l.lowerKey==="tag")&&(i=i??l.key)):l.set(p.nextValue);return}let c=l.value;if(typeof c!="string")return;if(l.isAlias){let p=this.filterAliasValues(c,n);if(!p.changed)return;p.nextValue===void 0?l.remove():l.set(p.nextValue);return}let u=this.filterFrontmatterTags(c,n);u.changed&&(u.nextValue===void 0?(l.remove(),(l.lowerKey==="tags"||l.lowerKey==="tag")&&(i=i??l.key)):l.set(u.nextValue))});i&&this.cleanupFrontmatterTags(a,i),(s||i!==null)&&(o=!0)})}catch(a){throw a instanceof Error?(a.message=`[Notebook Navigator] Failed to ${r}: ${a.message}`,a):Object.assign(new Error(`[Notebook Navigator] Failed to ${r}`),{cause:a})}return o}filterFrontmatterTags(e,n){if(Array.isArray(e)){let{filtered:r,removed:o}=this.filterStringArrayEntries(e,a=>It(a),a=>a.length===0||n(a));return o?{nextValue:r.length===0?void 0:r,changed:!0}:{nextValue:e,changed:!1}}if(typeof e=="string"){let r=(0,n3.parseFrontMatterTags)({tags:e})??[];if(r.length===0)return{nextValue:e,changed:!1};let{filtered:o,removed:a}=this.filterStringArrayEntries(r,s=>It(s),s=>s.length===0||n(s));if(!a)return{nextValue:e,changed:!1};let i=o.filter(s=>typeof s=="string");return i.length===0?{changed:!0}:{nextValue:i.length===1?i[0]:i,changed:!0}}return{nextValue:e,changed:!1}}filterAliasValues(e,n){if(Array.isArray(e)){let{filtered:r,removed:o}=this.filterStringArrayEntries(e,a=>{let i=a.trim();if(!i.startsWith("#"))return null;let s=It(i);return s.length===0?null:s},n);return o?{nextValue:r.length===0?void 0:r,changed:!0}:{nextValue:e,changed:!1}}if(typeof e=="string"){let r=e.trim();if(!r.startsWith("#"))return{nextValue:e,changed:!1};let o=It(r);return o.length===0||!n(o)?{nextValue:e,changed:!1}:{changed:!0}}return{nextValue:e,changed:!1}}filterStringArrayEntries(e,n,r){let o=!1,a=[];for(let i of e){if(typeof i!="string"){a.push(i);continue}let s=i.trim();if(s.length===0){o=!0;continue}let l=n(s);if(l===null){a.push(s);continue}if(r(l)){o=!0;continue}a.push(s)}return{filtered:a,removed:o}}resolveFrontmatterTagFieldKey(e){return Yo(e,"tags")??Yo(e,"tag")}dedupeCanonicalTagValues(e){let n=[],r=new Set;return e.forEach(o=>{let a=o.trim();if(a.length===0)return;let i=It(a);!i||r.has(i)||(r.add(i),n.push(a))}),n}cleanupFrontmatterTags(e,n="tags"){if(!!this.getSettings()?.keepEmptyTagsProperty){e[n]=[];return}Reflect.has(e,n)&&delete e[n]}async stripInlineTags(e,n){let r=this.dedupeCanonicalTagValues(n);if(r.length===0)return!1;let o=r.filter(u=>hN(u));if(o.length===0)return!1;o.sort((u,p)=>p.length-u.length);let a=o.map(u=>({tag:u,pattern:this.buildSpecificTagPattern(u)})),i=!1,s,l=this.app.vault;if(typeof l.read=="function")try{if(s=await l.read(e),typeof s=="string"){let u=s;i=a.some(({pattern:p})=>this.matchesPattern(u,p))}}catch(u){throw console.error("[Notebook Navigator] Failed to read file while stripping inline tags",u),u instanceof Error?u:new Error("[Notebook Navigator] Failed to read file while stripping inline tags")}else i=!0;if(!i)return!1;if(typeof s=="string"){let u=this.applyInlineTagRemoval(s,a);return u.changed?(await this.app.vault.modify(e,u.content),!0):!1}let c=!1;return await this.app.vault.process(e,u=>{let p=this.applyInlineTagRemoval(u,a);return p.changed&&(c=!0),p.content}),c}applyInlineTagRemoval(e,n){if(n.length===0)return{content:e,changed:!1};let r=e,o=!1,a=this.computeInlineTagExclusionRanges(r);for(let{pattern:i}of n){let{content:s,exclusionRanges:l}=this.removeInlineTagsWithPattern(r,i,a);s!==r&&(o=!0,r=s),a=l}return{content:r,changed:o}}hasInlineTags(e){return t.INLINE_TAG_TEST_PATTERN.test(e)}buildSpecificTagPattern(e){let n=e.trim(),r=n.startsWith("#")?n.slice(1):n,o=this.escapeRegExp(r);return new RegExp(`(${e3})?#${o}${Gge}`,"giu")}removeInlineTagsWithPattern(e,n,r){n.lastIndex=0;let o=r??this.computeInlineTagExclusionRanges(e),a=[],i=e.replace(n,(s,l,c)=>{let u=l?.length??0,p=c+u,m=p>0?e.charAt(p-1):null;return!fN(m)||Y$(p,o)?s:(a.push({start:c,length:s.length}),"")});if(a.length>0){let s=0;for(let l of a){let c=l.start-s;this.shiftRangesAfterRemoval(o,c,l.length),s+=l.length}}return{content:i,exclusionRanges:o}}matchesPattern(e,n){return n.lastIndex=0,n.test(e)}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}computeInlineTagExclusionRanges(e){let n=nc(e),r=wl(e,n),o=Z$(e);return ou([...n,...r,...o])}shiftRangesAfterRemoval(e,n,r){if(r<=0)return;let o=n+r;for(let a of e)if(!(a.end<=n)){if(a.start>=o){a.start-=r,a.end-=r;continue}a.end=Math.max(a.start,a.end-r)}}};Ud();Ee();nx();var r3=require("obsidian");Ee();ot();By();var ix=class extends r3.Modal{constructor(e,n){super(e),this.tagPath=n.tagPath,this.affectedCount=n.affectedCount,this.sampleFiles=n.sampleFiles,this.initialValue=n.initialValue??n.tagPath,this.onSubmit=n.onSubmit}onOpen(){let e=`#${this.tagPath}`,n=this.affectedCount===1?d.modals.tagOperation.file:d.modals.tagOperation.files;this.titleEl.setText(d.modals.tagOperation.renameTitle.replace("{tag}",e)),this.contentEl.createDiv("nn-tag-rename-description").setText(d.modals.tagOperation.renameWarning.replace("{oldTag}",e).replace("{count}",this.affectedCount.toString()).replace("{files}",n));let o=this.contentEl.createDiv("nn-tag-rename-input-container"),a=o.createEl("label",{text:d.modals.tagOperation.newTagPrompt});a.htmlFor="nn-tag-rename-input",this.inputEl=o.createEl("input",{type:"text",attr:{id:"nn-tag-rename-input"},value:this.initialValue,placeholder:d.modals.tagOperation.newTagPlaceholder}),this.inputEl.addClass("nn-input"),this.inputEl.addEventListener("input",()=>this.updateSubmitState()),this.contentEl.createEl("p",{text:d.modals.tagOperation.modificationWarning}).addClass("nn-tag-rename-warning"),mp(this.contentEl,{total:this.affectedCount,sample:this.sampleFiles});let s=this.contentEl.createDiv("nn-button-container");s.createEl("button",{text:d.common.cancel}).addEventListener("click",()=>this.close()),this.submitBtn=s.createEl("button",{text:d.modals.tagOperation.confirmRename,cls:"mod-cta"}),this.submitBtn.addEventListener("click",()=>{Q(()=>this.handleSubmit())}),this.scope.register([],"Enter",c=>{activeDocument.activeElement===this.inputEl&&(c.preventDefault(),Q(()=>this.handleSubmit()))}),this.updateSubmitState(),this.inputEl.focus(),this.inputEl.select()}onClose(){this.contentEl.empty()}updateSubmitState(){if(!this.submitBtn)return;let e=this.inputEl.value.trim(),n=e.length===0||e===this.tagPath;this.submitBtn.toggleClass("mod-disabled",n),this.submitBtn.disabled=n}async handleSubmit(){let e=this.inputEl.value.trim();if(e.length===0||e===this.tagPath)return;await this.onSubmit(e)&&this.close()}};tk();Fn();var qge=$t.operations.metadataMutationYieldBatchSize,sx=class{constructor(e,n,r,o,a,i){this.app=e;this.fileMutations=n;this.getTagTreeService=r;this.getMetadataService=o;this.resolveDisplayTagPathInternal=a;this.getHooks=i}async promptRenameTag(e,n){let r=this.resolveDisplayTagPathInternal(e),o=new Wi(r),a=_y(this.app,o),i=uz(this.app,a);if(i.total===0){de(`#${r}: ${d.listPane.emptyStateNoNotes}`,{variant:"warning"});return}new ix(this.app,{tagPath:r,affectedCount:i.total,sampleFiles:i.sample,initialValue:this.getInitialInputValue(n,r),onSubmit:async l=>this.submitRename(r,o,l,a)}).open()}async renameTag(e,n){let r=this.resolveDisplayTagPathInternal(e),o=new Wi(r),a=_y(this.app,o);return uz(this.app,a).total===0?(de(`#${r}: ${d.listPane.emptyStateNoNotes}`,{variant:"warning"}),!1):this.submitRename(r,o,n,a)}async submitRename(e,n,r,o){let a=(r.startsWith("#")?r.slice(1):r).trim();if(!this.fileMutations.isValidTagName(a))return de(d.modals.tagOperation.invalidTagName,{variant:"warning"}),!1;let i=new Wi(a);return lz(n,i)?(de(d.modals.tagOperation.descendantRenameError,{variant:"warning"}),!1):await K$(this.app,a)?this.runTagRename(e,a,o):!1}getInitialInputValue(e,n){let o=(e??n).trim();return o.length===0?n:o.startsWith("#")?o.slice(1):o}buildRenameAnalysis(e,n,r){let o=new Wi(e),a=new Wi(n),i=new tx(o,a),s=this.getTagTreeService(),l=r??_y(this.app,o),c=s?s.getAllTagPaths().map(p=>`#${p}`):[],u=c.length>0?i.willMergeTags(c):null;return{oldTag:o,newTag:a,replacement:i,targets:l,mergeConflict:u}}async executeRename(e){let n=e.mergeConflict;if(n){let[c,u]=n;de(`${c.tag} merges into ${u.tag}`,{variant:"warning"})}let r=0,o=0,a=0,i={"file-missing":0,"file-changed":0,"no-op":0},s={"file-missing":[],"file-changed":[],"no-op":[]},l=(c,u)=>{c.length>=8||c.push(u)};for(let c=0;c0&&console.warn("[Notebook Navigator] Tag rename skipped files",{skipped:o,total:e.targets.length,skippedByReason:i,samples:s}),{renamed:r,total:e.targets.length,skipped:o,failed:a}}async updateTagMetadataAfterRename(e,n,r){let o=this.getMetadataService();if(!o)return;let a=e.trim(),i=n.trim();if(!(a.length===0||i.length===0||a===i))try{await o.handleTagRename(a,i,r)}catch(s){console.error("[Notebook Navigator] Failed to update tag metadata after rename",s)}}async runTagRename(e,n,r=null){let o=this.getHooks(),a=this.buildRenameAnalysis(e,n,r);if(lz(a.oldTag,a.newTag))return de(d.modals.tagOperation.descendantRenameError,{variant:"warning"}),!1;if(a.oldTag.tag===a.newTag.tag)return de(d.modals.tagOperation.renameUnchanged.replace("{tag}",a.oldTag.tag),{variant:"warning"}),!1;if(a.targets.length===0)return de(`#${a.oldTag.name}: ${d.listPane.emptyStateNoNotes}`,{variant:"warning"}),!1;let i=await o.executeRename(a),s=i.skipped>0||i.failed>0,l=()=>{let c=i.skipped+i.failed;return d.modals.tagOperation.renameBatchNotFinalized.replace("{renamed}",i.renamed.toString()).replace("{total}",i.total.toString()).replace("{notUpdated}",c.toString())};if(i.renamed===0){let c=s?l():d.modals.tagOperation.renameNoChanges.replace("{oldTag}",a.oldTag.tag).replace("{newTag}",a.newTag.tag).replace("{countLabel}",d.listPane.emptyStateNoNotes),u=s&&i.failed>0?`${c} ${d.modals.tagOperation.checkConsoleForDetails}`:c;return de(`${d.modals.tagOperation.confirmRename}: ${a.oldTag.tag} → ${a.newTag.tag}. ${u}`,{variant:"warning"}),!1}if(s){let c=l(),u=i.failed>0?`${c} ${d.modals.tagOperation.checkConsoleForDetails}`:c;return de(`${d.modals.tagOperation.confirmRename}: ${a.oldTag.tag} → ${a.newTag.tag}. ${u}`,{variant:"warning"}),!0}return await o.updateTagMetadataAfterRename(a.oldTag.name,a.newTag.name,!!a.mergeConflict),await o.updateTagShortcutsAfterRename(a.oldTag.name,a.newTag.name),o.notifyTagRenamed({oldPath:a.oldTag.name,newPath:a.newTag.name,oldCanonicalPath:a.oldTag.canonicalName,newCanonicalPath:a.newTag.canonicalName,mergedIntoExisting:!!a.mergeConflict}),de(`${d.modals.tagOperation.confirmRename}: ${a.oldTag.tag} → ${a.newTag.tag} (${i.renamed}/${i.total})`,{variant:"success"}),!0}};Sn();Ia();dn();var lx=class{constructor(e){this.getMetadataService=e}async updateTagShortcutsAfterRename(e,n){let r=Ze(e),o=Ze(n);!r||!o||r===o||await this.mutateTagShortcuts(a=>{let i=`${r}/`,s=new Set;for(let p of a)if(Co(p)){let m=Ze(p.tagPath)??p.tagPath;m!==r&&!m.startsWith(i)&&s.add(m)}let l=new Set,c=!1,u=[];for(let p of a){if(!Co(p)){u.push(p);continue}let m=Ze(p.tagPath)??p.tagPath,g=m===r,f=m.startsWith(i),h=m;if(g||f){let v=f?m.slice(i.length):"";h=v.length>0?`${o}/${v}`:o,h!==m&&(c=!0)}if((g||f)&&s.has(h)){c=!0;continue}if(l.has(h)){h!==m&&(c=!0);continue}let b=h===p.tagPath?p:{...p,tagPath:h};u.push(b),l.add(h),s.add(h)}return{changed:c,next:u}},"Failed to update tag shortcuts after rename")}async removeTagShortcutsAfterDelete(e){let n=Ze(e);n&&await this.mutateTagShortcuts(r=>{let o=`${n}/`,a=!1,i=[];for(let s of r){if(!Co(s)){i.push(s);continue}let l=Ze(s.tagPath)??s.tagPath;if(l===n||l.startsWith(o)){a=!0;continue}i.push(s)}return{changed:a,next:i}},"Failed to remove tag shortcuts after delete")}async mutateTagShortcuts(e,n){let o=this.getMetadataService()?.getSettingsProvider();if(!(!o||!_N(o.settings.vaultProfiles,i=>{let{changed:s,next:l}=e(i);return s?l:null})))try{await o.saveSettingsAndUpdate()}catch(i){console.error(`[Notebook Navigator] ${n}`,i)}}};Ue();tk();var dx=class{constructor(e,n,r,o){this.app=e;this.getSettings=n;this.getTagTreeService=r;this.getMetadataService=o;this.tagRenameListeners=new Set;this.tagDeleteListeners=new Set;this.fileMutations=new ax(this.app,this.getSettings),this.batchOperations=new JI(this.fileMutations),this.shortcutMutations=new lx(this.getMetadataService),this.renameWorkflow=new sx(this.app,this.fileMutations,this.getTagTreeService,this.getMetadataService,a=>this.resolveDisplayTagPath(a),()=>this.createRenameHooks()),this.deleteWorkflow=new ox(this.app,this.fileMutations,this.getTagTreeService,this.getMetadataService,()=>this.createDeleteHooks())}addTagRenameListener(e){return this.tagRenameListeners.add(e),()=>{this.tagRenameListeners.delete(e)}}addTagDeleteListener(e){return this.tagDeleteListeners.add(e),()=>{this.tagDeleteListeners.delete(e)}}async addTagToFiles(e,n){return this.batchOperations.addTagToFiles(e,n)}getTagsFromFiles(e){return this.batchOperations.getTagsFromFiles(e)}async removeTagFromFiles(e,n){return this.batchOperations.removeTagFromFiles(e,n)}async clearAllTagsFromFiles(e){return this.batchOperations.clearAllTagsFromFiles(e)}async promptRenameTag(e){await this.openRenameModal(e)}async renameTag(e,n){return e===zt||e===bt?!1:this.renameWorkflow.renameTag(e,n)}async promoteTagToRoot(e){if(e===zt||e===bt)return;let n=this.resolveDisplayTagPath(e);if(!n||n.length===0||!n.includes("/"))return;let r=this.fileMutations.getTagLeaf(n);r.length===0||r===n||await this.openRenameModal(n,r)}async renameTagByDrag(e,n){if(n===zt||n===bt)return;let r=this.resolveDisplayTagPath(e),o=this.resolveDisplayTagPath(n),a=this.fileMutations.getTagLeaf(r),i=o.length>0?`${o}/${a}`:a;i!==r&&await this.openRenameModal(r,i)}async promptDeleteTag(e){await this.deleteWorkflow.promptDeleteTag(e)}async openRenameModal(e,n){await this.renameWorkflow.promptRenameTag(e,n)}resolveDisplayTagPath(e){return rx(e,this.getTagTreeService())}async executeRename(e){return this.renameWorkflow.executeRename(e)}async updateTagMetadataAfterRename(e,n,r){await this.renameWorkflow.updateTagMetadataAfterRename(e,n,r)}async updateTagShortcutsAfterRename(e,n){await this.shortcutMutations.updateTagShortcutsAfterRename(e,n)}async runTagRename(e,n,r){return this.renameWorkflow.runTagRename(e,n,r??null)}async runTagDelete(e,n){return this.deleteWorkflow.runTagDelete(e,n)}async deleteTagFromFile(e,n){return this.deleteWorkflow.deleteTagFromFile(e,n)}async removeTagMetadataAfterDelete(e){await this.deleteWorkflow.removeTagMetadataAfterDelete(e)}async removeTagShortcutsAfterDelete(e){await this.shortcutMutations.removeTagShortcutsAfterDelete(e)}createRenameHooks(){return{executeRename:e=>this.executeRename(e),updateTagMetadataAfterRename:(e,n,r)=>this.updateTagMetadataAfterRename(e,n,r),updateTagShortcutsAfterRename:(e,n)=>this.updateTagShortcutsAfterRename(e,n),notifyTagRenamed:e=>this.notifyTagRenamed(e)}}createDeleteHooks(){return{deleteTagFromFile:(e,n)=>this.deleteTagFromFile(e,n),removeTagMetadataAfterDelete:e=>this.removeTagMetadataAfterDelete(e),removeTagShortcutsAfterDelete:e=>this.removeTagShortcutsAfterDelete(e),notifyTagDeleted:e=>this.notifyTagDeleted(e),resolveDisplayTagPath:e=>this.resolveDisplayTagPath(e)}}notifyTagRenamed(e){if(this.tagRenameListeners.size!==0)for(let n of this.tagRenameListeners)try{n(e)}catch(r){console.error("[Notebook Navigator] Tag rename listener failed",r)}}notifyTagDeleted(e){if(this.tagDeleteListeners.size!==0)for(let n of this.tagDeleteListeners)try{n(e)}catch(r){console.error("[Notebook Navigator] Tag delete listener failed",r)}}};Ba();Rn();Dr();var cx=class{constructor(){this.tagTree=new Map;this.tagNodeByPath=new Map;this.taggedCount=0;this.untaggedCount=0;this.flattenedTags=[];this.cachedTagPaths=null;this.descendantTagPathsByNode=new WeakMap;this.descendantFilePathsByNode=new WeakMap;this.treeUpdateListeners=new Set}updateTagTree(e,n,r){let{nodeByPath:o,flattenedTags:a}=this.rebuildTreeIndexes(e);this.tagTree=e,this.tagNodeByPath=o,this.taggedCount=n,this.untaggedCount=r,this.flattenedTags=a,this.cachedTagPaths=null,this.descendantTagPathsByNode=new WeakMap,this.descendantFilePathsByNode=new WeakMap,this.notifyTreeUpdateListeners()}getTagTree(){return this.tagTree}hasNodes(){return this.tagNodeByPath.size>0}addTreeUpdateListener(e){return this.treeUpdateListeners.add(e),()=>{this.treeUpdateListeners.delete(e)}}getUntaggedCount(){return this.untaggedCount}findTagNode(e){let n=this.normalizeLookupPath(e);if(n.length>0){let r=this.tagNodeByPath.get(n);if(r)return r}return Li(this.tagTree,e)}resolveSelectionTagPath(e){let n=this.findTagNode(e);if(n)return n.path;let r=this.normalizeLookupPath(e);for(;r.includes("/")&&(r=r.slice(0,r.lastIndexOf("/")),!!r);){let o=this.findTagNode(r);if(o)return o.path}return null}getAllTagPaths(){return this.cachedTagPaths||(this.cachedTagPaths=this.flattenedTags.map(e=>e.path)),[...this.cachedTagPaths]}getFlattenedTagNodes(){return this.flattenedTags}collectDescendantTagPaths(e){let n=this.findTagNode(e);if(!n)return new Set;let r=this.collectTagPaths(n);return r.delete(n.path),r}collectTagPaths(e){let n=this.descendantTagPathsByNode.get(e);if(n)return new Set(n);let r=Array.from(ml(e));return this.descendantTagPathsByNode.set(e,r),new Set(r)}collectTagFilePaths(e){let n=this.findTagNode(e);if(!n)return[];let r=this.descendantFilePathsByNode.get(n);if(r)return[...r];let o=Array.from(iO(n));return this.descendantFilePathsByNode.set(n,o),[...o]}getTaggedCount(){return this.taggedCount}normalizeLookupPath(e){return It(e)}rebuildTreeIndexes(e){let n=new Map,r=[],o=new Set,a=[];for(let i of e.values())a.push(i);for(;a.length>0;){let i=a.pop();!i||o.has(i)||(o.add(i),n.has(i.path)||n.set(i.path,i),i.displayPath.length>0&&r.push(i),i.children.forEach(s=>{a.push(s)}))}return r.sort((i,s)=>Mt(i.displayPath,s.displayPath)),{nodeByPath:n,flattenedTags:r}}notifyTreeUpdateListeners(){this.treeUpdateListeners.forEach(e=>{e()})}};cn();var ux=class{constructor(){this.propertyTree=new Map;this.propertyNodeById=new Map;this.descendantNodeIdsByNode=new WeakMap;this.filePathsByNodeAndMode=new WeakMap;this.treeUpdateListeners=new Set}updatePropertyTree(e){this.propertyTree=e,this.rebuildIndexes(e),this.descendantNodeIdsByNode=new WeakMap,this.filePathsByNodeAndMode=new WeakMap,this.notifyTreeUpdateListeners()}getPropertyTree(){return this.propertyTree}hasNodes(){return this.propertyNodeById.size>0}addTreeUpdateListener(e){return this.treeUpdateListeners.add(e),()=>{this.treeUpdateListeners.delete(e)}}findNode(e){return this.propertyNodeById.get(e)??null}getKeyNode(e){return this.propertyTree.get(e)??null}resolveSelectionNodeId(e){return EN(this.propertyTree,e)}collectDescendantNodeIds(e){let n=this.findNode(e);if(!n)return new Set;let r=this.descendantNodeIdsByNode.get(n);if(r)return new Set(r);let o=new Set,a=new Set,i=s=>{if(!a.has(s)){a.add(s);for(let l of s.children.values())o.add(l.id),i(l)}};return i(n),this.descendantNodeIdsByNode.set(n,Array.from(o)),o}collectFilePaths(e,n){let r=this.findNode(e);if(!r)return new Set;if(r.kind==="value"){let c=this.filePathsByNodeAndMode.get(r),u=c?.direct??c?.withDescendants;if(u)return new Set(u);let p=this.collectNodeFilePaths(r,n),m=Array.from(p);return this.filePathsByNodeAndMode.set(r,{direct:m,withDescendants:m}),new Set(m)}let o=n?"withDescendants":"direct",a=this.filePathsByNodeAndMode.get(r),i=a?.[o];if(i)return new Set(i);let s=this.collectNodeFilePaths(r,n),l=Array.from(s);return this.filePathsByNodeAndMode.set(r,{direct:o==="direct"?l:a?.direct??null,withDescendants:o==="withDescendants"?l:a?.withDescendants??null}),new Set(l)}collectFilesForKeys(e){let n=new Set;for(let r of e){let o=this.getKeyNode(r);o&&o.notesWithValue.forEach(a=>n.add(a))}return n}rebuildIndexes(e){let n=new Map,r=new Set,o=a=>{if(!r.has(a)){r.add(a),n.set(a.id,a);for(let i of a.children.values())o(i)}};for(let a of e.values())o(a);this.propertyNodeById=n}notifyTreeUpdateListeners(){this.treeUpdateListeners.forEach(e=>{e()})}collectNodeFilePaths(e,n){if(e.kind==="key")return yj(e,n);if(!e.valuePath)return new Set;let r=this.getKeyNode(e.key);return r?vj(r,e.valuePath):new Set}};yz();var a3=require("obsidian"),$ge=/^[\x20-\x7E]+$/,Xge=/^[A-Za-z0-9 _./-]+$/,Qge=/(^|\s)-?path\s*:/i;function Zge(t){return t instanceof a3.TFile}function o3(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.search=="function"&&typeof e.refreshIndex=="function"&&typeof e.registerOnIndexed=="function"&&typeof e.unregisterOnIndexed=="function"}function Jge(t){if(!t||typeof t!="object")return!1;let e=t;return typeof e.path=="string"&&typeof e.score=="number"&&Array.isArray(e.matches)&&Array.isArray(e.foundWords)&&typeof e.basename=="string"}function ehe(t){return t.filter(e=>typeof e.match=="string"&&typeof e.offset=="number").map(e=>({text:e.match,offset:e.offset,length:e.match.length}))}function the(t){let e=t.trim();return e?$ge.test(e)&&Xge.test(e):!1}function nhe(t,e){let n=e?.pathScope?.trim();return!n||!the(n)||Qge.test(t)?t:`${t} path:"${n}"`}var mx=class{constructor(e){this.app=e}resolveApi(){let r=this.app.plugins?.plugins?.omnisearch;if(r&&r.api&&o3(r.api))return r.api;let o=activeWindow.omnisearch;return o&&o3(o)?o:null}isAvailable(){return this.resolveApi()!==null}async search(e,n){let r=this.resolveApi();if(!r)return[];try{let o=nhe(e,n),a=await r.search(o),i=[];for(let s of a){if(!Jge(s))continue;let l=this.app.vault.getAbstractFileByPath(s.path);Zge(l)&&i.push({file:l,path:s.path,basename:s.basename,score:s.score,excerpt:s.excerpt,matches:ehe(s.matches),foundWords:Array.isArray(s.foundWords)?s.foundWords.filter(c=>typeof c=="string"):[]})}return i}catch{return[]}}registerOnIndexed(e){let n=this.resolveApi();n&&n.registerOnIndexed(e)}unregisterOnIndexed(e){let n=this.resolveApi();n&&n.unregisterOnIndexed(e)}};Rz();Ha();KT();var R3=require("obsidian");ko();_a();var Cx=class{constructor(e){this.settingsProvider=e}recordFileOpen(e){if(this.shouldSkipFile(e))return!1;let n=e.path,r=this.settingsProvider.getRecentNotes(),o=r.filter(s=>s!==n);o.unshift(n);let a=this.getLimit();return o.length>a&&(o.length=a),o.length!==r.length||o.some((s,l)=>s!==r[l])?(this.settingsProvider.setRecentNotes(o),!0):!1}shouldSkipFile(e){if(this.settingsProvider.settings.hideRecentNotes!=="folder-notes")return!1;let n=e.parent;return n instanceof R3.TFolder?zs(e,n,{enableFolderNotes:!0,folderNoteName:this.settingsProvider.settings.folderNoteName,folderNoteNamePattern:this.settingsProvider.settings.folderNoteNamePattern}):!1}renameEntry(e,n){let r=this.settingsProvider.getRecentNotes();if(r.length===0)return!1;let o=this.getLimit(),a=[],i=new Set,s=!1;for(let l of r){let c=l===e?n:l;if(c!==l&&(s=!0),!c){s=!0;continue}if(i.has(c)){s=!0;continue}i.add(c),a.push(c)}return a.length>o&&(a.length=o,s=!0),s?(this.settingsProvider.setRecentNotes(a),!0):!1}removeEntry(e){if(!e)return!1;let n=this.settingsProvider.getRecentNotes();if(n.length===0)return!1;let r=n.filter(o=>o!==e);return r.length===n.length?!1:(this.settingsProvider.setRecentNotes(r),!0)}getLimit(){let{recentNotesCount:e}=this.settingsProvider.settings,n=typeof e=="number"?e:Le.recentNotesCount;return Math.max(1,n)}};var D3=require("obsidian");jl();Kw();var vhe=1440*60*1e3,sk=class{constructor(e){this.pendingNotice=null;this.isChecking=!1;this.plugin=e}getPendingNotice(){return this.pendingNotice}clearPendingNotice(){this.pendingNotice=null}async checkForUpdates(e=!1){if(this.isChecking)return this.pendingNotice;let n=Date.now(),r=this.plugin.getReleaseCheckTimestamp()??0;if(!e&&r&&n-r0?this.pendingNotice={version:o.version,publishedAt:o.publishedAt,url:o.url}:this.pendingNotice=null}else this.pendingNotice=null;return this.pendingNotice}catch{return this.pendingNotice=null,this.pendingNotice}finally{this.isChecking=!1}}async fetchLatestRelease(){let e=await(0,D3.requestUrl)({url:mU,method:"GET",headers:{"User-Agent":"NotebookNavigator/ReleaseCheck (Obsidian Plugin)",Accept:"application/vnd.github+json"},throw:!1});if(e.status!==200||!e.json)return null;let n=e.json;if(!n||n.draft||n.prerelease)return null;let r=this.normalizeVersion(n.tag_name);return r?{version:r,publishedAt:n.published_at??"",url:n.html_url}:null}normalizeVersion(e){return e.replace(/^v/i,"").trim()}};Nx();Jr();eg();zn();dk();Ot();ot();Ue();Nx();var ck=class{constructor(e){this.plugin=e}detachCalendarViewLeaves(){let e=this.plugin.app.workspace.getLeavesOfType(Au);for(let n of e)n.detach()}async ensureCalendarViewInRightSidebar(e){let n=e?.reveal??!1,r=e?.activate??n,o=e?.shouldContinue??(()=>!0),{workspace:a}=this.plugin.app;if(!o())return null;let i=a.getLeavesOfType(Au)[0]??null;if(i)return n?await a.revealLeaf(i):r&&a.setActiveLeaf(i,{focus:!0}),o()?i:null;let s=a.getRightLeaf(!0)??a.getRightLeaf(!1);return s?(await s.setViewState({type:Au,active:r}),o()?(n&&await a.revealLeaf(s),s):(s.detach(),null)):null}async activateNavigatorView(){let{workspace:e}=this.plugin.app,n,r=e.getLeavesOfType(wa);return r.length>0?(n=r[0],await e.revealLeaf(n)):(n=e.getLeftLeaf(!1),n&&(await n.setViewState({type:wa,active:!0}),await e.revealLeaf(n))),n}getNavigatorLeaves(){return this.plugin.app.workspace.getLeavesOfType(wa)}revealFileInActualFolder(e,n){this.getNavigatorLeaves().forEach(r=>{let{view:o}=r;Hs(o)&&o.navigateToFile(e,n)})}revealFileInNearestFolder(e,n){this.getNavigatorLeaves().forEach(r=>{let{view:o}=r;Hs(o)&&o.revealFileInNearestFolder(e,n)})}};var mk=require("obsidian");xL();Ue();iy();pk();Ee();Bd();dn();var gk=class{constructor(e,n){this.isWorkspaceReady=!1;this.pendingTrigger=null;this.plugin=e,this.workspace=n}resolveHomepageFile(){let{homepage:e}=this.plugin.settings,n=r=>{if(!r)return null;let o=this.plugin.app.vault.getAbstractFileByPath(r);return $q(o)?o:null};switch(e.source){case"none":return null;case"file":return n(e.file);case"daily-note":return this.resolvePeriodicHomepageFile("day");case"weekly-note":return this.resolvePeriodicHomepageFile("week");case"monthly-note":return this.resolvePeriodicHomepageFile("month");case"quarterly-note":return this.resolvePeriodicHomepageFile("quarter");case"yearly-note":return this.resolvePeriodicHomepageFile("year")}}canOpenHomepage(){if(this.resolveHomepageFile())return!0;let{homepage:e}=this.plugin.settings,n=this.getPeriodicHomepageKind(e.source);return!!(e.createMissingPeriodicNote&&n&&this.canCreatePeriodicHomepageFile(n))}async handleWorkspaceReady(e){if(this.isWorkspaceReady=!0,this.plugin.isShuttingDown())return;e.shouldActivateOnStartup&&await this.workspace.activateNavigatorView();let n=this.pendingTrigger??"startup";this.pendingTrigger=null,await this.open(n)}async open(e){if(this.plugin.isShuttingDown())return!1;if(!this.isWorkspaceReady&&e!=="startup")return this.pendingTrigger=e,!1;let n=await this.resolveHomepageFileForOpen();if(!n)return!1;let r=e!=="startup"||this.plugin.settings.autoRevealActiveFile,o={source:e==="startup"?"startup":"manual",isStartupReveal:e==="startup",preserveNavigationFocus:this.plugin.settings.startView==="navigation"&&e==="startup"};if(e==="startup"){let i=this.findExistingHomepageLeaf(n);if(i){let{workspace:s}=this.plugin.app;return await s.revealLeaf(i),s.setActiveLeaf(i,{focus:!0}),r&&this.workspace.revealFileInNearestFolder(n,o),!0}}r&&this.workspace.revealFileInNearestFolder(n,o);let{commandQueue:a}=this.plugin;return a?(await a.executeHomepageOpen(n,()=>this.plugin.app.workspace.openLinkText(n.path,"",!1))).success:(await this.plugin.app.workspace.openLinkText(n.path,"",!1),!0)}findExistingHomepageLeaf(e){let n=sh(this.plugin.app),r=e.path;for(let o of n)if(this.getLeafFilePath(o)===r)return o;return null}getLeafFilePath(e){let{view:n}=e;if(n instanceof mk.FileView&&n.file)return n.file.path;let r=n?.getState?.(),o=this.extractFilePath(r);if(o)return o;let a=e.getViewState();return this.extractFilePath(a.state)}extractFilePath(e){if(typeof e!="object"||e===null||!Object.prototype.hasOwnProperty.call(e,"file"))return null;let r=e.file;return typeof r=="string"?r:null}async resolveHomepageFileForOpen(){let e=this.resolveHomepageFile();if(e||!this.plugin.settings.homepage.createMissingPeriodicNote)return e;let n=this.getPeriodicHomepageKind(this.plugin.settings.homepage.source);return n?this.createPeriodicHomepageFile(n):null}getPeriodicHomepageKind(e){switch(e){case"daily-note":return"day";case"weekly-note":return"week";case"monthly-note":return"month";case"quarterly-note":return"quarter";case"yearly-note":return"year";case"none":case"file":return null}}canCreatePeriodicHomepageFile(e){let n=qr();if(!n)return!1;if(e==="day"&&this.plugin.settings.calendarIntegrationMode==="daily-notes")return!!tg(this.plugin.app);let r=np(e,this.plugin.settings),o=Im(r.calendarCustomFilePattern,r.fallbackPattern);return r.isPatternValid(o,n)}resolvePeriodicHomepageFile(e){let n=qr();if(!n)return null;let r=Ei(),{calendarRulesLocale:o}=Hu(this.plugin.settings.calendarLocale,n,r),a=Vu(this.plugin.settings.calendarPeriodicNotesLocaleSource,o,n),i=n().startOf("day");if(e==="day"&&this.plugin.settings.calendarIntegrationMode==="daily-notes"){let m=tg(this.plugin.app);return m?jy(this.plugin.app,i.clone().locale(Lc(n)),m):null}let s=np(e,this.plugin.settings),l=Im(s.calendarCustomFilePattern,s.fallbackPattern);if(!s.isPatternValid(l,n))return null;let c=rp(e,i,l,a,a),u=xm(c,{calendarCustomRootFolder:nn(this.plugin.settings).periodicNotesFolder},s.calendarCustomFilePattern,s.fallbackPattern),p=this.plugin.app.vault.getAbstractFileByPath(u.filePath);return p instanceof mk.TFile?p:null}async createPeriodicHomepageFile(e){let n=qr();if(!n)return null;let r=Ei(),{calendarRulesLocale:o}=Hu(this.plugin.settings.calendarLocale,n,r),a=Vu(this.plugin.settings.calendarPeriodicNotesLocaleSource,o,n),i=n().startOf("day");if(e==="day"&&this.plugin.settings.calendarIntegrationMode==="daily-notes"){let m=tg(this.plugin.app);return m?Gy(this.plugin.app,i.clone().locale(Lc(n)),m):null}let s=np(e,this.plugin.settings),l=Im(s.calendarCustomFilePattern,s.fallbackPattern);if(!s.isPatternValid(l,n))return null;let c=rp(e,i,l,a,a),u=xm(c,{calendarCustomRootFolder:nn(this.plugin.settings).periodicNotesFolder},s.calendarCustomFilePattern,s.fallbackPattern),p=this.plugin.app.vault.getAbstractFileByPath(u.filePath);if(p instanceof mk.TFile)return p;try{let m=oy(e,this.plugin.settings);return await ay(this.plugin.app,u.folderPath,u.fileName,m)}catch(m){return console.error("Failed to create homepage note",m),null}}};var oc=require("obsidian");Ue();ot();_a();dk();var j3="folder-note-sidebar-service",Rhe=1e3,Dhe={type:ih,state:{}},Ahe=new Set(["markdown","canvas","base","excalidraw"]),Lx=class{constructor(e){this.isStarted=!1;this.companionLeaf=null;this.currentFolderNotePath=null;this.selectedFolder=void 0;this.workspaceReady=!1;this.syncRequestId=0;this.suppressedSidebarOpenPath=null;this.suppressionTimer=null;this.plugin=e}start(){this.isStarted||(this.isStarted=!0,this.plugin.registerSettingsUpdateListener(j3,()=>this.handleSettingsUpdate()))}dispose(){this.isStarted=!1,this.plugin.unregisterSettingsUpdateListener(j3),this.clearSidebarOpenSuppression()}handleWorkspaceReady(){this.workspaceReady=!0;let e=this.selectedFolder;if(e!==void 0){let n=this.syncToSelectedFolder(e);return Q(()=>n),n}}isSuppressingSidebarOpen(e){return this.suppressedSidebarOpenPath===e}async openFolderNote(e){let n=++this.syncRequestId;await this.applyResolvedFolderNote(e,n)}async syncToSelectedFolder(e){if(this.selectedFolder=e,!this.workspaceReady||this.plugin.isShuttingDown()||!this.shouldFollowRelatedFolderNotes)return;let n=++this.syncRequestId,r=e?this.findNearestFolderNoteForFolder(e):null;await this.applyResolvedFolderNote(r,n)}get canUseRightSidebar(){let e=this.plugin.settings;return e.enableFolderNotes&&e.folderNoteOpenLocation==="right-sidebar"}get shouldFollowRelatedFolderNotes(){return this.canUseRightSidebar&&this.plugin.settings.showNearestFolderNoteInSidebar}handleSettingsUpdate(){if(!(!this.workspaceReady||this.plugin.isShuttingDown())){if(!this.canUseRightSidebar){Q(()=>this.detachCompanionLeaf());return}if(this.shouldFollowRelatedFolderNotes){let e=this.selectedFolder;e!==void 0&&Q(()=>this.syncToSelectedFolder(e))}}}async applyResolvedFolderNote(e,n){if(n!==this.syncRequestId||this.plugin.isShuttingDown()||!this.canUseRightSidebar)return;if(!e){await this.clearCompanionLeaf();return}if(this.currentFolderNotePath===e.path&&this.getUsableCompanionLeaf(e.path))return;let r=this.getOrCreateCompanionLeaf(e);if(!r)return;let o=this.getActiveLeaf();this.suppressSidebarOpen(e.path);let a=async i=>{i&&await i.openFile(e,{active:!1})};if(this.plugin.commandQueue){if(!(await this.plugin.commandQueue.executeBackgroundFileOpen(e,a,{getLeaf:()=>r})).success)return}else await a(r);n!==this.syncRequestId||this.plugin.isShuttingDown()||(this.currentFolderNotePath=e.path,oc.Platform.isMobile||await this.plugin.app.workspace.revealLeaf(r),o&&o!==r&&!this.plugin.isShuttingDown()&&this.plugin.app.workspace.setActiveLeaf(o,{focus:!1}))}findNearestFolderNoteForFolder(e){let n=e;for(;n;){let r=Pn(n,this.plugin.settings);if(r)return r;n=n.parent instanceof oc.TFolder?n.parent:null}return null}getOrCreateCompanionLeaf(e){let n=this.getUsableCompanionLeaf();if(n)return this.pruneRestoredCompanionLeafDuplicates(n),n;let r=this.findRestoredCompanionLeaf(e);if(r)return this.companionLeaf=r,this.pruneRestoredCompanionLeafDuplicates(r),r;let o=this.plugin.app.workspace.getRightLeaf(!0)??this.plugin.app.workspace.getRightLeaf(!1);return this.companionLeaf=o,o&&this.pruneRestoredCompanionLeafDuplicates(o),o}getUsableCompanionLeaf(e){let n=this.companionLeaf;if(!n||md(this.plugin.app,n)!=="right-sidebar")return null;let r=e===void 0?this.currentFolderNotePath:e;return r===null?this.isPlaceholderLeaf(n)?n:null:this.getFilePathFromLeaf(n)===r?n:null}findRestoredCompanionLeaf(e){let n=null,r=null,o=null;return this.plugin.app.workspace.iterateAllLeaves(a=>{if(n||md(this.plugin.app,a)!=="right-sidebar")return;!o&&this.isPlaceholderLeaf(a)&&(o=a);let i=this.getFilePathFromLeaf(a);if(i){if(e&&i===e.path){n=a;return}!r&&this.isFolderNotePath(i)&&(r=a)}}),e?n??o??r:o??r}pruneRestoredCompanionLeafDuplicates(e,n={}){let r=[],o=n.includeDocumentLeaves??!0;this.plugin.app.workspace.iterateAllLeaves(a=>{if(a===e||md(this.plugin.app,a)!=="right-sidebar")return;let i=this.getFilePathFromLeaf(a);if(o&&i&&this.isFolderNotePath(i)){r.push(a);return}this.isPlaceholderLeaf(a)&&r.push(a)}),r.forEach(a=>a.detach())}isPlaceholderLeaf(e){return e.getViewState().type===ih}getFileFromLeaf(e){let n=e.view;return typeof oc.FileView=="function"&&n instanceof oc.FileView&&n.file instanceof oc.TFile?n.file:null}getFilePathFromLeaf(e){let n=e.getViewState();if(!Ahe.has(n.type))return null;let r=this.getFileFromLeaf(e);if(r)return r.path;let o=n.state?.file;return typeof o=="string"&&o.length>0?o:null}isFolderNotePath(e){let n=this.plugin.app.vault.getAbstractFileByPath(e);return!(n instanceof oc.TFile)||!(n.parent instanceof oc.TFolder)?!1:Pn(n.parent,this.plugin.settings)?.path===n.path}getActiveLeaf(){return this.plugin.app.workspace.activeLeaf??null}async clearCompanionLeaf(){let e=this.getUsableCompanionLeaf()??this.findRestoredCompanionLeaf(null);this.currentFolderNotePath=null,this.companionLeaf=e,e&&(this.isPlaceholderLeaf(e)||await e.setViewState(Dhe),this.pruneRestoredCompanionLeafDuplicates(e))}detachCompanionLeaf(){let e=this.getUsableCompanionLeaf();this.currentFolderNotePath=null,this.companionLeaf=null,e&&e.detach(),this.pruneRestoredCompanionLeafDuplicates(e,{includeDocumentLeaves:!1})}suppressSidebarOpen(e){this.clearSidebarOpenSuppression(),this.suppressedSidebarOpenPath=e,!(typeof window>"u")&&(this.suppressionTimer=window.setTimeout(()=>{this.suppressedSidebarOpenPath===e&&(this.suppressedSidebarOpenPath=null),this.suppressionTimer=null},Rhe))}clearSidebarOpenSuppression(){this.suppressionTimer!==null&&typeof window<"u"&&window.clearTimeout(this.suppressionTimer),this.suppressionTimer=null,this.suppressedSidebarOpenPath=null}};var ac=require("obsidian");Ee();Ha();ot();Ru();dn();KT();function Az(t){let e=yn(),n=null,r=()=>{if(n===null){if(typeof window>"u"){e.notifyIconAssetsChanged();return}n=window.setTimeout(()=>{n=null,e.notifyIconAssetsChanged()},50)}};t.register(()=>{n!==null&&typeof window<"u"&&window.clearTimeout(n),n=null});let o=async(s,l)=>{if(UN(t.settings,s,l))try{await t.saveSettingsAndUpdate()}catch(u){console.error("Failed to persist hidden folder rename updates",u)}},a=async s=>{if(KN(t.settings,s))try{await t.saveSettingsAndUpdate()}catch(c){console.error("Failed to persist hidden folder removal updates",c)}};t.registerEvent(t.app.workspace.on("editor-menu",(s,l,c)=>{let u=c.file;u&&(s.addSeparator(),s.addItem(p=>{p.setTitle(d.plugin.revealInNavigator).setIcon("lucide-folder-open").onClick(()=>{Q(async()=>{await t.activateView(),await t.revealFileInActualFolder(u,{showHiddenFileNotice:!0})})})}))})),t.registerEvent(t.app.workspace.on("file-menu",(s,l)=>{l instanceof ac.TFolder&&s.addItem(c=>{c.setTitle(d.plugin.revealInNavigator).setIcon(vi).onClick(()=>{Q(async()=>{await t.navigateToFolder(l,{preserveNavigationFocus:!0})})})})})),t.ribbonIconEl=t.addRibbonIcon(vi,d.plugin.ribbonTooltip,()=>{Q(()=>t.activateView())}),t.registerEvent(t.app.workspace.on("file-open",s=>{!(s instanceof ac.TFile)||t.isFileInRightSidebar(s)||t.recentNotesService?.recordFileOpen(s)}));let i=t.app.workspace.getActiveFile();i instanceof ac.TFile&&!t.isFileInRightSidebar(i)&&t.recentNotesService?.recordFileOpen(i),t.registerEvent(t.app.vault.on("rename",(s,l)=>{Q(async()=>{if(t.isShuttingDown())return;if(s instanceof ac.TFolder){await o(l,s.path),await t.metadataService?.handleFolderRename(l,s.path);return}if(!(s instanceof ac.TFile))return;(UT(l)||UT(s.path))&&(Hq(s,l),Ty(l),Ty(s.path),r()),t.recentNotesService?.renameEntry(l,s.path),await t.metadataService?.handleFileRename(l,s.path);let u=m=>{let g=m.lastIndexOf("/");return g>0?m.substring(0,g):"/"};u(l)!==u(s.path)&&s===t.app.workspace.getActiveFile()&&(t.commandQueue?.isMovingFile()||await t.revealFileInActualFolder(s)),t.notifyFileRenameListeners(l,s.path)})})),t.registerEvent(t.app.vault.on("create",s=>{Q(async()=>{t.isShuttingDown()||!(s instanceof ac.TFile)||!dd(s)||(Bq(s),Ty(s.path),r())})})),t.registerEvent(t.app.vault.on("modify",s=>{Q(async()=>{t.isShuttingDown()||!(s instanceof ac.TFile)||!dd(s)||(Ty(s.path),r())})})),t.registerEvent(t.app.vault.on("delete",s=>{Q(async()=>{if(!t.isShuttingDown()){if(s instanceof ac.TFolder){await a(s.path),await t.metadataService?.handleFolderDelete(s.path);return}s instanceof ac.TFile&&(t.recentNotesService?.removeEntry(s.path),t.metadataService&&await t.metadataService.handleFileDelete(s.path),dd(s)&&(_q(s.path),Ty(s.path),r()))}})}))}Ee();var Yhe=[{id:"open",name:d.commands.open},{id:"toggle-left-sidebar",name:d.commands.toggleLeftSidebar},{id:"open-homepage",name:d.commands.openHomepage,checkable:!0},{id:"reveal-file",name:d.commands.revealFile,checkable:!0},{id:"open-all-files",name:d.commands.openAllFiles,checkable:!0},{id:"toggle-descendants",name:d.commands.toggleDescendants},{id:"toggle-hidden",name:d.commands.toggleHidden},{id:"toggle-tag-sort",name:d.commands.toggleTagSort},{id:"toggle-tags-by-selection",name:d.commands.toggleTagsBySelection},{id:"toggle-properties-by-selection",name:d.commands.togglePropertiesBySelection},{id:"toggle-compact-mode",name:d.commands.toggleCompactMode},{id:"toggle-pinned-section",name:d.commands.togglePinnedSection},{id:"toggle-dual-pane",name:d.commands.toggleDualPane},{id:"toggle-dual-pane-orientation",name:d.commands.toggleDualPaneOrientation},{id:"toggle-calendar",name:d.commands.toggleCalendar},{id:"open-daily-note",name:d.commands.openDailyNote},{id:"open-weekly-note",name:d.commands.openWeeklyNote},{id:"open-monthly-note",name:d.commands.openMonthlyNote},{id:"open-quarterly-note",name:d.commands.openQuarterlyNote},{id:"open-yearly-note",name:d.commands.openYearlyNote},{id:"select-profile",name:d.commands.selectVaultProfile},{id:"select-profile-1",name:d.commands.selectVaultProfile1},{id:"select-profile-2",name:d.commands.selectVaultProfile2},{id:"select-profile-3",name:d.commands.selectVaultProfile3},{id:"collapse-expand",name:d.commands.collapseExpand},{id:"collapse-expand-selected-item",name:d.commands.collapseExpandSelectedItem},{id:"new-note",name:d.commands.createNewNote},{id:"new-note-from-template",name:d.commands.createNewNoteFromTemplate,checkable:!0},{id:"move-files",name:d.commands.moveFiles},{id:"merge-notes",name:d.commands.mergeNotes},{id:"select-next-file",name:d.commands.selectNextFile},{id:"select-previous-file",name:d.commands.selectPreviousFile},{id:"navigate-back",name:d.commands.navigateBack},{id:"navigate-forward",name:d.commands.navigateForward},{id:"convert-to-folder-note",name:d.commands.convertToFolderNote,checkable:!0},{id:"set-as-folder-note",name:d.commands.setAsFolderNote,checkable:!0},{id:"detach-folder-note",name:d.commands.detachFolderNote,checkable:!0},{id:"pin-all-folder-notes",name:d.commands.pinAllFolderNotes,checkable:!0},{id:"delete-files",name:d.commands.deleteFile},{id:"rebuild-cache",name:d.commands.rebuildCache},{id:"add-tag",name:d.commands.addTag},{id:"set-property",name:d.commands.setProperty},{id:"remove-tag",name:d.commands.removeTag},{id:"remove-all-tags",name:d.commands.removeAllTags},{id:"navigate-to-folder",name:d.commands.navigateToFolder},{id:"navigate-to-tag",name:d.commands.navigateToTag},{id:"navigate-to-property",name:d.commands.navigateToProperty},{id:"add-shortcut",name:d.commands.addShortcut},{id:"search",name:d.commands.search},{id:"search-vault",name:d.commands.searchVaultRoot,checkable:!0}],$he=Array.from({length:9},(t,e)=>{let n=e+1;return{id:`open-shortcut-${n}`,name:d.commands.openShortcut.replace("{number}",n.toString()),checkable:!0}}),Xhe=[...Yhe,...$he],s4=new WeakMap;function Qhe(t){let e=s4.get(t);if(e)return e;let n=new Map,r=Object.prototype.hasOwnProperty.call(t,"addCommand"),o=t.addCommand.bind(t);t.addCommand=a=>(n.set(a.id,a),a);try{let{default:a}=(i4(),Lr(a4));a(t)}finally{r?t.addCommand=o:delete t.addCommand}return s4.set(t,n),n}function l4(t,e){return Qhe(t).get(e)}function Zhe(t,e){let n=l4(t,e);if(!n?.callback){console.error(`Notebook Navigator command handler not found: ${e}`);return}n.callback()}function Jhe(t,e,n){let r=l4(t,e);return r?.checkCallback?r.checkCallback(n)===!0:(console.error(`Notebook Navigator command check handler not found: ${e}`),!1)}function zz(t){Xhe.forEach(e=>{if(e.checkable){t.addCommand({id:e.id,name:e.name,checkCallback:n=>Jhe(t,e.id,n)});return}t.addCommand({id:e.id,name:e.name,callback:()=>Zhe(t,e.id)})})}xn();Ru();ko();var y4=require("obsidian");Ue();uw();Jr();Zr();dm();xn();function d4(t,e){let n={...t};if(!e||typeof e!="object")return n;let r=e;return Object.keys(t).forEach(o=>{let a=r[o];typeof a=="boolean"&&(n[o]=a)}),n}function Bz(t,e){let n=t.toolbarVisibility,r=e&&typeof e=="object"?e:void 0;return{navigation:d4(n.navigation,r?.navigation),list:d4(n.list,r?.list)}}function vk(t){if(typeof t=="number"&&Number.isFinite(t))return t;if(typeof t=="string"){let e=Number(t);if(Number.isFinite(e))return e}return null}function c4(t){let e=vk(t);if(e===null)return null;let n=Math.round(e);return nAc?null:n}function u4(t){let e=vk(t);if(e===null)return null;let n=Math.round(e);return n<10||n>24?null:n}function p4(t){let e=vk(t);if(e===null)return null;let n=Math.round(e);return n<20||n>28?null:n}function m4(t){return gm(t)?t:null}function g4(t){return hm(t)?t:null}function h4(t){let e=vk(t);if(e===null)return null;let n=Math.round(e);return n!==1&&n!==2&&n!==3&&n!==4&&n!==5&&n!==6?null:n}function f4(t){let e=vk(t);if(e===null)return null;let n=Math.round(e);return n<20||n>28?null:n}function b4(t){let{settings:e,storedData:n,keys:r}=t,o=typeof n?.lastReleaseCheckAt=="number"&&Number.isFinite(n.lastReleaseCheckAt)?n.lastReleaseCheckAt:null,a=ye.get(r.releaseCheckTimestampKey),i=typeof a=="number"&&Number.isFinite(a)?a:o??null;return i&&i!==a&&ye.set(r.releaseCheckTimestampKey,i),delete e.lastReleaseCheckAt,delete e.latestKnownRelease,!!(n&&("lastReleaseCheckAt"in n||"latestKnownRelease"in n))}function S4(t){let{settings:e,storedData:n,keys:r}=t,o=n?.recentColors,a=Array.isArray(o)?o.filter(c=>typeof c=="string"&&c.trim().length>0).slice(0,lm):[],i=ye.get(r.recentColorsKey),s=Array.isArray(i)?i.filter(c=>typeof c=="string"&&c.trim().length>0):[],l=s.length>0?s:a;if(l.length>0){let c=l.slice(0,lm);(s.length!==c.length||c.some((p,m)=>p!==s[m]))&&ye.set(r.recentColorsKey,c)}return delete e.recentColors,!!(n&&"recentColors"in n)}function w4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.paneTransitionDurationKey),a=c4(o);if(a!==null)return{value:a,migrated:!1};let i=e?.paneTransitionDuration,s=c4(i);if(s!==null)return ye.set(n.paneTransitionDurationKey,s),{value:s,migrated:!0};let l=r.paneTransitionDuration;return ye.set(n.paneTransitionDurationKey,l),{value:l,migrated:!1}}function T4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.toolbarVisibilityKey);if(mt(o))return{value:Bz(r,o),migrated:!1};let a=e?.toolbarVisibility;if(mt(a)){let s=Bz(r,a);return ye.set(n.toolbarVisibilityKey,s),{value:s,migrated:!0}}let i=Bz(r,null);return ye.set(n.toolbarVisibilityKey,i),{value:i,migrated:!1}}function k4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.navIndentKey),a=u4(o);if(a!==null)return{value:a,migrated:!1};let i=e?.navIndent,s=u4(i);if(s!==null)return ye.set(n.navIndentKey,s),{value:s,migrated:!0};let l=r.navIndent;return ye.set(n.navIndentKey,l),{value:l,migrated:!1}}function F4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.navItemHeightKey),a=p4(o);if(a!==null)return{value:a,migrated:!1};let i=e?.navItemHeight,s=p4(i);if(s!==null)return ye.set(n.navItemHeightKey,s),{value:s,migrated:!0};let l=r.navItemHeight;return ye.set(n.navItemHeightKey,l),{value:l,migrated:!1}}function P4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.navItemHeightScaleTextKey);if(typeof o=="boolean")return{value:o,migrated:!1};let a=e?.navItemHeightScaleText;if(typeof a=="boolean")return ye.set(n.navItemHeightScaleTextKey,a),{value:a,migrated:!0};let i=r.navItemHeightScaleText;return ye.set(n.navItemHeightScaleTextKey,i),{value:i,migrated:!1}}function C4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.pinNavigationBannerKey);if(typeof o=="boolean")return{value:o,migrated:!1};let a=e?.pinNavigationBanner;if(typeof a=="boolean")return ye.set(n.pinNavigationBannerKey,a),{value:a,migrated:!0};let i=r.pinNavigationBanner;return ye.set(n.pinNavigationBannerKey,i),{value:i,migrated:!1}}function N4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.calendarPlacementKey),a=m4(o);if(a!==null)return{value:a,migrated:!1};let i=e?.calendarPlacement,s=m4(i);if(s!==null)return ye.set(n.calendarPlacementKey,s),{value:s,migrated:!0};let l=r.calendarPlacement;return ye.set(n.calendarPlacementKey,l),{value:l,migrated:!1}}function I4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.calendarLeftPlacementKey),a=g4(o);if(a!==null)return{value:a,migrated:!1};let i=e?.calendarLeftPlacement,s=g4(i);if(s!==null)return ye.set(n.calendarLeftPlacementKey,s),{value:s,migrated:!0};let l=r.calendarLeftPlacement;return ye.set(n.calendarLeftPlacementKey,l),{value:l,migrated:!1}}function x4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.calendarWeeksToShowKey),a=h4(o);if(a!==null)return{value:a,migrated:!1};let i=e?.calendarWeeksToShow,s=h4(i);if(s!==null)return ye.set(n.calendarWeeksToShowKey,s),{value:s,migrated:!0};let l=r.calendarWeeksToShow;return ye.set(n.calendarWeeksToShowKey,l),{value:l,migrated:!1}}function E4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.compactItemHeightKey),a=f4(o);if(a!==null)return{value:a,migrated:!1};let i=e?.compactItemHeight,s=f4(i);if(s!==null)return ye.set(n.compactItemHeightKey,s),{value:s,migrated:!0};let l=r.compactItemHeight;return ye.set(n.compactItemHeightKey,l),{value:l,migrated:!1}}function M4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.compactItemHeightScaleTextKey);if(typeof o=="boolean")return{value:o,migrated:!1};let a=e?.compactItemHeightScaleText;if(typeof a=="boolean")return ye.set(n.compactItemHeightScaleTextKey,a),{value:a,migrated:!0};let i=r.compactItemHeightScaleText;return ye.set(n.compactItemHeightScaleTextKey,i),{value:i,migrated:!1}}function R4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.tagSortOrderKey),a=typeof o=="string"?o:null;if(a&&Ta(a))return a;let i=e?.tagSortOrder,s=typeof i=="string"?i:null;return s&&Ta(s)?(ye.set(n.tagSortOrderKey,s),s):(ye.set(n.tagSortOrderKey,r.tagSortOrder),r.tagSortOrder)}function D4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.propertySortOrderKey),a=typeof o=="string"?o:null;if(a&&Ta(a))return a;let i=e?.propertySortOrder,s=typeof i=="string"?i:null;return s&&Ta(s)?(ye.set(n.propertySortOrderKey,s),s):(ye.set(n.propertySortOrderKey,r.propertySortOrder),r.propertySortOrder)}function A4(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=ye.get(n.folderSortOrderKey),a=typeof o=="string"?o:null;if(a&&al(a))return a;let i=e?.folderSortOrder,s=typeof i=="string"?i:null;return s&&al(s)?(ye.set(n.folderSortOrderKey,s),s):(ye.set(n.folderSortOrderKey,r.folderSortOrder),r.folderSortOrder)}function v4(t,e){let n=i=>{if(typeof i=="number"&&Number.isFinite(i))return Za(i);if(typeof i=="string"){let s=Number(i);if(Number.isFinite(s))return Za(s)}return null},r=ye.get(t),o=n(r);if(o!==null)return o;let a=n(e);return a!==null?(ye.set(t,a),a):(ye.set(t,1),1)}function O4(t){let{settings:e,storedData:n,keys:r}=t,{shouldPersistDesktopScale:o,shouldPersistMobileScale:a}=t,i=n?.desktopScale,s=n?.mobileScale,l=!!(n&&("desktopScale"in n||"mobileScale"in n)),c=(u,p)=>{if(typeof u=="number"&&Number.isFinite(u))return Za(u);if(typeof u=="string"){let m=Number(u);if(Number.isFinite(m))return Za(m)}return Za(p)};if(y4.Platform.isMobile){let u=v4(r.uiScaleKey,s);e.mobileScale=u,e.desktopScale=c(i,e.desktopScale),a&&(a=!1)}else{let u=v4(r.uiScaleKey,i);e.desktopScale=u,e.mobileScale=c(s,e.mobileScale),o&&(o=!1)}return{migrated:l,shouldPersistDesktopScale:o,shouldPersistMobileScale:a}}function z4(t){return t.trim()}function efe(t){return t?t.includes("[")||t.includes("]"):!1}function L4(t){return t?!!(t.includes("yyyy")||t.includes("yy")||t.includes("XXX")||t.includes("XX")||t.includes("xxx")||t.includes("xx")||t.includes("EEEE")||t.includes("EEE")||t.includes("'")||/[Pp]{1,4}/u.test(t)):!1}function tfe(t){let e=0,n=!1;for(;e=4?"YYYY":e===2?"YY":null;case"d":return e===2?"DD":e===1?"D":null;case"E":return e>=4?"dddd":e===3?"ddd":e===2?"dd":e===1?"d":null;case"X":return e>=2&&e===2?"ZZ":"Z";case"x":return e>=2&&e===2?"ZZ":"Z";default:return null}}function ofe(t){let e="",n=0,r=!1,o=!1;for(;ntypeof t!="string"?"":t.replace(ife,"$1-");function lfe(t){return dv(t)?t:t==="word"?"words":t==="character"?"characters":t==="word-character"?"both":null}function dfe(t){return cv(t)?t:t==="with-spaces"?"include":t==="without-spaces"?"exclude":null}function _4(t){let{settings:e,storedData:n,keys:r,defaultSettings:o}=t,a=e;delete a.recentNotes,delete a.recentIcons,delete a.searchActive,delete a.showHiddenItems,delete a.hiddenTags,delete a.fileVisibility,delete a.preventInvalidCharacters,delete a.mobileBackground,delete a.optimizeNoteHeight,delete a.showPinnedIcon,delete a.showPinnedGroupHeader;let i=n?n.noteGrouping:void 0,s=a.showIcons;typeof s=="boolean"&&(typeof n?.showSectionIcons>"u"&&(e.showSectionIcons=s),typeof n?.showFolderIcons>"u"&&(e.showFolderIcons=s),typeof n?.showTagIcons>"u"&&(e.showTagIcons=s)),delete a.showIcons;let l=a.showParentFolderNames;typeof l=="boolean"&&typeof n?.showParentFolder>"u"&&(e.showParentFolder=l),delete a.showParentFolderNames;let c=a.showParentFolderColors;typeof c=="boolean"&&typeof n?.showParentFolderColor>"u"&&(e.showParentFolderColor=c),delete a.showParentFolderColors;let u=a.groupByDate;typeof u=="boolean"&&typeof i>"u"&&(e.noteGrouping=u?"date":"custom"),delete a.groupByDate;let p=a.autoExpandFoldersTags;typeof p=="boolean"&&typeof n?.autoExpandNavItems>"u"&&(e.autoExpandNavItems=p),delete a.autoExpandFoldersTags;let m=typeof a.homepage=="object"&&a.homepage!==null&&!Array.isArray(a.homepage),g=Na(typeof a.homepage=="string"?a.homepage:null),f=a.useMobileHomepage===!0;m||(e.homepage={source:g?"file":"none",file:g,createMissingPeriodicNote:o.homepage.createMissingPeriodicNote}),f&&(e.syncModes.homepage="local"),delete a.mobileHomepage,delete a.useMobileHomepage,e.noteGrouping=bA(e.noteGrouping)??o.noteGrouping;let h=L=>{L&&Object.values(L).forEach(gC)};h(e.folderAppearances),h(e.tagAppearances),h(e.propertyAppearances),typeof e.showSelectedNavigationPills!="boolean"&&(e.showSelectedNavigationPills=o.showSelectedNavigationPills),e.shortcutBadgeDisplay!=="index"&&e.shortcutBadgeDisplay!=="count"&&e.shortcutBadgeDisplay!=="none"&&(e.shortcutBadgeDisplay=o.shortcutBadgeDisplay);let b=a.hideFolderNotesInRecentNotes;typeof n?.hideRecentNotes>"u"&&typeof b=="boolean"&&(e.hideRecentNotes=b?"folder-notes":"none"),delete a.hideFolderNotesInRecentNotes,sv(e.hideRecentNotes)||(e.hideRecentNotes=o.hideRecentNotes);let v=typeof n?.notePropertyType>"u"?a.customPropertyType:a.notePropertyType;if((typeof v=="string"?v:null)==="wordCount"&&typeof n?.textCountDisplay>"u"&&(e.textCountDisplay="words",typeof n?.textCountPlacement>"u"&&(e.textCountPlacement=o.textCountPlacement)),delete a.customPropertyType,delete a.notePropertyType,typeof n?.textCountDisplay>"u"){let L=lfe(a.wordCharacterCountDisplay);L!==null?e.textCountDisplay=L:typeof a.showWordCount=="boolean"&&(e.textCountDisplay=a.showWordCount?"words":"none")}if(delete a.showWordCount,delete a.wordCharacterCountDisplay,typeof n?.textCountPlacement>"u"&&lv(a.wordCountPlacement)&&(e.textCountPlacement=a.wordCountPlacement),delete a.wordCountPlacement,typeof n?.characterCountSpaces>"u"){let L=dfe(a.characterCountMode);L!==null&&(e.characterCountSpaces=L)}delete a.characterCountMode;let S=a.propertyFields;typeof S!="string"?delete a.propertyFields:a.propertyFields=Bc(S);let w=a.customPropertyFields;typeof a.propertyFields>"u"&&typeof n?.propertyFields>"u"&&typeof w=="string"&&(a.propertyFields=Bc(w)),delete a.customPropertyFields;let k=a.showCustomPropertiesOnSeparateRows;typeof n?.showPropertiesOnSeparateRows>"u"&&typeof k=="boolean"&&(e.showPropertiesOnSeparateRows=k),delete a.showCustomPropertiesOnSeparateRows;let F=a.showCustomPropertyInCompactMode;typeof n?.showFilePropertiesInCompactMode>"u"&&typeof F=="boolean"&&(e.showFilePropertiesInCompactMode=F),delete a.showCustomPropertyInCompactMode;let P=a.showNotePropertyInCompactMode;typeof n?.showFilePropertiesInCompactMode>"u"&&typeof P=="boolean"&&(e.showFilePropertiesInCompactMode=P),delete a.showNotePropertyInCompactMode,typeof e.showPropertiesOnSeparateRows!="boolean"&&(e.showPropertiesOnSeparateRows=o.showPropertiesOnSeparateRows),delete a.customPropertyColorFields,delete a.customPropertyColorMap,typeof e.showFilePropertiesInCompactMode!="boolean"&&(e.showFilePropertiesInCompactMode=o.showFilePropertiesInCompactMode),typeof e.showParentFolderFullPath!="boolean"&&(e.showParentFolderFullPath=o.showParentFolderFullPath);let T=a.useFolderColorForFileTitles;typeof n?.useFolderColorForTitles>"u"&&typeof T=="boolean"&&(e.useFolderColorForTitles=T),delete a.useFolderColorForFileTitles,typeof e.useFolderColorForTitles!="boolean"&&(e.useFolderColorForTitles=o.useFolderColorForTitles),typeof e.useFolderIconForFiles!="boolean"&&(e.useFolderIconForFiles=o.useFolderIconForFiles),typeof e.showFileProperties!="boolean"&&(e.showFileProperties=o.showFileProperties),typeof e.colorFileProperties!="boolean"&&(e.colorFileProperties=o.colorFileProperties),typeof e.prioritizeColoredFileProperties!="boolean"&&(e.prioritizeColoredFileProperties=o.prioritizeColoredFileProperties),typeof e.showProperties!="boolean"&&(e.showProperties=o.showProperties),typeof e.showPropertyIcons!="boolean"&&(e.showPropertyIcons=o.showPropertyIcons),typeof e.inheritPropertyColors!="boolean"&&(e.inheritPropertyColors=o.inheritPropertyColors),typeof e.showAllPropertiesFolder!="boolean"&&(e.showAllPropertiesFolder=o.showAllPropertiesFolder),typeof e.scopePropertiesToCurrentContext!="boolean"&&(e.scopePropertiesToCurrentContext=o.scopePropertiesToCurrentContext),typeof e.enablePropertyInternalLinks!="boolean"&&(e.enablePropertyInternalLinks=o.enablePropertyInternalLinks),typeof e.enablePropertyExternalLinks!="boolean"&&(e.enablePropertyExternalLinks=o.enablePropertyExternalLinks),dv(e.textCountDisplay)||(e.textCountDisplay=o.textCountDisplay),lv(e.textCountPlacement)||(e.textCountPlacement=o.textCountPlacement),cv(e.characterCountSpaces)||(e.characterCountSpaces=o.characterCountSpaces),typeof e.wordCountTargetProperty!="string"?e.wordCountTargetProperty=o.wordCountTargetProperty:e.wordCountTargetProperty=e.wordCountTargetProperty.trim(),typeof e.showWordCountPercentage!="boolean"&&(e.showWordCountPercentage=o.showWordCountPercentage),Ta(e.propertySortOrder)||(e.propertySortOrder=o.propertySortOrder);let I=L=>{if(!L)return L;if(L.mode===void 0&&L.showDate===!1&&L.showPreview===!1&&L.showImage===!1){let D={...L,mode:"compact"};return delete D.showDate,delete D.showPreview,delete D.showImage,D}return L},N=L=>{L&&Object.entries(L).forEach(([V,D])=>{let A=I(D);if(A){let _=A;delete _.notePropertyType,delete _.customPropertyType,L[V]=A}})};N(e.folderAppearances),N(e.tagAppearances);let O=a.applyTagColorsToFileTags;typeof O=="boolean"&&(e.colorFileTags=O),delete a.applyTagColorsToFileTags;let K=a.slimItemHeight;if(typeof K=="number"&&Number.isFinite(K)){let L=ye.get(r.compactItemHeightKey);typeof n?.compactItemHeight>"u"&&L===null&&ye.set(r.compactItemHeightKey,K)}delete a.slimItemHeight;let G=a.slimItemHeightScaleText;if(typeof G=="boolean"){let L=ye.get(r.compactItemHeightScaleTextKey);typeof n?.compactItemHeightScaleText>"u"&&L===null&&ye.set(r.compactItemHeightScaleTextKey,G)}delete a.slimItemHeightScaleText;let X=a.showFileTagsInSlimMode;typeof X=="boolean"&&typeof n?.showFileTagsInCompactMode>"u"&&(e.showFileTagsInCompactMode=X),delete a.showFileTagsInSlimMode}function H4(t){let{settings:e,defaultSettings:n}=t,r=e,o=e.folderNoteTemplate,a=Na(o);e.folderNoteTemplate=a??n.folderNoteTemplate,typeof e.folderNoteNamePattern!="string"?e.folderNoteNamePattern=n.folderNoteNamePattern:e.folderNoteNamePattern=WO(e.folderNoteNamePattern),Object.prototype.hasOwnProperty.call(r,"folderNoteProperties")&&delete r.folderNoteProperties}function V4(t){let{settings:e}=t;typeof e.checkForUpdatesOnStart!="boolean"&&(e.checkForUpdatesOnStart=!0),dv(e.textCountDisplay)||(e.textCountDisplay="none"),lv(e.textCountPlacement)||(e.textCountPlacement="title"),cv(e.characterCountSpaces)||(e.characterCountSpaces="include"),dC(e.navCountLeaderStyle)||(e.navCountLeaderStyle=Le.navCountLeaderStyle),e.narrowSidebarLayout=sC(e.narrowSidebarLayout)??Le.narrowSidebarLayout,lC(e.narrowSidebarTriggerMode)||(e.narrowSidebarTriggerMode=Le.narrowSidebarTriggerMode),(typeof e.narrowSidebarCustomWidth!="number"||!Number.isFinite(e.narrowSidebarCustomWidth))&&(e.narrowSidebarCustomWidth=Le.narrowSidebarCustomWidth),typeof e.wordCountTargetProperty!="string"?e.wordCountTargetProperty=Le.wordCountTargetProperty:e.wordCountTargetProperty=e.wordCountTargetProperty.trim(),typeof e.showWordCountPercentage!="boolean"&&(e.showWordCountPercentage=!1),typeof e.showFolderGroupPaths!="boolean"&&(e.showFolderGroupPaths=Le.showFolderGroupPaths),typeof e.showCurrentFolderFilesAtBottom!="boolean"&&(e.showCurrentFolderFilesAtBottom=Le.showCurrentFolderFilesAtBottom)}function U4(t){let{settings:e,storedData:n}=t,r=e,o=typeof r.propertyFields=="string"?r.propertyFields:null,a=typeof n?.propertyFields=="string"?n.propertyFields:null;Object.prototype.hasOwnProperty.call(r,"propertyFields")&&delete r.propertyFields;let i=o??a;return i===null?null:Bc(i)}function K4(t){let{settings:e,legacyPropertyFields:n}=t,r=e;if(Object.prototype.hasOwnProperty.call(r,"propertyFields")&&delete r.propertyFields,!n||n.length===0)return;let o=BN(n);o.length!==0&&e.vaultProfiles.forEach(a=>{Array.isArray(a.propertyKeys)&&a.propertyKeys.length>0||(a.propertyKeys=o.map(i=>({...i})))})}function W4(t){let{storedData:e}=t;if(!e)return null;let n=e.shortcuts;if(!Array.isArray(n))return null;let r=[];return n.forEach(o=>{if(!o||typeof o!="object")return;let a=o,i=a.type;i!==Dn.FOLDER&&i!==Dn.NOTE&&i!==Dn.TAG&&i!==Dn.PROPERTY&&i!==Dn.SEARCH||r.push({...a})}),r.length===0?[]:r}function j4(t){let{settings:e,legacyShortcuts:n}=t,r=e;if(Object.prototype.hasOwnProperty.call(r,"shortcuts")&&delete r.shortcuts,!n||n.length===0)return;let o=Yc(n);e.vaultProfiles.forEach(a=>{Array.isArray(a.shortcuts)&&a.shortcuts.length>0||(a.shortcuts=Yc(o))})}function G4(t){let{settings:e}=t;if(!Array.isArray(e.vaultProfiles)||e.vaultProfiles.length===0)return!1;let n=!1;return e.vaultProfiles.forEach(r=>{if(!Array.isArray(r.shortcuts)||r.shortcuts.length===0)return;let o=!1,a=r.shortcuts.map(i=>{if(i.type!==Dn.SEARCH)return i;let s=sfe(i.query);return s===i.query?i:(o=!0,{...i,query:s})});o&&(r.shortcuts=a,n=!0)}),n}function q4(t){let{settings:e,storedData:n}=t,r=g=>{if(!Array.isArray(g))return[];let f=g.map(h=>typeof h=="string"?h.trim():"").filter(h=>h.length>0);return Array.from(new Set(f))},o=e,a=r(o.excludedFolders),i=r(o.excludedFiles);delete o.excludedFolders,delete o.excludedFiles;let s=r(n?.hiddenTags),l=o.navigationBanner,c=typeof l=="string"?l:null,u=n?.navigationBannerPath,p=typeof u=="string"?u:null,m=c&&c.length>0?c:p&&p.length>0?p:null;return delete o.navigationBanner,delete o.navigationBannerPath,{hiddenFolders:a,hiddenFileProperties:i,hiddenTags:s,navigationBanner:m,shouldApplyToProfiles:!Array.isArray(n?.vaultProfiles)}}function Y4(t){let{settings:e,migration:n}=t,r=typeof n.navigationBanner=="string"&&n.navigationBanner.length>0;if(!n.shouldApplyToProfiles||!r&&n.hiddenFolders.length===0&&n.hiddenFileProperties.length===0&&n.hiddenTags.length===0)return;let o=e.vaultProfiles.find(a=>a.id===e.vaultProfile)??e.vaultProfiles.find(a=>a.id===eo)??e.vaultProfiles[0];o&&(n.hiddenFolders.length>0&&(o.hiddenFolders=[...n.hiddenFolders]),n.hiddenFileProperties.length>0&&(o.hiddenFileProperties=[...n.hiddenFileProperties]),n.hiddenTags.length>0&&(o.hiddenTags=[...n.hiddenTags]),r&&(o.navigationBanner=n.navigationBanner))}function $4(t){let{settings:e}=t,n=e,r=n.calendarCustomRootFolder;if(Object.prototype.hasOwnProperty.call(n,"calendarCustomRootFolder")&&delete n.calendarCustomRootFolder,typeof r!="string")return null;let o=Ri(r);return o.length>0?o:null}function X4(t){let{settings:e,legacyPeriodicNotesFolder:n}=t;n&&(!Array.isArray(e.vaultProfiles)||e.vaultProfiles.length===0||e.vaultProfiles.forEach(r=>{typeof r.periodicNotesFolder=="string"&&r.periodicNotesFolder.length>0||(r.periodicNotesFolder=n)}))}xn();Jr();Yr();Si();Ee();Ot();Dr();dn();iN();cn();JT();pr();rh();Rn();Zr();$o();Sv();Ue();var yk=require("obsidian");Jr();$o();dm();function Q4(t){let e=(u,p)=>{ye.set(u,p)},n=(u,p)=>()=>{e(u,p())},r=(u,p)=>{p.forEach(m=>{delete u[m]})},o=(u,p)=>p.some(m=>m in u),a=u=>{let p=u.cleanupOnLoad??!0,m=u.hasPersistedValue??(f=>o(f,u.persistedKeys)),g=u.deleteFromPersisted??(f=>r(f,u.persistedKeys));return{loadPhase:u.loadPhase,cleanupOnLoad:p,hasPersistedValue:m,deleteFromPersisted:g,mirrorToLocalStorage:u.mirrorToLocalStorage,resolveOnLoad:u.resolveOnLoad}},i=u=>a({persistedKeys:u.persistedKeys,loadPhase:u.loadPhase,cleanupOnLoad:u.cleanupOnLoad,hasPersistedValue:u.hasPersistedValue,deleteFromPersisted:u.deleteFromPersisted,resolveOnLoad:({storedData:p})=>{if(t.isLocal(u.settingId)){let g=u.resolveDeviceLocal(p);return u.setCurrent(g.value),{migrated:g.migrated}}let m=u.sanitizeSynced();return u.setCurrent(m),e(u.localStorageKey,m),{migrated:!1}},mirrorToLocalStorage:n(u.localStorageKey,u.getCurrent)}),s=u=>i({settingId:u.settingId,persistedKeys:[u.settingId],loadPhase:u.loadPhase,localStorageKey:u.localStorageKey,resolveDeviceLocal:u.resolveDeviceLocal,sanitizeSynced:u.sanitizeSynced,getCurrent:()=>t.getSettings()[u.settingId],setCurrent:p=>{t.getSettings()[u.settingId]=p},cleanupOnLoad:u.cleanupOnLoad,hasPersistedValue:u.hasPersistedValue,deleteFromPersisted:u.deleteFromPersisted}),l=u=>a({persistedKeys:[u.persistedKey],loadPhase:"preProfiles",resolveOnLoad:()=>{let p=ye.get(t.keys.uxPreferencesKey),m=t.isUXPreferencesRecord(p),g=m?{...t.defaultUXPreferences,...p}:{...t.defaultUXPreferences},f=t.isLocal(u.settingId),h=t.getSettings(),b=f?g[u.persistedKey]:t.sanitizeBooleanSetting(h[u.persistedKey],t.defaultSettings[u.persistedKey]);return h[u.persistedKey]=b,(!m||g[u.persistedKey]!==b)&&e(t.keys.uxPreferencesKey,{...g,[u.persistedKey]:b}),{migrated:!1}},mirrorToLocalStorage:()=>{t.mirrorUXPreferences({[u.persistedKey]:t.getSettings()[u.persistedKey]})}}),c=u=>{let p=u?.useMobileHomepage===!0,m=Na(typeof u?.mobileHomepage=="string"?u.mobileHomepage:null),g=Na(typeof u?.homepage=="string"?u.homepage:null),f=m??g;return p?{source:yk.Platform.isMobile?f?"file":"none":g?"file":"none",file:yk.Platform.isMobile?f:g,createMissingPeriodicNote:t.defaultSettings.homepage.createMissingPeriodicNote}:{source:g?"file":"none",file:g,createMissingPeriodicNote:t.defaultSettings.homepage.createMissingPeriodicNote}};return{vaultProfile:a({persistedKeys:["vaultProfile"],loadPhase:"postProfiles",resolveOnLoad:()=>{let u=t.isLocal("vaultProfile"),p=t.getSettings();return p.vaultProfile=u?t.resolveActiveVaultProfileId():t.sanitizeVaultProfileId(p.vaultProfile),e(t.keys.vaultProfileKey,p.vaultProfile),{migrated:!1}},mirrorToLocalStorage:n(t.keys.vaultProfileKey,()=>t.getSettings().vaultProfile)}),homepage:s({settingId:"homepage",loadPhase:"preProfiles",localStorageKey:t.keys.homepageKey,resolveDeviceLocal:u=>{let p=ye.get(t.keys.homepageKey),m=u?"homepage"in u||"mobileHomepage"in u||"useMobileHomepage"in u:!1,g=t.sanitizeHomepageSetting(p),f=typeof u?.homepage=="object"&&u?.homepage!==null&&!Array.isArray(u?.homepage),h=p===null?f?t.sanitizeHomepageSetting(u?.homepage):c(u):g;return e(t.keys.homepageKey,h),{value:h,migrated:m}},sanitizeSynced:()=>t.sanitizeHomepageSetting(t.getSettings().homepage),deleteFromPersisted:u=>{delete u.homepage,delete u.mobileHomepage,delete u.useMobileHomepage},hasPersistedValue:u=>"homepage"in u||"mobileHomepage"in u||"useMobileHomepage"in u}),folderSortOrder:s({settingId:"folderSortOrder",loadPhase:"preProfiles",localStorageKey:t.keys.folderSortOrderKey,resolveDeviceLocal:u=>({value:A4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),migrated:!1}),sanitizeSynced:()=>t.sanitizeFolderSortOrderSetting(t.getSettings().folderSortOrder)}),tagSortOrder:s({settingId:"tagSortOrder",loadPhase:"preProfiles",localStorageKey:t.keys.tagSortOrderKey,resolveDeviceLocal:u=>({value:R4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),migrated:!1}),sanitizeSynced:()=>t.sanitizeTagSortOrderSetting(t.getSettings().tagSortOrder)}),propertySortOrder:s({settingId:"propertySortOrder",loadPhase:"preProfiles",localStorageKey:t.keys.propertySortOrderKey,resolveDeviceLocal:u=>({value:D4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),migrated:!1}),sanitizeSynced:()=>t.sanitizeTagSortOrderSetting(t.getSettings().propertySortOrder)}),includeDescendantNotes:l({settingId:"includeDescendantNotes",persistedKey:"includeDescendantNotes"}),dualPane:a({persistedKeys:["dualPane"],loadPhase:"preProfiles",resolveOnLoad:()=>{let u=t.isLocal("dualPane"),p=ye.get(t.keys.dualPaneKey),m=t.parseDualPanePreference(p),g=t.getSettings(),f=u?m??t.defaultSettings.dualPane:t.sanitizeBooleanSetting(g.dualPane,t.defaultSettings.dualPane);return g.dualPane=f,e(t.keys.dualPaneKey,f?"1":"0"),{migrated:!1}},mirrorToLocalStorage:n(t.keys.dualPaneKey,()=>t.getSettings().dualPane?"1":"0")}),dualPaneOrientation:a({persistedKeys:["dualPaneOrientation"],loadPhase:"preProfiles",resolveOnLoad:()=>{let u=t.isLocal("dualPaneOrientation"),p=ye.get(t.keys.dualPaneOrientationKey),m=t.parseDualPaneOrientation(p),g=t.getSettings(),f=u?m??t.defaultSettings.dualPaneOrientation:t.sanitizeDualPaneOrientationSetting(g.dualPaneOrientation);return g.dualPaneOrientation=f,e(t.keys.dualPaneOrientationKey,f),{migrated:!1}},mirrorToLocalStorage:n(t.keys.dualPaneOrientationKey,()=>t.getSettings().dualPaneOrientation)}),narrowSidebarLayout:a({persistedKeys:["narrowSidebarLayout"],loadPhase:"preProfiles",resolveOnLoad:()=>{let u=t.isLocal("narrowSidebarLayout"),p=ye.get(t.keys.narrowSidebarLayoutKey),m=t.getSettings(),g=u?t.sanitizeNarrowSidebarLayoutSetting(p):t.sanitizeNarrowSidebarLayoutSetting(m.narrowSidebarLayout);return m.narrowSidebarLayout=g,e(t.keys.narrowSidebarLayoutKey,g),{migrated:!1}},mirrorToLocalStorage:n(t.keys.narrowSidebarLayoutKey,()=>t.getSettings().narrowSidebarLayout)}),narrowSidebarTriggerMode:a({persistedKeys:["narrowSidebarTriggerMode"],loadPhase:"preProfiles",resolveOnLoad:()=>{let u=t.isLocal("narrowSidebarTriggerMode"),p=ye.get(t.keys.narrowSidebarTriggerModeKey),m=t.getSettings(),g=u?t.sanitizeNarrowSidebarTriggerModeSetting(p):t.sanitizeNarrowSidebarTriggerModeSetting(m.narrowSidebarTriggerMode);return m.narrowSidebarTriggerMode=g,e(t.keys.narrowSidebarTriggerModeKey,g),{migrated:!1}},mirrorToLocalStorage:n(t.keys.narrowSidebarTriggerModeKey,()=>t.getSettings().narrowSidebarTriggerMode)}),narrowSidebarCustomWidth:a({persistedKeys:["narrowSidebarCustomWidth"],loadPhase:"preProfiles",resolveOnLoad:()=>{let u=t.isLocal("narrowSidebarCustomWidth"),p=ye.get(t.keys.narrowSidebarCustomWidthKey),m=t.getSettings(),g=u?t.sanitizeNarrowSidebarCustomWidthSetting(p):t.sanitizeNarrowSidebarCustomWidthSetting(m.narrowSidebarCustomWidth);return m.narrowSidebarCustomWidth=g,e(t.keys.narrowSidebarCustomWidthKey,g),{migrated:!1}},mirrorToLocalStorage:n(t.keys.narrowSidebarCustomWidthKey,()=>t.getSettings().narrowSidebarCustomWidth)}),paneTransitionDuration:s({settingId:"paneTransitionDuration",loadPhase:"preProfiles",localStorageKey:t.keys.paneTransitionDurationKey,resolveDeviceLocal:u=>w4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizePaneTransitionDurationSetting(t.getSettings().paneTransitionDuration)}),toolbarVisibility:s({settingId:"toolbarVisibility",loadPhase:"preProfiles",localStorageKey:t.keys.toolbarVisibilityKey,resolveDeviceLocal:u=>T4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizeToolbarVisibilitySetting(t.getSettings().toolbarVisibility)}),useFloatingToolbars:s({settingId:"useFloatingToolbars",loadPhase:"preProfiles",localStorageKey:t.keys.useFloatingToolbarsKey,resolveDeviceLocal:()=>{let u=ye.get(t.keys.useFloatingToolbarsKey),p=t.sanitizeBooleanSetting(u,t.defaultSettings.useFloatingToolbars);return e(t.keys.useFloatingToolbarsKey,p),{value:p,migrated:!1}},sanitizeSynced:()=>t.sanitizeBooleanSetting(t.getSettings().useFloatingToolbars,t.defaultSettings.useFloatingToolbars)}),pinNavigationBanner:s({settingId:"pinNavigationBanner",loadPhase:"preProfiles",localStorageKey:t.keys.pinNavigationBannerKey,resolveDeviceLocal:u=>C4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizeBooleanSetting(t.getSettings().pinNavigationBanner,t.defaultSettings.pinNavigationBanner)}),navIndent:s({settingId:"navIndent",loadPhase:"preProfiles",localStorageKey:t.keys.navIndentKey,resolveDeviceLocal:u=>k4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizeNavIndentSetting(t.getSettings().navIndent)}),navItemHeight:s({settingId:"navItemHeight",loadPhase:"preProfiles",localStorageKey:t.keys.navItemHeightKey,resolveDeviceLocal:u=>F4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizeNavItemHeightSetting(t.getSettings().navItemHeight)}),navItemHeightScaleText:s({settingId:"navItemHeightScaleText",loadPhase:"preProfiles",localStorageKey:t.keys.navItemHeightScaleTextKey,resolveDeviceLocal:u=>P4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizeBooleanSetting(t.getSettings().navItemHeightScaleText,t.defaultSettings.navItemHeightScaleText)}),calendarPlacement:s({settingId:"calendarPlacement",loadPhase:"preProfiles",localStorageKey:t.keys.calendarPlacementKey,resolveDeviceLocal:u=>N4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizeCalendarPlacementSetting(t.getSettings().calendarPlacement)}),calendarLeftPlacement:s({settingId:"calendarLeftPlacement",loadPhase:"preProfiles",localStorageKey:t.keys.calendarLeftPlacementKey,resolveDeviceLocal:u=>I4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizeCalendarLeftPlacementSetting(t.getSettings().calendarLeftPlacement)}),calendarWeeksToShow:s({settingId:"calendarWeeksToShow",loadPhase:"preProfiles",localStorageKey:t.keys.calendarWeeksToShowKey,resolveDeviceLocal:u=>x4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizeCalendarWeeksToShowSetting(t.getSettings().calendarWeeksToShow)}),compactItemHeight:s({settingId:"compactItemHeight",loadPhase:"preProfiles",localStorageKey:t.keys.compactItemHeightKey,resolveDeviceLocal:u=>E4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizeCompactItemHeightSetting(t.getSettings().compactItemHeight)}),compactItemHeightScaleText:s({settingId:"compactItemHeightScaleText",loadPhase:"preProfiles",localStorageKey:t.keys.compactItemHeightScaleTextKey,resolveDeviceLocal:u=>M4({storedData:u,keys:t.keys,defaultSettings:t.defaultSettings}),sanitizeSynced:()=>t.sanitizeBooleanSetting(t.getSettings().compactItemHeightScaleText,t.defaultSettings.compactItemHeightScaleText)}),featureImageSize:s({settingId:"featureImageSize",loadPhase:"preProfiles",localStorageKey:t.keys.featureImageSizeKey,resolveDeviceLocal:()=>{let u=ye.get(t.keys.featureImageSizeKey),p=t.sanitizeFeatureImageSizeSetting(u);return e(t.keys.featureImageSizeKey,p),{value:p,migrated:!1}},sanitizeSynced:()=>t.sanitizeFeatureImageSizeSetting(t.getSettings().featureImageSize)}),featureImagePixelSize:s({settingId:"featureImagePixelSize",loadPhase:"preProfiles",localStorageKey:t.keys.featureImagePixelSizeKey,resolveDeviceLocal:()=>{let u=ye.get(t.keys.featureImagePixelSizeKey),p=t.sanitizeFeatureImagePixelSizeSetting(u);return e(t.keys.featureImagePixelSizeKey,p),{value:p,migrated:!1}},sanitizeSynced:()=>t.sanitizeFeatureImagePixelSizeSetting(t.getSettings().featureImagePixelSize)}),uiScale:a({persistedKeys:["desktopScale","mobileScale"],loadPhase:"preProfiles",cleanupOnLoad:!1,hasPersistedValue:()=>!1,deleteFromPersisted:u=>{t.getShouldPersistDesktopScale()||delete u.desktopScale,t.getShouldPersistMobileScale()||delete u.mobileScale},resolveOnLoad:({storedData:u})=>{let p=t.isLocal("uiScale"),m=t.getSettings();if(p){let f=O4({settings:m,storedData:u,keys:t.keys,shouldPersistDesktopScale:t.getShouldPersistDesktopScale(),shouldPersistMobileScale:t.getShouldPersistMobileScale()});return t.setShouldPersistDesktopScale(f.shouldPersistDesktopScale),t.setShouldPersistMobileScale(f.shouldPersistMobileScale),{migrated:f.migrated}}m.desktopScale=Za(m.desktopScale),m.mobileScale=Za(m.mobileScale);let g=Za(yk.Platform.isMobile?m.mobileScale:m.desktopScale);return e(t.keys.uiScaleKey,g),{migrated:!1}},mirrorToLocalStorage:()=>{let u=t.getSettings(),p=Za(yk.Platform.isMobile?u.mobileScale:u.desktopScale);e(t.keys.uiScaleKey,p)}})}}var Z4=require("obsidian");ko();var bk={base:{searchActive:!1,showCalendar:!1,showHiddenItems:!1,pinShortcuts:!0,includeDescendantNotes:Le.includeDescendantNotes},platform:{mobile:{},desktop:{}}},Hz=Object.keys(bk.base).filter(t=>t in bk.base),cfe=new Set(Hz);function Qh(){let t=Z4.Platform.isMobile?bk.platform.mobile:bk.platform.desktop;return{...bk.base,...t}}function Bx(t){if(t===null||typeof t!="object")return!1;let e=t;for(let n of Hz){let r=e[n];if(typeof r<"u"&&typeof r!="boolean")return!1}return!0}function J4(t,e=Qh()){let n={...e};if(t===null||typeof t!="object")return{preferences:n,changed:!0};let r=t,o=!1;Object.keys(r).forEach(a=>{cfe.has(a)||(o=!0)});for(let a of Hz){let i=r[a];if(typeof i=="boolean"){n[a]=i;continue}o=!0}return{preferences:n,changed:o}}function ufe(t,e){if(typeof t!="string")return e;let n=t.trim();return n.length===0?e:n}var pfe=new Set(["vaultProfile","tagSortOrder","includeDescendantNotes","dualPane","dualPaneOrientation","paneTransitionDuration","toolbarVisibility","navIndent","navItemHeight","navItemHeightScaleText","calendarWeeksToShow","compactItemHeight","compactItemHeightScaleText","uiScale"]);function Vz(t){return mt(t)?Object.values(t).some(e=>mt(e)&&e.groupBy==="none"):!1}function mfe(t){return t?t.noteGrouping==="none"||Vz(t.folderAppearances)||Vz(t.tagAppearances)||Vz(t.propertyAppearances):!1}var _x=class{constructor(e){this.currentSettings={...Le};this.syncModeRegistry=null;this.shouldPersistDesktopScale=!1;this.shouldPersistMobileScale=!1;this.hiddenFolderCacheKey=null;this.hiddenTagCacheKey=null;this.hiddenFileNamesCacheKey=null;this.options=e}get settings(){return this.currentSettings}set settings(e){this.currentSettings=e}getSyncMode(e){return this.currentSettings.syncModes?.[e]==="local"?"local":"synced"}isLocal(e){return this.getSyncMode(e)==="local"}isSynced(e){return this.getSyncMode(e)==="synced"}async setSyncMode(e,n){let r=n==="local"?"local":"synced";if(this.getSyncMode(e)===r)return!1;r==="local"&&this.seedLocalValue(e);let a=De(this.currentSettings.syncModes,ov);return a[e]=r,this.currentSettings.syncModes=a,!0}mirrorAllSyncModeSettingsToLocalStorage(){let e=this.getSyncModeRegistry();cm.forEach(n=>{e[n].mirrorToLocalStorage()})}prepareImportedUiScalePersistence(){this.isLocal("uiScale")&&(this.shouldPersistDesktopScale=!0,this.shouldPersistMobileScale=!0)}clearAllLocalStorage(){Object.keys(ut).forEach(n=>{if(n==="databaseSchemaVersionKey"||n==="databaseContentVersionKey"||n==="debugLoggingEnabledKey")return;let r=ut[n];ye.remove(r)})}async loadSettings(){let e=await this.options.loadData(),n=mt(e)?e:null,r=!!(n&&Object.prototype.hasOwnProperty.call(n,"propertyFields")),o=!!(n&&(typeof n.homepage=="string"||Object.prototype.hasOwnProperty.call(n,"mobileHomepage")||Object.prototype.hasOwnProperty.call(n,"useMobileHomepage"))),a=!!(n&&Object.prototype.hasOwnProperty.call(n,"useFolderColorForFileTitles")),i=!!(n&&Object.prototype.hasOwnProperty.call(n,"showPinnedIcon")),s=!!(n&&Object.prototype.hasOwnProperty.call(n,"showPinnedGroupHeader")),l=n?.interfaceIcons,c=!!(mt(l)&&Object.prototype.hasOwnProperty.call(l,"pinned-section")),u=!!(n&&Object.prototype.hasOwnProperty.call(n,"propertySortKey")&&typeof n.propertySortKey!="string"),p=!!(n&&Object.prototype.hasOwnProperty.call(n,"manualSortPropertyKey")&&typeof n.manualSortPropertyKey!="string"),m=!!(n&&Object.prototype.hasOwnProperty.call(n,"defaultFolderSort")&&(!lh(n.defaultFolderSort)||Jl(n.defaultFolderSort))),g=mfe(n),f=!!(n&&Object.prototype.hasOwnProperty.call(n,"openFolderNotesInNewTab")),h=!!(n&&Object.prototype.hasOwnProperty.call(n,"shiftEnterOpenContext")&&!yw(n.shiftEnterOpenContext)),b=!!(n&&Object.prototype.hasOwnProperty.call(n,"cmdCtrlEnterOpenContext")&&!yw(n.cmdCtrlEnterOpenContext)),v=n,y=n===null;this.shouldPersistDesktopScale=!!(n&&"desktopScale"in n),this.shouldPersistMobileScale=!!(n&&"mobileScale"in n),this.currentSettings={...Le,...v??{}};let S=!!(n&&"searchProvider"in n),w=!!(n&&"lastAnnouncedRelease"in n),k=ye.get(this.options.keys.searchProviderKey);k==="internal"||k==="omnisearch"?this.currentSettings.searchProvider=k:(this.currentSettings.searchProvider="internal",ye.set(this.options.keys.searchProviderKey,"internal"));let F=this.currentSettings;delete F.showCalendar,delete F.calendarCustomPromptForTitle,delete F.saveMetadataToFrontmatter,delete F.lastAnnouncedRelease,delete F.optimizeNoteHeight,cC(n?.folderNoteOpenLocation)||(this.currentSettings.folderNoteOpenLocation=n?.openFolderNotesInNewTab===!0?"new-tab":Le.folderNoteOpenLocation),delete F.openFolderNotesInNewTab,typeof this.currentSettings.propertySortKey!="string"&&(this.currentSettings.propertySortKey=Le.propertySortKey),typeof this.currentSettings.manualSortPropertyKey!="string"&&(this.currentSettings.manualSortPropertyKey=Le.manualSortPropertyKey),(!lh(this.currentSettings.defaultFolderSort)||Jl(this.currentSettings.defaultFolderSort))&&(this.currentSettings.defaultFolderSort=Le.defaultFolderSort),typeof this.currentSettings.manualSortGroupHeaderProperty!="string"&&(this.currentSettings.manualSortGroupHeaderProperty=Le.manualSortGroupHeaderProperty),this.currentSettings.keyboardShortcuts=CU(this.currentSettings.keyboardShortcuts),yw(this.currentSettings.shiftEnterOpenContext)||(this.currentSettings.shiftEnterOpenContext=Le.shiftEnterOpenContext),yw(this.currentSettings.cmdCtrlEnterOpenContext)||(this.currentSettings.cmdCtrlEnterOpenContext=Le.cmdCtrlEnterOpenContext),this.normalizeSyncModes({storedData:n,isFirstLaunch:y});let P=this.getSyncModeRegistry();_4({settings:this.currentSettings,storedData:n,keys:this.options.keys,defaultSettings:Le}),this.sanitizeSettingsRecords();let T=wm(this.currentSettings),I=B4({settings:this.currentSettings,defaultDateFormat:lA(),defaultTimeFormat:dA(),defaultSettings:Le});this.currentSettings.dateFormat||(this.currentSettings.dateFormat=lA()),this.currentSettings.timeFormat||(this.currentSettings.timeFormat=dA()),(typeof this.currentSettings.recentNotesCount!="number"||this.currentSettings.recentNotesCount<=0)&&(this.currentSettings.recentNotesCount=Le.recentNotesCount),sv(this.currentSettings.hideRecentNotes)||(this.currentSettings.hideRecentNotes=Le.hideRecentNotes),this.currentSettings.calendarEnabled=this.sanitizeBooleanSetting(this.currentSettings.calendarEnabled,Le.calendarEnabled),nC(this.currentSettings.propertySortSecondary)||(this.currentSettings.propertySortSecondary=Le.propertySortSecondary),oC(this.currentSettings.manualSortNewNotePlacement)||(this.currentSettings.manualSortNewNotePlacement=Le.manualSortNewNotePlacement),uC(this.currentSettings.calendarWeekendDays)||(this.currentSettings.calendarWeekendDays=Le.calendarWeekendDays),pC(this.currentSettings.calendarMonthHeadingFormat)||(this.currentSettings.calendarMonthHeadingFormat=Le.calendarMonthHeadingFormat),mC(this.currentSettings.calendarPeriodicNotesLocaleSource)||(this.currentSettings.calendarPeriodicNotesLocaleSource=Le.calendarPeriodicNotesLocaleSource),dh(this.currentSettings.featureImageSize)||(this.currentSettings.featureImageSize=Le.featureImageSize),ch(this.currentSettings.featureImagePixelSize)||(this.currentSettings.featureImagePixelSize=Le.featureImagePixelSize),AU(this.currentSettings.mouseBackForwardAction)||(this.currentSettings.mouseBackForwardAction=Le.mouseBackForwardAction),al(this.currentSettings.folderSortOrder)||(this.currentSettings.folderSortOrder=Le.folderSortOrder),this.currentSettings.deleteAttachments=ZP(this.currentSettings.deleteAttachments,Le.deleteAttachments),this.currentSettings.moveFileConflicts=JP(this.currentSettings.moveFileConflicts,Le.moveFileConflicts);let N=!1;cm.forEach(E=>{let R=P[E];if(R.loadPhase!=="preProfiles")return;let M=R.resolveOnLoad({storedData:n});E==="uiScale"&&(N=M.migrated)}),Array.isArray(this.currentSettings.rootFolderOrder)||(this.currentSettings.rootFolderOrder=[]),Array.isArray(this.currentSettings.rootTagOrder)||(this.currentSettings.rootTagOrder=[]),Array.isArray(this.currentSettings.rootPropertyOrder)||(this.currentSettings.rootPropertyOrder=[]);let O=b4({settings:this.currentSettings,storedData:n,keys:this.options.keys}),K=S4({settings:this.currentSettings,storedData:n,keys:this.options.keys}),G=!!(n&&cm.some(E=>{let R=P[E];return!R.cleanupOnLoad||!this.isLocal(E)?!1:R.hasPersistedValue(n)}));H4({settings:this.currentSettings,defaultSettings:Le}),V4({settings:this.currentSettings});let X=q4({settings:this.currentSettings,storedData:n}),L=U4({settings:this.currentSettings,storedData:n}),V=W4({storedData:n}),D=$4({settings:this.currentSettings});Oo(this.currentSettings),X4({settings:this.currentSettings,legacyPeriodicNotesFolder:D}),Y4({settings:this.currentSettings,migration:X}),K4({settings:this.currentSettings,legacyPropertyFields:L}),j4({settings:this.currentSettings,legacyShortcuts:V});let A=G4({settings:this.currentSettings});return this.normalizeIconSettings(),this.normalizeTaskSettings(),this.normalizeFileIconMapSettings(),this.normalizeInterfaceIconsSettings(),P.vaultProfile.resolveOnLoad({storedData:n}),this.refreshMatcherCachesIfNeeded(),(O||K||G||S||w||r||o||a||i||s||c||u||p||m||g||f||h||b||T||N||I||A)&&await this.options.saveData(this.getPersistableSettings()),y}normalizeTagSettings(){let e=r=>{if(!r)return Object.create(null);let o=Object.create(null),a=De(r);for(let[i,s]of Object.entries(a)){let l=It(i);l&&(o[l]=s)}return o},n=r=>r?[...new Set(r.map(o=>It(o)).filter(o=>o.length>0))]:[];this.currentSettings.tagColors&&(this.currentSettings.tagColors=e(this.currentSettings.tagColors)),this.currentSettings.tagBackgroundColors&&(this.currentSettings.tagBackgroundColors=e(this.currentSettings.tagBackgroundColors)),this.currentSettings.tagIcons&&(this.currentSettings.tagIcons=e(this.currentSettings.tagIcons)),this.currentSettings.tagSortOverrides&&(this.currentSettings.tagSortOverrides=e(this.currentSettings.tagSortOverrides)),this.currentSettings.tagTreeSortOverrides&&(this.currentSettings.tagTreeSortOverrides=e(this.currentSettings.tagTreeSortOverrides)),this.currentSettings.tagAppearances&&(this.currentSettings.tagAppearances=e(this.currentSettings.tagAppearances)),Array.isArray(this.currentSettings.vaultProfiles)&&this.currentSettings.vaultProfiles.forEach(r=>{r.hiddenTags=n(r.hiddenTags),r.hiddenFileTags=n(r.hiddenFileTags)})}normalizePropertySettings(){let e=r=>{if(!r)return Object.create(null);let o=Object.create(null),a=De(r);for(let[i,s]of Object.entries(a)){let l=i===Oe?Oe:Gt(i);l&&(o[l]=s)}return o},n=r=>{if(!r)return Object.create(null);let o=Object.create(null),a=De(r);for(let[i,s]of Object.entries(a)){let l=Wv(i);l&&(o[l]=s)}return o};this.currentSettings.propertyColors&&(this.currentSettings.propertyColors=e(this.currentSettings.propertyColors)),this.currentSettings.propertyBackgroundColors&&(this.currentSettings.propertyBackgroundColors=e(this.currentSettings.propertyBackgroundColors)),this.currentSettings.propertyIcons&&(this.currentSettings.propertyIcons=e(this.currentSettings.propertyIcons)),this.currentSettings.propertySortOverrides&&(this.currentSettings.propertySortOverrides=e(this.currentSettings.propertySortOverrides)),this.currentSettings.propertyTreeSortOverrides&&(this.currentSettings.propertyTreeSortOverrides=n(this.currentSettings.propertyTreeSortOverrides)),this.currentSettings.propertyAppearances&&(this.currentSettings.propertyAppearances=e(this.currentSettings.propertyAppearances))}normalizeNavigationSeparatorSettings(){let e=Object.create(null),n=De(this.currentSettings.navigationSeparators,fm);for(let[r,o]of Object.entries(n)){let a=qI(r);a&&(e[a]=o)}this.currentSettings.navigationSeparators=e}async saveSettings(){Oo(this.currentSettings),this.refreshMatcherCachesIfNeeded(),ye.set(this.options.keys.homepageKey,this.currentSettings.homepage),await this.options.saveData(this.getPersistableSettings())}getPersistableSettings(){let e={...this.currentSettings};delete e.hiddenTags,delete e.fileVisibility,delete e.recentColors,delete e.lastReleaseCheckAt,delete e.latestKnownRelease,delete e.searchProvider,delete e.showCalendar,delete e.calendarCustomPromptForTitle,delete e.saveMetadataToFrontmatter,delete e.propertyFields,delete e.notePropertyType,delete e.optimizeNoteHeight,delete e.showPinnedIcon,delete e.showPinnedGroupHeader,delete e.showWordCount,delete e.wordCountPlacement,delete e.wordCharacterCountDisplay,delete e.characterCountMode;let n=this.getSyncModeRegistry();return cm.forEach(r=>{this.isLocal(r)&&n[r].deleteFromPersisted(e)}),e}refreshMatcherCachesIfNeeded(){let e=this.buildPatternCacheKey(i=>i.hiddenFolders),n=this.buildPatternCacheKey(i=>i.hiddenTags),r=this.buildPatternCacheKey(i=>i.hiddenFileTags),o=`${n}${r}`,a=this.buildPatternCacheKey(i=>i.hiddenFileNames);e!==this.hiddenFolderCacheKey&&(Lj(),this.hiddenFolderCacheKey=e),o!==this.hiddenTagCacheKey&&(BW(),this.hiddenTagCacheKey=o),a!==this.hiddenFileNamesCacheKey&&(sj(),this.hiddenFileNamesCacheKey=a)}setLocalStorageVersion(){ye.set(ut.localStorageVersionKey,BA)}getStoredLocalStorageVersion(){return ye.get(ut.localStorageVersionKey)}getCurrentLocalStorageVersion(){return BA}parseFiniteNumber(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){let n=Number(e);if(Number.isFinite(n))return n}return null}sanitizeBoundedIntegerSetting(e,n){let r=this.parseFiniteNumber(e);if(r===null)return n.fallback;let o=Math.round(r);return on.max?n.fallback:o}sanitizeBooleanSetting(e,n){return typeof e=="boolean"?e:n}sanitizeHomepageSetting(e){if(typeof e!="object"||e===null)return{...Le.homepage};let n=e,r=av(n.source)?n.source:Le.homepage.source,o=Na(typeof n.file=="string"?n.file:null),a=typeof n.createMissingPeriodicNote=="boolean"?n.createMissingPeriodicNote:Le.homepage.createMissingPeriodicNote;return{source:r,file:o,createMissingPeriodicNote:a}}sanitizeDualPaneOrientationSetting(e){return this.parseDualPaneOrientation(e)??Le.dualPaneOrientation}sanitizeNarrowSidebarLayoutSetting(e){return sC(e)??Le.narrowSidebarLayout}sanitizeNarrowSidebarTriggerModeSetting(e){return lC(e)?e:Le.narrowSidebarTriggerMode}sanitizeNarrowSidebarCustomWidthSetting(e){return this.sanitizeBoundedIntegerSetting(e,{min:pm,max:mm,fallback:Le.narrowSidebarCustomWidth})}sanitizePaneTransitionDurationSetting(e){return this.sanitizeBoundedIntegerSetting(e,{min:Dc,max:Ac,fallback:Le.paneTransitionDuration})}sanitizeNavIndentSetting(e){return this.sanitizeBoundedIntegerSetting(e,{min:10,max:24,fallback:Le.navIndent})}sanitizeNavItemHeightSetting(e){return this.sanitizeBoundedIntegerSetting(e,{min:20,max:28,fallback:Le.navItemHeight})}sanitizeCalendarPlacementSetting(e){return gm(e)?e:Le.calendarPlacement}sanitizeCalendarLeftPlacementSetting(e){return hm(e)?e:Le.calendarLeftPlacement}sanitizeCalendarWeeksToShowSetting(e){let n=this.parseFiniteNumber(e);if(n===null)return Le.calendarWeeksToShow;let r=Math.round(n);return r===1||r===2||r===3||r===4||r===5||r===6?r:Le.calendarWeeksToShow}sanitizeCompactItemHeightSetting(e){return this.sanitizeBoundedIntegerSetting(e,{min:20,max:28,fallback:Le.compactItemHeight})}sanitizeFeatureImageSizeSetting(e){return dh(e)?e:Le.featureImageSize}sanitizeFeatureImagePixelSizeSetting(e){return ch(e)?e:Le.featureImagePixelSize}sanitizeTagSortOrderSetting(e){return typeof e=="string"&&Ta(e)?e:Le.tagSortOrder}sanitizeFolderSortOrderSetting(e){return typeof e=="string"&&al(e)?e:Le.folderSortOrder}sanitizeVaultProfileId(e){let n=this.currentSettings.vaultProfiles,r=typeof e=="string"?n.find(a=>a.id===e):null;if(r)return r.id;let o=n.find(a=>a.id===eo);return o?o.id:n[0]?.id??eo}sanitizeToolbarVisibilitySetting(e){let n=Le.toolbarVisibility,r=(o,a)=>{let i={...o};return ka(a)&&Object.keys(o).forEach(s=>{let l=a[s];typeof l=="boolean"&&(i[s]=l)}),i};return ka(e)?{navigation:r(n.navigation,e.navigation),list:r(n.list,e.list)}:{navigation:{...n.navigation},list:{...n.list}}}resolveActiveVaultProfileId(){let e=this.currentSettings.vaultProfiles,n=i=>{if(typeof i!="string"||!i)return null;let s=e.find(l=>l.id===i);return s?s.id:null},r=ye.get(this.options.keys.vaultProfileKey),o=n(r);if(o)return o;let a=e.find(i=>i.id===eo);return a?a.id:e[0]?.id??eo}normalizeSyncModes(e){let{storedData:n,isFirstLaunch:r}=e,o=n?.syncModes,a=ka(o)?o:null,i=De(void 0);cm.forEach(s=>{let l=r?"synced":pfe.has(s)?"local":"synced",c=a?a[s]:void 0;i[s]=ov(c)?c:l}),this.currentSettings.syncModes=i}getSyncModeRegistry(){return this.syncModeRegistry?this.syncModeRegistry:(this.syncModeRegistry=Q4({keys:this.options.keys,defaultSettings:Le,isLocal:e=>this.isLocal(e),getSettings:()=>this.currentSettings,resolveActiveVaultProfileId:()=>this.resolveActiveVaultProfileId(),sanitizeVaultProfileId:e=>this.sanitizeVaultProfileId(e),parseDualPanePreference:e=>this.parseDualPanePreference(e),parseDualPaneOrientation:e=>this.parseDualPaneOrientation(e),sanitizeBooleanSetting:(e,n)=>this.sanitizeBooleanSetting(e,n),sanitizeHomepageSetting:e=>this.sanitizeHomepageSetting(e),sanitizeDualPaneOrientationSetting:e=>this.sanitizeDualPaneOrientationSetting(e),sanitizeNarrowSidebarLayoutSetting:e=>this.sanitizeNarrowSidebarLayoutSetting(e),sanitizeNarrowSidebarTriggerModeSetting:e=>this.sanitizeNarrowSidebarTriggerModeSetting(e),sanitizeNarrowSidebarCustomWidthSetting:e=>this.sanitizeNarrowSidebarCustomWidthSetting(e),sanitizeTagSortOrderSetting:e=>this.sanitizeTagSortOrderSetting(e),sanitizeFolderSortOrderSetting:e=>this.sanitizeFolderSortOrderSetting(e),sanitizePaneTransitionDurationSetting:e=>this.sanitizePaneTransitionDurationSetting(e),sanitizeToolbarVisibilitySetting:e=>this.sanitizeToolbarVisibilitySetting(e),sanitizeNavIndentSetting:e=>this.sanitizeNavIndentSetting(e),sanitizeNavItemHeightSetting:e=>this.sanitizeNavItemHeightSetting(e),sanitizeCalendarWeeksToShowSetting:e=>this.sanitizeCalendarWeeksToShowSetting(e),sanitizeCalendarPlacementSetting:e=>this.sanitizeCalendarPlacementSetting(e),sanitizeCalendarLeftPlacementSetting:e=>this.sanitizeCalendarLeftPlacementSetting(e),sanitizeCompactItemHeightSetting:e=>this.sanitizeCompactItemHeightSetting(e),sanitizeFeatureImageSizeSetting:e=>this.sanitizeFeatureImageSizeSetting(e),sanitizeFeatureImagePixelSizeSetting:e=>this.sanitizeFeatureImagePixelSizeSetting(e),defaultUXPreferences:Qh(),isUXPreferencesRecord:Bx,mirrorUXPreferences:e=>{this.options.mirrorUXPreferences(e)},getShouldPersistDesktopScale:()=>this.shouldPersistDesktopScale,getShouldPersistMobileScale:()=>this.shouldPersistMobileScale,setShouldPersistDesktopScale:e=>{this.shouldPersistDesktopScale=e},setShouldPersistMobileScale:e=>{this.shouldPersistMobileScale=e}}),this.syncModeRegistry)}seedLocalValue(e){this.getSyncModeRegistry()[e].mirrorToLocalStorage()}sanitizeSettingsRecords(){let e=l=>De(l,Ln),n=l=>{let c=Object.create(null);if(!l)return c;for(let u of Object.keys(l)){let p=Oc(l[u]);p&&(c[u]=p)}return c},r=l=>De(l,al),o=l=>ka(l),a=l=>{let c=De(l,o);return Object.values(c).forEach(u=>{delete u.notePropertyType,gC(u)}),c},i=l=>De(l,fm),s=l=>De(l,ov);this.currentSettings.folderColors=e(this.currentSettings.folderColors),this.currentSettings.folderBackgroundColors=e(this.currentSettings.folderBackgroundColors),this.currentSettings.fileColors=e(this.currentSettings.fileColors),this.currentSettings.fileBackgroundColors=e(this.currentSettings.fileBackgroundColors),this.currentSettings.tagColors=e(this.currentSettings.tagColors),this.currentSettings.tagBackgroundColors=e(this.currentSettings.tagBackgroundColors),this.currentSettings.propertyColors=e(this.currentSettings.propertyColors),this.currentSettings.propertyBackgroundColors=e(this.currentSettings.propertyBackgroundColors),this.currentSettings.virtualFolderColors=e(this.currentSettings.virtualFolderColors),this.currentSettings.virtualFolderBackgroundColors=e(this.currentSettings.virtualFolderBackgroundColors),this.currentSettings.folderSortOverrides=n(this.currentSettings.folderSortOverrides),this.currentSettings.tagSortOverrides=n(this.currentSettings.tagSortOverrides),this.currentSettings.propertySortOverrides=n(this.currentSettings.propertySortOverrides),this.currentSettings.folderTreeSortOverrides=r(this.currentSettings.folderTreeSortOverrides),this.currentSettings.tagTreeSortOverrides=r(this.currentSettings.tagTreeSortOverrides),this.currentSettings.propertyTreeSortOverrides=r(this.currentSettings.propertyTreeSortOverrides),this.currentSettings.folderAppearances=a(this.currentSettings.folderAppearances),this.currentSettings.tagAppearances=a(this.currentSettings.tagAppearances),this.currentSettings.propertyAppearances=a(this.currentSettings.propertyAppearances),this.currentSettings.navigationSeparators=i(this.currentSettings.navigationSeparators),this.currentSettings.externalIconProviders=i(this.currentSettings.externalIconProviders),this.currentSettings.syncModes=s(this.currentSettings.syncModes),this.currentSettings.calendarMonthHighlights=e(this.currentSettings.calendarMonthHighlights),this.currentSettings.pinnedNotes=Ou(this.currentSettings.pinnedNotes),this.currentSettings.collapsedPinnedContexts=uv(this.currentSettings.collapsedPinnedContexts)}normalizeTaskSettings(){typeof this.currentSettings.showFileIconUnfinishedTask!="boolean"&&(this.currentSettings.showFileIconUnfinishedTask=Le.showFileIconUnfinishedTask),typeof this.currentSettings.showFileBackgroundUnfinishedTask!="boolean"&&(this.currentSettings.showFileBackgroundUnfinishedTask=Le.showFileBackgroundUnfinishedTask),this.currentSettings.unfinishedTaskBackgroundColor=ufe(this.currentSettings.unfinishedTaskBackgroundColor,Le.unfinishedTaskBackgroundColor)}normalizeIconSettings(){let e=n=>{let r=De(n,Ln);return Object.keys(r).forEach(o=>{let a=qn(r[o]);if(!a){delete r[o];return}r[o]=a}),r};this.currentSettings.folderIcons=e(this.currentSettings.folderIcons),this.currentSettings.tagIcons=e(this.currentSettings.tagIcons),this.currentSettings.propertyIcons=e(this.currentSettings.propertyIcons),this.currentSettings.fileIcons=e(this.currentSettings.fileIcons)}normalizeFileIconMapSettings(){let e=(n,r,o)=>{if(!ka(n))return xT(o,r);let a=De(void 0);return Object.entries(n).forEach(([i,s])=>{typeof s=="string"&&(a[i]=s)}),xT(a,r)};typeof this.currentSettings.showCategoryIcons!="boolean"&&(this.currentSettings.showCategoryIcons=Le.showCategoryIcons),typeof this.currentSettings.showFilenameMatchIcons!="boolean"&&(this.currentSettings.showFilenameMatchIcons=Le.showFilenameMatchIcons),bv(this.currentSettings.fileTypeIconPreset)||(this.currentSettings.fileTypeIconPreset=Le.fileTypeIconPreset),this.currentSettings.fileTypeIconMap=e(this.currentSettings.fileTypeIconMap,Rm,Le.fileTypeIconMap),this.currentSettings.fileNameIconMap=e(this.currentSettings.fileNameIconMap,Dm,Le.fileNameIconMap)}normalizeInterfaceIconsSettings(){let e=this.currentSettings.interfaceIcons;if(!ka(e)){this.currentSettings.interfaceIcons=De(Le.interfaceIcons,Ln);return}let n=De(void 0);Object.entries(e).forEach(([o,a])=>{typeof a=="string"&&(n[o]=a)});let r=n["list-sort"];r&&typeof r=="string"&&(n["list-sort-ascending"]=n["list-sort-ascending"]??r,n["list-sort-descending"]=n["list-sort-descending"]??r,delete n["list-sort"]),this.currentSettings.interfaceIcons=De(Xq(n),Ln)}buildPatternCacheKey(e){let n=Array.isArray(this.currentSettings.vaultProfiles)?this.currentSettings.vaultProfiles:[];if(n.length===0)return"";let r=n.map(o=>({id:o.id??"",key:Ph(e(o)??[])}));return r.sort((o,a)=>o.id.localeCompare(a.id)),r.map(o=>`${o.id}:${o.key}`).join("")}parseDualPanePreference(e){if(typeof e=="string"){if(e==="1")return!0;if(e==="0")return!1}return null}parseDualPaneOrientation(e){return e==="vertical"?"vertical":e==="horizontal"?"horizontal":null}};var Uz=require("obsidian");uw();ko();xn();ko();Jr();Si();Ot();Zr();gL();var e5=1e3,Hx=class{constructor(e){this.notesCache=[];this.notesByProfileCache=De(void 0);this.iconsCache=De(void 0);this.notesPersistTimer=null;this.iconsPersistTimer=null;this.lastPersistedNotesByProfile=De(void 0);this.lastPersistedIcons=De(void 0);this.settings=e.settings,this.keys=e.keys,this.notifyChange=e.notifyChange,this.vaultProfileId=e.vaultProfileId}hydrate(){this.hydrateRecentNotes(),this.hydrateRecentIcons()}getRecentNotes(){return[...this.notesCache]}setRecentNotes(e){let n=this.normalizeRecentNotes(e,this.getRecentNotesLimit());this.areArraysEqual(n,this.notesCache)||(this.notesCache=n,n.length===0?delete this.notesByProfileCache[this.vaultProfileId]:this.notesByProfileCache[this.vaultProfileId]=n,this.scheduleRecentNotesPersist())}getRecentIcons(){return this.cloneIconMap(this.iconsCache)}setRecentIcons(e){let n=this.normalizeRecentIconsMap(e);this.areIconMapsEqual(n,this.iconsCache)||(this.iconsCache=n,this.scheduleRecentIconsPersist())}applyRecentNotesLimit(){let e=this.getRecentNotesLimit(),n=Object.keys(this.notesByProfileCache),r=!1;n.forEach(a=>{let i=this.notesByProfileCache[a]??[],s=this.normalizeRecentNotes(i,e);this.areArraysEqual(s,i)||(r=!0,s.length===0?delete this.notesByProfileCache[a]:this.notesByProfileCache[a]=s)});let o=this.notesByProfileCache[this.vaultProfileId]??[];this.areArraysEqual(o,this.notesCache)||(this.notesCache=[...o],r=!0),r&&this.scheduleRecentNotesPersist()}flushPendingPersists(){this.notesPersistTimer!==null&&(window.clearTimeout(this.notesPersistTimer),this.notesPersistTimer=null),this.iconsPersistTimer!==null&&(window.clearTimeout(this.iconsPersistTimer),this.iconsPersistTimer=null),this.persistRecentNotesImmediately(),this.persistRecentIconsImmediately()}hydrateRecentNotes(){let e=this.getRecentNotesLimit(),n=ye.get(this.keys.recentNotesKey),r=this.getValidVaultProfileIds(),o=De(void 0),a=!1;if(Array.isArray(n)){let i=n.filter(l=>typeof l=="string"),s=this.normalizeRecentNotes(i,e);s.length>0&&(o[this.vaultProfileId]=s),a=!0}else if(mt(n))for(let[i,s]of Object.entries(n)){if(!r.has(i)){a=!0;continue}if(!Array.isArray(s)){a=!0;continue}if(s.length===0){a=!0;continue}let l=s.filter(u=>typeof u=="string");l.length!==s.length&&(a=!0);let c=this.normalizeRecentNotes(l,e);this.areArraysEqual(c,l)||(a=!0),c.length>0?o[i]=c:l.length>0&&(a=!0)}this.notesByProfileCache=o,this.notesCache=[...o[this.vaultProfileId]??[]],this.lastPersistedNotesByProfile=this.cloneIconMap(o),a&&ye.set(this.keys.recentNotesKey,this.cloneIconMap(o))}hydrateRecentIcons(){let e=ye.get(this.keys.recentIconsKey),n=mt(e)?e:{},{sanitized:r,didSanitize:o}=this.sanitizeIconRecord(n),a=this.normalizeRecentIconsMap(r);this.iconsCache=a,this.lastPersistedIcons=this.cloneIconMap(a),(o||!this.areIconMapsEqual(a,r))&&ye.set(this.keys.recentIconsKey,a)}scheduleRecentNotesPersist(){this.notesPersistTimer!==null&&window.clearTimeout(this.notesPersistTimer),this.notesPersistTimer=window.setTimeout(()=>{this.notesPersistTimer=null,this.persistRecentNotesAsync()},e5)}scheduleRecentIconsPersist(){this.iconsPersistTimer!==null&&window.clearTimeout(this.iconsPersistTimer),this.iconsPersistTimer=window.setTimeout(()=>{this.iconsPersistTimer=null,this.persistRecentIconsAsync()},e5)}persistRecentNotesAsync(){this.runWhenIdle(()=>{this.persistRecentNotesImmediately()})}persistRecentIconsAsync(){this.runWhenIdle(()=>{this.persistRecentIconsImmediately()})}persistRecentNotesImmediately(){if(this.pruneRecentNotesByProfileCache(),this.areIconMapsEqual(this.notesByProfileCache,this.lastPersistedNotesByProfile))return;let e=this.cloneIconMap(this.notesByProfileCache);ye.set(this.keys.recentNotesKey,e),this.lastPersistedNotesByProfile=e,this.notifyChange()}persistRecentIconsImmediately(){if(this.areIconMapsEqual(this.iconsCache,this.lastPersistedIcons))return;let e=this.cloneIconMap(this.iconsCache);ye.set(this.keys.recentIconsKey,e),this.lastPersistedIcons=e,this.notifyChange()}runWhenIdle(e){window.setTimeout(()=>{e()},0)}normalizeRecentNotes(e,n){let r=new Set,o=[];for(let a of e)if(!(typeof a!="string"||a.length===0)&&!r.has(a)&&(r.add(a),o.push(a),o.length>=n))break;return o}normalizeRecentIconsMap(e){let n=De(void 0);for(let[r,o]of Object.entries(e)){if(typeof r!="string"||r.length===0)continue;let a=Array.isArray(o)?o:[],i=new Set,s=[];for(let l of a){if(typeof l!="string"||l.length===0)continue;let c=this.normalizeIconIdentifierForProvider(r,l);if(c&&!i.has(c)&&(i.add(c),s.push(c),s.length>=15))break}s.length>0&&(n[r]=s)}return n}normalizeIconIdentifierForProvider(e,n){let r=n.trim();if(!r)return null;let o=r;!o.includes(":")&&e!=="lucide"&&(o=`${e}:${o}`);let a=qn(o);if(!a)return null;let i=a.indexOf(":"),s=i===-1?"lucide":a.substring(0,i),l=i===-1?a:a.substring(i+1);return!l||s!==e?null:e==="lucide"?l:`${e}:${l}`}areArraysEqual(e,n){if(e.length!==n.length)return!1;for(let r=0;r{r.id&&n.add(r.id)}),this.vaultProfileId&&n.add(this.vaultProfileId),n}pruneRecentNotesByProfileCache(){let e=this.getValidVaultProfileIds();Object.keys(this.notesByProfileCache).forEach(n=>{e.has(n)||delete this.notesByProfileCache[n]})}sanitizeIconRecord(e){let n=De(void 0),r=!1;for(let[o,a]of Object.entries(e)){if(typeof o!="string"||o.length===0){r=!0;continue}if(!Array.isArray(a)){r=!0;continue}if(a.length===0){r=!0;continue}let i=a.filter(s=>typeof s=="string");i.length!==a.length&&(r=!0),i.length>0?n[o]=i:r=!0}return{sanitized:n,didSanitize:r}}};var Sk=class{constructor(e){this.storage=null;this.options=e}initialize(e){this.dispose(),this.storage=new Hx({settings:this.options.settings,keys:this.options.keys,notifyChange:this.options.onRecentDataChange,vaultProfileId:e}),this.storage.hydrate(),this.options.onRecentDataChange()}dispose(){this.storage?.flushPendingPersists(),this.storage=null}getRecentNotes(){return this.storage?.getRecentNotes()??[]}setRecentNotes(e){this.storage?.setRecentNotes(e)}applyRecentNotesLimit(){this.storage?.applyRecentNotesLimit()}getRecentIcons(){return this.storage?.getRecentIcons()??{}}setRecentIcons(e){this.storage?.setRecentIcons(e)}flushPendingPersists(){this.storage?.flushPendingPersists()}};Jr();dm();Ue();dn();ot();xn();var Vx=class{constructor(e){this.dualPanePreference=!0;this.dualPaneOrientationPreference="horizontal";this.recentDataManager=null;this.recentDataListeners=new Map;this.uxPreferences=Qh();this.uxPreferenceListeners=new Map;this.options=e}syncMirrorsFromSettings(){let e=this.options.getSettings(),n=this.uxPreferences.includeDescendantNotes;return this.dualPanePreference=e.dualPane,this.dualPaneOrientationPreference=e.dualPaneOrientation,this.uxPreferences={...this.uxPreferences,includeDescendantNotes:e.includeDescendantNotes},n!==this.uxPreferences.includeDescendantNotes}initializeRecentDataManager(){let e=this.options.getSettings();this.recentDataManager||(this.recentDataManager=new Sk({settings:e,keys:this.options.keys,onRecentDataChange:()=>this.notifyRecentDataUpdate()})),this.recentDataManager.initialize(e.vaultProfile)}flushPendingPersists(){this.recentDataManager?.flushPendingPersists()}dispose(){this.recentDataManager?.dispose(),this.recentDataManager=null,this.recentDataListeners.clear(),this.uxPreferenceListeners.clear()}getRecentNotes(){return this.recentDataManager?.getRecentNotes()??[]}setRecentNotes(e){this.recentDataManager?.setRecentNotes(e)}applyRecentNotesLimit(){this.recentDataManager?.applyRecentNotesLimit()}getRecentIcons(){return this.recentDataManager?.getRecentIcons()??{}}setRecentIcons(e){this.recentDataManager?.setRecentIcons(e)}registerRecentDataListener(e,n){this.recentDataListeners.set(e,n)}unregisterRecentDataListener(e){this.recentDataListeners.delete(e)}loadUXPreferences(){let e=Qh(),n=ye.get(this.options.keys.uxPreferencesKey),r=J4(n,e);this.uxPreferences=r.preferences,(r.changed||!Bx(n))&&this.persistUXPreferences(!1)}resetUXPreferencesToDefaults(){this.uxPreferences=Qh(),this.persistUXPreferences(!1)}mirrorUXPreferences(e){this.uxPreferences={...this.uxPreferences,...e},this.persistUXPreferences(!1)}getUXPreferences(){return{...this.uxPreferences}}registerUXPreferencesListener(e,n){this.uxPreferenceListeners.set(e,n)}unregisterUXPreferencesListener(e){this.uxPreferenceListeners.delete(e)}useDualPane(){return this.dualPanePreference}setDualPanePreference(e){let n=!!e;if(this.dualPanePreference===n)return;this.dualPanePreference=n;let r=this.options.getSettings();r.dualPane=n,ye.set(this.options.keys.dualPaneKey,n?"1":"0"),this.options.persistSyncModeSettingUpdate("dualPane")}toggleDualPanePreference(){this.setDualPanePreference(!this.dualPanePreference)}getDualPaneOrientation(){return this.dualPaneOrientationPreference}async setDualPaneOrientation(e){let n=e==="vertical"?"vertical":"horizontal";if(this.dualPaneOrientationPreference===n)return;this.dualPaneOrientationPreference=n;let r=this.options.getSettings();r.dualPaneOrientation=n,ye.set(this.options.keys.dualPaneOrientationKey,n),await this.options.persistSyncModeSettingUpdateAsync("dualPaneOrientation")}setNarrowSidebarLayout(e){let n=e==="vertical"||e==="singlePane"?e:"none",r=this.options.getSettings();r.narrowSidebarLayout!==n&&(r.narrowSidebarLayout=n,ye.set(this.options.keys.narrowSidebarLayoutKey,n),this.options.persistSyncModeSettingUpdate("narrowSidebarLayout"))}setNarrowSidebarTriggerMode(e){let n=e==="customWidth"?"customWidth":"fitPanes",r=this.options.getSettings();r.narrowSidebarTriggerMode!==n&&(r.narrowSidebarTriggerMode=n,ye.set(this.options.keys.narrowSidebarTriggerModeKey,n),this.options.persistSyncModeSettingUpdate("narrowSidebarTriggerMode"))}setNarrowSidebarCustomWidth(e){if(!Number.isFinite(e))return;let n=Math.round(e),r=Math.min(mm,Math.max(pm,n)),o=this.options.getSettings();o.narrowSidebarCustomWidth!==r&&(o.narrowSidebarCustomWidth=r,ye.set(this.options.keys.narrowSidebarCustomWidthKey,r),this.options.persistSyncModeSettingUpdate("narrowSidebarCustomWidth"))}getUIScale(){let e=this.options.getSettings(),n=Uz.Platform.isMobile?e.mobileScale:e.desktopScale;return Za(n)}setUIScale(e){let n=Za(e),r=this.options.getSettings(),o=Uz.Platform.isMobile,a=Za(o?r.mobileScale:r.desktopScale);o?r.mobileScale=n:r.desktopScale=n,ye.set(this.options.keys.uiScaleKey,n),a!==n&&this.options.persistSyncModeSettingUpdate("uiScale")}getTagSortOrder(){return this.options.getSettings().tagSortOrder}getPropertySortOrder(){return this.options.getSettings().propertySortOrder}getFolderSortOrder(){return this.options.getSettings().folderSortOrder}setTagSortOrder(e){let n=this.options.getSettings();!Ta(e)||n.tagSortOrder===e||(n.tagSortOrder=e,ye.set(this.options.keys.tagSortOrderKey,e),this.options.persistSyncModeSettingUpdate("tagSortOrder"))}setPropertySortOrder(e){let n=this.options.getSettings();!Ta(e)||n.propertySortOrder===e||(n.propertySortOrder=e,ye.set(this.options.keys.propertySortOrderKey,e),this.options.persistSyncModeSettingUpdate("propertySortOrder"))}setFolderSortOrder(e){let n=this.options.getSettings();!al(e)||n.folderSortOrder===e||(n.folderSortOrder=e,ye.set(this.options.keys.folderSortOrderKey,e),this.options.persistSyncModeSettingUpdate("folderSortOrder"))}getReleaseCheckTimestamp(){let e=ye.get(this.options.keys.releaseCheckTimestampKey);return typeof e=="number"&&Number.isFinite(e)?e:null}setReleaseCheckTimestamp(e){ye.set(this.options.keys.releaseCheckTimestampKey,e)}getRecentColors(){let e=ye.get(this.options.keys.recentColorsKey);return Array.isArray(e)?e.filter(n=>typeof n=="string"&&n.trim().length>0):[]}setRecentColors(e){let n=Array.isArray(e)?e.filter(r=>typeof r=="string"&&r.trim().length>0):[];ye.set(this.options.keys.recentColorsKey,n.slice(0,lm))}getSearchProvider(){return this.options.getSettings().searchProvider==="omnisearch"?"omnisearch":"internal"}setSearchProvider(e){let n=this.options.getSettings(),r=e==="omnisearch"&&this.options.isOmnisearchAvailable()?"omnisearch":"internal";n.searchProvider!==r&&(n.searchProvider=r,ye.set(this.options.keys.searchProviderKey,r),this.options.notifySettingsUpdate())}setPaneTransitionDuration(e){this.updateBoundedNumberSettingAndMirror({settingId:"paneTransitionDuration",localStorageKey:this.options.keys.paneTransitionDurationKey,rawValue:e,min:Dc,max:Ac,fallback:Le.paneTransitionDuration})}persistToolbarVisibility(){ye.set(this.options.keys.toolbarVisibilityKey,this.options.getSettings().toolbarVisibility),this.options.notifySettingsUpdate(),!this.options.isLocal("toolbarVisibility")&&Q(()=>this.options.saveSettings())}setUseFloatingToolbars(e){this.updateSettingAndMirrorToLocalStorage({settingId:"useFloatingToolbars",localStorageKey:this.options.keys.useFloatingToolbarsKey,nextValue:!!e})}setPinNavigationBanner(e){this.updateSettingAndMirrorToLocalStorage({settingId:"pinNavigationBanner",localStorageKey:this.options.keys.pinNavigationBannerKey,nextValue:!!e})}setNavIndent(e){this.updateBoundedNumberSettingAndMirror({settingId:"navIndent",localStorageKey:this.options.keys.navIndentKey,rawValue:e,min:10,max:24,fallback:Le.navIndent})}setNavItemHeight(e){this.updateBoundedNumberSettingAndMirror({settingId:"navItemHeight",localStorageKey:this.options.keys.navItemHeightKey,rawValue:e,min:20,max:28,fallback:Le.navItemHeight})}setNavItemHeightScaleText(e){this.updateSettingAndMirrorToLocalStorage({settingId:"navItemHeightScaleText",localStorageKey:this.options.keys.navItemHeightScaleTextKey,nextValue:e})}setCalendarWeeksToShow(e){this.updateSettingAndMirrorToLocalStorage({settingId:"calendarWeeksToShow",localStorageKey:this.options.keys.calendarWeeksToShowKey,nextValue:e})}setCalendarPlacement(e){let r=this.options.getSettings().calendarPlacement;r!==e&&(this.updateSettingAndMirrorToLocalStorage({settingId:"calendarPlacement",localStorageKey:this.options.keys.calendarPlacementKey,nextValue:e}),r==="right-sidebar"&&e==="left-sidebar"&&this.setShowCalendar(!0))}setCalendarLeftPlacement(e){this.updateSettingAndMirrorToLocalStorage({settingId:"calendarLeftPlacement",localStorageKey:this.options.keys.calendarLeftPlacementKey,nextValue:e})}setCompactItemHeight(e){this.updateBoundedNumberSettingAndMirror({settingId:"compactItemHeight",localStorageKey:this.options.keys.compactItemHeightKey,rawValue:e,min:20,max:28,fallback:Le.compactItemHeight})}setCompactItemHeightScaleText(e){this.updateSettingAndMirrorToLocalStorage({settingId:"compactItemHeightScaleText",localStorageKey:this.options.keys.compactItemHeightScaleTextKey,nextValue:e})}setFeatureImageSize(e){this.updateSettingAndMirrorToLocalStorage({settingId:"featureImageSize",localStorageKey:this.options.keys.featureImageSizeKey,nextValue:e})}setFeatureImagePixelSize(e){this.updateSettingAndMirrorToLocalStorage({settingId:"featureImagePixelSize",localStorageKey:this.options.keys.featureImagePixelSizeKey,nextValue:e})}setVaultProfile(e){let n=this.options.getSettings();Oo(n);let r=n.vaultProfiles.find(o=>o.id===e)??n.vaultProfiles.find(o=>o.id===eo)??n.vaultProfiles[0];!r||n.vaultProfile===r.id||(n.vaultProfile=r.id,ye.set(this.options.keys.vaultProfileKey,r.id),this.initializeRecentDataManager(),this.options.refreshMatcherCachesIfNeeded(),this.options.persistSyncModeSettingUpdate("vaultProfile"))}setSearchActive(e){this.updateUXPreference("searchActive",e)}setIncludeDescendantNotes(e){let n=!!e;if(this.uxPreferences.includeDescendantNotes===n)return;let r=this.options.getSettings();r.includeDescendantNotes=n,this.updateUXPreference("includeDescendantNotes",n),this.options.persistSyncModeSettingUpdate("includeDescendantNotes")}toggleIncludeDescendantNotes(){this.setIncludeDescendantNotes(!this.uxPreferences.includeDescendantNotes)}setShowHiddenItems(e){this.updateUXPreference("showHiddenItems",e)}toggleShowHiddenItems(){this.setShowHiddenItems(!this.uxPreferences.showHiddenItems)}setPinShortcuts(e){this.updateUXPreference("pinShortcuts",e)}setShowCalendar(e){let n=!!e;this.uxPreferences.showCalendar!==n&&this.updateUXPreference("showCalendar",n)}toggleShowCalendar(){this.setShowCalendar(!this.uxPreferences.showCalendar)}notifyUXPreferencesUpdate(){if(this.uxPreferenceListeners.size!==0)for(let[e,n]of this.uxPreferenceListeners)try{n()}catch(r){console.error(`Failed to notify UX preferences listener "${e}"`,r)}}notifyRecentDataUpdate(){if(this.options.isShuttingDown())return;Array.from(this.recentDataListeners.values()).forEach(n=>{try{n()}catch{}})}updateUXPreference(e,n){this.uxPreferences[e]!==n&&(this.uxPreferences={...this.uxPreferences,[e]:n},this.persistUXPreferences())}persistUXPreferences(e=!0){ye.set(this.options.keys.uxPreferencesKey,this.uxPreferences),e&&this.notifyUXPreferencesUpdate()}updateSettingAndMirrorToLocalStorage(e){let n=this.options.getSettings();n[e.settingId]!==e.nextValue&&(n[e.settingId]=e.nextValue,ye.set(e.localStorageKey,e.nextValue),this.options.persistSyncModeSettingUpdate(e.settingId))}updateBoundedNumberSettingAndMirror(e){let n=this.parseFiniteNumber(e.rawValue),r=n!==null?Math.min(e.max,Math.max(e.min,n)):e.fallback;this.updateSettingAndMirrorToLocalStorage({settingId:e.settingId,localStorageKey:e.localStorageKey,nextValue:r})}parseFiniteNumber(e){if(typeof e=="number"&&Number.isFinite(e))return e;if(typeof e=="string"){let n=Number(e);if(Number.isFinite(n))return n}return null}};jz();Wu();LO();ko();function fNe(t){let e=t.setting;return!e||typeof e.open!="function"||typeof e.openTabById!="function"?null:e}var nA=class extends Pc.Plugin{constructor(){super(...arguments);this.ribbonIconEl=void 0;this.metadataService=null;this.tagOperations=null;this.propertyOperations=null;this.tagTreeService=null;this.propertyTreeService=null;this.commandQueue=null;this.settings={...Le};this.fileSystemOps=null;this.omnisearchService=null;this.externalIconController=null;this.api=null;this.recentNotesService=null;this.releaseCheckService=null;this.debugLoggingService=null;this.keys=ut;this.settingsUpdateListeners=new Map;this.fileRenameListeners=new Map;this.updateNoticeListeners=new Map;this.isUnloading=!1;this.isHandlingExternalSettingsUpdate=!1;this.workspaceCoordinator=null;this.homepageController=null;this.folderNoteSidebarService=null;this.settingTab=null;this.pendingUpdateNotice=null;this.hasWorkspaceLayoutReady=!1;this.lastCalendarPlacement=null;this.calendarPlacementRequestId=0;this.calendarCursorDateIso=null;this.settingsController=new _x({keys:this.keys,loadData:()=>this.loadData(),saveData:n=>this.saveData(n),mirrorUXPreferences:n=>this.preferencesController.mirrorUXPreferences(n)});this.preferencesController=new Vx({keys:this.keys,getSettings:()=>this.settings,notifySettingsUpdate:()=>this.notifySettingsUpdate(),saveSettings:()=>this.settingsController.saveSettings(),isShuttingDown:()=>this.isUnloading,isLocal:n=>this.isLocal(n),persistSyncModeSettingUpdate:n=>this.persistSyncModeSettingUpdate(n),persistSyncModeSettingUpdateAsync:n=>this.persistSyncModeSettingUpdateAsync(n),isOmnisearchAvailable:()=>this.omnisearchService?.isAvailable()??!1,refreshMatcherCachesIfNeeded:()=>this.settingsController.refreshMatcherCachesIfNeeded()})}getSyncMode(n){return this.settingsController.getSyncMode(n)}isLocal(n){return this.settingsController.isLocal(n)}isSynced(n){return this.settingsController.isSynced(n)}openSettings(){let n=fNe(this.app);if(!n)return!1;try{return n.open(),n.openTabById(this.manifest.id),!0}catch{return!1}}isDebugLoggingEnabled(){return this.debugLoggingService?.isEnabled()??!1}setDebugLoggingEnabled(n){this.debugLoggingService?.setEnabled(n),n||Wz()}async setSyncMode(n,r){await this.settingsController.setSyncMode(n,r)&&await this.saveSettingsAndUpdate()}persistSyncModeSettingUpdate(n){if(this.isLocal(n)){this.notifySettingsUpdate();return}Q(()=>this.saveSettingsAndUpdate())}async persistSyncModeSettingUpdateAsync(n){if(this.isLocal(n)){this.notifySettingsUpdate();return}await this.saveSettingsAndUpdate()}async onExternalSettingsChange(){if(this.isUnloading)return;await this.loadSettings();let n=this.preferencesController.syncMirrorsFromSettings();this.preferencesController.initializeRecentDataManager(),this.notifySettingsUpdateWithFullRefresh(),n&&this.preferencesController.notifyUXPreferencesUpdate()}async loadSettings(){let n=await this.settingsController.loadSettings();return this.settings=this.settingsController.settings,n}replaceSettings(n){this.settings=n,this.settingsController.settings=n}getRecentNotes(){return this.preferencesController.getRecentNotes()}setRecentNotes(n){this.preferencesController.setRecentNotes(n)}applyRecentNotesLimit(){this.preferencesController.applyRecentNotesLimit()}registerRecentDataListener(n,r){this.preferencesController.registerRecentDataListener(n,r)}unregisterRecentDataListener(n){this.preferencesController.unregisterRecentDataListener(n)}registerUpdateNoticeListener(n,r){this.updateNoticeListeners.set(n,r)}unregisterUpdateNoticeListener(n){this.updateNoticeListeners.delete(n)}getPendingUpdateNotice(){return this.pendingUpdateNotice}markUpdateNoticeAsDisplayed(n){this.pendingUpdateNotice&&this.pendingUpdateNotice.version===n&&this.setPendingUpdateNotice(null)}getRecentIcons(){return this.preferencesController.getRecentIcons()}setRecentIcons(n){this.preferencesController.setRecentIcons(n)}isFileInRightSidebar(n){if(this.folderNoteSidebarService?.isSuppressingSidebarOpen(n.path))return!0;if(!this.settings.autoRevealIgnoreRightSidebar)return!1;let r=this.app.workspace.getActiveViewOfType(Pc.FileView);return!r?.file||r.file.path!==n.path?!1:md(this.app,r.leaf??null)==="right-sidebar"}async onload(){ye.init(this.app),this.debugLoggingService=new _C(this.app,{pluginVersion:this.manifest.version}),HA(this.debugLoggingService),this.debugLoggingService.initialize(),this.debugLoggingService.isEnabled()||Wz(),Rr("onload.start",{pluginVersion:this.manifest.version,minAppVersion:this.manifest.minAppVersion}),typeof Pc.addIcon=="function"&&(0,Pc.addIcon)(vi,S1);let n=this.app.appId||"",r=Pc.Platform.isMobile?200:1e3,o=Pc.Platform.isMobile?1e4:5e4,a=Pc.Platform.isMobile?20:50;Rr("database.init.scheduled",{featureImageCacheMaxEntries:r,previewTextCacheMaxEntries:o,previewLoadMaxBatch:a}),Q(async()=>{try{Rr("database.init.start"),await DW(n,{featureImageCacheMaxEntries:r,previewTextCacheMaxEntries:o,previewLoadMaxBatch:a}),Rr("database.init.complete")}catch(u){Rr("database.init.failed",{error:u}),console.error("Failed to initialize database:",u)}},{onError:u=>{Rr("database.init.failed",{error:u}),console.error("Failed to initialize database:",u)}});let i=await this.loadSettings();Rr("settings.loaded",{isFirstLaunch:i}),this.preferencesController.syncMirrorsFromSettings();let s=this.settingsController.getStoredLocalStorageVersion();if(this.preferencesController.loadUXPreferences(),this.settingsController.normalizeTagSettings(),this.settingsController.normalizePropertySettings(),this.settingsController.normalizeNavigationSeparatorSettings(),i){if(this.settingsController.clearAllLocalStorage(),this.preferencesController.resetUXPreferencesToDefaults(),this.settingsController.mirrorAllSyncModeSettingsToLocalStorage(),this.preferencesController.syncMirrorsFromSettings(),this.settings.showRootFolder){let u=["/"];ye.set(ut.expandedFoldersKey,u)}this.settingsController.setLocalStorageVersion(),await this.saveData(this.settingsController.getPersistableSettings())}else{let u=typeof s=="number"?s:Number(s??Number.NaN);(!u||u!==this.settingsController.getCurrentLocalStorageVersion())&&this.settingsController.setLocalStorageVersion()}this.preferencesController.initializeRecentDataManager(),this.recentNotesService=new Cx(this),this.workspaceCoordinator=new ck(this),this.homepageController=new gk(this,this.workspaceCoordinator),this.tagTreeService=new cx,this.propertyTreeService=new ux,this.metadataService=new YI(this.app,this,()=>this.tagTreeService,()=>this.propertyTreeService),this.tagOperations=new dx(this.app,()=>this.settings,()=>this.tagTreeService,()=>this.metadataService),this.propertyOperations=new ZI(this.app,()=>this.settings,()=>this.saveSettingsAndUpdate(),()=>this.propertyTreeService),this.commandQueue=new px,this.folderNoteSidebarService=new Lx(this),this.folderNoteSidebarService.start(),this.fileSystemOps=new Px(this.app,()=>this.tagTreeService,()=>this.propertyTreeService,()=>this.commandQueue,()=>this.metadataService,()=>({includeDescendantNotes:this.preferencesController.getUXPreferences().includeDescendantNotes,showHiddenItems:this.preferencesController.getUXPreferences().showHiddenItems}),this),this.omnisearchService=new mx(this.app),this.api=new Ax(this,this.app),this.metadataService.setFolderStyleChangeListener(u=>{this.isUnloading||!this.api||this.api[Ea].metadata.emitFolderChangedForPath(u)}),this.releaseCheckService=new sk(this),Rr("services.initialized"),yn().registerProvider(new II(this.app)),this.hasEnabledExternalIconProviders()&&this.syncExternalIconController(),this.registerSettingsUpdateListener("external-icon-controller",()=>{(this.externalIconController||this.hasEnabledExternalIconProviders())&&this.syncExternalIconController()}),this.registerView(wa,u=>{let{NotebookNavigatorView:p}=(jD(),Lr(aie));return new p(u,this)}),this.registerView(Au,u=>{let{NotebookNavigatorCalendarView:p}=(mie(),Lr(pie));return new p(u,this)}),this.registerView(ih,u=>{let{FolderNoteSidebarPlaceholderView:p}=(fie(),Lr(hie));return new p(u)}),zz(this),this.settingTab=new KI(this.app,this),this.addSettingTab(this.settingTab),Az(this);let c=i;this.app.workspace.onLayoutReady(()=>{this.hasWorkspaceLayoutReady=!0,Rr("layout.ready"),Q(async()=>{if(Rr("layout.readyTasks.start"),this.isUnloading)return;if(await this.homepageController?.handleWorkspaceReady({shouldActivateOnStartup:c}),await this.folderNoteSidebarService?.handleWorkspaceReady(),i){let{WelcomeModal:m}=await Promise.resolve().then(()=>(bie(),yie));new m(this.app).open()}let u=s5();if(u){this.debugLoggingService?.logReport("PDF processing from previous run",{path:u});let{InfoModal:m}=await Promise.resolve().then(()=>(qR(),Wee));new m(this.app,{title:"PDF processing from previous run",intro:"The previous app session ended while this PDF thumbnail was being processed.",items:[`\`${u}\``,"This can also happen if Obsidian or Android closed the app before cleanup finished."]}).open()}typeof window>"u"?await this.checkForVersionUpdate({isFirstLaunch:i}):window.setTimeout(()=>{Q(async()=>{this.isUnloading||await this.checkForVersionUpdate({isFirstLaunch:i})})},1e3),this.app.workspace.trigger("parse-style-settings"),this.applyCalendarPlacementView({force:!0,reveal:!1}),this.settings.checkForUpdatesOnStart&&Q(()=>this.runReleaseUpdateCheck()),Rr("layout.readyTasks.complete"),DK({shouldActivateOnStartup:c})})}),Rr("onload.complete")}registerSettingsUpdateListener(n,r){this.settingsUpdateListeners.set(n,r)}isExternalSettingsUpdate(){return this.isHandlingExternalSettingsUpdate}useDualPane(){return this.preferencesController.useDualPane()}isShuttingDown(){return this.isUnloading}async openFolderNoteInRightSidebar(n){await this.folderNoteSidebarService?.openFolderNote(n)}async syncFolderNoteSidebarToFolder(n){await this.folderNoteSidebarService?.syncToSelectedFolder(n)}setDualPanePreference(n){this.preferencesController.setDualPanePreference(n)}toggleDualPanePreference(){this.preferencesController.toggleDualPanePreference()}getDualPaneOrientation(){return this.preferencesController.getDualPaneOrientation()}async setDualPaneOrientation(n){await this.preferencesController.setDualPaneOrientation(n)}setNarrowSidebarLayout(n){this.preferencesController.setNarrowSidebarLayout(n)}setNarrowSidebarTriggerMode(n){this.preferencesController.setNarrowSidebarTriggerMode(n)}setNarrowSidebarCustomWidth(n){this.preferencesController.setNarrowSidebarCustomWidth(n)}getUIScale(){return this.preferencesController.getUIScale()}setUIScale(n){this.preferencesController.setUIScale(n)}getTagSortOrder(){return this.preferencesController.getTagSortOrder()}getPropertySortOrder(){return this.preferencesController.getPropertySortOrder()}getFolderSortOrder(){return this.preferencesController.getFolderSortOrder()}setTagSortOrder(n){this.preferencesController.setTagSortOrder(n)}setPropertySortOrder(n){this.preferencesController.setPropertySortOrder(n)}setFolderSortOrder(n){this.preferencesController.setFolderSortOrder(n)}getReleaseCheckTimestamp(){return this.preferencesController.getReleaseCheckTimestamp()}setReleaseCheckTimestamp(n){this.preferencesController.setReleaseCheckTimestamp(n)}getRecentColors(){return this.preferencesController.getRecentColors()}setRecentColors(n){this.preferencesController.setRecentColors(n)}getSearchProvider(){return this.preferencesController.getSearchProvider()}setSearchProvider(n){this.preferencesController.setSearchProvider(n)}setPaneTransitionDuration(n){this.preferencesController.setPaneTransitionDuration(n)}persistToolbarVisibility(){this.preferencesController.persistToolbarVisibility()}setUseFloatingToolbars(n){this.preferencesController.setUseFloatingToolbars(n)}setPinNavigationBanner(n){this.preferencesController.setPinNavigationBanner(n)}setNavIndent(n){this.preferencesController.setNavIndent(n)}setNavItemHeight(n){this.preferencesController.setNavItemHeight(n)}setNavItemHeightScaleText(n){this.preferencesController.setNavItemHeightScaleText(n)}setCalendarWeeksToShow(n){this.preferencesController.setCalendarWeeksToShow(n)}setCalendarPlacement(n){this.preferencesController.setCalendarPlacement(n)}setCalendarLeftPlacement(n){this.preferencesController.setCalendarLeftPlacement(n)}getCalendarCursorDateIso(){return this.calendarCursorDateIso}setCalendarCursorDateIso(n){this.calendarCursorDateIso=n}setCompactItemHeight(n){this.preferencesController.setCompactItemHeight(n)}setCompactItemHeightScaleText(n){this.preferencesController.setCompactItemHeightScaleText(n)}setFeatureImageSize(n){this.preferencesController.setFeatureImageSize(n)}setFeatureImagePixelSize(n){this.preferencesController.setFeatureImagePixelSize(n)}setVaultProfile(n){this.preferencesController.setVaultProfile(n)}getUXPreferences(){return this.preferencesController.getUXPreferences()}registerUXPreferencesListener(n,r){this.preferencesController.registerUXPreferencesListener(n,r)}unregisterUXPreferencesListener(n){this.preferencesController.unregisterUXPreferencesListener(n)}setSearchActive(n){this.preferencesController.setSearchActive(n)}setIncludeDescendantNotes(n){this.preferencesController.setIncludeDescendantNotes(n)}toggleIncludeDescendantNotes(){this.preferencesController.toggleIncludeDescendantNotes()}setShowHiddenItems(n){this.preferencesController.setShowHiddenItems(n)}toggleShowHiddenItems(){this.preferencesController.toggleShowHiddenItems()}setPinShortcuts(n){this.preferencesController.setPinShortcuts(n)}setShowCalendar(n){this.preferencesController.setShowCalendar(n)}toggleShowCalendar(){this.preferencesController.toggleShowCalendar()}async togglePinnedGroupCollapsed(n){let r=uv(this.settings.collapsedPinnedContexts);r[n]?delete r[n]:r[n]=!0,this.settings.collapsedPinnedContexts=r,await this.saveSettingsAndUpdate()}unregisterSettingsUpdateListener(n){this.settingsUpdateListeners.delete(n)}async rebuildCache(){if(this.isUnloading)throw new Error("Plugin is unloading");await this.activateView();let n=this.app.workspace.getLeavesOfType(wa)[0];if(!n)throw new Error("Notebook Navigator view not available");let{view:r}=n;if(!Hs(r))throw new Error("Notebook Navigator view not found");if(!await r.whenReady())throw new Error("Notebook Navigator view not ready");await r.rebuildCache()}isExternalIconProviderInstalled(n){return this.externalIconController?.isProviderInstalled(n)??!1}isExternalIconProviderDownloading(n){return this.externalIconController?.isProviderDownloading(n)??!1}getExternalIconProviderVersion(n){return this.externalIconController?.getProviderVersion(n)??null}async downloadExternalIconProvider(n){await this.getExternalIconController().installProvider(n)}async removeExternalIconProvider(n){await this.getExternalIconController().removeProvider(n)}hasEnabledExternalIconProviders(){let n=De(this.settings.externalIconProviders);return Object.values(n).some(Boolean)}getExternalIconController(){if(!this.externalIconController){let{ExternalIconProviderController:n}=(Mie(),Lr(Eie));this.externalIconController=new n(this.app,yn(),this)}return this.externalIconController}syncExternalIconController(){Q(async()=>{let n=this.getExternalIconController();await n.initialize(),await n.syncWithSettings()},{onError:n=>{console.error("External icon controller init failed:",n)}})}registerFileRenameListener(n,r){this.fileRenameListeners.set(n,r)}unregisterFileRenameListener(n){this.fileRenameListeners.delete(n)}notifyFileRenameListeners(n,r){this.fileRenameListeners.forEach(o=>{try{o(n,r)}catch(a){console.error("Error in file rename listener:",a)}})}initiateShutdown(){if(!this.isUnloading){this.isUnloading=!0;try{this.preferencesController.flushPendingPersists()}catch(n){console.error("Failed to flush recent data during shutdown:",n)}this.commandQueue&&this.commandQueue.clearAllOperations(),this.stopNavigatorContentProcessing(),OW()}}stopNavigatorContentProcessing(){try{let n=this.app.workspace.getLeavesOfType(wa);for(let o of n){let a=o.view;Hs(a)&&a.stopContentProcessing()}let r=this.app.workspace.getLeavesOfType(Au);for(let o of r){let a=o.view;A3(a)&&a.stopContentProcessing()}}catch(n){console.error("Failed stopping content processing during shutdown:",n)}}onunload(){this.initiateShutdown(),this.debugLoggingService?.dispose(),HA(null),this.debugLoggingService=null,this.preferencesController.dispose(),this.folderNoteSidebarService?.dispose(),this.folderNoteSidebarService=null,this.settingsUpdateListeners.clear(),this.fileRenameListeners.clear(),this.externalIconController&&(this.externalIconController.dispose(),this.externalIconController=null),this.metadataService&&(this.metadataService.dispose(),this.metadataService=null),this.tagOperations&&(this.tagOperations=null),this.propertyOperations&&(this.propertyOperations=null),this.propertyTreeService&&(this.propertyTreeService=null),this.commandQueue&&(this.commandQueue=null),this.ribbonIconEl?.remove(),this.ribbonIconEl=void 0,this.settingTab=null,this.omnisearchService=null}async saveSettingsAndUpdate(){await this.settingsController.saveSettings(),this.onSettingsUpdate()}createSettingsTransferJson(){return JSON.stringify(d2(this.settings),null,2)}async importSettingsTransfer(n){if(this.isUnloading)throw new Error("Plugin is unloading");this.replaceSettings(c2(this.settings,n)),this.settingsController.normalizeTagSettings(),this.settingsController.normalizePropertySettings(),this.settingsController.normalizeNavigationSeparatorSettings(),this.settingsController.prepareImportedUiScalePersistence(),this.settingsController.mirrorAllSyncModeSettingsToLocalStorage(),await this.settingsController.saveSettings(),await this.loadSettings(),this.settingsController.normalizeTagSettings(),this.settingsController.normalizePropertySettings(),this.settingsController.normalizeNavigationSeparatorSettings();let r=this.preferencesController.syncMirrorsFromSettings();this.preferencesController.initializeRecentDataManager(),await this.settingsController.saveSettings(),this.notifySettingsUpdateWithFullRefresh(),r&&this.preferencesController.notifyUXPreferencesUpdate()}notifySettingsUpdateWithFullRefresh(){try{this.isHandlingExternalSettingsUpdate=!0,this.onSettingsUpdate()}finally{this.isHandlingExternalSettingsUpdate=!1}}async resetAllSettings(){if(this.isUnloading)throw new Error("Plugin is unloading");let n=De(this.settings.syncModes,ov);this.settingsController.clearAllLocalStorage(),await this.saveData({}),await this.loadSettings(),this.settingsController.normalizeTagSettings(),this.settingsController.normalizePropertySettings(),this.settingsController.normalizeNavigationSeparatorSettings(),this.settings.syncModes=n,await this.saveSettingsAndUpdate(),this.preferencesController.resetUXPreferencesToDefaults(),this.settingsController.mirrorAllSyncModeSettingsToLocalStorage(),this.preferencesController.syncMirrorsFromSettings(),this.settingsController.setLocalStorageVersion(),this.settings.showRootFolder&&ye.set(ut.expandedFoldersKey,["/"]),this.preferencesController.initializeRecentDataManager(),this.onSettingsUpdate(),this.preferencesController.notifyUXPreferencesUpdate()}notifySettingsUpdate(){this.onSettingsUpdate()}isObsidianSettingsModalOpen(){return typeof document>"u"?!1:activeDocument.querySelector(".modal.mod-settings, .modal-container.mod-settings")!==null}applyCalendarPlacementView(n={}){if(this.isUnloading||!this.hasWorkspaceLayoutReady)return;let r=this.workspaceCoordinator;if(!r)return;let o=this.settings.calendarEnabled?this.settings.calendarPlacement:null,a=this.lastCalendarPlacement;if(!(n.force??!1)&&a===o)return;this.lastCalendarPlacement=o;let s=++this.calendarPlacementRequestId;if(o==="right-sidebar"){let l=n.reveal??!1,c=n.activate??l;Q(()=>r.ensureCalendarViewInRightSidebar({reveal:l,activate:c,shouldContinue:()=>!this.isUnloading&&this.hasWorkspaceLayoutReady&&this.calendarPlacementRequestId===s&&this.settings.calendarEnabled&&this.settings.calendarPlacement==="right-sidebar"}));return}r.detachCalendarViewLeaves()}async runMetadataCleanup(){if(!this.metadataService||this.isUnloading)return!1;let n=await this.metadataService.cleanupAllMetadata();return n&&await this.saveSettingsAndUpdate(),n}async getMetadataCleanupSummary(){return!this.metadataService||this.isUnloading?{folders:0,tags:0,properties:0,files:0,pinnedNotes:0,separators:0,total:0}:this.metadataService.getCleanupSummary()}onSettingsUpdate(){if(this.isUnloading)return;this.api&&this.api[Ea].metadata.updateFromSettings(this.settings),Array.from(this.settingsUpdateListeners.values()).forEach(a=>{try{a()}catch{}});let r=this.lastCalendarPlacement!=="right-sidebar"&&this.settings.calendarEnabled&&this.settings.calendarPlacement==="right-sidebar",o=r&&!this.isObsidianSettingsModalOpen();this.applyCalendarPlacementView({reveal:r,activate:o})}async activateView(){return this.workspaceCoordinator?.activateNavigatorView()??null}getNavigatorLeaves(){return this.workspaceCoordinator?.getNavigatorLeaves()??this.app.workspace.getLeavesOfType(wa)}async navigateToFolder(n,r){await this.activateView();let o=this.app.workspace.getLeavesOfType(wa);if(o.length===0)return;let i=o[0].view;Hs(i)&&i.navigateToFolder(n,r)}async revealFileInActualFolder(n,r){this.workspaceCoordinator?.revealFileInActualFolder(n,r)}async revealFileInNearestFolder(n,r){this.workspaceCoordinator?.revealFileInNearestFolder(n,r)}resolveHomepageFile(){return this.homepageController?.resolveHomepageFile()??null}canOpenHomepage(){return this.homepageController?.canOpenHomepage()??!1}async openHomepage(n){return this.homepageController?.open(n)??!1}async runReleaseUpdateCheck(n=!1){await this.evaluateReleaseUpdates(n)}dismissPendingUpdateNotice(){this.setPendingUpdateNotice(null)}async evaluateReleaseUpdates(n=!1){if(!(!this.releaseCheckService||this.isUnloading)&&!(!this.settings.checkForUpdatesOnStart&&!n))try{let r=await this.releaseCheckService.checkForUpdates(n);this.setPendingUpdateNotice(r??null)}catch{}}setPendingUpdateNotice(n){let r=this.pendingUpdateNotice?.version??null,o=n?.version??null,a=!!n,i=!!this.pendingUpdateNotice;r===o&&a===i||(this.pendingUpdateNotice=n,n||this.releaseCheckService?.clearPendingNotice(),this.notifyUpdateNoticeListeners())}notifyUpdateNoticeListeners(){if(this.isUnloading)return;Array.from(this.updateNoticeListeners.values()).forEach(r=>{try{r(this.pendingUpdateNotice)}catch{}})}async checkForVersionUpdate(n){let{isFirstLaunch:r}=n,o=this.manifest.version,a=this.settings.lastShownVersion;if(!a){if(r){this.settings.lastShownVersion=o,await this.saveSettingsAndUpdate();return}let{getLatestReleaseNotes:i,isReleaseAutoDisplayEnabled:s}=await Promise.resolve().then(()=>(jw(),Ww));if(!s(o)){this.settings.lastShownVersion=o,await this.saveSettingsAndUpdate();return}let{WhatsNewModal:l}=await Promise.resolve().then(()=>(Uw(),Vw)),c=i();new l(this.app,c,()=>{window.setTimeout(()=>{Q(async()=>{this.settings.lastShownVersion=o,await this.saveSettingsAndUpdate()})},1e3)}).open();return}if(a!==o){let{getReleaseNotesBetweenVersions:i,getLatestReleaseNotes:s,compareVersions:l,isReleaseAutoDisplayEnabled:c,shouldAutoDisplayReleaseNotesForUpdate:u}=await Promise.resolve().then(()=>(jw(),Ww)),p=l(o,a)>0;if(p){if(!u(a,o))return}else if(!c(o))return;let{WhatsNewModal:m}=await Promise.resolve().then(()=>(Uw(),Vw)),g;p?g=i(a,o):g=s(),new m(this.app,g,()=>{window.setTimeout(()=>{Q(async()=>{this.settings.lastShownVersion=o,await this.saveSettingsAndUpdate()})},1e3)}).open()}}};
/*! Bundled license information:
react/cjs/react.production.min.js:
(**
* @license React
* react.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
scheduler/cjs/scheduler.production.min.js:
(**
* @license React
* scheduler.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react-dom/cjs/react-dom.production.min.js:
(**
* @license React
* react-dom.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
react/cjs/react-jsx-runtime.production.min.js:
(**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
*/
/* nosourcemap */