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 cZ(t){let{text:e,context:n}=t;if(!e.includes("![")&&!e.includes("[[")&&!e.includes("^[")&&!e.includes("[^"))return t;let r=p=>Mg(p,n.inlineCodeRanges)!==null||Mg(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:dZ(e,n,o)}function JM(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=Mg(i,e.inlineCodeRanges);s&&s.end>i&&(i=Math.min(a,s.end));let l=Mg(i,e.fencedCodeRanges);return l&&l.end>i&&(i=Math.min(a,l.end)),dZ(t,e,i)}function RF(t,e){return t.includes("&")?vV(t,e,{includeInline:!0,includeFenced:!0,transform:iZ,contextWhenNoRanges:e}):{text:t,context:e}}function uZ(t,e){if(!t.includes("<"))return t;let n=Ec(t),o={inlineCodeRanges:jl(t,n),fencedCodeRanges:n};return ZM(t,o,{...e,enabled:!0}).text}function pZ(t,e){if(!t.includes("&"))return t;let n=e?.preserveInlineCode??!0,r=e?.preserveFencedCode??!0;if(!n&&!r)return iZ(t);let o=r?Ec(t):[],i={inlineCodeRanges:n?jl(t,o):[],fencedCodeRanges:o};return RF(t,i).text}var kke,oZ,eA=U(()=>{Vb();Q0();rZ();kke=Object.freeze({amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",ndash:"–",mdash:"—",hellip:"…",copy:"©",reg:"®",trade:"™"}),oZ=0});function Rke(t){if(!t.includes("\\"))return{protectedText:t,escapeSegments:[],escapeBase:""};let e=YM("ESC"),n=[];return{protectedText:t.replace(xke,(o,a)=>{let i=$M(e,n.length);return n.push(a),i}),escapeSegments:n,escapeBase:e}}function Mke(t,e,n){if(e.length===0)return t;let r=new RegExp(`${XM(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 Ake(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 Dke(t){return t.includes("[[")?t.replace(/!\[\[[^\]\n\r]*?\]\]/g," ").replace(/\[\[[^\]\n\r]*?\]\]/g,n=>{let r=Ake(n.slice(2,-2));return r.length>0?r:" "}):t}function Oke(t){return t.replace(/^\s*(?:[-*+]\s+|\d+\.\s+)?\[(?: |x|X|\/|-)?\]\]?\s*/gm,"").replace(/^\s*([*_-])(?:\s*\1){2,}\s*$/gm,"")}function Lke(t){return t.includes("^")?t.replace(/(^|[ \t])\^[0-9A-Za-z-]+(?=\s|$)/gm,"$1"):t}function zke(t,e,n){let r=YM("INLINE"),o=YM("CODE"),a=[],i=[],s=yV(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=hV(t.slice(u.start,u.end)),m=$M(r,a.length);a.push(p),c+=m}else{if(n){let h=c.length>0&&!/\s$/.test(c),b=t[u.end]??"",y=b!==""&&!/\s/.test(b);h&&y&&(c+=" "),l=u.end;continue}let p=tA(t.slice(u.start,u.end)),m=$M(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(`${XM(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(`${XM(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 _ke(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 tA(t){let e=sZ(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 nA(t,e=!1,n=!0,r){let o=r&&r.fencedCodeRanges.length>0?r.fencedCodeRanges:Ec(t),i={inlineCodeRanges:r&&r.inlineCodeRanges.length>0?r.inlineCodeRanges:jl(t,o),fencedCodeRanges:o},{protectedText:s,inlineSegments:l,fencedSegments:c,inlineBase:u,fencedBase:p}=zke(t,i,n),m=Rke(s),g=m.protectedText.includes("\\")&&m.protectedText.includes(`
`)?m.protectedText.replace(Eke,`
`):m.protectedText,f=g.includes(">")?g.replace(Ike,""):g,h=(T,...F)=>{let k=F,P=_ke(k),E=T.match(/^([`~]{3,})/u);if(E&&T.endsWith(E[1]))return n?"":tA(T);if(T.startsWith("%%")&&T.endsWith("%%")||T.match(/\[![\w-]+\]/))return"";if(T.startsWith("`")&&T.endsWith("`"))return T.slice(1,-1);if(T.startsWith("!"))return" ";if(T.match(/#[\w\-/]+(?=\s|$)/))return"";let C=T.trimStart();if(C.startsWith("^[")||C.startsWith("[^"))return"";let L=T.match(/(^|[^*\d])\*([^*\n]+)\*(?![*\d])/);if(L&&L[0]===T){let G=L[2];return typeof G!="string"||!G.trim()?T:`${L[1]??""}${G}`}let z=T.match(/(^|[^_a-zA-Z0-9])_([^_\n]+)_(?![_a-zA-Z0-9])/);if(z&&z[0]===T){let G=z[2];return typeof G!="string"||!G.trim()?T:`${z[1]??""}${G}`}if(T.match(/^#+\s+/))return e?"":T.replace(/^#+\s+/,"").trim();if(T.match(/^[-+\d]/)||T.match(/^\*\s+/)||T.match(/^\s*\|.*\|/))return"";for(let G=0;G{Vb();eA();mZ=/^(?:[-*+]\s+|\d+\.\s+)/.source,gZ=/^(#+)\s+(.*)$/m.source,hZ=/^\s*\|.*\|.*$/m.source,fZ=/^\s*\[\^[^\]]+]:.*$/m.source,yZ=[/([`~]{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-]+\][+-]?/.source,mZ,gZ,hZ,/\^\[[^\]]*?]/.source,/\[\^[^\]]+]/.source,fZ],Fke=new Set([mZ,gZ,hZ,fZ]),Cke=new RegExp(yZ.join("|"),"gm"),Nke=new RegExp(yZ.filter(t=>!Fke.has(t)).join("|"),"gm"),Ike=/^\s{0,3}(?:>\s*)+/gm,xke=/\\([\u0021-\u002F\u003A-\u0040\u005B-\u0060\u007B-\u007E])/g,Eke=/\\\r?\n/g});function Hke(t){return t.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"")}function Vke(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 vZ(t,e){if(!t.text.trim())return"";let n=e.stripHtmlInPreview?ZM(t.text,t.context,{enabled:!0,preserveFencedCode:!0}):t;if(!n.text.trim())return"";let r=e.stripLatexInPreview?lZ(n.text,n.context,{enabled:!0}):n;if(!r.text.trim())return"";let o=RF(r.text,r.context);if(!o.text.trim())return"";let a=cZ(o);if(!a.text.trim())return"";let i=nA(a.text,e.skipHeadingsInPreview,e.skipCodeBlocksInPreview,a.context),s=QM(i);return s?s.length>rA?`${s.substring(0,rA-1)}…`:s:""}function wZ(t,e){return!!(qO(t)||LN(e))}function TZ(t,e){let n=e?.stripHtml!==!1;if(!(n&&t.includes("<"))){let u=jl(t),p=RF(t,{inlineCodeRanges:u,fencedCodeRanges:[]}),m=fV(p.text,p.context.inlineCodeRanges),g=QM(m);return g.length>0?g:void 0}let o=Ec(t),a={inlineCodeRanges:jl(t,o),fencedCodeRanges:o},i=n?ZM(t,a,{enabled:!0}):{text:t,context:a},s=RF(i.text,i.context),l=fV(s.text,s.context.inlineCodeRanges),c=QM(l);return c.length>0?c:void 0}function kZ(t,e,n){let r=rA+bZ,o=SZ,a=e.previewProperties.length>0,i=e.previewPropertiesFallback;if(n&&a)for(let u of e.previewProperties){let p=Xs(n,u),m=Vke(p);if(!m)continue;let g=m.length>MF?m.slice(0,MF):m,f=e.skipCalloutsInPreview?$0(g):g,h=f.length>o?f.slice(0,o):f,b=Ec(h),y=jl(h,b),v=JM(h,{inlineCodeRanges:y,fencedCodeRanges:b},r,o),S=vZ(v,e);if(S)return S}if(a&&!i||!t)return"";let s=Hke(t);if(!s.trim())return"";let l=e.skipCalloutsInPreview?$0(s.length>MF?s.slice(0,MF):s):s,c=e.skipCodeBlocksInPreview?(()=>{let u=h5(l,o,MF);if(!u)return{text:"",context:{inlineCodeRanges:[],fencedCodeRanges:[]}};let p=jl(u);return JM(u,{inlineCodeRanges:p,fencedCodeRanges:[]},r,o)})():(()=>{let u=l.length>o?l.slice(0,o):l,p=Ec(u),m=jl(u,p);return JM(u,{inlineCodeRanges:m,fencedCodeRanges:p},r,o)})();return vZ(c,e)}var rA,bZ,SZ,MF,PZ=U(()=>{Vb();ws();Et();eA();bV();rA=500,bZ=400,SZ=rA+bZ*2,MF=SZ*50});var ly,SV=U(()=>{eA();bV();PZ();ly=class{static isExcalidrawFile(e,n){return wZ(e,n)}static stripMarkdownSyntax(e,n=!1,r=!0,o){return nA(e,n,r,o)}static stripHtmlTagsPreservingCode(e,n){return uZ(e,n)}static decodeHtmlEntitiesPreservingCode(e,n){return pZ(e,n)}static normalizeExcerpt(e,n){return TZ(e,n)}static extractCodeBlockContent(e){return tA(e)}static extractPreviewText(e,n,r){return kZ(e,n,r)}}});function oA(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.skipCalloutsInPreview!==n.skipCalloutsInPreview||e.stripHtmlInPreview!==n.stripHtmlInPreview||e.stripLatexInPreview!==n.stripLatexInPreview||!ao(e.previewProperties,n.previewProperties)||e.previewPropertiesFallback!==n.previewPropertiesFallback||e.showFilePreview!==n.showFilePreview,a=!ao(e.featureImageProperties,n.featureImageProperties),s=!ao(e.featureImageExcludeProperties,n.featureImageExcludeProperties)||e.featureImagePixelSize!==n.featureImagePixelSize||e.showFeatureImage&&!n.showFeatureImage||n.showFeatureImage&&(a||e.downloadExternalFeatureImages!==n.downloadExternalFeatureImages);return{shouldClearPreview:o,shouldClearProperties:!1,shouldClearFeatureImage:s,shouldClearWordCounts:!Uc(e)&&Uc(n),shouldClearCharacterCounts:!Wc(e)&&Wc(n)}}function Kke(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||!j0(t.charCodeAt(n))||(n=Rg(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 jke(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(...FZ(n));return e}return[]}function wV(t){if(!t)return[];let e=[];return Object.keys(t).forEach(n=>{let r=FZ(t[n]);r.length!==0&&r.forEach(o=>{e.push({fieldKey:n,value:o.value,valueKind:o.valueKind})})}),e}var aA,zS,TV=U(()=>{aA=require("obsidian");Ol();Vn();ll();_l();Vb();SV();Et();sg();Vl();AS();pV();Lr();YH();KM();zS=class extends MS{constructor(){super(...arguments);this.PARALLEL_LIMIT=Ut.contentProvider.parallelLimit;this.readFailureAttemptsByPath=new Map;this.emptyFrontmatterRetryCounts=new Map;this.featureImageExcludeMatcherKeys=[];this.featureImageExcludeMatcher=null;this.processors=[{id:"preview",needsProcessing:n=>iy(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=>Uc(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=>Wc(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=>sy(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.fileData||n.fileModified||n.fileData.properties===null,run:async n=>await this.processProperties(n)},{id:"featureImage",needsProcessing:n=>!dh(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!==Eu(n.file,n.drawingProviderId),run:async n=>await this.processFeatureImage(n)}]}getContentType(){return"markdownPipeline"}getRelevantSettings(){return["showFilePreview","skipHeadingsInPreview","skipCodeBlocksInPreview","skipCalloutsInPreview","stripHtmlInPreview","stripLatexInPreview","previewProperties","previewPropertiesFallback","showFeatureImage","featureImageProperties","featureImageExcludeProperties","featureImagePixelSize","downloadExternalFeatureImages","textCountDisplay","showTooltips","showTooltipWordCount","calendarEnabled","manualSortGroupHeaderProperty","manualSortPropertyKey","noteGrouping","defaultFolderSort","propertySortKey","propertyGroupKey","folderSortOverrides","tagSortOverrides","propertySortOverrides","wordCountTargetProperty"]}recordReadFailure(n){let o=(this.readFailureAttemptsByPath.get(n)??0)+1;return this.readFailureAttemptsByPath.set(n,o),{attempts:o,shouldFallback:o>=Ut.contentProvider.retry.maxAttempts}}clearReadFailures(n){this.readFailureAttemptsByPath.delete(n)}getFeatureImageExcludeMatcher(n){return(!this.featureImageExcludeMatcher||!ao(this.featureImageExcludeMatcherKeys,n))&&(this.featureImageExcludeMatcherKeys=[...n],this.featureImageExcludeMatcher=DN(n)),this.featureImageExcludeMatcher}shouldRegenerate(n,r){let{shouldClearPreview:o,shouldClearProperties:a,shouldClearFeatureImage:i,shouldClearWordCounts:s,shouldClearCharacterCounts:l}=oA({oldSettings:n,newSettings:r});return o||a||i||s||l}async clearContent(n){let{shouldClearPreview:r,shouldClearProperties:o,shouldClearFeatureImage:a,shouldClearWordCounts:i,shouldClearCharacterCounts:s}=oA(n);if(!r&&!o&&!a&&!i&&!s)return;let l=Ft();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=n!==null&&n.markdownPipelineMtime!==r.stat.mtime;if(!n||a)return!0;let i=iy(o)&&n.previewStatus==="unprocessed",s=dh(o)&&(n.featureImageKey===null||n.featureImageStatus==="unprocessed");if(dh(o)&&!s){let m=this.app.metadataCache.getFileCache(r)?.frontmatter;if(!this.getFeatureImageExcludeMatcher(o.featureImageExcludeProperties).matches(m)){let f=zv(r,m),h=f?Eu(r,f):null;s=h!==null&&n.featureImageKey!==h}}let l=n.properties===null,c=Uc(o)&&n.wordCount===null,u=Wc(o)&&(n.characterCountWithSpaces===null||n.characterCountWithoutSpaces===null),p=sy(o)&&(n.taskTotal===null||n.taskUnfinished===null);return i||s||l||c||u||p}async processFile(n,r,o){if(n.file.extension!=="md")return{update:null,processed:!0};let a=iy(o),i=dh(o),s=Uc(o),l=Wc(o),c=sy(o),u=a&&o.previewProperties.length>0,p=i&&o.featureImageProperties.length>0,m=i&&o.featureImageExcludeProperties.length>0,g=this.app.metadataCache.getFileCache(n.file);if(!g)return this.emptyFrontmatterRetryCounts.delete(n.path),{update:null,processed:!1};let f=g.frontmatter??null,h=zv(n.file,f),b=h!==null,y=r!==null&&r.markdownPipelineMtime!==n.file.stat.mtime,v=a&&(!r||y||r.previewStatus==="unprocessed"),S=v&&!b,T=u&&(!b||h==="excalidraw")&&v,F=y&&(r?.properties?.length??0)>0,k=i&&(!r||y||r.featureImageKey===null||r.featureImageStatus==="unprocessed")&&!b;if(f===null&&(F||T||k&&(p||m))){let j=this.emptyFrontmatterRetryCounts.get(n.path)??0;if(Date.now()-n.file.stat.mtime<=Ut.contentProvider.metadataCache.recentFileWindowMs&&jO&&(!r||!WM({taskTotal:r.taskTotal,taskUnfinished:r.taskUnfinished},O))?(I.taskTotal=O.taskTotal,I.taskUnfinished=O.taskUnfinished,!0):!1;if(B){let j=aA.Platform.isMobile?Ut.markdown.maxReadBytes.mobile:Ut.markdown.maxReadBytes.desktop;if(n.file.stat.size>j){if(f===null&&!b&&k&&n.file.name.toLowerCase().endsWith(".md")){let Z=this.emptyFrontmatterRetryCounts.get(n.path)??0;if(Date.now()-n.file.stat.mtime<=Ut.contentProvider.metadataCache.recentFileWindowMs&&Z0&&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:xj(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}:Rj(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??jke(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=wV(n.frontmatter);return!n.fileData||n.fileData.properties===null||!vf(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 l=Eu(n.file,n.drawingProviderId);return n.fileData?.featureImageKey===l&&n.fileData.featureImageStatus==="none"?null:{featureImageKey:l,featureImage:this.createEmptyBlob()}}let r=n.featureImageReference??qH({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"||(r.kind==="local"&&bp(r.file)||r.kind==="external"&&d9(r.url))&&n.fileData?.featureImageKey===o&&n.fileData.featureImageStatus==="none")return null;try{let l=await this.createThumbnailBlob(r,n.settings);return{featureImageKey:o,featureImage:l??this.createEmptyBlob()}}catch(l){return console.error(`Error generating feature image for ${n.file.path}:`,l),{featureImageKey:o,featureImage:this.createEmptyBlob()}}}}});function qke(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 iA,CZ=U(()=>{Vn();Kb();wr();sn();zM();iA=class extends sh{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=aa(n),a=aa(r);return!qke(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 Ft().batchClearAllFileContent("metadata")}onSettingsChanged(n){super.onSettingsChanged(n),aa(n).length===0&&this.clearPendingHiddenStates()}stopProcessing(){super.stopProcessing(),this.clearPendingHiddenStates()}needsProcessing(n,r,o){let a=aa(o);if(!(o.useFrontmatterMetadata||a.length>0)||r.extension!=="md")return!1;let s=a.length>0,l=s?oo(a):null,c=!1,u=!1,p=()=>{c||!l||(u=oa(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=aa(o),i=o.useFrontmatterMetadata,s=a.length>0,l=s?oo(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?oB(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?oa(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 NZ,sA,IZ=U(()=>{NZ=require("obsidian");Ol();Vn();Cn();zM();sA=class extends sh{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 Ft().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,NZ.getAllTags)(a),s=QL(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<=Ut.contentProvider.metadataCache.recentFileWindowMs,u=l||c;if(u||this.emptyTagRetryCounts.delete(n.path),u){let p=this.emptyTagRetryCounts.get(n.path)??0;if(po===r[a])}}});function EZ(t){let{app:e,contentRegistryRef:n,pendingSyncTimeoutIdRef:r,clearCacheRebuildNotice:o}=t;(0,xZ.useEffect)(()=>{if(!n.current){let a=new LS(e),i=dV();n.current=new OS,n.current.registerProvider(new zS(e,a,i)),n.current.registerProvider(new MS(e,a,i)),n.current.registerProvider(new iA(e)),n.current.registerProvider(new sA(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 xZ,RZ=U(()=>{xZ=he(Ve());mV();gV();TV();KM();CZ();IZ()});function As(t){let e=[];EF(t)&&e.push("markdownPipeline"),t.showTags&&e.push("tags");let n=aa(t);return(t.useFrontmatterMetadata||n.length>0)&&e.push("metadata"),e}function ch(t){let e=new Set;xF(t).forEach(n=>e.add(n));for(let n of As(t))(n==="tags"||n==="metadata")&&e.add(n);return Array.from(e)}function lA(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)na(a.path)&&(o+=1);return o}function kV(t,e){return(e??As(t)).filter(r=>r==="markdownPipeline"?EF(t):r==="tags"?t.showTags:r==="metadata"?t.useFrontmatterMetadata||aa(t).length>0:!1)}function AF(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{Lr();sn();AS()});function Yke(t){switch(t){case"markdownPipeline":return MZ;case"tags":return AZ;case"metadata":return DZ;default:return 0}}function PV(t){let e=0;for(let n of t)e|=Yke(n);return e}function $ke(t){let e=[];return(t&MZ)!==0&&e.push("markdownPipeline"),(t&AZ)!==0&&e.push("tags"),(t&DZ)!==0&&e.push("metadata"),e}function OZ(t){let{app:e,settings:n,latestSettingsRef:r,stoppedRef:o,contentRegistryRef:a,metadataWaitDisposersRef:i,pendingMetadataWaitPathsRef:s}=t,l=(0,Qo.useCallback)(()=>{let C=i.current;if(C.size!==0){for(let L of C)try{L()}catch{}C.clear()}},[i]),c=(0,Qo.useRef)(null),u=(0,Qo.useRef)(new Map),p=(0,Qo.useRef)(null),m=(0,Qo.useRef)(null),g=(0,Qo.useRef)(null),f=(0,Qo.useRef)(null);(0,Qo.useEffect)(()=>{let C=PV(As(n));s.current.forEach((L,z)=>{let G=L&C;if(G===0){s.current.delete(z);return}G!==L&&s.current.set(z,G)})},[s,n]),(0,Qo.useEffect)(()=>{As(n).length>0||(l(),s.current.clear())},[l,s,n]);let h=(0,Qo.useCallback)(()=>{f.current!==null&&(typeof window<"u"&&window.clearTimeout(f.current),f.current=null)},[]),b=(0,Qo.useCallback)(()=>{if(f.current!==null||typeof window>"u")return;let C=1e4;f.current=window.setTimeout(()=>{f.current=null;let L=s.current.size;if(L===0)return;let z=[];for(let G of s.current.keys())if(z.push(G),z.length>=20)break;console.error("Notebook Navigator could not resolve metadata for all files.",{unresolved:z,totalPending:L,hint:"Reduce file size, fix invalid frontmatter, exclude the files, or disable metadata-dependent providers."})},C)},[s]),y=(0,Qo.useCallback)(()=>{let C=c.current;C&&(s.current.size>0||p.current===null&&g.current===null&&(m.current||u.current.size>0||C()))},[p,c,s,u,m,g]),v=(0,Qo.useCallback)(()=>{if(o.current){u.current.clear();return}let C=a.current;if(!C){u.current.clear();return}let L=r.current,z=PV(As(L));if(z===0){u.current.clear();return}let G=u.current;u.current=new Map;for(let[Q,R]of G){if(R.length===0)continue;let O=Q&z;if(O===0)continue;let D=$ke(O);D.length!==0&&C.queueFilesForAllProviders(R,L,{include:D})}y()},[a,r,y,o]),S=(0,Qo.useCallback)(()=>{if(p.current===null){if(typeof window>"u"){v();return}p.current=window.setTimeout(()=>{p.current=null,v()},0)}},[v]),w=(0,Qo.useCallback)((C,L)=>{let z=u.current.get(L);z?z.push(C):u.current.set(L,[C]),S()},[S]),T=(0,Qo.useCallback)(C=>{let L=s.current.get(C.path)??0;L===0||!e.metadataCache.getFileCache(C)||(s.current.delete(C.path),w(C,L),s.current.size===0&&h())},[e,h,s,w]),F=(0,Qo.useCallback)(()=>{if(g.current!==null&&typeof window<"u"&&window.clearTimeout(g.current),g.current=null,o.current){m.current=null;return}let C=m.current;if(!C)return;let L=500;for(let z=0;z{g.current=null,F()},0):F();return}s.current.size===0&&(h(),y())},[e,h,y,s,w,o]),k=(0,Qo.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]),P=(0,Qo.useCallback)(()=>{if(c.current)return;let C=null,L=null,z=!1,G=()=>{if(!z){if(z=!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,C){try{e.metadataCache.offref(C)}catch{}C=null}if(L){try{e.metadataCache.offref(L)}catch{}L=null}i.current.delete(G),c.current=null}};C=e.metadataCache.on("resolved",()=>{h(),k(),s.current.size>0&&b()}),L=e.metadataCache.on("changed",Q=>{!(Q instanceof FV.TFile)||Q.extension!=="md"||T(Q)}),c.current=G,i.current.add(G),k(),s.current.size>0&&b()},[e,h,T,i,s,b,k]);return{queueMetadataContentWhenReady:(0,Qo.useCallback)((C,L,z)=>{let G=z??r.current,Q=kV(G,L),R=PV(Q);if(Q.length===0||R===0)return;let O=[],D=new Set;for(let N of C)N.extension==="md"&&(D.has(N.path)||(D.add(N.path),O.push(N)));if(O.length===0)return;let x=GM(O,Q,G,{conservativeMetadata:!0,app:e});if(x.length===0)return;let B=[],I=0;for(let N of x){let M=s.current.get(N.path)??0;if((M&R)===R)continue;!!e.metadataCache.getFileCache(N)?B.push(N):(s.current.set(N.path,M|R),I+=1)}let A=N=>{if(N.length===0||o.current)return;let M=r.current,H=kV(M,L);H.length===0||!a.current||a.current.queueFilesForAllProviders(N,M,{include:H})};if(B.length>0&&A(B),I>0){P();return}s.current.size>0&&!c.current&&P()},[e,a,P,r,c,s,o]),disposeMetadataWaitDisposers:l}}var Qo,FV,MZ,AZ,DZ,LZ=U(()=>{Qo=he(Ve()),FV=require("obsidian");DS();dy();MZ=1,AZ=2,DZ=4});function Xke(t){return t==="preview"||t==="tags"||t==="featureImage"||t==="metadata"||t==="wordCount"||t==="characterCount"||t==="tasks"||t==="properties"}function Qke(t){if(!ht(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=>!Xke(o))))}function DF(){let t=Te.get(lt.cacheRebuildNoticeKey);return Qke(t)?t:null}function BS(t){Te.set(lt.cacheRebuildNoticeKey,t)}function hm(){Te.remove(lt.cacheRebuildNoticeKey)}var dA=U(()=>{Ue();jr();mo()});function BZ(t){let{contentRegistryRef:e,pendingSyncTimeoutIdRef:n,rebuildFileCacheRef:r,cancelTreeRebuildDebouncer:o,disposeMetadataWaitDisposers:a,pendingMetadataWaitPathsRef:i,setFileData:s,tagTreeService:l,propertyTreeService:c,setIsStorageReady:u,isStorageReadyRef:p,hasBuiltInitialCacheRef:m,buildFileCacheFnRef:g,latestSettingsRef:f,stoppedRef:h,clearCacheRebuildNotice:b,startCacheRebuildNotice:y,getIndexableFiles:v}=t;return{rebuildCache:(0,zZ.useCallback)(async()=>{b(),hm();let w=h.current;h.current=!0,e.current&&e.current.stopAllProcessing(),n.current!==null&&(typeof window<"u"&&window.clearTimeout(n.current),n.current=null);let T=r.current;if(T)try{T.cancel()}catch{}o(),a(),i.current.clear();try{await Ft().clearDatabase()}catch(E){throw console.error("Failed to clear database during cache rebuild:",E),h.current=w,E}let F=new Map,k=new Map;s({tagTree:F,propertyTree:k,tagged:0,untagged:0,hiddenRootTags:new Map}),l&&l.updateTagTree(F,0,0),c&&c.updatePropertyTree(k),GI(),p.current=!1,u(!1),m.current=!1;let P=g.current;if(!P){h.current=w,console.error("Rebuild cache requested before initialization completed.");return}h.current=!1;try{let E=f.current,C=ch(E),L=lA(v(),C);L>0&&C.length>0&&BS({total:L,source:"rebuild",types:C}),y(L,C),m.current=!0,await P(!0)}catch(E){throw b(),hm(),m.current=!1,h.current=w,E}h.current=w},[g,o,b,e,a,v,m,p,f,i,n,r,s,u,y,h,c,l])}}var zZ,_Z=U(()=>{zZ=he(Ve());Vn();Qa();dy();dA()});function HZ(t){let{app:e,contentRegistryRef:n,queueMetadataContentWhenReady:r}=t,o=(0,CV.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}mm(p)&&u.push(p)}return s.showFeatureImage&&u.length>0&&l.queueFilesForAllProviders(u,s,{include:["fileThumbnails"]}),{markdownFiles:c}},[n]),a=(0,CV.useCallback)((i,s,l)=>{if(!n.current)return;let c=As(l),u=[];try{let m=i.filter(b=>b.extension==="md"),g=c.length>0?GM(m,c,l,{conservativeMetadata:!0,app:e}):[],f=jM(i,l),h=new Map;for(let b of[...g,...f])h.set(b.path,b);if(u=Array.from(h.values()),u.length===0){let b=Ft(),y=xF(l);c.includes("tags")&&y.push("tags"),c.includes("metadata")&&y.push("metadata");let v=b.getFilesNeedingAnyContent(y);v.size>0&&(u=s.filter(S=>v.has(S.path)))}}catch(m){console.error("Failed to check content needs from IndexedDB:",m)}if(u.length===0)return;let{markdownFiles:p}=o(u,l);c.length>0&&r(p,c,l)},[e,n,o,r]);return{queueIndexableFilesForContentGeneration:o,queueIndexableFilesNeedingContentGeneration:a}}var CV,VZ=U(()=>{CV=he(Ve());Vn();DS();dy();AS()});function KZ(t){let{app:e,latestSettingsRef:n,showHiddenItems:r}=t,o=(0,NV.useCallback)(()=>dq(e,n.current,{showHiddenItems:r}),[e,n,r]),a=(0,NV.useCallback)(()=>cq(e,n.current,{showHiddenItems:!0}),[e,n]);return{getVisibleMarkdownFiles:o,getIndexableFiles:a}}var NV,UZ=U(()=>{NV=he(Ve());wr()});function GZ(t){let{isStorageReadyRef:e,stoppedRef:n,getVisibleMarkdownFiles:r}=t,o=(0,ds.useRef)(null),a=(0,ds.useRef)(null),i=(0,ds.useRef)({tags:!1,properties:!1}),s=(0,ds.useRef)({tags:!1,properties:!1}),l=(0,ds.useRef)(!1),c=(0,ds.useRef)({tags:0,properties:0}),u=(0,ds.useRef)(null),p=(0,ds.useRef)(null),m=(0,ds.useRef)(r);m.current=r;let g=(0,ds.useCallback)(v=>{if(n.current||!e.current||!v.tags&&!v.properties)return;let S=null,w=()=>S??=m.current();v.tags&&o.current?.(w),v.properties&&a.current?.(w)},[e,n]),f=(0,ds.useCallback)(()=>{let v=i.current;i.current={tags:!1,properties:!1},g(v)},[g]),h=(0,ds.useCallback)(()=>{l.current=!1;let v=s.current;s.current={tags:!1,properties:!1};let S=i.current,w=!1;p.current!==null&&(window.clearTimeout(p.current),p.current=null,w=!0);let T={tags:(v.tags||w)&&S.tags,properties:(v.properties||w)&&S.properties};T.tags&&(S.tags=!1),T.properties&&(S.properties=!1),g(T)},[g]),b=(0,ds.useCallback)((v,S)=>{let w=performance.now(),T=v==="tags"?"properties":"tags",F=i.current[T]&&w-c.current[T]>=_t.DEBOUNCE_TAG_TREE;i.current[v]||(i.current[v]=!0,c.current[v]=w),F?(u.current?.cancel(),p.current===null&&(p.current=window.setTimeout(()=>{p.current=null,f()},0))):(u.current||(u.current=(0,WZ.debounce)(f,_t.DEBOUNCE_TAG_TREE,!0)),u.current()),S?.flush&&(s.current[v]=!0,l.current||(l.current=!0,queueMicrotask(h)))},[h,f]),y=(0,ds.useCallback)(v=>{i.current={tags:!1,properties:!1},s.current={tags:!1,properties:!1},p.current!==null&&(window.clearTimeout(p.current),p.current=null);let S=u.current;if(S){try{S.cancel()}catch{}v?.reset&&(u.current=null)}},[]);return{tagTreeRebuildFnRef:o,propertyTreeRebuildFnRef:a,scheduleTreeRebuild:b,cancelTreeRebuildDebouncer:y}}var ds,WZ,jZ=U(()=>{ds=he(Ve()),WZ=require("obsidian");po()});function YZ(t){let{app:e,settings:n,showHiddenItems:r,hiddenFolders:o,hiddenTags:a,hiddenFileProperties:i,hiddenFileTags:s,fileVisibility:l,profileId:c,isStorageReady:u,isStorageReadyRef:p,latestSettingsRef:m,stoppedRef:g,setFileData:f,getVisibleMarkdownFiles:h,tagTreeService:b,scheduleTreeRebuild:y,tagTreeRebuildFnRef:v}=t,S=(0,Yd.useRef)(o),w=(0,Yd.useRef)(a);(0,Yd.useEffect)(()=>{S.current=o},[o]),(0,Yd.useEffect)(()=>{w.current=a},[a]);let T=(0,Yd.useRef)(!1),F=(0,Yd.useCallback)(P=>{let E=Ft(),C=r?[]:S.current,L=P?P():h(),z=new Set(L.map(D=>D.path)),{tagTree:G,tagged:Q,untagged:R,hiddenRootTags:O}=jI(E,C,z,w.current,r);return f(D=>({...D,tagTree:G,tagged:Q,untagged:R,hiddenRootTags:O})),b&&b.updateTagTree(G,Q,R),G},[h,f,r,b]);v.current=P=>{m.current.showTags&&F(P)};let k=(0,Yd.useCallback)(P=>{g.current||!p.current||m.current.showTags&&y("tags",P)},[p,m,y,g]);return(0,Yd.useEffect)(()=>{if(!u){T.current=!1;return}if(!T.current){T.current=!0;return}n.showTags&&k()},[r,n.showTags,u,k,o,i,a,l,c]),(0,Yd.useEffect)(()=>{if(!u||!n.showTags)return;let P=r||s.length===0,E=!r&&i.length>0;return Ft().onContentChange(z=>{if(g.current)return;let G=null,Q=!1,R=!1,O=null,D=!1;for(let x of z){let B=E&&x.metadataHiddenChanged===!0;if(x.changes.tags===void 0&&!B)continue;D||(O=e.workspace.getActiveFile()?.path??null,D=!0);let I=O!==null&&x.path===O;if(!(Q&&!I)){if(P&&!B){let A=e.vault.getAbstractFileByPath(x.path);if(!(A instanceof qZ.TFile)||(G||(G=_v(e,m.current,{showHiddenItems:r})),!G(A)))continue}if(Q=!0,I){R=!0;break}}}Q&&k({flush:R})})},[e,i,s,u,m,n.showTags,k,r,g]),{rebuildTagTree:F,scheduleTagTreeRebuild:k}}var Yd,qZ,$Z=U(()=>{Yd=he(Ve()),qZ=require("obsidian");Vn();Qa();wr()});function XZ(t){return Kv(t)}function Zke(t){let e=new Map,n=nn(t);return Gp(n.propertyKeys).forEach(o=>{let a=o.key.trim(),i=Ee(a);!a||!i||e.has(i)||e.set(i,a)}),e}function Jke(t,e){for(let[n,r]of e.entries()){if(t.has(n))continue;let o={id:or(n),kind:"key",key:n,valuePath:null,name:r,displayPath:r,children:new Map,notesWithValue:new Set};t.set(n,o),dz(o)}}function QZ(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,scheduleTreeRebuild:y,propertyTreeRebuildFnRef:v}=t,S=(0,yl.useRef)(o),w=(0,yl.useMemo)(()=>XZ(n),[n]),T=(0,yl.useRef)(!1),F=Kl(n);(0,yl.useEffect)(()=>{S.current=o},[o]);let k=(0,yl.useCallback)(()=>{let C=new Map;return f(L=>({...L,propertyTree:C})),b?.updatePropertyTree(C),C},[b,f]),P=(0,yl.useCallback)(C=>{let L=m.current,z=Zke(L),G=new Set(z.keys());if(!(L.showProperties&&z.size>0))return k();let R=Ft(),O=r?[]:S.current,x=(C?C():h()).map(I=>I.path),B=Nq({forEachFile:I=>{x.forEach(A=>{let N=R.getFile(A);N&&I(A,N)})}},{excludedFolderPatterns:O,includedPropertyKeys:G});return Jke(B,z),f(I=>({...I,propertyTree:B})),b?.updatePropertyTree(B),B},[k,h,m,b,f,r]);v.current=C=>{P(C)};let E=(0,yl.useCallback)(C=>{if(!(g.current||!p.current)){if(!XZ(m.current)){k();return}y("properties",C)}},[k,p,m,y,g]);return(0,yl.useEffect)(()=>{if(!u){T.current=!1;return}if(!T.current){T.current=!0;return}if(!w){k();return}E()},[r,u,w,E,k,h,o,a,i,s,l,c,F,n.showProperties]),(0,yl.useEffect)(()=>{if(!u||!w)return;let C=!r&&s.length>0,L=!r&&a.length>0;return Ft().onContentChange(Q=>{if(g.current)return;let R=null,O=r?[]:S.current,D=!1,x=!1,B=null,I=!1,A=Du(m.current,"any");for(let N of Q){let M=N.changedPropertyKeys,H=N.changes.properties!==void 0&&(M===void 0||M.some(j=>A.has(j))),q=C&&N.changes.tags!==void 0,X=L&&N.metadataHiddenChanged===!0;if(!H&&!q&&!X||O.length>0&&Za(N.path,O))continue;I||(B=e.workspace.getActiveFile()?.path??null,I=!0);let V=B!==null&&N.path===B;if(!(D&&!V)){if(!q&&!X){let j=e.vault.getAbstractFileByPath(N.path);if(!(j instanceof OF.TFile)||(R||(R=_v(e,m.current,{showHiddenItems:r})),!R(j)))continue}if(D=!0,V){x=!0;break}}}if(D){let N=x&&Q.every(M=>M.path===B);E({flush:N})}})},[e,a,s,u,w,m,E,r,g]),(0,yl.useEffect)(()=>{if(!u||!w)return;let C=R=>R instanceof OF.TFile?R.extension==="md":R instanceof OF.TFolder,L=R=>{g.current||C(R)&&E()},z=R=>{g.current||C(R)&&E()},G=e.vault.on("delete",L),Q=e.vault.on("rename",z);return()=>{e.vault.offref(G),e.vault.offref(Q)}},[e.vault,u,w,E,g]),{rebuildPropertyTree:P,schedulePropertyTreeRebuild:E}}var yl,OF,ZZ=U(()=>{yl=he(Ve()),OF=require("obsidian");Vn();wr();un();Et();sn()});function LF(t){let e=Ft(),n=[],r=[],o=[],a=new Map,i=new Set;for(let s of t){i.add(s.path);let l=e.getFile(s.path);l?s.stat.mtime!==l.mtime&&(r.push(s),a.set(s.path,l)):n.push(s)}return e.forEachFile(s=>{i.has(s)||o.push(s)}),{toAdd:n,toUpdate:r,toRemove:o,existingData:a,cachedFileCount:e.getFileCount()}}var IV=U(()=>{Vn()});function JZ(t){let{paths:e,buffer:n,pendingRenameData:r,isPathInVault:o}=t;if(n.moves.length===0&&r.size===0)return e;let a=new Set(r.keys());for(let i of n.moves)a.add(i.newPath);return e.filter(i=>!a.has(i)||!o(i))}function eJ(t){let{buffer:e,pendingRenameData:n,isStopped:r,getStore:o,cancelScheduledDiff:a,queueContentRefresh:i,scheduleDiff:s}=t,l=g=>{for(let f of g)n.get(f.newPath)===f.seeded&&n.delete(f.newPath)},c=async(g,f,h)=>{if(h.length===0)return;let b=new Map(f.map(S=>[S.path,S.data])),y=[],v=new Set;for(let S of h){if(v.has(S.newPath)||n.has(S.newPath))continue;let w=b.get(S.newPath);if(!w)continue;let T={...w,featureImage:null,featureImageKey:null,featureImageStatus:"unprocessed"};v.add(S.newPath),y.push({path:S.newPath,data:T}),g.seedMemoryFile(S.newPath,T)}if(y.length!==0)try{await g.setFiles(y)}catch(S){console.error("Failed to mark renamed feature images for regeneration:",S)}},u=()=>{e.timerId=null;let g=e.moves;g.length!==0&&(e.moves=[],$(async()=>{if(r()){l(g);return}let f=o(),h=[];for(let k of g){if(k.file.stat.mtime===k.seeded.mtime){h.push({path:k.newPath,data:k.seeded});continue}let P={...k.seeded,mtime:k.file.stat.mtime};h.push({path:k.newPath,data:P}),f.seedMemoryFile(k.newPath,P)}let b=g.filter(k=>k.hasStoredBlob).map(k=>({oldPath:k.oldPath,newPath:k.newPath})),y=[];for(let k of g)k.wasMarkdown&&k.isMarkdown?y.push({type:"move",oldPath:k.oldPath,newPath:k.newPath}):k.wasMarkdown&&y.push({type:"delete",path:k.oldPath});let v=f.setFiles(h).then(()=>!0,k=>(console.error("Failed to persist renamed file records:",k),!1)),S=f.moveFeatureImageBlobs(b),w=f.movePreviewTexts(y),T=await v,[F]=await Promise.all([S,w.then(()=>{})]);if(T)l(g);else for(let k=0;kk.file)),s()}))};return{scheduleFlush:()=>{if(a(),e.timerId===null){if(typeof window<"u"){e.timerId=window.setTimeout(u,0);return}u()}},flushNow:()=>{e.timerId!==null&&(typeof window<"u"&&window.clearTimeout(e.timerId),e.timerId=null),e.moves.length>0&&u()}}}var tJ=U(()=>{st()});async function ePe(t){return t.useFrontmatterMetadata?sB(t)?!1:(await Ft().batchClearAllFileContent("metadata"),HE(t),!0):(hP(),!1)}function rJ(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,modifyFlushBufferRef:f,metadataChangeFlushBufferRef:h,renameFlushBufferRef:b,buildFileCacheFnRef:y,rebuildFileCacheRef:v,activeVaultEventRefsRef:S,activeMetadataEventRefRef:w,rebuildTagTree:T,scheduleTagTreeRebuild:F,rebuildPropertyTree:k,schedulePropertyTreeRebuild:P,cancelTreeRebuildDebouncer:E,startCacheRebuildNotice:C,getIndexableFiles:L,getVisibleMarkdownFiles:z,queueMetadataContentWhenReady:G,queueIndexableFilesForContentGeneration:Q,queueIndexableFilesNeedingContentGeneration:R,disposeMetadataWaitDisposers:O}=t;(0,nJ.useEffect)(()=>{let D=async(de,Pe=!1)=>{if(!a.current)if(i.current&&(i.current=!1),Pe){let Fe=performance.now();try{Sr("storage.initialLoad.start",{indexableFileCount:de.length});let te=performance.now(),{toAdd:ye,toUpdate:ce,toRemove:pe,existingData:ue,cachedFileCount:Se}=LF(de),ee=Math.round(performance.now()-te);pe.length>0&&await wk(pe),(ye.length>0||ce.length>0)&&await Ev([...ye,...ce],ue,g.current);let ie=await ePe(r),Ce=null,we=()=>Ce??=z(),Le=0;if(r.showTags){let Ie=performance.now();T(we),Le=Math.round(performance.now()-Ie)}let We=performance.now();k(we);let Nt=Math.round(performance.now()-We);u.current=!0,c(!0),n?.[Ka].setStorageReady(!0);let Pt=As(r),Zt=Pt.length>0,ze={metadataDependentTypes:Pt,frontmatterMetadataCacheInvalidated:ie};if(p.current&&Zt){let Ie=[],De=[],Me=0;for(let nt of de){if(nt.extension==="md"){Ie.push(nt);continue}mm(nt)&&De.push(nt)}if(Pt.length>0&&Ie.length>0&&G(Ie,Pt,r),r.showFeatureImage&&De.length>0){let nt=jM(De,r);Me=nt.length,nt.length>0&&p.current.queueFilesForAllProviders(nt,r,{include:["fileThumbnails"]})}ze.markdownFiles=Ie.length,ze.fileThumbnailFiles=De.length,ze.filesNeedingThumbnails=Me}cL({status:"storageReady",indexableFileCount:de.length,cachedFileCount:Se,diff:{toAdd:ye.length,toUpdate:ce.length,toRemove:pe.length},queued:ze,timingsMs:{diff:ee,tagTree:Le,propertyTree:Nt,initialLoad:Math.round(performance.now()-Fe)}})}catch(te){Sr("storage.initialLoad.failed",{error:te}),cL({status:"initialLoadFailed",indexableFileCount:de.length,error:te}),console.error("Failed during initial load sequence:",te)}}else{m.current!==null&&(typeof window<"u"&&window.clearTimeout(m.current),m.current=null);let Fe=async()=>{if(!a.current)try{let{toAdd:te,toUpdate:ye,toRemove:ce,existingData:pe,cachedFileCount:ue}=LF(de);if(Sr("storage.diff.processed",{indexableFileCount:de.length,cachedFileCount:ue,toAdd:te.length,toUpdate:ye.length,toRemove:ce.length}),te.length>0||ye.length>0||ce.length>0){try{let Se=[...te,...ye];if(Se.length>0&&await Ev(Se,pe,g.current),ce.length>0){let ee=JZ({paths:ce,buffer:b.current,pendingRenameData:g.current,isPathInVault:ie=>e.vault.getAbstractFileByPath(ie)instanceof ep.TFile});ee.length>0&&(await wk(ee),r.showTags&&F({flush:!0}),Kv(r)&&P({flush:!0}))}}catch(Se){console.error("Failed to update IndexedDB cache:",Se)}R([...te,...ye],de,r)}}catch(te){console.error("Error processing file cache diff:",te)}};typeof window<"u"?m.current=window.setTimeout(()=>{m.current=null,$(()=>Fe())},0):$(()=>Fe())}},x=async(de=!1)=>{if(a.current)return;let Pe=L();await D(Pe,de)};y.current=x;let B=v.current;if(B||(B=(0,ep.debounce)(()=>{if(a.current)return;let de=y.current;de&&$(()=>de(!1))},_t.FILE_OPERATION_DELAY,!0),v.current=B),s&&!l.current){if(l.current=!0,Ft().consumePendingRebuildNotice()){let Pe=o.current,Fe=ch(Pe),te=lA(L(),Fe);C(te,Fe)}$(()=>x(!0))}let I=de=>{if(!(a.current||!p.current))try{let Pe=o.current,Fe=As(Pe),{markdownFiles:te}=Q(de,Pe);Fe.length>0&&G(te,Fe,Pe)}catch(Pe){console.error("Failed to queue content refresh for files:",Pe)}},A=f.current,N=h.current,M=()=>{A.timerId!==null&&(typeof window<"u"&&window.clearTimeout(A.timerId),A.timerId=null)},H=()=>{N.timerId!==null&&(typeof window<"u"&&window.clearTimeout(N.timerId),N.timerId=null)},q=de=>{let Pe=new Map;for(let Fe of de){let te=e.vault.getAbstractFileByPath(Fe.path);te instanceof ep.TFile&&Pe.set(te.path,te)}return Array.from(Pe.values())},X=()=>{A.timerId=null,!A.isProcessing&&$(async()=>{if(a.current){A.files.clear();return}let de=Array.from(A.files.values());if(A.files.clear(),de.length===0)return;let Pe=q(de);if(Pe.length===0)return;let Fe=!1;A.isProcessing=!0;try{let ye=Ft().getFiles(Pe.map(ce=>ce.path));await Ev(Pe,ye,g.current),Fe=!0}catch(te){console.error("Failed to record file changes on modify:",te)}finally{A.isProcessing=!1}if(Fe){let te=Pe.filter(ye=>ye.extension!=="md");te.length>0&&I(te)}A.files.size>0&&!a.current&&V()})},V=()=>{if(!(a.current||A.isProcessing||A.timerId!==null)){if(typeof window<"u"){A.timerId=window.setTimeout(X,_t.FILE_OPERATION_DELAY);return}X()}},j=()=>{N.timerId=null,!N.isProcessing&&$(async()=>{if(a.current){N.files.clear();return}let de=Array.from(N.files.values());if(N.files.clear(),de.length===0)return;let Pe=q(de).filter(ye=>ye.extension==="md"&&!nf(ye.path));if(Pe.length===0)return;let Fe=o.current,te=As(Fe);N.isProcessing=!0;try{te.length>0&&await A2(Pe,te)}catch(ye){console.error("Failed to mark files for regeneration:",ye)}finally{N.isProcessing=!1}I(Pe),N.files.size>0&&!a.current&&_()})},_=()=>{if(!(a.current||N.isProcessing||N.timerId!==null)){if(typeof window<"u"){N.timerId=window.setTimeout(j,_t.FILE_OPERATION_DELAY);return}j()}};A.files.size>0&&V(),N.files.size>0&&_();let W=de=>{nq(e,de)},J=b.current,Z=eJ({buffer:J,pendingRenameData:g.current,isStopped:()=>a.current,getStore:()=>Ft(),cancelScheduledDiff:()=>{m.current!==null&&(typeof window<"u"&&window.clearTimeout(m.current),m.current=null)},queueContentRefresh:de=>I(de),scheduleDiff:()=>B?.()}),re=(de,Pe)=>{if(de instanceof ep.TFile){W(Pe),W(de.path);try{let Fe=Ft(),te=Fe.getFile(Pe);if(te){let ye=na(Pe),ce=na(de.path),pe=ce?ye?te.previewStatus:"unprocessed":"none",ue=vv(te.featureImageKey,Pe,de.path),Se={...te,previewStatus:pe,featureImageKey:ue??te.featureImageKey,markdownPipelineMtime:ye&&ce?0:te.markdownPipelineMtime,metadataMtime:ye&&ce?0:te.metadataMtime};g.current.set(de.path,Se),Fe.seedMemoryFile(de.path,Se);let ee=te.featureImageStatus==="has";ee&&Fe.beginFeatureImageBlobMove(Pe,de.path),ye&&ce&&Fe.beginPreviewTextMove(Pe,de.path),J.moves.push({file:de,oldPath:Pe,newPath:de.path,seeded:Se,wasMarkdown:ye,isMarkdown:ce,hasStoredBlob:ee}),Z.scheduleFlush(),B?.();return}}catch(Fe){console.error("Failed to capture renamed file data:",Fe)}}B?.()},Y=de=>{if(a.current||!(de instanceof ep.TFile)||nf(de.path))return;if(nx(e,de.path)){W(de.path);return}de.extension!=="md"&&!mm(de)||(A.files.set(de.path,de),V())},ne=de=>{de instanceof ep.TFile&&nf(de.path)||(B?.(),de instanceof ep.TFile&&W(de.path))},le=[e.vault.on("create",ne),e.vault.on("delete",ne),e.vault.on("rename",re),e.vault.on("modify",Y)];S.current=le;let ae=de=>{a.current||!(de instanceof ep.TFile)||de.extension!=="md"||nf(de.path)||As(o.current).length!==0&&(N.files.set(de.path,de),_())},ve=e.metadataCache.on("changed",ae);return w.current=ve,()=>{y.current=null,le.forEach(de=>e.vault.offref(de)),e.metadataCache.offref(ve),S.current=null,w.current=null,m.current!==null&&(typeof window<"u"&&window.clearTimeout(m.current),m.current=null),M(),H(),Z.flushNow(),E({reset:!0}),O()}},[e,n,w,S,y,E,p,O,L,z,l,i,s,u,o,h,f,g,m,Q,R,G,v,T,k,b,F,P,c,r,a,C])}var nJ,ep,oJ=U(()=>{nJ=he(Ve()),ep=require("obsidian");po();Lg();IV();rf();Vn();tJ();st();Lr();un();Vl();DS();dy();Mp();fP()});function aJ(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,y=(0,Ds.useRef)(!1),v=(0,Ds.useRef)(null),S=(0,Ds.useRef)(null),w=(0,Ds.useRef)(null),T=(0,Ds.useRef)(null),F=(0,Ds.useCallback)(()=>{w.current!==null&&(typeof window<"u"&&window.clearTimeout(w.current),w.current=null)},[]),k=(0,Ds.useCallback)(()=>{F(),v.current=null},[F]),P=(0,Ds.useCallback)(async(L,z)=>{let G=r.current;if(!G)return;let Q=()=>{DF()?.source==="settings"&&(b(),hm())},R=await G.handleSettingsChange(L,z);$5(L,z)&&(z.useFrontmatterMetadata?HE(z):hP());let O=L.showFeatureImage!==z.showFeatureImage&&z.showFeatureImage;if((R.length>0||O)&&!n.current){let H=ch(z);if(H.length>0){if(DF()?.source!=="rebuild"){let V=Ft().getFilesNeedingAnyContent(H).size;V>0?(BS({total:V,source:"settings",types:H}),h(V,H)):Q()}}else Q()}if(n.current||!r.current)return;let x=As(z),B=new Set(R),I=x.filter(H=>B.has(H));if(O&&!I.includes("markdownPipeline")&&I.push("markdownPipeline"),!(I.length>0||O))return;let N=u();if(n.current||!r.current)return;let{markdownFiles:M}=g(N,z);I.length>0&&m(M,I,z)},[b,r,u,g,m,h,n]),E=(0,Ds.useCallback)(async()=>{if(!y.current){y.current=!0;try{for(;!n.current;){let L=v.current;if(!L)return;v.current=null;let z=S.current;if(!z){S.current=L;continue}await P(z,L),S.current=L}}finally{y.current=!1}}},[P,n]),C=(0,Ds.useCallback)((L,z)=>{if(!n.current&&(S.current||(S.current=L),v.current=z,!y.current)){if(F(),typeof window>"u"){$(()=>E());return}w.current=window.setTimeout(()=>{w.current=null,$(()=>E())},_t.DEBOUNCE_CONTENT)}},[F,E,n]);return(0,Ds.useEffect)(()=>{let L=T.current;if(!L){T.current=e;return}let z=r.current,G=z?.getAllRelevantSettings()??[];(!z||G.some(M=>L[M]!==e[M])||q9(L,e))&&C(L,e);let R=_a(L),O=AF(R,o),D=aa(L),x=AF(D,a),B=Ru(L),I=AF(B,i),A=Mu(L),N=AF(A,s);O||x?$(async()=>{try{let M=u(),{toAdd:H,toUpdate:q,toRemove:X,existingData:V}=LF(M);X.length>0&&await wk(X),(H.length>0||q.length>0)&&await Ev([...H,...q],V,p.current),e.showTags&&l(),c(),f([...H,...q],M,e)}catch(M){console.error("Error resyncing cache after exclusion changes:",M)}}):(I||N)&&(e.showTags&&l(),c()),T.current=e},[r,u,i,s,a,o,p,f,C,l,c,e]),(0,Ds.useEffect)(()=>()=>{k()},[k]),{resetPendingSettingsChanges:k}}var Ds,iJ=U(()=>{Ds=he(Ve());po();IV();Vn();st();sn();dA();dy();fP();AS()});var lJ=hu(cA=>{"use strict";var tPe=Ve(),nPe=Symbol.for("react.element"),rPe=Symbol.for("react.fragment"),oPe=Object.prototype.hasOwnProperty,aPe=tPe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,iPe={key:!0,ref:!0,__self:!0,__source:!0};function sJ(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)oPe.call(e,r)&&!iPe.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:nPe,type:t,key:a,ref:i,props:o,_owner:aPe.current}}cA.Fragment=rPe;cA.jsx=sJ;cA.jsxs=sJ});var $e=hu((j7e,dJ)=>{"use strict";dJ.exports=lJ()});function uA({children:t,plugin:e}){let n=cJ.Platform.isMobile,r=(0,_S.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,pJ.jsx)(uJ.Provider,{value:r,children:t})}function vt(){let t=(0,_S.useContext)(uJ);if(!t)throw new Error("useServices must be used within a ServicesProvider");return t}function Ti(){let{fileSystemOps:t}=vt();return t}function Zo(){let{metadataService:t}=vt();if(!t)throw new Error("MetadataService not initialized");return t}function HS(){let{tagOperations:t}=vt();if(!t)throw new Error("TagOperations not initialized");return t}function pA(){let{propertyOperations:t}=vt();if(!t)throw new Error("PropertyOperations not initialized");return t}function vl(){let{commandQueue:t}=vt();if(!t)throw new Error("CommandQueue not initialized");return t}var _S,cJ,pJ,uJ,fn=U(()=>{_S=he(Ve()),cJ=require("obsidian"),pJ=he($e()),uJ=(0,_S.createContext)(null)});function mJ(t,e){if(Ui(t))return"excalidraw.md";let n=t.extension.toLowerCase();if(n==="md"){let r=e?.getFileCache(t);if(LN(r?.frontmatter))return"excalidraw.md"}return n}function xV(t){let e=[];return Object.entries(t).forEach(([n,r])=>{if(typeof n!="string"||typeof r!="string")return;let o=$s(n),a=fc(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 lPe(t,e){let n=$s(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 gJ(t,e,n=uv,r){if(!t)return null;let o=Jh(n)&&r&&r[n]!==!0?null:tG(n),a=e[t]??o?.[t]??sPe[t];return a?fc(a)??a:TT(t)?"image":null}function VS(t,e,n={}){let r=n.customIconId;if(r)return r;if(e.showFilenameMatchIcons){let i=n.fileNameNeedles??xV(e.fileNameIconMap),s=n.fileNameForMatch??t.basename,l=lPe(s,i);if(l)return l}let o=n.allowCategoryIcons??e.showCategoryIcons;if(o){let i=mJ(t,n.metadataCache),s=gJ(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 hJ(t,e,n,r,o=uv,a){if(r)return r;let i=mJ(t,n);return gJ(i,e,o,a)??"file"}var sPe,zF=U(()=>{ws();Lr();Mi();Et();gv();sPe=Object.freeze(Object.assign(Object.create(null),{md:"file-text","excalidraw.md":"pencil",canvas:"layout-grid",base:"database",pdf:"file-text"}))});function gA({children:t,plugin:e}){let[n,r]=(0,Io.useState)(0),o=(0,Io.useRef)(null),a=(0,Io.useRef)(null),i=(0,Io.useRef)(null),s=(0,Io.useRef)(null),l=(0,Io.useCallback)(async m=>{m(e.settings),await e.saveSettingsAndUpdate()},[e]),c=Io.default.useMemo(()=>{let m=He(e.settings.tagColors),g=He(e.settings.tagBackgroundColors),f=He(e.settings.propertyColors),h=He(e.settings.propertyBackgroundColors),b=He(e.settings.virtualFolderColors),y=He(e.settings.virtualFolderBackgroundColors),v=He(e.settings.tagIcons,Hn),S=He(e.settings.propertyIcons,Hn),w=He(e.settings.calendarMonthHighlights,Hn),T=e.settings.interfaceIcons,F=a.current,k=F&&F.raw===T?F.sanitized:He(T,Hn);(!F||F.raw!==T)&&(a.current={raw:T,sanitized:k});let P=Tp(e.settings.pinnedNotes),E=i.current,C=E&&pPe(E,P)?E:P;i.current=C;let L=s.current,z=cR(e.settings.folderAppearances,L?.folders),G=cR(e.settings.tagAppearances,L?.tags),Q=cR(e.settings.propertyAppearances,L?.properties);s.current={folders:z,tags:G,properties:Q};let R={...e.settings,dualPaneOrientation:e.getDualPaneOrientation(),tagColors:m,tagBackgroundColors:g,propertyColors:f,propertyBackgroundColors:h,virtualFolderColors:b,virtualFolderBackgroundColors:y,tagIcons:v,propertyIcons:S,calendarMonthHighlights:w,interfaceIcons:k,folderAppearances:z,tagAppearances:G,propertyAppearances:Q,pinnedNotes:C};return Array.isArray(e.settings.vaultProfiles)&&(R.vaultProfiles=e.settings.vaultProfiles.map(O=>({...O,hiddenFolders:Array.isArray(O.hiddenFolders)?[...O.hiddenFolders]:[],descendantExcludedFolders:Array.isArray(O.descendantExcludedFolders)?[...O.descendantExcludedFolders]:[],hiddenFileProperties:Array.isArray(O.hiddenFileProperties)?[...O.hiddenFileProperties]:[],hiddenFileNames:Array.isArray(O.hiddenFileNames)?[...O.hiddenFileNames]:[],hiddenTags:Array.isArray(O.hiddenTags)?[...O.hiddenTags]:[],hiddenFileTags:Array.isArray(O.hiddenFileTags)?[...O.hiddenFileTags]:[],propertyKeys:Gp(O.propertyKeys),shortcuts:Lu(O.shortcuts),navRainbow:Vq(O.navRainbow)}))),R},[e,n]),u=Io.default.useMemo(()=>({fileNameIconNeedles:c.showFilenameMatchIcons?xV(c.fileNameIconMap):[]}),[c.showFilenameMatchIcons,c.fileNameIconMap]);(0,Io.useEffect)(()=>{let m=`settings-provider-${Date.now()}`,g=()=>{r(f=>f+1)};return e.registerSettingsUpdateListener(m,g),()=>{e.unregisterSettingsUpdateListener(m)}},[e]);let p=Io.default.useMemo(()=>{let m=nn(c),g=o.current,f=g?.profile.id===m.id,h=ao(g?.profile.hiddenFolders??[],m.hiddenFolders),b=ao(g?.profile.descendantExcludedFolders??[],m.descendantExcludedFolders),y=ao(g?.profile.hiddenFileProperties??[],m.hiddenFileProperties),v=ao(g?.profile.hiddenFileNames??[],m.hiddenFileNames),S=ao(g?.profile.hiddenTags??[],m.hiddenTags),w=ao(g?.profile.hiddenFileTags??[],m.hiddenFileTags),T=g?.profile.fileVisibility===m.fileVisibility,F=m.navigationBanner??null,k=g?.navigationBanner===F,P=g?.profile.periodicNotesFolder===m.periodicNotesFolder,E=g?.profile.name===m.name,C=cPe(g?.profile.propertyKeys,m.propertyKeys),L=uPe(g?.profile.shortcuts,m.shortcuts),z=fx(g?.profile.navRainbow,m.navRainbow);if(f&&h&&b&&y&&v&&S&&w&&T&&k&&P&&E&&C&&L&&z&&g)return g;let G={profile:m,hiddenFolders:m.hiddenFolders,descendantExcludedFolders:m.descendantExcludedFolders,hiddenFileProperties:m.hiddenFileProperties,hiddenFileNames:m.hiddenFileNames,hiddenTags:m.hiddenTags,hiddenFileTags:m.hiddenFileTags,fileVisibility:m.fileVisibility,propertyKeys:C&&g?g.propertyKeys:m.propertyKeys,navigationBanner:F};return o.current=G,G},[c]);return(0,BF.jsx)(yJ.Provider,{value:c,children:(0,BF.jsx)(SJ.Provider,{value:u,children:(0,BF.jsx)(bJ.Provider,{value:p,children:(0,BF.jsx)(vJ.Provider,{value:l,children:t})})})})}function yt(){let t=(0,Io.useContext)(yJ);if(t===null)throw new Error("useSettingsState must be used within a SettingsProvider");return t}function bl(){let t=(0,Io.useContext)(vJ);if(!t)throw new Error("useSettingsUpdate must be used within a SettingsProvider");return t}function hA(){let t=(0,Io.useContext)(SJ);if(!t)throw new Error("useSettingsDerived must be used within a SettingsProvider");return t}function Sl(){let t=(0,Io.useContext)(bJ);if(!t)throw new Error("useActiveProfile must be used within a SettingsProvider");return t}var Io,BF,yJ,vJ,bJ,SJ,fJ,mA,dPe,cPe,uPe,pPe,on=U(()=>{Io=he(Ve());Ha();sn();Et();ll();Zb();zF();BF=he($e()),yJ=(0,Io.createContext)(null),vJ=(0,Io.createContext)(null),bJ=(0,Io.createContext)(null),SJ=(0,Io.createContext)(null),fJ=t=>t&&t.length>0?t:void 0,mA=(t,e)=>fJ(t)===fJ(e),dPe=(t,e)=>_k(t)===_k(e),cPe=(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!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}});function yA({children:t,plugin:e}){let[n,r]=(0,ki.useState)(0),o=(0,ki.useRef)("");o.current||(o.current=`ux-preferences-${Date.now()}-${Math.random().toString(16).slice(2)}`),(0,ki.useEffect)(()=>{let l=()=>{r(c=>c+1)};return e.registerUXPreferencesListener(o.current,l),()=>{e.unregisterUXPreferencesListener(o.current)}},[e]);let a=(0,ki.useMemo)(()=>e.getUXPreferences(),[e,n]),i=(0,ki.useMemo)(()=>e.getCollapsedPinnedContexts(),[e,n]),s=(0,ki.useMemo)(()=>({setSearchActive:l=>{e.setSearchActive(l)},setIncludeDescendantNotes:l=>{e.setIncludeDescendantNotes(l)},toggleIncludeDescendantNotes:()=>{e.toggleIncludeDescendantNotes()},setShowHiddenItems:l=>{e.setShowHiddenItems(l)},toggleShowHiddenItems:()=>{e.toggleShowHiddenItems()},setPinShortcuts:l=>{e.setPinShortcuts(l)},setShowCalendar:l=>{e.setShowCalendar(l)},toggleShowCalendar:()=>{e.toggleShowCalendar()}}),[e]);return(0,fA.jsx)(wJ.Provider,{value:a,children:(0,fA.jsx)(TJ.Provider,{value:s,children:(0,fA.jsx)(kJ.Provider,{value:i,children:t})})})}function jt(){let t=(0,ki.useContext)(wJ);if(!t)throw new Error("useUXPreferences must be used within a UXPreferencesProvider");return t}function $d(){let t=(0,ki.useContext)(TJ);if(!t)throw new Error("useUXPreferenceActions must be used within a UXPreferencesProvider");return t}function PJ(){let t=(0,ki.useContext)(kJ);if(!t)throw new Error("useCollapsedPinnedContexts must be used within a UXPreferencesProvider");return t}var ki,fA,wJ,TJ,kJ,gr=U(()=>{ki=he(Ve()),fA=he($e()),wJ=(0,ki.createContext)(null),TJ=(0,ki.createContext)(null),kJ=(0,ki.createContext)(null)});function mPe(){let t=KS>0;EV.forEach(e=>{e(t)})}function FJ(t){let e=KS>0;KS=Math.max(0,KS+t),e!==KS>0&&mPe()}function uh(){return KS>0}function NJ(t){return EV.add(t),t(uh()),()=>{EV.delete(t)}}function IJ({app:t,api:e,children:n}){let r=yt(),{hiddenFolders:o,hiddenFileProperties:a,hiddenFileNames:i,hiddenTags:s,hiddenFileTags:l,fileVisibility:c,profile:u}=Sl(),m=jt().showHiddenItems,{tagTreeService:g,propertyTreeService:f}=vt(),[h,b]=(0,Mn.useState)({tagTree:new Map,propertyTree:new Map,tagged:0,untagged:0,hiddenRootTags:new Map}),y=(0,Mn.useRef)(null),v=(0,Mn.useRef)(!0),S=(0,Mn.useRef)(null),w=(0,Mn.useRef)(!1),T=(0,Mn.useRef)(new Set),F=(0,Mn.useRef)(new Map),k=(0,Mn.useRef)(new Map),P=(0,Mn.useRef)({files:new Map,timerId:null,isProcessing:!1}),E=(0,Mn.useRef)({files:new Map,timerId:null,isProcessing:!1}),C=(0,Mn.useRef)({moves:[],timerId:null}),L=(0,Mn.useRef)(r);L.current=r;let z=(0,Mn.useRef)(null),G=(0,Mn.useRef)(null),Q=(0,Mn.useRef)(null),R=(0,Mn.useRef)(null),[O,D]=(0,Mn.useState)(!1),x=J9(),B=(0,Mn.useRef)(!1);B.current=O;let I=(0,Mn.useRef)(!1),{clearCacheRebuildNotice:A,startCacheRebuildNotice:N}=Q9({app:t,stoppedRef:w,onRebuildComplete:hm}),M=(0,Mn.useRef)(!1);(0,Mn.useEffect)(()=>(FJ(1),()=>{FJ(-1)}),[]);let{getVisibleMarkdownFiles:H,getIndexableFiles:q}=KZ({app:t,latestSettingsRef:L,showHiddenItems:m}),{tagTreeRebuildFnRef:X,propertyTreeRebuildFnRef:V,scheduleTreeRebuild:j,cancelTreeRebuildDebouncer:_}=GZ({isStorageReadyRef:B,stoppedRef:w,getVisibleMarkdownFiles:H}),{rebuildTagTree:W,scheduleTagTreeRebuild:J}=YZ({app:t,settings:r,showHiddenItems:m,hiddenFolders:o,hiddenTags:s,hiddenFileProperties:a,hiddenFileTags:l,fileVisibility:c,profileId:u.id,isStorageReady:O,isStorageReadyRef:B,latestSettingsRef:L,stoppedRef:w,setFileData:b,getVisibleMarkdownFiles:H,tagTreeService:g??null,scheduleTreeRebuild:j,tagTreeRebuildFnRef:X}),{rebuildPropertyTree:Z,schedulePropertyTreeRebuild:re}=QZ({app:t,settings:r,showHiddenItems:m,hiddenFolders:o,hiddenFileProperties:a,hiddenFileNames:i,hiddenFileTags:l,fileVisibility:c,profileId:u.id,isStorageReady:O,isStorageReadyRef:B,latestSettingsRef:L,stoppedRef:w,setFileData:b,getVisibleMarkdownFiles:H,propertyTreeService:f??null,scheduleTreeRebuild:j,propertyTreeRebuildFnRef:V}),{queueMetadataContentWhenReady:Y,disposeMetadataWaitDisposers:ne}=OZ({app:t,settings:r,latestSettingsRef:L,stoppedRef:w,contentRegistryRef:y,metadataWaitDisposersRef:T,pendingMetadataWaitPathsRef:F}),{queueIndexableFilesForContentGeneration:le,queueIndexableFilesNeedingContentGeneration:ae}=HZ({app:t,contentRegistryRef:y,queueMetadataContentWhenReady:Y}),{rebuildCache:ve}=BZ({contentRegistryRef:y,pendingSyncTimeoutIdRef:S,rebuildFileCacheRef:Q,cancelTreeRebuildDebouncer:_,disposeMetadataWaitDisposers:ne,pendingMetadataWaitPathsRef:F,setFileData:b,tagTreeService:g??null,propertyTreeService:f??null,setIsStorageReady:D,isStorageReadyRef:B,hasBuiltInitialCacheRef:I,buildFileCacheFnRef:R,latestSettingsRef:L,stoppedRef:w,clearCacheRebuildNotice:A,startCacheRebuildNotice:N,getIndexableFiles:q});(0,Mn.useEffect)(()=>{if(!O||M.current)return;M.current=!0;let Ce=DF();if(!Ce)return;let we=ch(L.current);if(we.length===0){hm();return}let Le=Ft().getFilesNeedingAnyContent(we).size;if(Le<=0){hm();return}let We=Math.max(Ce.total,Le);We!==Ce.total&&BS({...Ce,total:We}),N(We,we)},[O,N]);let de=(0,Mn.useCallback)(Ce=>{if(!r.useFrontmatterMetadata||Ce.extension!=="md")return null;let we=mr();return VE(Ce,we?.getFile(Ce.path)??null,r)??_E(t,Ce,r)},[t,r]),Pe=(0,Mn.useCallback)(Ce=>{let we=de(Ce);return we?.fn?we.fn:kp(Ce,void 0,r)},[de,r]),Fe=(0,Mn.useCallback)(Ce=>CJ(Ce,de(Ce)),[de]),te=(0,Mn.useCallback)(Ce=>Fe(Ce).created,[Fe]),ye=(0,Mn.useCallback)(Ce=>Fe(Ce).modified,[Fe]),ce=(0,Mn.useCallback)(Ce=>{let we=de(Ce),Le=CJ(Ce,we);return{name:we?.fn||kp(Ce,void 0,r),created:Le.created,modified:Le.modified}},[de,r]),pe=(0,Mn.useCallback)(Ce=>Ft().hasPreview(Ce),[]),ue=(0,Mn.useCallback)(async Ce=>{if(w.current)return;let we=L.current;if(we.showFeatureImage&&!(Ce.extension!=="md"&&!mm(Ce))){try{await Ft().clearFileContent(Ce.path,"featureImage")}catch(Le){console.error("Failed to clear feature image content:",Le);return}if(!(w.current||!y.current))try{Ce.extension==="md"?Y([Ce],["markdownPipeline"],we):y.current.queueFilesForAllProviders([Ce],we,{include:["fileThumbnails"]})}catch(Le){console.error("Failed to queue feature image regeneration for file:",Ce.path,Le)}}},[Y]),Se=(0,Mn.useMemo)(()=>({fileData:h,getFileDisplayName:Pe,getFileCreatedTime:te,getFileModifiedTime:ye,getFileTimestamps:Fe,getFileMetadata:ce,getDB:Ft,getFile:Pt=>Ft().getFile(Pt),getFiles:Pt=>Ft().getFiles(Pt),hasPreview:pe,isStorageReady:O,getTagTree:()=>h.tagTree,getPropertyTree:()=>h.propertyTree,findTagInTree:Pt=>$i(h.tagTree,Pt),getAllTagPaths:()=>{let Pt=[];for(let Zt of h.tagTree.values()){let ze=Hl(Zt);Pt.push(...ze)}return Pt},getTagDisplayPath:Pt=>$i(h.tagTree,Pt)?.displayPath??Pt,rebuildCache:ve,regenerateFeatureImageForFile:ue}),[h,Pe,te,ye,Fe,ce,pe,O,ve,ue]);EZ({app:t,contentRegistryRef:y,pendingSyncTimeoutIdRef:S,clearCacheRebuildNotice:A});let{resetPendingSettingsChanges:ee}=aJ({settings:r,stoppedRef:w,contentRegistryRef:y,hiddenFolders:o,hiddenFileProperties:a,hiddenFileNames:i,hiddenFileTags:l,scheduleTagTreeRebuild:J,schedulePropertyTreeRebuild:re,getIndexableFiles:q,pendingRenameDataRef:k,queueMetadataContentWhenReady:Y,queueIndexableFilesForContentGeneration:le,queueIndexableFilesNeedingContentGeneration:ae,startCacheRebuildNotice:N,clearCacheRebuildNotice:A});rJ({app:t,api:e,settings:r,latestSettingsRef:L,stoppedRef:w,isFirstLoadRef:v,isIndexedDBReady:x,hasBuiltInitialCacheRef:I,setIsStorageReady:D,isStorageReadyRef:B,contentRegistryRef:y,pendingSyncTimeoutIdRef:S,pendingRenameDataRef:k,modifyFlushBufferRef:P,metadataChangeFlushBufferRef:E,renameFlushBufferRef:C,buildFileCacheFnRef:R,rebuildFileCacheRef:Q,activeVaultEventRefsRef:z,activeMetadataEventRefRef:G,rebuildTagTree:W,rebuildPropertyTree:Z,scheduleTagTreeRebuild:J,schedulePropertyTreeRebuild:re,cancelTreeRebuildDebouncer:_,startCacheRebuildNotice:N,getIndexableFiles:q,getVisibleMarkdownFiles:H,queueMetadataContentWhenReady:Y,queueIndexableFilesForContentGeneration:le,queueIndexableFilesNeedingContentGeneration:ae,disposeMetadataWaitDisposers:ne});let ie=(0,Mn.useMemo)(()=>({...Se,stopAllProcessing:()=>{w.current=!0,ee(),y.current&&y.current.stopAllProcessing(),S.current!==null&&(typeof window<"u"&&window.clearTimeout(S.current),S.current=null);for(let we of[P.current,E.current])we.timerId!==null&&(typeof window<"u"&&window.clearTimeout(we.timerId),we.timerId=null),we.files.clear();let Ce=C.current;Ce.timerId!==null&&(typeof window<"u"&&window.clearTimeout(Ce.timerId),Ce.timerId=null),Ce.moves=[];try{z.current&&(z.current.forEach(we=>t.vault.offref(we)),z.current=null),G.current&&(t.metadataCache.offref(G.current),G.current=null)}catch{}try{Q.current?.cancel()}catch{}Q.current=null,_({reset:!0}),ne(),F.current.clear()}}),[_,ee,Se,ne,t.vault,t.metadataCache]);return(0,EJ.jsx)(RV.Provider,{value:ie,children:n})}function _o(){let t=(0,Mn.useContext)(RV);if(!t)throw new Error("useFileCache must be used within StorageProvider");return t}function xJ(){return(0,Mn.useContext)(RV)}var Mn,EJ,RV,KS,EV,CJ,cs=U(()=>{Mn=he(Ve());Kb();fP();Z9();eZ();RZ();LZ();_Z();VZ();UZ();jZ();$Z();ZZ();oJ();iJ();xv();Vn();ws();Qa();fn();on();gr();dy();dA();DS();EJ=he($e()),RV=(0,Mn.createContext)(null),KS=0,EV=new Set;CJ=(t,e)=>({created:e?.fc!==void 0&&e.fc!==Rr.FIELD_NOT_CONFIGURED&&e.fc!==Rr.PARSE_FAILED?e.fc:t.stat.ctime,modified:e?.fm!==void 0&&e.fm!==Rr.FIELD_NOT_CONFIGURED&&e.fm!==Rr.PARSE_FAILED?e.fm:t.stat.mtime})});function gPe(t){return t.startView==="navigation"?"navigation":"files"}function hPe(t,e){switch(e.type){case"ACTIVATE_PANE":{let n=e.target==="search"?"files":e.target;return t.focusedPane===e.target&&t.currentSinglePaneView===n?t:{...t,focusedPane:e.target,currentSinglePaneView:n}}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 AJ({children:t}){let{plugin:e}=vt(),n=yt(),r=jt(),{setPinShortcuts:o}=$d(),a=()=>{let m=Te.get(lt.navigationPaneWidthKey)??dc.defaultWidth,g=gPe(e.settings);return{focusedPane:g,currentSinglePaneView:g,paneWidth:Math.max(dc.minWidth,m),containerWidth:null,dualPanePreference:e.useDualPane(),dualPane:!1,singlePane:!1,effectiveDualPaneOrientation:e.getDualPaneOrientation(),pinShortcuts:r.pinShortcuts}},[i,s]=(0,Pi.useReducer)(hPe,void 0,a),l=(0,Pi.useRef)(i.pinShortcuts);(0,Pi.useEffect)(()=>{l.current=i.pinShortcuts},[i.pinShortcuts]);let c=(0,Pi.useMemo)(()=>{let p=vc()&&i.dualPanePreference,m=n.dualPaneOrientation;if(p&&n.dualPaneOrientation==="horizontal"&&n.narrowSidebarLayout!=="none"&&i.containerWidth!==null){let g=n.narrowSidebarTriggerMode==="customWidth"?n.narrowSidebarCustomWidth:i.paneWidth+vW.minWidth;i.containerWidth>=g||(n.narrowSidebarLayout==="singlePane"?p=!1:n.narrowSidebarLayout==="vertical"&&(m="vertical"))}return{...i,dualPane:p,singlePane:!p,effectiveDualPaneOrientation:m,pinShortcuts:i.pinShortcuts}},[i,n.dualPaneOrientation,n.narrowSidebarCustomWidth,n.narrowSidebarLayout,n.narrowSidebarTriggerMode]),u=(0,Pi.useCallback)(p=>{if(p.type==="SET_PIN_SHORTCUTS"){let m=p.value;m!==l.current&&(l.current=m,o(m))}s(p)},[s,o]);return(0,Pi.useEffect)(()=>{let p=`ui-state-${Date.now()}`,m=()=>{s({type:"SET_DUAL_PANE",value:e.useDualPane()})};return e.registerSettingsUpdateListener(p,m),()=>{e.unregisterSettingsUpdateListener(p)}},[e]),(0,Pi.useEffect)(()=>{l.current!==r.pinShortcuts&&(l.current=r.pinShortcuts,s({type:"SET_PIN_SHORTCUTS",value:r.pinShortcuts}))},[s,r.pinShortcuts]),(0,MV.jsx)(RJ.Provider,{value:c,children:(0,MV.jsx)(MJ.Provider,{value:u,children:t})})}function Qr(){let t=(0,Pi.useContext)(RJ);if(!t)throw new Error("useUIState must be used within UIStateProvider");return t}function So(){let t=(0,Pi.useContext)(MJ);if(!t)throw new Error("useUIDispatch must be used within UIStateProvider");return t}var Pi,MV,RJ,MJ,wa=U(()=>{Pi=he(Ve());Ue();Ue();jr();$r();fn();on();gr();MV=he($e());RJ=(0,Pi.createContext)(null),MJ=(0,Pi.createContext)(null)});function DJ(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 _F(t){return encodeURIComponent(t)}function AV({selectionType:t,selectedFolderPath:e,selectedTag:n,selectedProperty:r,groupingMode:o}){let a;t===K.TAG&&n?a=`tag:${_F(n)}`:t===K.PROPERTY&&r?a=`property:${_F(r)}`:a=`folder:${_F(e??"/")}`;let i=jo(o),s=i!==null?Ys(i,"asc"):o;return`scope=${a};group=${_F(s)};id=`}function OJ(t){return`${AV(t)}${_F(t.groupId)}`}var vA=U(()=>{Ue();hn()});function DV(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 fPe(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"SET_LIST_GROUPS_COLLAPSED":{let n=new Set(t.collapsedListGroups);return e.collapseKeys.forEach(r=>{e.collapsed?n.add(r):n.delete(r)}),{...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=DV(t.expandedFolders,e.existingPaths);return n?{...t,expandedFolders:n}:t}case"CLEANUP_DELETED_TAGS":{let n=DV(t.expandedTags,e.existingTags);return n?{...t,expandedTags:n}:t}case"CLEANUP_DELETED_PROPERTIES":{let n=DV(t.expandedProperties,e.existingPropertyNodeIds);return n?{...t,expandedProperties:n}:t}default:return t}}function BJ({children:t}){let e=()=>{let o=Te.get(lt.expandedFoldersKey),a=Te.get(lt.expandedTagsKey),i=Te.get(lt.expandedPropertiesKey),s=Te.get(lt.expandedVirtualFoldersKey),l=Te.get(lt.collapsedListGroupsKey),c=new Set(o||[]),u=new Set(a||[]),p=new Set(i||[]),m=new Set(s||[_n,_e]),g=new Set(DJ(l));return{expandedFolders:c,expandedTags:u,expandedProperties:p,expandedVirtualFolders:m,collapsedListGroups:g}},[n,r]=(0,wl.useReducer)(fPe,void 0,e);return(0,wl.useEffect)(()=>{Te.set(lt.expandedFoldersKey,Array.from(n.expandedFolders))},[n.expandedFolders]),(0,wl.useEffect)(()=>{Te.set(lt.expandedTagsKey,Array.from(n.expandedTags))},[n.expandedTags]),(0,wl.useEffect)(()=>{Te.set(lt.expandedPropertiesKey,Array.from(n.expandedProperties))},[n.expandedProperties]),(0,wl.useEffect)(()=>{Te.set(lt.expandedVirtualFoldersKey,Array.from(n.expandedVirtualFolders))},[n.expandedVirtualFolders]),(0,wl.useEffect)(()=>{Te.set(lt.collapsedListGroupsKey,Array.from(n.collapsedListGroups))},[n.collapsedListGroups]),(0,OV.jsx)(LJ.Provider,{value:n,children:(0,OV.jsx)(zJ.Provider,{value:r,children:t})})}function la(){let t=(0,wl.useContext)(LJ);if(!t)throw new Error("useExpansionState must be used within ExpansionProvider");return t}function Wa(){let t=(0,wl.useContext)(zJ);if(!t)throw new Error("useExpansionDispatch must be used within ExpansionProvider");return t}var wl,OV,LJ,zJ,Tl=U(()=>{wl=he(Ve());Ue();jr();vA();OV=he($e()),LJ=(0,wl.createContext)(null),zJ=(0,wl.createContext)(null)});function VJ(t){let e=new Set;return t&&e.add(t.path),e}function LV(t){return!t||t===_e?t:en(t)??t}function HF(t,e){return e<=0||t<0?0:t>=e?e-1:t}function zV(t,e){return!t||!e?!1:t.type===e.type&&t.value===e.value}function BV(t){if(t.selectionType==="folder"&&t.selectedFolder)return{type:"folder",value:t.selectedFolder.path};if(t.selectionType==="tag"&&t.selectedTag){let e=at(t.selectedTag);return e?{type:"tag",value:e}:null}if(t.selectionType==="property"&&t.selectedProperty){let e=LV(t.selectedProperty);return e?{type:"property",value:e}:null}return null}function HJ(t,e){let n=t.slice(),r=HF(e,n.length);return n.length===0?{navigationHistory:n,navigationHistoryIndex:0}:(r>0&&zV(n[r],n[r-1])&&(n.splice(r,1),r-=1),r0?t.navigationHistory.slice():[e],a=HF(t.navigationHistoryIndex,o.length);if(typeof r=="number"){let c=HF(r,o.length);return o[c]=e,HJ(o,c)}let i=n??"record";if(i==="skip")return bA(o,a);if(i==="replace")return o[a]=e,HJ(o,a);let s=o[a];if(zV(s,e))return bA(o,a);let l=o.slice(0,a+1);return l.push(e),bA(l,l.length-1)}function Gc(t,e){let n=BV({selectionType:e.selectionType,selectedFolder:e.selectedFolder,selectedTag:e.selectedTag,selectedProperty:e.selectedProperty}),{navigationHistory:r,navigationHistoryIndex:o}=yPe(t,n,e.historyBehavior,e.historyIndex);return{...t,selectionType:e.selectionType,selectedFolder:e.selectedFolder,selectedTag:e.selectedTag,selectedProperty:e.selectedProperty,selectedFiles:VJ(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 SA(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 jc(t,e){return e.selectedFile?e.selectedFile:SA(e.selectedFiles,t)}function KJ(t,e,n){switch(e.type){case"SET_SELECTED_FOLDER":return Gc(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 Gc(t,{selectionType:"tag",selectedFolder:null,selectedTag:at(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 Gc(t,{selectionType:"property",selectedFolder:null,selectedTag:null,selectedProperty:LV(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:VJ(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:at(e.targetTag),o=e.source??(e.isManualReveal?"manual":"auto"),a=e.historyBehavior??(o==="startup"?"replace":"record"),i=e.targetFolder??null;return e.isManualReveal?Gc(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?Gc(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}):Gc(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?Gc(t,{selectionType:"property",selectedFolder:null,selectedTag:null,selectedProperty:LV(e.targetProperty),selectedFile:e.file,isRevealOperation:!0,isFolderChangeWithAutoSelect:!1,isKeyboardNavigation:!1,isFolderNavigation:t.isFolderNavigation,revealSource:o,historyBehavior:a,historyIndex:e.historyIndex}):Gc(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?Gc(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?Gc(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}):Gc(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?SA(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 _J,VF=U(()=>{Ue();un();Cn();_J=100});function wA(t,e,n){try{return Te.get(t)??e}catch(r){return console.error(n,r),e}}function vPe(t,e){try{let n=Te.get(t);return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]}catch(n){return console.error(e,n),[]}}function KF(t,e,n){try{if(e===null){Te.remove(t);return}if(Array.isArray(e)&&e.length===0){Te.remove(t);return}Te.set(t,e)}catch(r){console.error(n,r)}}function UJ({app:t,settings:e}){let n=t.vault,r=wA(lt.selectedFolderKey,null,"Failed to load selected folder from localStorage:"),o=wA(lt.selectedTagKey,null,"Failed to load selected tag from localStorage:"),a=wA(lt.selectedFileKey,null,"Failed to load selected file from localStorage:"),i=vPe(lt.selectedFilesKey,"Failed to load selected files from localStorage:"),s=null;r&&(s=n.getFolderByPath(r));let l=null;if(e.showProperties&&(l=qv(wA(lt.selectedPropertyKey,null,"Failed to load selected property from localStorage:"))),l&&!Wv(e,l)){l=null;try{Te.remove(lt.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 y=n.getFileByPath(b);y&&(u.add(y.path),c||(c=y))}),u.size===0&&a){let b=n.getFileByPath(a);b&&(c=b,u.add(b.path))}let p=at(o),m="folder";l?(m="property",s=null):p?(m="tag",s=null):s||(s=n.getRoot());let g=BV({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 WJ(t){let e=(0,Jo.useRef)(t);return e.current=t,e}function GJ({app:t,dispatch:e,includeDescendantNotes:n,propertyTreeService:r,settings:o,showHiddenItems:a,tagTreeService:i}){let s=(0,Jo.useCallback)(l=>{if(Kn()&&o.autoSelectFirstFileOnFocusChange&&l.length>0)return l[0];let c=t.workspace.getActiveFile();return c&&l.some(u=>u.path===c.path)?c:null},[t.workspace,o.autoSelectFirstFileOnFocusChange]);return(0,Jo.useCallback)(l=>{let c={includeDescendantNotes:n,showHiddenItems:a};if(l.type==="SET_SELECTED_FOLDER"&&l.autoSelectedFile===void 0){if(l.folder){let u=Wb(l.folder,o,c,t);e({...l,autoSelectedFile:s(u)})}else e({...l,autoSelectedFile:null});return}if(l.type==="SET_SELECTED_TAG"&&l.autoSelectedFile===void 0){if(l.tag){let u=KE(l.tag,o,c,t,i);e({...l,autoSelectedFile:s(u)})}else e({...l,autoSelectedFile:null});return}if(l.type==="SET_SELECTED_PROPERTY"&&l.autoSelectedFile===void 0){let u=UE(l.nodeId,o,c,t,r);e({...l,autoSelectedFile:s(u)});return}if(l.type==="CLEANUP_DELETED_FILE"&&!Kn()){e({...l,nextFileToSelect:null});return}e(l)},[t,e,n,r,s,o,a,i])}function jJ({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,Jo.useRef)(null),f=(0,Jo.useCallback)((b,y)=>{if(!i||b!=="property"||!y){g.current=null;return}if(g.current!==null&&g.current!==y&&(g.current=null),!zk(a,y)){g.current=null,a.showProperties?e({type:"SET_SELECTED_PROPERTY",nodeId:_e,historyBehavior:"replace"}):e({type:"SET_SELECTED_FOLDER",folder:t.vault.getRoot(),historyBehavior:"replace"});return}if(y===_e||!l){g.current=null;return}if(!l.hasNodes())return;let v=l.resolveSelectionNodeId(y);if(v===_e){if(g.current===y)return;g.current=null,a.showProperties?e({type:"SET_SELECTED_PROPERTY",nodeId:_e,historyBehavior:"replace"}):e({type:"SET_SELECTED_FOLDER",folder:t.vault.getRoot(),historyBehavior:"replace"});return}g.current===y&&(g.current=null),v!==y&&e({type:"SET_SELECTED_PROPERTY",nodeId:v,historyBehavior:"replace"})},[t.vault,e,a,i,l]);(0,Jo.useEffect)(()=>{if(l)return l.addTreeUpdateListener(()=>{let b=u.current;f(b.selectionType,b.selectedProperty)})},[l,f,u]),(0,Jo.useEffect)(()=>{if(m)return m.addTreeUpdateListener(()=>{let b=u.current,y=b.selectedTag;if(b.selectionType!=="tag"||!y||y===Lt||y===wt||!m.hasNodes())return;let v=m.resolveSelectionTagPath(y);if(!v){n({type:"SET_SELECTED_FOLDER",folder:t.vault.getRoot(),historyBehavior:"replace"});return}v!==y&&n({type:"SET_SELECTED_TAG",tag:v,historyBehavior:"replace"})})},[t.vault,n,u,m]),(0,Jo.useEffect)(()=>{if(!p)return;let b=w=>{let T=u.current.selectedTag;if(!(!T||!w.oldCanonicalPath||!w.newCanonicalPath)&&(T===w.oldCanonicalPath||T.startsWith(`${w.oldCanonicalPath}/`))){let F=T.slice(w.oldCanonicalPath.length),k=F?`${w.newCanonicalPath}${F}`:w.newCanonicalPath;n({type:"SET_SELECTED_TAG",tag:k,historyBehavior:"replace"})}},y=w=>{let T=u.current.selectedTag;if(!(!T||!w.canonicalPath)&&(T===w.canonicalPath||T.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"})}},v=p.addTagRenameListener(b),S=p.addTagDeleteListener(y);return()=>{v(),S()}},[n,u,p]),(0,Jo.useEffect)(()=>{if(!s)return;let b=w=>{let T=u.current,F=T.selectedProperty;if(!F||T.selectionType!=="property"||F===_e)return;let k=en(F);if(!k)return;let P=Nn(k);if(!P||P.key!==w.oldKey)return;let E=P.valuePath?fa(w.newKey,P.valuePath):or(w.newKey);g.current=E,n({type:"SET_SELECTED_PROPERTY",nodeId:E,historyBehavior:"replace"})},y=w=>{let T=u.current,F=T.selectedProperty;if(!F||T.selectionType!=="property"||F===_e)return;let k=en(F);if(!k)return;let P=Nn(k);!P||P.key!==w.key||(g.current=null,a.showProperties?n({type:"SET_SELECTED_PROPERTY",nodeId:_e,historyBehavior:"replace"}):n({type:"SET_SELECTED_FOLDER",folder:t.vault.getRoot(),historyBehavior:"replace"}))},v=s.addPropertyKeyRenameListener(b),S=s.addPropertyKeyDeleteListener(y);return()=>{v(),S()}},[t.vault,n,a.showProperties,s,u]),(0,Jo.useEffect)(()=>{let b=a.showProperties&&c.selectionType==="property"&&c.selectedProperty===_e;!i&&c.selectionType==="property"&&!b&&(a.showProperties?e({type:"SET_SELECTED_PROPERTY",nodeId:_e,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,Jo.useMemo)(()=>{let b=Array.from(Du(a,"navigation"));return b.length===0?"":(b.sort(),b.join(""))},[a]);(0,Jo.useEffect)(()=>{f(c.selectionType,c.selectedProperty)},[h,f,a.showProperties,c.selectedProperty,c.selectionType]),(0,Jo.useEffect)(()=>{let b=`selection-context-${Math.random().toString(36).substring(2,11)}`;return r?.(b,(v,S)=>{e({type:"UPDATE_FILE_PATH",oldPath:v,newPath:S})}),()=>{o?.(b)}},[e,r,o])}function qJ({api:t,app:e,state:n}){(0,Jo.useEffect)(()=>{KF(lt.selectedFolderKey,n.selectedFolder?n.selectedFolder.path:null,"Failed to save selected folder to localStorage:")},[n.selectedFolder]),(0,Jo.useEffect)(()=>{KF(lt.selectedTagKey,n.selectedTag,"Failed to save selected tag to localStorage:")},[n.selectedTag]),(0,Jo.useEffect)(()=>{KF(lt.selectedPropertyKey,n.selectedProperty,"Failed to save selected property to localStorage:")},[n.selectedProperty]),(0,Jo.useEffect)(()=>{let r=n.selectedFile??SA(n.selectedFiles,e);KF(lt.selectedFileKey,r?r.path:null,"Failed to save selected file to localStorage:")},[e,n.selectedFile,n.selectedFiles]),(0,Jo.useEffect)(()=>{KF(lt.selectedFilesKey,n.selectedFiles.size>0?Array.from(n.selectedFiles):null,"Failed to save selected files to localStorage:"),t?.[Ka].selection.updateFileState(n.selectedFiles,n.selectedFile)},[t,n.selectedFile,n.selectedFiles]),(0,Jo.useEffect)(()=>{t?.[Ka].selection.updateNavigationState(n.selectedFolder,n.selectedTag,n.selectedProperty)},[t,n.selectedFolder,n.selectedProperty,n.selectedTag])}var Jo,YJ=U(()=>{Jo=he(Ve());vP();jr();Lg();Ue();un();$r();Cn();sn();VF();VF()});function ree({children:t,app:e,api:n,tagTreeService:r,propertyTreeService:o,onFileRename:a,onFileRenameUnsubscribe:i}){let s=yt(),l=jt(),c=Kv(s),{tagOperations:u,propertyOperations:p}=vt(),[m,g]=(0,Nr.useReducer)((k,P)=>KJ(k,P,e),void 0,()=>UJ({app:e,settings:s})),f=WJ(m),h=(0,Nr.useRef)(new Set),b=(0,Nr.useMemo)(()=>({subscribe:k=>(h.current.add(k),()=>{h.current.delete(k)})}),[]),y=GJ({app:e,dispatch:g,includeDescendantNotes:l.includeDescendantNotes,propertyTreeService:o,settings:s,showHiddenItems:l.showHiddenItems,tagTreeService:r});jJ({app:e,dispatch:g,enhancedDispatch:y,onFileRename:a,onFileRenameUnsubscribe:i,pluginSettings:s,propertyFeatureEnabled:c,propertyOperations:p,propertyTreeService:o,state:m,stateRef:f,tagOperations:u,tagTreeService:r}),qJ({api:n,app:e,state:m}),(0,Nr.useEffect)(()=>{h.current.forEach(k=>{k(m)})},[m]);let v=(0,Nr.useMemo)(()=>({selectionType:m.selectionType,selectedFolder:m.selectedFolder,selectedTag:m.selectedTag,selectedProperty:m.selectedProperty}),[m.selectedFolder,m.selectedProperty,m.selectedTag,m.selectionType]),S=(0,Nr.useMemo)(()=>({selectedFiles:m.selectedFiles,selectedFile:m.selectedFile,anchorIndex:m.anchorIndex,lastMovementDirection:m.lastMovementDirection}),[m.anchorIndex,m.lastMovementDirection,m.selectedFile,m.selectedFiles]),w=(0,Nr.useMemo)(()=>({isRevealOperation:m.isRevealOperation,isFolderChangeWithAutoSelect:m.isFolderChangeWithAutoSelect,isKeyboardNavigation:m.isKeyboardNavigation,isFolderNavigation:m.isFolderNavigation,revealSource:m.revealSource}),[m.isFolderChangeWithAutoSelect,m.isFolderNavigation,m.isKeyboardNavigation,m.isRevealOperation,m.revealSource]),T=(0,Nr.useMemo)(()=>({isRevealOperation:m.isRevealOperation,revealSource:m.revealSource}),[m.isRevealOperation,m.revealSource]),F=(0,Nr.useMemo)(()=>({navigationHistory:m.navigationHistory,navigationHistoryIndex:m.navigationHistoryIndex}),[m.navigationHistory,m.navigationHistoryIndex]);return(0,fm.jsx)($J.Provider,{value:v,children:(0,fm.jsx)(XJ.Provider,{value:S,children:(0,fm.jsx)(QJ.Provider,{value:w,children:(0,fm.jsx)(ZJ.Provider,{value:T,children:(0,fm.jsx)(JJ.Provider,{value:F,children:(0,fm.jsx)(eee.Provider,{value:f,children:(0,fm.jsx)(tee.Provider,{value:b,children:(0,fm.jsx)(nee.Provider,{value:y,children:t})})})})})})})})}function nd(){let t=(0,Nr.useContext)($J);if(!t)throw new Error("useNavigationSelection must be used within SelectionProvider");return t}function UF(){let t=(0,Nr.useContext)(XJ);if(!t)throw new Error("useFileSelection must be used within SelectionProvider");return t}function bPe(){let t=(0,Nr.useContext)(QJ);if(!t)throw new Error("useSelectionFlags must be used within SelectionProvider");return t}function oee(){let t=(0,Nr.useContext)(ZJ);if(!t)throw new Error("useSelectionReveal must be used within SelectionProvider");return t}function aee(){let t=(0,Nr.useContext)(eee);if(!t)throw new Error("useSelectionStateRefValue must be used within SelectionProvider");return t}function iee(){let t=(0,Nr.useContext)(tee);if(!t)throw new Error("useSelectionStateSubscription must be used within SelectionProvider");return t}function SPe(){let t=(0,Nr.useContext)(JJ);if(!t)throw new Error("useSelectionHistory must be used within SelectionProvider");return t}function hr(){let t=nd(),e=UF(),n=bPe(),r=SPe();return(0,Nr.useMemo)(()=>({...t,...e,...n,...r}),[e,t,n,r])}function ar(){let t=(0,Nr.useContext)(nee);if(!t)throw new Error("useSelectionDispatch must be used within SelectionProvider");return t}var Nr,fm,$J,XJ,QJ,ZJ,JJ,eee,tee,nee,Ur=U(()=>{Nr=he(Ve());on();gr();fn();un();YJ();VF();VF();fm=he($e()),$J=(0,Nr.createContext)(null),XJ=(0,Nr.createContext)(null),QJ=(0,Nr.createContext)(null),ZJ=(0,Nr.createContext)(null),JJ=(0,Nr.createContext)(null),eee=(0,Nr.createContext)(null),tee=(0,Nr.createContext)(null),nee=(0,Nr.createContext)(null)});function WF(t){return t instanceof kA.TFolder}function TA(t){return t instanceof kA.TFile}function lee({children:t}){let e=yt(),n=bl(),{app:r}=vt(),[o,a]=(0,An.useState)(0),i=(0,An.useRef)(new Map),s=(0,An.useMemo)(()=>Gk(e.vaultProfiles,e.vaultProfile),[e.vaultProfiles,e.vaultProfile]),l=s.id,c=(0,An.useMemo)(()=>s.shortcuts??[],[s]),u=(0,An.useMemo)(()=>e.vaultProfiles.map(M=>{let H=M.shortcuts??[];return{id:M.id,shortcuts:H,fingerprint:_V(H)}}),[e.vaultProfiles]);(0,An.useEffect)(()=>{let M=i.current,H=new Set(u.map(j=>j.id));if(M.forEach((j,_)=>{H.has(_)||M.delete(_)}),u.length===0)return;let q=u.filter(j=>M.get(j.id)!==j.fingerprint);if(q.length===0)return;let X=q.filter(j=>j.shortcuts.some(_=>{if(Oo(_)){let W=at(_.tagPath);return W!==null&&W!==_.tagPath}if(ya(_)){let W=Up(_.nodeId);return W!==null&&W!==_.nodeId}return!1})),V=new Set(X.map(j=>j.id));q.forEach(j=>{V.has(j.id)||M.set(j.id,j.fingerprint)}),X.length!==0&&$(async()=>{await n(j=>{X.forEach(_=>{let W=j.vaultProfiles.find(Y=>Y.id===_.id);if(!W||!Array.isArray(W.shortcuts)){M.set(_.id,_.fingerprint);return}let J=!1,Z=W.shortcuts.map(Y=>{if(!Oo(Y)){if(!ya(Y))return Y;let le=Up(Y.nodeId);return!le||le===Y.nodeId?Y:(J=!0,{...Y,nodeId:le})}let ne=at(Y.tagPath);return!ne||ne===Y.tagPath?Y:(J=!0,{...Y,tagPath:ne})});if(J){W.shortcuts=Z,M.set(_.id,_V(Z));return}let re=_V(W.shortcuts??[]);M.set(_.id,re)})})})},[u,n]);let p=(0,An.useCallback)(async M=>{if(!l)return!1;let H=!1;return await n(q=>{let X=q.vaultProfiles.find(_=>_.id===l);if(!X)return;let V=Array.isArray(X.shortcuts)?X.shortcuts:[],j=M(V);j&&(X.shortcuts=j,H=!0)}),H},[l,n]),m=(0,An.useMemo)(()=>{let M=new Map;return c.forEach(H=>{M.set(Ad(H),H)}),M},[c]),g=(0,An.useMemo)(()=>j4(r,c),[r,c,o]),f=(0,An.useMemo)(()=>q4(c,g),[c,g]),h=f.folderShortcutKeysByPath,b=f.noteShortcutKeysByPath,y=(0,An.useMemo)(()=>{let M=new Map;return c.forEach(H=>{if(Oo(H)){let q=at(H.tagPath);q&&M.set(q,Ad(H))}}),M},[c]),v=(0,An.useMemo)(()=>{let M=new Map;return c.forEach(H=>{if(ya(H)){let q=Up(H.nodeId);q&&M.set(q,Ad(H))}}),M},[c]),S=(0,An.useMemo)(()=>{let M=new Map;return c.forEach(H=>{if(Qi(H)){let q=Wp(H.name);q&&M.set(q,H)}}),M},[c]);(0,An.useEffect)(()=>{let M=new Map(h),H=new Map(b),q=new Set(Array.from(M.keys(),Gl)),X=new Set(Array.from(H.keys(),Gl));if(M.size===0&&H.size===0)return;let V=r.vault,j=le=>M.has(le)||H.has(le),_=(le,ae)=>j(ae)?!0:WF(le)?q.has(Gl(ae)):X.has(Gl(ae)),W=le=>{!WF(le)&&!TA(le)||_(le,le.path)&&a(ae=>ae+1)},J=le=>{!WF(le)&&!TA(le)||_(le,le.path)&&a(ae=>ae+1)},Z=(le,ae)=>{!WF(le)&&!TA(le)||(_(le,ae)||_(le,le.path))&&a(ve=>ve+1)},re=V.on("create",W),Y=V.on("delete",J),ne=V.on("rename",(le,ae)=>{Z(le,ae)});return()=>{V.offref(re),V.offref(Y),V.offref(ne)}},[r.vault,h,b]);let w=(0,An.useMemo)(()=>c.map(M=>{let H=Ad(M);if(ia(M)){let q=g.folderTargetsByPath.get(M.path)??null;return WF(q)?{key:H,shortcut:M,folder:q,note:null,search:null,tagPath:null,propertyNodeId:null,isMissing:!1}:{key:H,shortcut:M,folder:null,note:null,search:null,tagPath:null,propertyNodeId:null,isMissing:!0}}if(Do(M)){let q=g.noteTargetsByPath.get(M.path)??null;return TA(q)?{key:H,shortcut:M,folder:null,note:q,search:null,tagPath:null,propertyNodeId:null,isMissing:!1}:{key:H,shortcut:M,folder:null,note:null,search:null,tagPath:null,propertyNodeId:null,isMissing:!0}}if(Oo(M)){let q=at(M.tagPath);return{key:H,shortcut:M,folder:null,note:null,search:null,tagPath:q??M.tagPath,propertyNodeId:null,isMissing:!q}}if(ya(M)){let q=Up(M.nodeId);return{key:H,shortcut:M,folder:null,note:null,search:null,tagPath:null,propertyNodeId:q??M.nodeId,isMissing:!q}}return{key:H,shortcut:M,folder:null,note:null,search:M,tagPath:null,propertyNodeId:null,isMissing:!1}}),[c,g]),T=(0,An.useCallback)(async(M,H)=>p(q=>{let X=[...q],V=typeof H=="number"?Math.max(0,Math.min(H,X.length)):X.length;return X.splice(V,0,M),X}),[p]),F=(0,An.useCallback)(async(M,H)=>{if(M.length===0)return 0;let q=new Set(h.keys()),X=new Set(b.keys()),V=new Set(y.keys()),j=new Set(v.keys()),_=new Set(S.keys()),W=!1,J=!1,Z=!1,re=!1,Y=!1,ne=!1,le=!1,ae=!1,ve=!1,de=[];return M.forEach(Fe=>{if(Fe.type===zn.FOLDER){if(q.has(Fe.path)){W=!0;return}q.add(Fe.path),de.push(Fe);return}if(Fe.type===zn.NOTE){if(X.has(Fe.path)){J=!0;return}X.add(Fe.path),de.push(Fe);return}if(Fe.type===zn.TAG){let te=at(Fe.tagPath);if(!te){re=!0;return}if(V.has(te)){Z=!0;return}V.add(te),de.push({...Fe,tagPath:te});return}if(Fe.type===zn.PROPERTY){let te=Up(Fe.nodeId);if(!te){ne=!0;return}if(j.has(te)){Y=!0;return}if(j.add(te),te===Fe.nodeId){de.push(Fe);return}de.push({...Fe,nodeId:te});return}if(Fe.type===zn.SEARCH){let te=Fe.name.trim(),ye=Fe.query.trim(),ce=mx(Fe.startTarget);if(!te){ae=!0;return}if(!ye){ve=!0;return}let pe=Wp(te);if(_.has(pe)){le=!0;return}_.add(pe),de.push({...Fe,name:te,query:ye,startTarget:ce})}}),W&&oe(d.shortcuts.folderExists,{variant:"warning"}),J&&oe(d.shortcuts.noteExists,{variant:"warning"}),Z&&oe(d.shortcuts.tagExists,{variant:"warning"}),re&&oe(d.modals.tagOperation.invalidTagName,{variant:"warning"}),Y&&oe(d.shortcuts.propertyExists,{variant:"warning"}),ne&&oe(d.shortcuts.invalidProperty,{variant:"warning"}),le&&oe(d.shortcuts.searchExists,{variant:"warning"}),ae&&oe(d.shortcuts.emptySearchName,{variant:"warning"}),ve&&oe(d.shortcuts.emptySearchQuery,{variant:"warning"}),de.length===0?0:await p(Fe=>{let te=[...Fe],ye=typeof H?.index=="number"?Math.max(0,Math.min(H.index,te.length)):te.length;return de.forEach(ce=>{te.splice(ye,0,ce),ye+=1}),te})?de.length:0},[h,b,y,v,S,p]),k=(0,An.useCallback)(async(M,H)=>h.has(M)?(oe(d.shortcuts.folderExists,{variant:"warning"}),!1):T({type:zn.FOLDER,path:M},H?.index),[T,h]),P=(0,An.useCallback)(async(M,H)=>b.has(M)?(oe(d.shortcuts.noteExists,{variant:"warning"}),!1):T({type:zn.NOTE,path:M},H?.index),[T,b]),E=(0,An.useCallback)(async(M,H)=>{let q=at(M);return q?y.has(q)?(oe(d.shortcuts.tagExists,{variant:"warning"}),!1):T({type:zn.TAG,tagPath:q},H?.index):!1},[T,y]),C=(0,An.useCallback)(async(M,H)=>{let q=Up(M);return q?v.has(q)?(oe(d.shortcuts.propertyExists,{variant:"warning"}),!1):T({type:zn.PROPERTY,nodeId:q},H?.index):(oe(d.shortcuts.invalidProperty,{variant:"warning"}),!1)},[T,v]),L=(0,An.useCallback)(async({name:M,query:H,provider:q,startTarget:X},V)=>{let j=H.trim();if(!j)return oe(d.shortcuts.emptySearchQuery,{variant:"warning"}),!1;let _=M.trim();if(!_)return oe(d.shortcuts.emptySearchName,{variant:"warning"}),!1;let W=Wp(_);if(S.has(W))return oe(d.shortcuts.searchExists,{variant:"warning"}),!1;let J=mx(X);return T({type:zn.SEARCH,name:_,query:j,provider:q,startTarget:J},V?.index)},[T,S]),z=(0,An.useCallback)(async M=>m.has(M)?p(H=>{let q=H.filter(X=>Ad(X)!==M);return q.length===H.length?null:q}):!1,[m,p]),G=(0,An.useCallback)(async(M,H,q)=>{let X=m.get(M);if(!X)return!1;if(Qi(X)){let W=H.trim();if(!W)return oe(d.shortcuts.emptySearchName,{variant:"warning"}),!1;let J=Wp(W),Z=Wp(X.name),re=S.get(J);return J!==Z&&re?(oe(d.shortcuts.searchExists,{variant:"warning"}),!1):p(Y=>{let ne=!1,le=Y.map(ae=>Ad(ae)!==M||!Qi(ae)||ae.name===W?ae:(ne=!0,{...ae,name:W}));return ne?le:null})}let V=H.trim(),j=q?.trim(),_=V.length===0||j&&V===j?void 0:V;return p(W=>{let J=!1,Z=W.map(re=>Ad(re)!==M||re.type===zn.SEARCH||(re.alias&&re.alias.length>0?re.alias:void 0)===_?re:(J=!0,{...re,alias:_}));return J?Z:null})},[S,m,p]),Q=(0,An.useCallback)(async M=>{let H=S.get(Wp(M));return H?z(Ad(H)):!1},[z,S]),R=(0,An.useCallback)(async()=>p(()=>[]),[p]),O=(0,An.useCallback)(async M=>{if(M.length!==c.length)return!1;let H=[];for(let q of M){let X=m.get(q);if(!X)return!1;H.push(X)}return p(()=>H)},[c.length,m,p]),D=(0,An.useCallback)(M=>h.has(M),[h]),x=(0,An.useCallback)(M=>b.has(M),[b]),B=(0,An.useCallback)(M=>{let H=at(M);return H?y.has(H):!1},[y]),I=(0,An.useCallback)(M=>{let H=Up(M);return H?v.has(H):!1},[v]),A=(0,An.useCallback)(M=>S.get(Wp(M)),[S]),N=(0,An.useMemo)(()=>({shortcuts:c,hydratedShortcuts:w,shortcutMap:m,folderShortcutKeysByPath:h,noteShortcutKeysByPath:b,tagShortcutKeysByPath:y,propertyShortcutKeysByNodeId:v,searchShortcutsByName:S,addFolderShortcut:k,addNoteShortcut:P,addTagShortcut:E,addPropertyShortcut:C,addSearchShortcut:L,addShortcutsBatch:F,removeShortcut:z,renameShortcut:G,removeSearchShortcut:Q,clearShortcuts:R,reorderShortcuts:O,hasFolderShortcut:D,hasNoteShortcut:x,hasTagShortcut:B,hasPropertyShortcut:I,findSearchShortcut:A}),[c,w,m,h,b,y,v,S,k,P,E,C,L,F,z,G,Q,R,O,D,x,B,I,A]);return(0,dee.jsx)(see.Provider,{value:N,children:t})}function Xd(){let t=(0,An.useContext)(see);if(!t)throw new Error("useShortcuts must be used within a ShortcutsProvider");return t}var An,kA,dee,wPe,_V,see,ph=U(()=>{An=he(Ve()),kA=require("obsidian");on();fn();Ha();Oe();bn();Cn();st();sn();Ob();dee=he($e()),wPe=t=>{if(ia(t)||Do(t)||Oo(t)||ya(t)){let n=Oo(t)?t.tagPath:ya(t)?t.nodeId:t.path;return`${t.type}:${n}`}let e=_k(t.startTarget);return`${t.type}:${t.name}:${t.query}:${t.provider}:${e}`},_V=t=>t.length===0?"empty":t.map(wPe).join("|"),see=(0,An.createContext)(null)});function uee({children:t}){let e=(0,mh.useRef)(null),n=(0,mh.useMemo)(()=>({getSession:()=>e.current,setSession:r=>{e.current=r},clearSession:()=>{e.current=null}}),[]);return(0,pee.jsx)(cee.Provider,{value:n,children:t})}function US(){let t=(0,mh.useContext)(cee);if(!t)throw new Error("useInternalDragSession must be used within InternalDragSessionProvider");return t}var mh,pee,cee,GF=U(()=>{mh=he(Ve()),pee=he($e()),cee=(0,mh.createContext)(null)});function Qd(t){return typeof t=="string"&&t.length>0}function PPe(t){let e=[];for(let n of t)Qd(n)&&e.push(n);return e}function mee(t,e){return e?.getPathType?.(t)??null}function FPe(t,e){let n=mee(t,e),r=`${t}.md`,o=mee(r,e);return n==="file"?t:o==="file"?r:t}function CPe(t,e){let n=t.trim();if(!n||!n.startsWith(kPe))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 Qd(a)?FPe(a,e):null}catch{return null}}function gee(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=>CPe(a,e)).filter(Qd);return o.length>0?o:null}function HV(t){let e=Array.from(t??[]);return e.includes(hee)||e.includes(fee)}function WS(t){let e=Array.from(t??[]);return HV(e)||e.length===2&&e.includes(yee)&&e.includes(vee)}function jF(t){return Array.from(t??[]).includes(TPe)}function NPe(t){let e=t.trim();if(!e)return null;try{let n=JSON.parse(e);if(Array.isArray(n)){let r=PPe(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 PA(t,e){if(!t)return null;let n=t.getData(fee);if(Qd(n)){let i=NPe(n);if(i&&i.length>0)return i}let r=t.getData(hee);if(Qd(r))return[r];let o=t.getData(yee);if(Qd(o)){let i=gee(o,e);if(i&&i.length>0)return i}let a=t.getData(vee);if(Qd(a)){let i=gee(a,e);if(i&&i.length>0)return i}return null}function bee(t){let e=t.trim();if(!e)return null;try{let n=JSON.parse(e);if(Qd(n))return n;if(n&&typeof n=="object"){let r=n,o=Qd(r.canonicalPath)?r.canonicalPath:null,a=Qd(r.displayPath)?r.displayPath:null;return o||a||null}}catch{return e}return null}function See(t){let e=t.trim();if(!e)return null;try{let n=JSON.parse(e);if(Qd(n))return n;if(n&&typeof n=="object"){let r=n;return Qd(r.nodeId)?r.nodeId:null}}catch{return e}return null}var hee,fee,yee,vee,TPe,kPe,FA=U(()=>{hee="obsidian/file",fee="obsidian/files",yee="text/uri-list",vee="text/plain",TPe="Files",kPe="obsidian://open"});function ym(t,e){return t==="/"&&!e}function da(t,e,n){return ym(t,n)||e.has(t)}function IPe(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 Tee(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 kee(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 xPe(t){return t.type==="virtual-folder"?Tee(t):kee(t.type,[...t.ancestorIds??[],t.id],!0)}function EPe(t,e){let n=IPe(t,e);return{isExpanded:n,hasChildren:t.hasChildren,canExpand:t.hasChildren&&!n,canCollapse:n}}function Zd(t,e,n,r="toggle",o){let a=EPe(t,e);return(r==="expand"?a.canExpand:r==="collapse"?a.canCollapse:a.canExpand||a.canCollapse)?(o?.collapseOtherBranches&&a.canExpand?n(xPe(t)):n(Tee(t)),!0):!1}function Os({type:t,ids:e,collapseOtherBranches:n,dispatch:r}){e.length!==0&&r(kee(t,e,n))}function tp(t,e){let n=[],r=t.parent;for(;r;){if(r.path==="/"){e?.includeRootFolder!==!1&&n.unshift(r.path);break}n.unshift(r.path),r=r.parent}return n}function qF(t){if(!t.includes("/"))return[];let e=t.split("/"),n=[];for(let r=1;r0,ancestorIds:qF(t.data.path)};case be.PROPERTY_KEY:case be.PROPERTY_VALUE:return{type:"property",id:t.data.id,hasChildren:t.data.children.size>0,ancestorIds:VV(t.data.id)};case be.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 wee,qc=U(()=>{wee=require("obsidian");Ue();wr();un()});function Iee(t){let{app:e,isMobile:n,tagTreeService:r,propertyTreeService:o}=vt(),a=Ti(),i=HS(),s=hr(),l=ar(),c=yt(),u=jt(),p=US(),m=u.includeDescendantNotes,g=u.showHiddenItems,f=la(),h=Wa(),b=(0,pn.useRef)(null),y=(0,pn.useRef)(null),v=(0,pn.useRef)(null),S=(0,pn.useRef)(0),w=(0,pn.useRef)(f.expandedFolders),T=(0,pn.useRef)(f.expandedTags),F=(0,pn.useRef)(null),k=(0,pn.useRef)(null),P=(0,pn.useRef)(null),E=(0,pn.useRef)(null),C=(0,pn.useRef)(0),L=(0,pn.useRef)(new Set),z=(0,pn.useMemo)(()=>{let te=c.springLoadedFoldersInitialDelay;return Number.isFinite(te)?Math.round(Math.min(2,Math.max(.1,te))*1e3):CA},[c.springLoadedFoldersInitialDelay]),G=(0,pn.useMemo)(()=>{let te=c.springLoadedFoldersSubsequentDelay;return Number.isFinite(te)?Math.round(Math.min(2,Math.max(.1,te))*1e3):CA},[c.springLoadedFoldersSubsequentDelay]),Q=(0,pn.useCallback)(te=>{if(cU(e))try{if(!te){e.dragManager.draggable=null;return}let ye=e.dragManager.draggable,ce=ye?{...ye,...te}:{...te};e.dragManager.draggable=ce}catch(ye){console.error("[Notebook Navigator] Failed to set drag payload",ye)}},[e]),R=te=>te instanceof HTMLElement,O=te=>te===K.FILE||te===K.FOLDER||te===K.TAG||te===K.PROPERTY,D=(0,pn.useCallback)(te=>{te.classList.add("nn-dragging"),L.current.add(te)},[]),x=(0,pn.useCallback)(()=>{L.current.forEach(te=>{te.classList.remove("nn-dragging")}),L.current.clear()},[]),B=(0,pn.useCallback)(()=>{let te=t.current;te&&te.querySelectorAll(".nn-file[data-drag-path]").forEach(ye=>{let ce=$N(ye,"data-drag-path");ce&&s.selectedFiles.has(ce)&&D(ye)})},[t,D,s.selectedFiles]),I=(0,pn.useCallback)((te,ye)=>{let pe=(t.current?.win??activeWindow).createDiv();return pe.className="nn-drag-preview-badge",pe.textContent=`${ye}`,Xk(te,pe)},[t]),A=(0,pn.useCallback)((te,ye,ce,pe,ue,Se)=>{let ee=LPe(ye,ce,ue,Se);if(ee.length===0)return!1;let Ce=(t.current?.win??activeWindow).createDiv();Ce.className="nn-drag-preview-icon";let we=pe??"#ffffff";return Ce.style.color=we,Ce.style.setProperty("--icon-color",we),Ce.style.fill=we,Ce.style.stroke=we,ee.some(We=>zPe(Ce,We))?Xk(te,Ce):!1},[t]),N=(0,pn.useCallback)(()=>ba({selectionType:s.selectionType,selectedFolder:s.selectedFolder,selectedTag:s.selectedTag,selectedProperty:s.selectedProperty},c,{includeDescendantNotes:m,showHiddenItems:g},e,r,o),[s,c,m,g,e,r,o]),M=(0,pn.useCallback)(te=>{let ye=[];for(let ce of te){let pe=e.vault.getFileByPath(ce);pe&&ye.push(pe)}return ye},[e]),H=(0,pn.useCallback)(te=>{let ye=e.vault.getAbstractFileByPath(te);return ye instanceof vm.TFile?"file":ye instanceof vm.TFolder?"folder":null},[e]),q=(0,pn.useCallback)(te=>{let ye=PA(te,{getPathType:H,vaultName:e.vault.getName()});if(ye&&ye.length>0)return ye;let ce=p.getSession();return ce?.type===K.FILE&&ce.filePaths.length>0?ce.filePaths:null},[e,H,p]),X=(0,pn.useCallback)(te=>{let ye=te?.getData(Pee);if(ye)return ye;let ce=p.getSession();return ce?.type===K.FOLDER?ce.folderPath:null},[p]),V=(0,pn.useCallback)(async(te,ye)=>{let ce=N();await a.moveFilesToFolder({files:te,targetFolder:ye,selectionContext:{selectedFile:s.selectedFile,dispatch:l,allFiles:ce},showNotifications:!0})},[a,N,s.selectedFile,l]),j=(0,pn.useCallback)(te=>{let ye=q(te.dataTransfer??null);if(!ye||ye.length===0)return{files:[],hasNonMarkdown:!1};let ce=M(ye);if(ce.length===0)return{files:[],hasNonMarkdown:!1};let pe=ce.some(ue=>ue.extension!=="md");return{files:ce,hasNonMarkdown:pe}},[q,M]),_=(0,pn.useCallback)(te=>{if(!R(te.target))return;S.current=0,p.clearSession(),x();let ye=te.target.closest('[data-draggable="true"]');if(!ye||!ye.instanceOf(HTMLElement))return;let ce=$N(ye,"data-drag-path"),pe=ye.getAttribute("data-drag-type"),ue=ye.getAttribute("data-drag-canonical"),Se=ye.getAttribute("data-drag-icon"),ee=ye.getAttribute("data-drag-fallback-icon"),ie=ye.getAttribute("data-drag-base-icon"),Ce=ye.getAttribute("data-drag-icon-color"),we=ye.getAttribute("data-drag-allow-multi-file")!=="false",Le=Se&&Se.trim().length>0?Se:void 0,We=ee&&ee.trim().length>0?ee:void 0,Nt=ie&&ie.trim().length>0?ie:void 0,Pt=Ce&&Ce.trim().length>0?Ce:void 0;if(!ce||!te.dataTransfer)return;let Zt=we&&pe===K.FILE&&s.selectedFiles.has(ce)&&s.selectedFiles.size>1;if(Q(null),Zt){let Ie=Array.from(s.selectedFiles);te.dataTransfer.effectAllowed="all",F.current=K.FILE;let De=M(Ie);De.length>0&&(p.setSession({type:K.FILE,filePaths:De.map(Me=>Me.path)}),Cee(te.dataTransfer,e.vault.getName(),De),Q({type:"files",files:De,title:`${De.length} files`})),B(),I(te,Ie.length);return}if(pe===K.FOLDER){let Ie=e.vault.getFolderByPath(ce);Ie&&p.setSession({type:K.FOLDER,folderPath:Ie.path}),te.dataTransfer.setData(Pee,ce)}if(pe===K.FILE||pe===K.FOLDER||pe===K.TAG||pe===K.PROPERTY?F.current=pe:F.current=K.FILE,te.dataTransfer.effectAllowed=pe===K.PROPERTY?"copy":"all",pe===K.FILE){let Ie=e.vault.getFileByPath(ce);Ie&&(p.setSession({type:K.FILE,filePaths:[Ie.path]}),Cee(te.dataTransfer,e.vault.getName(),[Ie]),Q({type:"file",file:Ie,title:Ie.basename}))}else if(pe===K.TAG){P.current=ce,E.current=ue??null,p.setSession({type:K.TAG,displayPath:ce,canonicalPath:ue??Mt(ce)});try{let Ie={displayPath:ce,canonicalPath:ue??Mt(ce)};te.dataTransfer.setData(Bh,JSON.stringify(Ie)),te.dataTransfer.setData("text/plain",`#${ce}`)}catch(Ie){console.error("[Notebook Navigator] Failed to attach tag drag payload",Ie)}Q({type:"tag",title:ce})}else if(pe===K.PROPERTY){p.setSession({type:K.PROPERTY,nodeId:ce});try{let Ie={nodeId:ce};te.dataTransfer.setData(fT,JSON.stringify(Ie))}catch(Ie){console.error("[Notebook Navigator] Failed to attach property drag payload",Ie)}}D(ye);let ze=O(pe)?pe:null;A(te,ze,Le,Pt,We,Nt)},[s,e,M,p,Q,x,D,B,I,A]);(0,pn.useEffect)(()=>{w.current=f.expandedFolders},[f.expandedFolders]),(0,pn.useEffect)(()=>{T.current=f.expandedTags},[f.expandedTags]);let W=(0,pn.useCallback)(()=>{y.current!==null&&(window.clearTimeout(y.current),y.current=null),v.current=null},[]);(0,pn.useEffect)(()=>{c.springLoadedFolders||W()},[c.springLoadedFolders,W]);let J=(0,pn.useCallback)(te=>{if(v.current?.type===te.type&&v.current.path===te.path||(W(),te.isAlreadyExpanded()))return;let ye=te.resolveNode();if(!ye.isValid||!ye.hasChildren)return;let ce=S.current===0?z:G;v.current={type:te.type,path:te.path},y.current=window.setTimeout(()=>{let pe=te.resolveNode();if(!pe.isValid){W();return}pe.hasChildren&&!te.isAlreadyExpanded()&&(te.expand(),S.current+=1),W()},ce)},[W,z,G]),Z=(0,pn.useCallback)(te=>{J({type:"folder",path:te,isAlreadyExpanded:()=>da(te,w.current,c.showRootFolder),resolveNode:()=>{let ye=e.vault.getFolderByPath(te);return ye?{isValid:!0,hasChildren:ye.children.some(ce=>ce instanceof vm.TFolder)}:{isValid:!1,hasChildren:!1}},expand:()=>{let ye=c.collapseOtherBranchesOnExpand?e.vault.getFolderByPath(te):null,ce=ye?[...tp(ye,{includeRootFolder:c.showRootFolder}),te]:[te];Os({type:"folder",ids:ce,collapseOtherBranches:c.collapseOtherBranchesOnExpand,dispatch:h})}})},[e,h,J,c.collapseOtherBranchesOnExpand,c.showRootFolder]),re=(0,pn.useCallback)(te=>{r&&J({type:"tag",path:te,isAlreadyExpanded:()=>T.current.has(te),resolveNode:()=>{if(!r)return{isValid:!1,hasChildren:!1};let ye=r.findTagNode(te);return ye?{isValid:!0,hasChildren:ye.children.size>0}:{isValid:!1,hasChildren:!1}},expand:()=>{let ye=c.collapseOtherBranchesOnExpand?[...qF(te),te]:[te];Os({type:"tag",ids:ye,collapseOtherBranches:c.collapseOtherBranchesOnExpand,dispatch:h})}})},[r,h,J,c.collapseOtherBranchesOnExpand]),Y=(0,pn.useCallback)((te,ye)=>{if(!c.springLoadedFolders){W();return}if(te==="folder"){Z(ye);return}re(ye)},[c.springLoadedFolders,W,Z,re]),ne=(0,pn.useCallback)(te=>{if(!R(te.target))return;let ye=te.target.closest('[data-drop-zone="folder"],[data-drop-zone="tag"],[data-drop-zone="tag-root"],[data-drop-zone="property"]'),ce=!!te.dataTransfer?.types?.includes(Yv);if(b.current&&b.current!==ye&&(b.current.classList.remove("nn-drag-over"),b.current=null,k.current=null,W()),!ye){ce&&te.dataTransfer&&(te.dataTransfer.dropEffect="none"),k.current=null,W();return}if(b.current===ye&&k.current&&te.dataTransfer){te.preventDefault(),te.dataTransfer.dropEffect=k.current;return}if(ce){ye.classList.remove("nn-drag-over"),b.current=null,k.current=null,W(),te.dataTransfer&&(te.dataTransfer.dropEffect="none");return}if(F.current===K.PROPERTY){ye.classList.remove("nn-drag-over"),b.current=null,k.current=null,W(),te.dataTransfer&&(te.dataTransfer.dropEffect="none");return}if(te.dataTransfer){let pe=ye.getAttribute("data-drop-zone"),ue=ye.getAttribute("data-drop-path"),Se=ye.dataset.allowInternalDrop!=="false",ee=ye.dataset.allowExternalDrop!=="false",ie=te.dataTransfer.types,Ce=p.getSession(),we=Ce?.type===K.FILE&&Ce.filePaths.length>0,Le=Ce?.type===K.FOLDER,We=Ce?.type===K.TAG,Nt=WS(ie)||we||Le,Pt=!!ie?.includes(Bh)||We,Zt=jF(ie)||!!(te.dataTransfer.files&&te.dataTransfer.files.length>0),ze=Nt||Pt,Ie=Zt&&!ze;if(pe==="property"){let Me=F.current===K.FOLDER,nt=F.current===K.TAG;if(Me||nt||!Nt||Ie){b.current===ye&&(ye.classList.remove("nn-drag-over"),b.current=null,k.current=null),W(),te.dataTransfer.dropEffect="none";return}}if(ze&&!Se||Ie&&!ee){b.current===ye&&(ye.classList.remove("nn-drag-over"),b.current=null,k.current=null),W(),te.dataTransfer.dropEffect="none";return}if(!Fee(pe,{hasObsidianData:Nt,hasTagPayload:Pt,isExternalOnly:Ie})){b.current===ye&&(ye.classList.remove("nn-drag-over"),b.current=null,k.current=null),W(),te.dataTransfer.dropEffect="none";return}te.preventDefault();let De=!!ie?.includes("Files")&&!ze;if(pe==="folder"){if(F.current===K.TAG){b.current===ye&&(ye.classList.remove("nn-drag-over"),b.current=null,k.current=null),W(),te.dataTransfer.dropEffect="none";return}te.dataTransfer.dropEffect=De?"copy":"move",ue&&Y("folder",ue)}else if(pe==="tag"){if(F.current===K.FOLDER){b.current===ye&&ye.classList.remove("nn-drag-over"),b.current=null,k.current=null,W(),te.dataTransfer.dropEffect="none";return}if(te.dataTransfer.dropEffect=ue===wt?"move":"copy",ue!==wt){let Me=ye.getAttribute("data-tag");Me?Y("tag",Me):W()}else W()}else pe==="property"&&(W(),te.dataTransfer.dropEffect="move");if(pe==="tag-root"){if(F.current!==K.TAG){b.current===ye&&(ye.classList.remove("nn-drag-over"),b.current=null,k.current=null),W(),te.dataTransfer.dropEffect="none";return}te.dataTransfer.dropEffect="move",W()}}te.defaultPrevented&&(b.current!==ye&&ye.classList.add("nn-drag-over"),b.current=ye,k.current=te.dataTransfer?.dropEffect??null)},[W,p,Y]),le=(0,pn.useCallback)(async(te,ye)=>{let{files:ce,hasNonMarkdown:pe}=j(te);if(ce.length!==0){if(pe){oe(d.fileSystem.notifications.tagsRequireMarkdown,{variant:"warning"});return}if(ye===wt)try{let ue=await i.clearAllTagsFromFiles(ce);if(ue>0){let Se=ue===1?d.fileSystem.notifications.tagsClearedFromNote:d.fileSystem.notifications.tagsClearedFromNotes.replace("{count}",ue.toString());oe(Se,{variant:"success"})}else oe(d.dragDrop.notifications.noTagsToClear,{variant:"warning"})}catch(ue){console.error("Error clearing tags:",ue),oe(d.dragDrop.errors.failedToClearTags,{variant:"warning"})}else try{let{added:ue,skipped:Se}=await i.addTagToFiles(ye,ce);if(ue>0){let ee=ue===1?d.fileSystem.notifications.tagAddedToNote:d.fileSystem.notifications.tagAddedToNotes.replace("{count}",ue.toString());oe(ee,{variant:"success"})}Se>0&&oe(d.dragDrop.notifications.filesAlreadyHaveTag.replace("{count}",Se.toString()),{timeout:_t.NOTICE_ERROR,variant:"warning"})}catch(ue){console.error("Error adding tag:",ue),oe(d.dragDrop.errors.failedToAddTag.replace("{tag}",ye),{variant:"warning"})}}},[j,i]),ae=(0,pn.useCallback)(async(te,ye)=>{let{files:ce,hasNonMarkdown:pe}=j(te);if(ce.length!==0){if(pe){oe(d.fileSystem.notifications.propertiesRequireMarkdown,{variant:"warning"});return}await a.applyPropertyNodeToFiles(ye,ce)}},[a,j]),ve=(0,pn.useCallback)(async(te,ye)=>{let ce={success:0,failed:0},pe=[];for(let ue=0;ue0){let ue=ce.success===1?d.dragDrop.notifications.fileImported:d.dragDrop.notifications.filesImported.replace("{count}",ce.success.toString());oe(ue,{variant:"success"})}if(ce.failed>0){let ue=d.dragDrop.errors.failedToImportFiles.replace("{names}",pe.join(", "));oe(ue,{timeout:_t.NOTICE_ERROR,variant:"warning"})}},[e]),de=(0,pn.useCallback)(async te=>{C.current=Date.now()+RPe;try{let ye=b.current;if(ye&&ye.classList.remove("nn-drag-over"),b.current=null,k.current=null,!ye&&R(te.target)){let Ge=te.target.closest("[data-drop-zone]");ye=Ge instanceof HTMLElement?Ge:null}if(!!te.dataTransfer?.types?.includes(Yv)){W();return}if(F.current===K.PROPERTY){W();return}if(!ye){W();return}let pe=ye.getAttribute("data-drop-zone"),ue=$N(ye,"data-drop-path");if(!pe||!ue){W();return}W();let Se=ye.dataset.allowInternalDrop!=="false",ee=ye.dataset.allowExternalDrop!=="false",ie=te.dataTransfer?.types,Ce=te.dataTransfer?.files??null,we=q(te.dataTransfer??null),Le=X(te.dataTransfer??null),Nt=p.getSession()?.type===K.TAG,Pt=HV(ie)||!!(we&&we.length>0)||!!Le,Zt=!!ie?.includes(Bh)||Nt,ze=jF(ie)||!!(Ce&&Ce.length>0),Ie=Pt||Zt,De=ze&&!Ie;if(Ie&&!Se||De&&!ee||!Fee(pe,{hasObsidianData:Pt,hasTagPayload:Zt,isExternalOnly:De}))return;if(te.preventDefault(),pe==="tag-root"){if(F.current===K.TAG){let Ge=P.current;if(!Ge)return;await i.promoteTagToRoot(Ge)}return}if(pe==="tag"){if(F.current===K.TAG){let Ge=P.current,Tt=E.current;if(!Ge||!Tt)return;let gt=ye.getAttribute("data-tag")??"";if(ue===wt||gt===Lt||ue===Lt||gt===Tt)return;if(gt.startsWith(`${Tt}/`)){oe(d.modals.tagOperation.descendantRenameError,{variant:"warning"});return}await i.renameTagByDrag(Ge,ue);return}if(F.current===K.FOLDER)return;await le(te,ue);return}if(pe==="property"){if(!Pt||De||F.current===K.TAG||F.current===K.FOLDER)return;await ae(te,ue);return}if(pe==="folder"&&F.current===K.TAG)return;let Me=e.vault.getFolderByPath(ue);if(!Me)return;if(Ce&&Ce.length>0&&!Pt){await ve(Ce,Me);return}if(we&&we.length>0){let Ge=M(we);if(Ge.length>0){await V(Ge,Me);return}}if(!Le)return;let nt=e.vault.getAbstractFileByPath(Le);if(!nt)return;if(nt instanceof vm.TFile)await V([nt],Me);else if(nt instanceof vm.TFolder){if(Me.path===nt.path||Me.path.startsWith(`${nt.path}/`)){oe(d.dragDrop.errors.cannotMoveIntoSelf,{variant:"warning"});return}if(nt.parent?.path===Me.path)return;try{await a.moveFolderToTarget(nt,Me),oe(d.fileSystem.notifications.folderMoved.replace("{name}",nt.name),{variant:"success"})}catch(Ge){if(Ge instanceof Gu){if(Ge.code==="destination-exists"){oe(d.fileSystem.errors.folderAlreadyExists.replace("{name}",nt.name),{variant:"warning"});return}if(Ge.code==="invalid-target"){oe(d.dragDrop.errors.cannotMoveIntoSelf,{variant:"warning"});return}}console.error("Error moving folder:",Ge),oe(d.dragDrop.errors.failedToMoveFolder.replace("{name}",nt.name),{variant:"warning"})}}}finally{x(),Q(null),F.current=null,p.clearSession(),P.current=null,E.current=null,S.current=0}},[e,ae,le,ve,V,M,q,X,p,W,x,Q,i,a]),Pe=(0,pn.useCallback)(te=>{let ye=te.target;if(!(ye instanceof HTMLElement))return;let ce=ye.closest("[data-drop-zone]");if(ce instanceof HTMLElement&&ce===b.current){let pe=te.relatedTarget;(!(pe instanceof Node)||!ce.contains(pe))&&(ce.classList.remove("nn-drag-over"),b.current=null,k.current=null,W())}},[W]),Fe=(0,pn.useCallback)(()=>{S.current=0,x(),b.current&&(b.current.classList.remove("nn-drag-over"),b.current=null),k.current=null,Q(null),W(),F.current=null,p.clearSession(),P.current=null,E.current=null},[x,W,p,Q]);(0,pn.useEffect)(()=>{let te=t.current;if(!te||n)return;let ye=te.ownerDocument,ce=ue=>{$(()=>de(ue))};te.addEventListener("dragstart",_),te.addEventListener("dragover",ne),te.addEventListener("dragleave",Pe),te.addEventListener("drop",ce),ye.addEventListener("dragend",Fe),ye.addEventListener("drop",Fe);let pe=ue=>{Date.now()>C.current||(ue.preventDefault(),ue.stopPropagation(),ue.stopImmediatePropagation())};return te.addEventListener("click",pe,!0),()=>{te.removeEventListener("dragstart",_),te.removeEventListener("dragover",ne),te.removeEventListener("dragleave",Pe),te.removeEventListener("drop",ce),ye.removeEventListener("dragend",Fe),ye.removeEventListener("drop",Fe),te.removeEventListener("click",pe,!0),x(),Q(null),W(),F.current=null,p.clearSession(),k.current=null}},[t,_,ne,Pe,de,Fe,n,x,W,p,Q])}var pn,vm,CA,RPe,Pee,MPe,APe,Fee,Nee,DPe,OPe,LPe,zPe,BPe,_Pe,Cee,KV=U(()=>{pn=he(Ve()),vm=require("obsidian");Ur();fn();on();gr();Tl();GF();Oe();bn();Ue();Ha();po();Ts();jp();t0();Hr();st();FA();hB();bi();qc();ei();CA=500,RPe=100,Pee="obsidian/file",MPe="text/plain",APe="text/uri-list",Fee=(t,{hasObsidianData:e,hasTagPayload:n,isExternalOnly:r})=>t==="folder"?e||r:t==="tag"?n||e:t==="tag-root"?n:t==="property"?e:!1,Nee=t=>t.startsWith("emoji:")?t.slice(6):/\p{Extended_Pictographic}/u.test(t)?t:null,DPe=t=>{if(Nee(t))return!0;let e=t.startsWith("lucide-")?t.slice(7):t;return Fn().isValidIcon(e)},OPe=(t,e)=>e||(t===K.FOLDER?"folder-closed":t===K.TAG?"tags":t===K.FILE?"file":t===K.PROPERTY?"align-left":null),LPe=(t,e,n,r)=>{let o=[];e&&o.push(e),n&&o.push(n);let a=OPe(t,r);return a&&o.push(a),Array.from(new Set(o))},zPe=(t,e)=>{if(!DPe(e))return!1;t.innerHTML="";try{if(Fn().renderIcon(t,e),t.childNodes.length>0||t.innerHTML.trim()!=="")return!0}catch(r){}let n=Nee(e);if(n)return t.textContent=n,!0;try{return(0,vm.setIcon)(t,e),t.childNodes.length>0}catch(r){}return!1},BPe=t=>t.extension==="md"&&t.path.endsWith(".md")?t.path.slice(0,-3):t.path,_Pe=(t,e)=>{let n=encodeURIComponent(t),r=encodeURIComponent(BPe(e));return`obsidian://open?vault=${n}&file=${r}`},Cee=(t,e,n)=>{let r=n.map(o=>_Pe(e,o)).join(`
`);r&&(t.setData(MPe,r),t.setData(APe,r))}});function KPe(t,e){return e?t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom:!1}function xee(t,e){let n=t.dataTransfer?.types;return e||WS(n)||jF(n)}function UPe(t){let e=t.target;if(!(e instanceof HTMLElement))return!1;let n=e.closest('[data-draggable="true"]');return n instanceof HTMLElement?n.getAttribute("data-drag-type")===K.FILE:!1}function Eee({containerRef:t,isMobile:e,isSinglePane:n,isFilesView:r,onActivateNavigation:o,onRestoreFiles:a}){let i=(0,cy.useRef)(null),s=(0,cy.useRef)(!1),l=(0,cy.useRef)(!1),c=(0,cy.useRef)(!1),u=US();(0,cy.useEffect)(()=>{let p=t.current;if(!p||e)return;let m=p.ownerDocument,g=()=>{i.current!==null&&(window.clearTimeout(i.current),i.current=null)},f=()=>{i.current!==null||s.current||(i.current=window.setTimeout(()=>{i.current=null,l.current&&(!n||!r||(s.current=!0,o()))},CA))},h=T=>{let k=p.getBoundingClientRect().left+HPe;if(T.clientX<=k)return!0;let P=p.querySelector(VPe);return P?KPe(T,P.getBoundingClientRect()):!1},b=T=>{l.current=!0,c.current=UPe(T),s.current=!1,g()},y=T=>{let F=c.current||u.getSession()?.type===K.FILE;if(xee(T,F)){if(l.current=!0,!n||!r){g();return}h(T)?f():s.current||g()}},v=T=>{let F=c.current||u.getSession()?.type===K.FILE;if(!xee(T,F))return;let k=T.relatedTarget;if(k instanceof Node&&p.contains(k))return;let P=p.getBoundingClientRect();T.clientX>=P.left&&T.clientX<=P.right&&T.clientY>=P.top&&T.clientY<=P.bottom||(l.current=!1,g(),s.current&&(s.current=!1,a()))},S=()=>{l.current=!1,c.current=!1,g(),s.current&&(s.current=!1,a())},w=()=>{S()};return p.addEventListener("dragstart",b),p.addEventListener("dragover",y),p.addEventListener("dragleave",v),p.addEventListener("dragend",S),p.addEventListener("drop",w),m.addEventListener("dragend",S),m.addEventListener("drop",S),()=>{g(),p.removeEventListener("dragstart",b),p.removeEventListener("dragover",y),p.removeEventListener("dragleave",v),p.removeEventListener("dragend",S),p.removeEventListener("drop",w),m.removeEventListener("dragend",S),m.removeEventListener("drop",S)}},[t,u,e,n,r,o,a])}var cy,HPe,VPe,Ree=U(()=>{cy=he(Ve());KV();FA();Ue();GF();HPe=32,VPe='[data-pane-toggle="navigation"]'});function Mee({hasNavigatorFocus:t,isOpeningVersionHistory:e,isOpeningInNewContext:n,isNavigatorOpeningSelectedFile:r}){return!t||e||n?!1:r}function Aee(t,e){if(!t||e.length===0)return!1;let n=t.getContainer().win;return e.some(r=>r.getContainer().win===n)}var Dee=U(()=>{});function Oee(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.activatePane(r?"navigation":"files")}function WPe(t){if(!t.includes("/"))return[];let e=t.split("/"),n=[];for(let r=1;r!t.expandedTags.has(l))&&Os({type:"tag",ids:i,collapseOtherBranches:!!t.collapseOtherBranchesOnExpand,dispatch:t.expansionDispatch})}return Oee(t,r,n),!n?.skipScroll&&t.requestScroll&&t.requestScroll(r,{align:"auto",itemType:K.TAG}),r}var UV=U(()=>{Ue();Cn();Og();qc()});function GPe(t,e,n){if(e===_e)return e;let r=t.resolveSelectionNodeId?t.resolveSelectionNodeId(e):cx(t.propertyTree,e);return r===_e?n?.requirePropertyInTree??!0?null:e:r}function jPe(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.activatePane(r?"navigation":"files")}function $F(t,e,n){let r=e===_e?_e:en(e);if(!r)return null;let o=GPe(t,r,n);if(!o)return null;if(t.showProperties&&t.showAllPropertiesFolder&&!t.expandedVirtualFolders.has(_e)){let l=new Set(t.expandedVirtualFolders);l.add(_e),t.expansionDispatch({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:l})}let a=o!==_e?Xi(o):_e;return a&&a!==_e&&a!==o&&!t.expandedProperties.has(a)&&Os({type:"property",ids:[a],collapseOtherBranches:!!t.collapseOtherBranchesOnExpand,dispatch:t.expansionDispatch}),jPe(t,o,n),!n?.skipScroll&&t.requestScroll&&t.requestScroll(o,{align:"auto",itemType:K.PROPERTY}),o}var WV=U(()=>{Ue();un();qc()});function GS({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,y=a??t.activeLeaf;o=void 0,a=void 0,n({candidateFile:b,activeLeaf:y})},_t.YIELD_TO_EVENT_LOOP)},u=f=>{if(e?.consumeBackgroundActiveLeafChange(f)===!0){s();return}c(void 0,f)},p=f=>{if(f instanceof Lee.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 Lee,NA=U(()=>{Lee=require("obsidian");po()});function zee({app:t,navigationPaneRef:e,focusNavigationPane:n,focusFilesPane:r}){let o=yt(),a=jt(),i=a.includeDescendantNotes,s=la(),l=Wa(),c=hr(),u=ar(),p=Qr(),m=So(),{getDB:g,getPropertyTree:f,findTagInTree:h}=_o(),b=vl(),y=(0,io.useCallback)(N=>{N==="navigation"?n():r()},[r,n]),[v,S]=(0,io.useState)(null),[w,T]=(0,io.useState)(!1),F=(0,io.useRef)(null),k=(0,io.useRef)(!1),P=(0,io.useRef)(null);(0,io.useEffect)(()=>{P.current=c.selectedFile?.path??null},[c.selectedFile]);let E=(0,io.useCallback)(N=>{if(!o.autoRevealIgnoreOtherWindows||!N)return!1;let M=t.workspace.getLeavesOfType(Ra);return M.length===0?!1:!Aee(N,M)},[t,o.autoRevealIgnoreOtherWindows]),C=(0,io.useCallback)((N,M)=>v6(N,o,t,a.showHiddenItems)?(u({type:"SET_SELECTED_FILE",file:N}),M?.showHiddenFileNotice&&oe(d.fileSystem.notifications.hiddenFileReveal,{variant:"warning"}),!0):!1,[u,o,t,a.showHiddenItems]),L=(0,io.useCallback)(N=>{if(!N)return{target:null,expandAncestors:!1};if(!i)return{target:N,expandAncestors:!0};let M=t.vault.getRoot(),H=o.showRootFolder||a.showHiddenItems,q=V=>{if(!H&&M&&V===M)return!1;let j=V;for(;j;){let _=j.parent;if(!_)break;if(!da(_.path,s.expandedFolders,o.showRootFolder))return!1;j=_}return!0},X=N;for(;X&&!q(X);)X=X.parent;return X?!H&&M&&X===M?{target:N,expandAncestors:!1}:{target:X,expandAncestors:!1}:{target:H?M??N:N,expandAncestors:!1}},[i,o.showRootFolder,a.showHiddenItems,s.expandedFolders,t]),z=(0,io.useCallback)(N=>{Os({type:"folder",ids:N.filter(M=>!ym(M,o.showRootFolder)),collapseOtherBranches:o.collapseOtherBranchesOnExpand,dispatch:l})},[l,o.collapseOtherBranchesOnExpand,o.showRootFolder]),G=(0,io.useCallback)(N=>{Os({type:"tag",ids:N,collapseOtherBranches:o.collapseOtherBranchesOnExpand,dispatch:l})},[l,o.collapseOtherBranchesOnExpand]),Q=(0,io.useCallback)(N=>{Os({type:"property",ids:N,collapseOtherBranches:o.collapseOtherBranchesOnExpand,dispatch:l})},[l,o.collapseOtherBranchesOnExpand]),R=(0,io.useCallback)((N,M)=>{if(!N?.parent||C(N,M))return!1;let H=N.parent,{target:q,expandAncestors:X}=L(H),V=i?H:q??H,j=[],_=H.parent;for(;_&&(j.unshift(_.path),_.path!=="/");)_=_.parent;return j.length>0&&(X||j.some(J=>!da(J,s.expandedFolders,o.showRootFolder)))&&z(j),u({type:"REVEAL_FILE",file:N,preserveFolder:!1,isManualReveal:!0,targetFolder:V??void 0,source:M?.source}),m({type:"ACTIVATE_PANE",target:"files"}),e.current&&V&&e.current.requestScroll(V.path,{align:"auto",itemType:K.FOLDER}),!0},[s.expandedFolders,z,u,m,e,L,i,C,o.showRootFolder]),O=(0,io.useCallback)((N,M)=>{let H=!!M?.skipSinglePaneSwitch,q=YF({showTags:o.showTags,showAllTagsFolder:o.showAllTagsFolder,expandedTags:s.expandedTags,expandedVirtualFolders:s.expandedVirtualFolders,collapseOtherBranchesOnExpand:o.collapseOtherBranchesOnExpand,expansionDispatch:l,selectionDispatch:u,activatePane:y,findTagInTree:h,requestScroll:(X,V)=>{e.current?.requestScroll(X,V)}},N,{preserveNavigationFocus:H,skipScroll:M?.skipScroll,source:M?.source});q&&c.selectedFile&&u({type:"REVEAL_FILE",file:c.selectedFile,preserveFolder:!0,isManualReveal:!1,targetTag:q,source:M?.source})},[s.expandedTags,s.expandedVirtualFolders,l,u,y,h,c.selectedFile,e,o.showAllTagsFolder,o.collapseOtherBranchesOnExpand,o.showTags]),D=(0,io.useCallback)((N,M)=>{let H=!!M?.skipSinglePaneSwitch,q=$F({showProperties:o.showProperties,showAllPropertiesFolder:o.showAllPropertiesFolder,propertyTree:f(),expandedProperties:s.expandedProperties,expandedVirtualFolders:s.expandedVirtualFolders,collapseOtherBranchesOnExpand:o.collapseOtherBranchesOnExpand,expansionDispatch:l,selectionDispatch:u,activatePane:y,requestScroll:(X,V)=>{e.current?.requestScroll(X,V)}},N,{preserveNavigationFocus:H,skipScroll:M?.skipScroll,source:M?.source});return q?(c.selectedFile&&u({type:"REVEAL_FILE",file:c.selectedFile,preserveFolder:!0,isManualReveal:!1,targetProperty:q,source:M?.source}),!0):!1},[s.expandedProperties,s.expandedVirtualFolders,l,u,y,c.selectedFile,e,o.showAllPropertiesFolder,o.collapseOtherBranchesOnExpand,o.showProperties,f]),x=(0,io.useCallback)((N,M)=>{if(!N?.parent||C(N,M))return;let H,q,X=null,V=!1,j=M?.isStartupReveal?"startup":M?.source,W=!(j==="auto"||j==="startup")||o.autoRevealShortestPath,Z=!!(M?.isStartupReveal&&o.startView==="navigation")?"center":"auto";if(c.selectionType==="tag"){let ne=U2(N,c.selectedTag,o,g(),i,W);if(H=ne,ne){let le=at(ne);if(le)if(i&&W)if(o.showTags&&o.showAllTagsFolder&&!s.expandedVirtualFolders.has(_n))if(le===wt){let ve=new Set(s.expandedVirtualFolders);ve.add(_n),l({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:ve}),H=wt}else H=Lt;else H=W2(le,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(le.includes("/")){let ae=le.split("/"),ve=[];for(let de=1;de!s.expandedTags.has(de))&&G(ve)}H=le}}}if(c.selectionType==="property"){let ne=g().getFile(N.path),le=o.showProperties?Sq(ne?.properties??null,c.selectedProperty,o,i):null;if(q=le,le){let ae=o.showProperties&&o.showAllPropertiesFolder&&!s.expandedVirtualFolders.has(_e);if(i&&ae)q=_e;else{let ve=le,de=ve!==_e?Xi(ve):null,Pe=de&&Bk(de)?de:null,Fe=!!(Pe&&Pe!==ve&&!s.expandedProperties.has(Pe));if(i&&Fe)q=Pe;else{if(!i&&o.showProperties&&o.showAllPropertiesFolder&&!s.expandedVirtualFolders.has(_e)){let te=new Set(s.expandedVirtualFolders);te.add(_e),l({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:te})}!i&&Fe&&Pe&&Q([Pe])}}}}let re=null;if(H==null&&q==null&&N.parent)if(W){let{target:ne,expandAncestors:le}=L(N.parent);re=ne;let ae=c.selectedFolder,ve=i&&c.selectionType==="folder"&&ae!==null&&FG(ae.path,N.parent.path);if(ne?ae&&ae.path===ne.path||ve?V=!0:X=ne:ve&&(V=!0),le){let de=[],Pe=N.parent;if(Pe&&Pe.parent)for(Pe=Pe.parent;Pe&&(de.unshift(Pe.path),Pe.path!=="/");)Pe=Pe.parent;de.some(Fe=>!da(Fe,s.expandedFolders,o.showRootFolder))&&z(de)}}else{re=N.parent,X=N.parent;let ne=[],le=N.parent.parent;for(;le&&(ne.unshift(le.path),le.path!=="/");)le=le.parent;ne.some(ae=>!da(ae,s.expandedFolders,o.showRootFolder))&&z(ne)}if(u({type:"REVEAL_FILE",file:N,preserveFolder:V,isManualReveal:!1,targetTag:H,targetProperty:q,targetFolder:X??void 0,source:j}),!!!(o.skipAutoScroll&&j==="shortcut")){if(H&&e.current)e.current.requestScroll(H,{align:Z,itemType:K.TAG});else if(!H&&q&&e.current)e.current.requestScroll(q,{align:Z,itemType:K.PROPERTY});else if(!H&&!q&&e.current){let ne=X??(V&&c.selectedFolder?c.selectedFolder:re??N.parent);ne&&e.current.requestScroll(ne.path,{align:Z,itemType:K.FOLDER})}}},[o,i,c.selectedFolder,c.selectionType,c.selectedTag,c.selectedProperty,s.expandedFolders,s.expandedTags,s.expandedProperties,s.expandedVirtualFolders,l,z,Q,G,u,g,L,e,C]),B=(0,io.useCallback)((N,M)=>{let H=typeof N=="string"?t.vault.getFolderByPath(N):N;if(!H)return!1;let q=[],X=H.parent;for(;X&&(q.unshift(X.path),X.path!=="/");)X=X.parent;q.some(W=>!da(W,s.expandedFolders,o.showRootFolder))&&z(q);let j=!!M?.suppressAutoSelect;return u({type:"SET_SELECTED_FOLDER",folder:H,source:M?.source,autoSelectedFile:j?null:void 0,historyIndex:M?.historyIndex}),M?.skipFocus||(p.singlePane?M?.preserveNavigationFocus?n():r():n()),!M?.skipScroll&&e.current&&e.current.requestScroll(H.path,{align:"auto",itemType:K.FOLDER}),!0},[t,s.expandedFolders,z,u,p,e,n,r,o.showRootFolder]),I=(0,io.useCallback)((N,M)=>YF({showTags:o.showTags,showAllTagsFolder:o.showAllTagsFolder,expandedTags:s.expandedTags,expandedVirtualFolders:s.expandedVirtualFolders,collapseOtherBranchesOnExpand:o.collapseOtherBranchesOnExpand,expansionDispatch:l,selectionDispatch:u,activatePane:y,findTagInTree:h,requestScroll:(H,q)=>{e.current?.requestScroll(H,q)}},N,M),[l,s.expandedTags,s.expandedVirtualFolders,h,y,e,u,o.showAllTagsFolder,o.collapseOtherBranchesOnExpand,o.showTags]),A=(0,io.useCallback)((N,M)=>$F({showProperties:o.showProperties,showAllPropertiesFolder:o.showAllPropertiesFolder,propertyTree:f(),expandedProperties:s.expandedProperties,expandedVirtualFolders:s.expandedVirtualFolders,collapseOtherBranchesOnExpand:o.collapseOtherBranchesOnExpand,expansionDispatch:l,selectionDispatch:u,activatePane:y,requestScroll:(H,q)=>{e.current?.requestScroll(H,q)}},N,M),[l,s.expandedProperties,s.expandedVirtualFolders,y,e,u,o.showAllPropertiesFolder,o.collapseOtherBranchesOnExpand,o.showProperties,f]);return(0,io.useEffect)(()=>{if(v){let N=window.setTimeout(()=>{S(null),T(!1)},_t.DEBOUNCE_KEYBOARD);return()=>window.clearTimeout(N)}},[v]),(0,io.useEffect)(()=>{if(!o.autoRevealActiveFile)return;let N=(H,q)=>{let X=t.workspace.getActiveViewOfType(jS.FileView),V=X?.file instanceof jS.TFile?X.file:null,j=q?.activeLeaf??X?.leaf??null,_=H instanceof jS.TFile?H:V;if(!_)return;let W=_.stat.ctime===_.stat.mtime&&Date.now()-_.stat.ctime<_t.FILE_OPERATION_DELAY;if(!W&&(o.autoRevealIgnoreRightSidebar&&ul(t,j)==="right-sidebar"||E(j))||F.current===_)return;if(F.current=_,W){S(_);return}let J=b&&b.isOpeningVersionHistory(),Z=b&&b.isOpeningInNewContext(),re=activeDocument.querySelector(".nn-split-container"),Y=!!(re&&re.contains(activeDocument.activeElement)),ne=P.current,le=ne!==null&&ne===_.path;Mee({hasNavigatorFocus:Y,isOpeningVersionHistory:J,isOpeningInNewContext:Z,isNavigatorOpeningSelectedFile:le})||b&&b.isOpeningFolderNote()||S(_)},M=GS({workspace:t.workspace,commandQueue:b,onChange:({candidateFile:H,activeLeaf:q})=>{N(H,{activeLeaf:q})}});if(!k.current){let H=t.workspace.getActiveFile();if(H){let q=t.workspace.getActiveViewOfType(jS.FileView)?.leaf??null,X=ul(t,q);!(o.autoRevealIgnoreRightSidebar&&X==="right-sidebar")&&!E(q)&&(F.current=H,T(!0),S(H))}k.current=!0}return()=>{M()}},[t,t.workspace,o.autoRevealActiveFile,o.autoRevealIgnoreOtherWindows,o.autoRevealIgnoreRightSidebar,o.startView,b,E]),(0,io.useEffect)(()=>{if(v)if(w){if(o.autoRevealShortestPath&&c.selectionType===K.TAG&&c.selectedTag&&c.selectedFile?.path===v.path){let N=p.singlePane&&o.startView==="navigation";O(c.selectedTag,{skipSinglePaneSwitch:N});return}if(c.selectionType===K.PROPERTY&&c.selectedProperty&&c.selectedFile?.path===v.path){let N=p.singlePane&&o.startView==="navigation";if(D(c.selectedProperty,{skipSinglePaneSwitch:N}))return}x(v,{source:"auto",isStartupReveal:!0})}else x(v,{source:"auto"})},[v,w,R,x,c.selectionType,c.selectedTag,c.selectedProperty,c.selectedFile,O,D,o.autoRevealShortestPath,o.startView,p.singlePane]),{revealFileInActualFolder:R,revealFileInNearestFolder:x,navigateToFolder:B,navigateToTag:I,navigateToProperty:A,revealTag:O,revealProperty:D}}var io,jS,Bee=U(()=>{io=he(Ve()),jS=require("obsidian");qb();Dee();Tl();Ur();on();gr();wa();cs();fn();Cn();Ue();po();ra();UV();WV();Qb();Oe();bn();NA();un();qc()});function _ee({app:t,containerRef:e,setIsNavigatorFocused:n}){let r=Qr(),o=Wa(),a=ar(),i=vl();(0,IA.useEffect)(()=>{let s=c=>{if(c instanceof uy.TFolder){let u=new Set,p=m=>{u.add(m.path),m.children.forEach(g=>{g instanceof uy.TFolder&&p(g)})};p(t.vault.getRoot()),o({type:"CLEANUP_DELETED_FOLDERS",existingPaths:u}),a({type:"CLEANUP_DELETED_FOLDER",deletedPath:c.path})}else c instanceof uy.TFile&&a({type:"CLEANUP_DELETED_FILE",deletedPath:c.path,nextFileToSelect:null})},l=t.vault.on("delete",s);return()=>{t.vault.offref(l)}},[t.vault,o,a]),(0,IA.useEffect)(()=>{if(!Kn()){n(!0);return}let s=e.current;if(!s)return;let l=(0,uy.debounce)(p=>{n(p)},_t.DEBOUNCE_KEYBOARD),c=()=>{l(!0)},u=p=>{p.relatedTarget&&s.contains(p.relatedTarget)||l(!1)};return s.addEventListener("focusin",c),s.addEventListener("focusout",u),Gi(s),()=>{l.cancel(),s.removeEventListener("focusin",c),s.removeEventListener("focusout",u)}},[e,n]),(0,IA.useEffect)(()=>{if(r.focusedPane==="search")return;let s=i.isOpeningVersionHistory(),l=i.isOpeningInNewContext();if(r.focusedPane&&!s&&!l){let c=e.current;if(!c)return;Gi(c)}},[r.focusedPane,e,i])}var IA,uy,Hee=U(()=>{IA=he(Ve()),uy=require("obsidian");po();Tl();Ur();wa();fn();Ts();$r()});function xA(){let t=(0,qS.useRef)(null),e=(0,qS.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,qS.useEffect)(()=>()=>{t.current&&(t.current(),t.current=null)},[]),{startPointerDrag:e}}var qS,GV=U(()=>{qS=he(Ve())});function jV({orientation:t="horizontal",initialSize:e,min:n,storageKey:r,scale:o}={}){let a=Pc(t),i=typeof e=="number"?e:a.defaultSize,s=typeof n=="number"?n:a.minSize,[l,c]=(0,py.useState)(()=>{if(r){let h=Te.get(r);if(typeof h=="number")return Math.max(s,h)}return i}),[u,p]=(0,py.useState)(!1),{startPointerDrag:m}=xA(),g=typeof o=="number"&&Number.isFinite(o)&&o>0?o:1,f=(0,py.useCallback)(h=>{if(h.pointerType==="mouse"&&h.button!==0)return;let b=t==="horizontal"?h.clientX:h.clientY,y=l,v=y,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 k=F/g;v=Math.max(s,y+k),c(v)},onEnd:()=>{r&&Te.set(r,v),p(!1)}})},[t,l,s,g,r,m]);return(0,py.useEffect)(()=>{if(!r){c(i);return}let h=Te.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 py,Vee=U(()=>{py=he(Ve());jr();tb();GV()});function $V(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 qPe(t,e){if(!e)return t.size>0;for(let n of t)if(n!==QF)return!0;return!1}function YPe(t,e){let n=new Set,r=o=>{o.children.forEach(a=>{a instanceof Kee.TFolder&&(n.add(a.path),r(a))})};return e&&n.add(t.path),r(t),n}function Uee(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(_e):n.delete(_e)),n}function $Pe(t){let e=$V(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===QF&&!i||n.add(l);if(e.affectFolders&&a&&i&&n.add(QF),e.affectTags&&t.selectedTagParentPaths)for(let l of t.selectedTagParentPaths)r.add(l);e.affectProperties&&t.selectedPropertyKeyNodeId&&o.add(t.selectedPropertyKeyNodeId);let s=Uee(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 qV(t,e){let n=e?.includeSelection??!1;return $Pe({behavior:t.behavior,currentExpandedVirtualFolders:t.currentExpandedVirtualFolders,selectedFolderParentPaths:n?XPe(t.selectedFolder??null,t.showRootFolder):void 0,selectedTagParentPaths:n?QPe(t.selectedTag??null):void 0,selectedPropertyKeyNodeId:n?ZPe(t.selectedPropertyNodeId??null):void 0,revealTagsRoot:n?JPe(t.selectedTag??null,t.showAllTagsFolder):void 0,revealPropertiesRoot:n?eFe(t.selectedPropertyNodeId??null,t.showAllPropertiesFolder):void 0,preserveRootFolder:t.preserveRootFolder,rootFolderExpanded:t.rootFolderExpanded})}function XPe(t,e){return t?tp(t,{includeRootFolder:e}):[]}function QPe(t){if(!t)return[];let e=[],n=t.split("/"),r="";for(let o=0;oe.has(n))}function YS(){let{app:t}=vt(),e=yt(),r=jt().showHiddenItems,{setShowHiddenItems:o}=$d(),a=la(),i=Wa(),s=hr(),l=Ti(),{fileData:c}=_o(),u=(0,XF.useCallback)(()=>{let f=e.collapseBehavior,h=$V(f),b=h.affectFolders&&qPe(a.expandedFolders,e.excludeVaultRootFromCollapse||ym(QF,e.showRootFolder)),y=h.affectTags&&(a.expandedTags.size>0||e.showAllTagsFolder&&a.expandedVirtualFolders.has(_n)),v=h.affectProperties&&(a.expandedProperties.size>0||e.showAllPropertiesFolder&&a.expandedVirtualFolders.has(_e)),S=b||y||v;if(e.smartCollapse&&S){let w=qV({behavior:f,currentExpandedVirtualFolders:a.expandedVirtualFolders,selectedFolder:s.selectedFolder,selectedTag:s.selectedTag,selectedPropertyNodeId:s.selectedProperty,showAllTagsFolder:e.showAllTagsFolder,showAllPropertiesFolder:e.showAllPropertiesFolder,showRootFolder:e.showRootFolder,preserveRootFolder:e.showRootFolder&&e.excludeVaultRootFromCollapse,rootFolderExpanded:a.expandedFolders.has(QF)},{includeSelection:!0}),T=!h.affectFolders||YV(a.expandedFolders,w.folders),F=!h.affectTags||YV(a.expandedTags,w.tags),k=!h.affectProperties||YV(a.expandedProperties,w.properties),P=(!h.affectTags||w.virtualFolders.has(_n)===a.expandedVirtualFolders.has(_n))&&(!h.affectProperties||w.virtualFolders.has(_e)===a.expandedVirtualFolders.has(_e));if(T&&F&&k&&P)return!1}return S},[e.collapseBehavior,e.excludeVaultRootFromCollapse,e.showAllPropertiesFolder,e.showAllTagsFolder,e.showRootFolder,e.smartCollapse,a.expandedFolders,a.expandedProperties,a.expandedTags,a.expandedVirtualFolders,s.selectedFolder,s.selectedProperty,s.selectedTag]),p=(0,XF.useCallback)(()=>{let f=e.collapseBehavior,h=t.vault.getRoot(),b=u(),y=$V(f);if(b)if(e.smartCollapse&&(s.selectedFolder||s.selectedTag||s.selectedProperty)){let v=qV({behavior:f,currentExpandedVirtualFolders:a.expandedVirtualFolders,selectedFolder:s.selectedFolder,selectedTag:s.selectedTag,selectedPropertyNodeId:s.selectedProperty,showAllTagsFolder:e.showAllTagsFolder,showAllPropertiesFolder:e.showAllPropertiesFolder,showRootFolder:e.showRootFolder,preserveRootFolder:e.showRootFolder&&e.excludeVaultRootFromCollapse,rootFolderExpanded:a.expandedFolders.has(h.path)},{includeSelection:!0});y.affectFolders&&i({type:"SET_EXPANDED_FOLDERS",folders:v.folders}),y.affectTags&&i({type:"SET_EXPANDED_TAGS",tags:v.tags}),y.affectProperties&&i({type:"SET_EXPANDED_PROPERTIES",properties:v.properties}),(y.affectTags||y.affectProperties)&&i({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:v.virtualFolders})}else{let v=qV({behavior:f,currentExpandedVirtualFolders:a.expandedVirtualFolders,showAllTagsFolder:e.showAllTagsFolder,showAllPropertiesFolder:e.showAllPropertiesFolder,showRootFolder:e.showRootFolder,preserveRootFolder:e.showRootFolder&&e.excludeVaultRootFromCollapse,rootFolderExpanded:a.expandedFolders.has(h.path)});y.affectFolders&&i({type:"SET_EXPANDED_FOLDERS",folders:v.folders}),y.affectTags&&i({type:"SET_EXPANDED_TAGS",tags:v.tags}),y.affectProperties&&i({type:"SET_EXPANDED_PROPERTIES",properties:v.properties}),(y.affectTags||y.affectProperties)&&i({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:v.virtualFolders})}else if(y.affectFolders&&i({type:"SET_EXPANDED_FOLDERS",folders:YPe(h,e.showRootFolder)}),y.affectTags||y.affectProperties){let v=new Set,S=new Set,w=T=>{T.children.size!==0&&(S.add(T.id),T.children.forEach(F=>{w(F)}))};if(y.affectTags){for(let T of c.tagTree.values())Hl(T,v);i({type:"SET_EXPANDED_TAGS",tags:v})}if(y.affectProperties){for(let T of c.propertyTree.values())w(T);i({type:"SET_EXPANDED_PROPERTIES",properties:S})}i({type:"SET_EXPANDED_VIRTUAL_FOLDERS",folders:Uee(a.expandedVirtualFolders,{keepTagsRoot:y.affectTags?e.showAllTagsFolder:void 0,keepPropertiesRoot:y.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,XF.useCallback)(async()=>{if(s.selectedFolder)try{await l.createNewFolder(s.selectedFolder,()=>{if(s.selectedFolder&&!da(s.selectedFolder.path,a.expandedFolders,e.showRootFolder)){let f=e.collapseOtherBranchesOnExpand?[...tp(s.selectedFolder,{includeRootFolder:e.showRootFolder}),s.selectedFolder.path]:[s.selectedFolder.path];Os({type:"folder",ids:f,collapseOtherBranches:e.collapseOtherBranchesOnExpand,dispatch:i})}})}catch{}},[s.selectedFolder,a.expandedFolders,l,i,e.collapseOtherBranchesOnExpand,e.showRootFolder]),g=(0,XF.useCallback)(()=>{o(!r)},[o,r]);return{shouldCollapseItems:u,handleExpandCollapseAll:p,handleNewFolder:m,handleToggleShowExcludedFolders:g}}var XF,Kee,QF,EA=U(()=>{XF=he(Ve()),Kee=require("obsidian");Tl();Ur();fn();on();gr();cs();Ue();un();Qa();qc();QF="/"});function tFe(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,np.useRef)(null),m=(0,np.useRef)(null),g=(0,np.useRef)(!1);(0,np.useEffect)(()=>{if(!i||!t.current)return;let f=t.current,h=v=>{let S=v.touches[0];p.current=S.clientX,m.current=S.clientY;let w=c?.(v)??!1,T=s?!0:u?S.clientX>=window.innerWidth-a:S.clientX<=a;g.current=T&&!w},b=v=>{if(!g.current||p.current===null||m.current===null)return;let S=v.touches[0],w=S.clientX-p.current,T=S.clientY-m.current;Math.abs(w)>Math.abs(T)+5&&v.preventDefault()},y=v=>{if(p.current===null||m.current===null)return;if(!g.current){p.current=null,m.current=null,g.current=!1;return}let S=v.changedTouches[0].clientX,w=v.changedTouches[0].clientY,T=S-p.current,F=w-m.current;Math.abs(T)>Math.abs(F)&&Math.abs(T)>o&&(T>0&&n?n():T<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",y),()=>{f.removeEventListener("touchstart",h),f.removeEventListener("touchmove",b),f.removeEventListener("touchend",y)}},[s,t,n,r,o,a,i,u,c])}function Wee(t,e){let n=Qr(),r=So(),o=activeDocument.body.classList.contains("mod-rtl"),a=!0,i=(0,np.useCallback)(u=>{let p=u.target;return p instanceof Element?p.closest(".nn-breadcrumb-scroll")!==null:!1},[]),s=(0,np.useCallback)(()=>{o||r({type:"ACTIVATE_PANE",target:"navigation"})},[o,r]),l=(0,np.useCallback)(()=>{o&&r({type:"ACTIVATE_PANE",target:"navigation"})},[o,r]),c=e&&n.singlePane&&n.currentSinglePaneView==="files";tFe(t,{onSwipeRight:s,onSwipeLeft:l,enabled:c,allowAnywhereSwipe:a,shouldIgnoreTouchStart:i,isRTL:o})}var np,Gee=U(()=>{np=he(Ve());wa()});function jee(){let{plugin:t}=vt(),[e,n]=(0,$S.useState)(()=>t.getPendingUpdateNotice());(0,$S.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,$S.useCallback)(o=>{t.markUpdateNoticeAsDisplayed(o)},[t]);return{bannerNotice:e,markAsDisplayed:r}}var $S,qee=U(()=>{$S=he(Ve());fn()});function Yee(t){let e=[];return Array.from(t.values()).sort((r,o)=>At(r.displayPath,o.displayPath)).forEach(r=>{e.push({nodeId:r.id,label:r.displayPath,searchText:r.displayPath,noteCount:Au(r)}),Array.from(r.children.values()).sort((a,i)=>At(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 ZF,$ee=U(()=>{Oe();un();Ln();Cf();ZF=class extends rl{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 nFe(t,e){let n=Mt(t);return n?e.some(r=>r.item.path===n):!1}var XS,XV=U(()=>{Oe();Cf();Cn();Hr();XS=class extends rl{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||!$I(this.currentInput)||nFe(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 Yc(t){return`${t.type}:${t.key}`}function bm(t,e){return t===K.TAG?at(e)??e.toLowerCase():e}function Xee(t,e){let n=bm(t,e);return`${t}:${n}`}function kl(t,e,n){return t.get(Xee(e,n))}function JF(t,e,n,r){t.set(Xee(e,n),r)}function Qee(t){let e=new Map;return t.forEach((n,r)=>{n.type===be.FOLDER?JF(e,K.FOLDER,n.data.path,r):n.type===be.TAG||n.type===be.UNTAGGED?JF(e,K.TAG,n.data.path,r):n.type===be.VIRTUAL_FOLDER&&n.tagCollectionId?JF(e,K.TAG,n.tagCollectionId,r):n.type===be.VIRTUAL_FOLDER&&n.propertyCollectionId?JF(e,K.PROPERTY,n.key,r):(n.type===be.PROPERTY_KEY||n.type===be.PROPERTY_VALUE)&&JF(e,K.PROPERTY,n.data.id,r)}),e}function rFe(t){return typeof t.level!="number"?!1:t.type===be.FOLDER||t.type===be.TAG||t.type===be.UNTAGGED||t.type===be.PROPERTY_KEY||t.type===be.PROPERTY_VALUE||t.type===be.VIRTUAL_FOLDER}function Zee(t,e=n=>n.key){let n=new Map,r=t.filter(rFe),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 hh=U(()=>{Ue();Cn()});async function RA({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:ba({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 Jee({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 QV.TFolder).sort((u,p)=>At(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 QV.TFolder&&u.path!==a.path).sort((u,p)=>At(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 QV,MA=U(()=>{QV=require("obsidian");Ln();bi()});function AA({compactItemHeight:t,scaleText:e,titleLineHeight:n}){let{defaultCompactItemHeight:r,defaultCompactFontSize:o,mobileHeightIncrement:a,mobileFontSizeIncrement:i,minCompactPaddingVerticalMobile:s}=uN,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 ZV=U(()=>{Ue()});function oFe(t){let e=t.win.createDiv();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 JV(t){let e=Number.parseFloat(t);return!Number.isFinite(e)||e<=0?null:e}function aFe(t){let e=oFe(t);try{e.classList.add("nn-mobile"),e.style.fontSize="16px";let n=getComputedStyle(e),r=e.getBoundingClientRect().height,o=r>0?r:JV(n.fontSize),a=o?o/16:1,i={};for(let s of DA){let l=n.getPropertyValue(s),c=JV(l.trim());if(c!==null){i[s]=c;continue}e.style.fontSize=`var(${s})`;let u=JV(getComputedStyle(e).fontSize);u!==null&&(i[s]=u/a)}return{scaleFactor:a,fontSizeValues:i}}finally{e.remove()}}function e1(t){t.style.removeProperty("--nn-android-font-scale");for(let e of DA)t.style.removeProperty(e)}function ete(t){e1(t);let{scaleFactor:e,fontSizeValues:n}=aFe(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 DA){let a=n[o];if(a===void 0)continue;let i=a/r;t.style.setProperty(o,`${i}px`)}}}function tte(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 iFe(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 DA){let o=t.style.getPropertyValue(r);o&&e.style.setProperty(r,o.trim())}}function nte(t){let e=t.querySelector(".nn-split-container.nn-mobile");e instanceof HTMLElement&&iFe(t,e)}var DA,t1=U(()=>{DA=["--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"]});var rte,OA,ote=U(()=>{rte=require("obsidian");Oe();OA=class extends rte.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 QS({app:t,plugin:e,tagOperations:n,files:r,options:o}){if(r.length===0)return;if(r.some(u=>u.extension!=="md")){oe(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 XS(t,e,u=>{$(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());oe(m,{variant:"success"})}else{let m=p.skipped>0?p.skipped:r.length,g=d.dragDrop.notifications.filesAlreadyHaveTag.replace("{count}",m.toString());oe(g,{variant:"warning"})}o?.onComplete?.(p)})},s,l,i).open()}async function LA({app:t,tagOperations:e,files:n,options:r}){if(n.length===0)return;if(!n.every(s=>s.extension==="md")){oe(d.fileSystem.notifications.tagsRequireMarkdown,{variant:"warning"});return}let o=e.getTagsFromFiles(n);if(o.length===0){oe(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());oe(l,{variant:"success"}),r?.onComplete?.(s)};if(o.length===1){let s=await e.removeTagFromFiles(o[0],n);a(s);return}new OA(t,o,s=>{$(async()=>{let l=await e.removeTagFromFiles(s,n);a(l)})}).open()}function zA({app:t,tagOperations:e,files:n,options:r}){if(n.length===0)return;if(!n.every(i=>i.extension==="md")){oe(d.fileSystem.notifications.tagsRequireMarkdown,{variant:"warning"});return}if(e.getTagsFromFiles(n).length===0){oe(d.fileSystem.notifications.noTagsToRemove,{variant:"warning"});return}new Pn(t,d.modals.fileSystem.removeAllTagsTitle,n.length===1?d.modals.fileSystem.removeAllTagsFromNote:d.modals.fileSystem.removeAllTagsFromNotes.replace("{count}",n.length.toString()),()=>{$(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());oe(s,{variant:"success"}),r?.onComplete?.(i)})},r?.confirmActionLabel??d.common.remove).open()}var BA=U(()=>{XV();ote();$a();Oe();st();bn()});function sFe(t){let e=eC.get(t);if(e!==void 0)return e;let n=bq(t);if(n.size===0)return eC.set(t,!1),!1;let r=mr();if(!r)return eC.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(Ee(l.fieldKey)===o&&!(l.valueKind!==void 0&&l.valueKind!=="boolean")&&Er(l.value)==="true")return eC.set(t,!0),!0}}return eC.set(t,!1),!1}function _A(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=Ee(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=sFe(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 y=At(h.name,b.name);return y!==0?y: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 eC,n1=U(()=>{Vn();un();Et();Ln();sn();eC=new WeakMap});function ate(t,e){let n=t.indexOf(`
`,e);return n===-1?t.length:n}function r1(t,e){return e>=t.length?t.length:e+1}function lFe(t){let e=ate(t,0);if(t.slice(0,e).trim()!=="---")return t;let r=r1(t,e);for(;r{n+=mFe(r,o,e)}),`${o1(n)}
`}function mFe(t,e,n){let r=e===0?t.content:lFe(t.content),o=e===0?o1(r):cFe(r);return`${e>0?uFe(n,t.file):""}${o}`}function HA(t){let e=t.trim().replace(/\.md$/iu,"").trim(),n=ON(e),r=zN(n);return(ite.Platform.isWin?_N(r):r).trim()}function Sm(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 gFe(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 hFe(t,e){let n=[];for(let r of e)n.push({file:r,content:await t.vault.read(r)});return n}function fFe(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 yFe(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 gFe(t,e)}async function ste({app:t,files:e,outputFolder:n,outputName:r,separator:o,moveSourcesToTrash:a,openOutputFile:i,trashSourceFiles:s}){let l=Sm(e);if(l.length<2)throw new Error("At least two markdown notes are required.");let c=HA(r);if(!c)throw new Error("Output name is required.");let u=await hFe(t,l),p=pFe(u,o),m=Cs(n.path,c,"md",t),g=ol(n.path,m,"md"),f=await t.vault.create(g,p),h=0,b=null;if(i)try{await i(f)}catch(y){b=fFe(y)}return a&&b===null&&(h=await yFe(t,l,s)),{file:f,sourceCount:l.length,failedSourceTrashCount:h,outputOpenError:b}}var ite,ZS=U(()=>{ite=require("obsidian");jp();ws()});var cte={};En(cte,{MergeNotesModal:()=>a1});function bFe(){let t=Te.get(lt.mergeNotesSeparatorKey);return dte(t)?t:lte}function SFe(){let t=Te.get(lt.mergeNotesMoveSourcesToTrashKey);return typeof t=="boolean"?t:vFe}function wFe(t,e){Te.set(lt.mergeNotesSeparatorKey,t),Te.set(lt.mergeNotesMoveSourcesToTrashKey,e)}function dte(t){return t==="none"||t==="blank-line"||t==="horizontal-rule"||t==="heading"}var JS,lte,vFe,a1,ute=U(()=>{JS=require("obsidian");Oe();Ue();st();jr();ZS();lte="blank-line",vFe=!1,a1=class extends JS.Modal{constructor(n,r){super(n);this.isSubmitting=!1;this.moveSourcesToTrash=SFe();this.outputName="";this.separator=bFe();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 JS.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 JS.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 JS.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 dte(n)?n:lte}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=HA(this.outputName).length===0||this.isSubmitting;this.submitBtn.disabled=n,this.submitBtn.toggleClass("mod-disabled",n)}submit(){this.isSubmitting||HA(this.outputName).length===0||(this.isSubmitting=!0,this.updateSubmitState(),$(async()=>{try{await this.onSubmit({outputName:this.outputName,separator:this.separator,moveSourcesToTrash:this.moveSourcesToTrash})&&(wFe(this.separator,this.moveSourcesToTrash),this.close())}finally{this.isSubmitting=!1,this.updateSubmitState()}}))}}});function TFe(t){let e=new Set;return t.forEach(n=>{e.add(n.parent instanceof pte.TFolder?n.parent.path:"/")}),e.size>1}async function kFe(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 VA({app:t,commandQueue:e,fileSystemOps:n,files:r,outputFolder:o,defaultOutputName:a}){let i=Sm(r);if(i.length<2)return;let{MergeNotesModal:s}=await Promise.resolve().then(()=>(ute(),cte));new s(t,{defaultOutputName:a,destinationFolder:o,noteCount:i.length,showCrossFolderLinkWarning:TFe(i),onSubmit:async c=>{try{let u=await ste({app:t,files:i,outputFolder:o,outputName:c.outputName,separator:c.separator,moveSourcesToTrash:c.moveSourcesToTrash,openOutputFile:p=>kFe(t,e,p),trashSourceFiles:async p=>(await n.trashFilesWithOpenLeafCleanup(p)).failedCount});return u.outputOpenError!==null?(oe(d.fileSystem.errors.mergeNotesOpenOutput.replace("{name}",u.file.name).replace("{error}",qr(u.outputOpenError,d.common.unknownError)),{variant:"warning"}),!0):(oe(d.fileSystem.notices.mergeNotes.replace("{count}",u.sourceCount.toString()).replace("{name}",u.file.name),{variant:"success"}),u.failedSourceTrashCount>0&&oe(d.fileSystem.errors.mergeNotesTrashSources.replace("{count}",u.failedSourceTrashCount.toString()),{variant:"warning"}),!0)}catch(u){return oe(d.fileSystem.errors.mergeNotes.replace("{error}",qr(u,d.common.unknownError)),{variant:"warning"}),!1}}}).open()}var pte,i1=U(()=>{pte=require("obsidian");Oe();Dp();ZS();bn()});function KA({isMobile:t,desktopScale:e,mobileScale:n}){return(0,mte.useMemo)(()=>{let r=mi(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 mte,s1=U(()=>{mte=he(Ve());Wm()});function WA({items:t,virtualizer:e,focusedPane:n,containerRef:r,isSelectable:o,onKeyDown:a,onKeyUp:i}){let s=Qr(),l=(0,ew.useCallback)(()=>({findNextIndex:(p,m=!1)=>PFe(t,p,o,m),findPreviousIndex:(p,m=!1)=>FFe(t,p,o,m),getPageSize:()=>CFe(e),scrollToIndex:p=>{e.scrollToIndex(p,{align:"auto"})},getItemAt:p=>UA(t,p),isRTL:()=>activeDocument.body.classList.contains("mod-rtl")}),[t,o,e]),c=(0,ew.useCallback)(p=>{r.current?.getAttribute("data-navigator-focused")==="true"&&(Cp(p)||s.focusedPane===n&&a(p,l()))},[r,s.focusedPane,n,a,l]),u=(0,ew.useCallback)(p=>{!i||r.current?.getAttribute("data-navigator-focused")!=="true"||Cp(p)||s.focusedPane===n&&i(p,l())},[r,s.focusedPane,n,i,l]);(0,ew.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 ew,UA,PFe,FFe,CFe,l1=U(()=>{ew=he(Ve());wa();Ts();UA=(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=UA(t,a);if(i&&n(i))return a}return e},CFe=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 d1(t){return typeof t=="object"&&t!==null}function yte(t,e){return d1(t)&&typeof t[e]=="function"}function gte(t){if(!d1(t)||!Object.prototype.hasOwnProperty.call(t,"file"))return null;let e=t.file;return typeof e=="string"?e:null}function NFe(t){return d1(t)&&typeof t.type=="string"&&SW(t.type)}function IFe(t){if(!yte(t,"getViewState"))return null;try{let e=t.getViewState();return NFe(e)?e:null}catch{return null}}function xFe(t){let{view:e}=t;if(e instanceof fte.FileView&&e.file)return e.file.path;let n=IFe(t);if(!n)return null;if(yte(e,"getState"))try{let r=gte(e.getState());if(r)return r}catch{}return gte(n.state)}function vte(t,e){return xFe(t)===e.path}function EFe(t,e){try{return wp(t).find(n=>ul(t,n)==="main"&&vte(n,e))??null}catch{return null}}function RFe(t,e,n){return n||(EFe(t,e)??t.workspace.getLeaf(!1))}async function MFe(t,e,n,r){if(e){if(vte(e,n)){await t.workspace.revealLeaf(e),t.workspace.setActiveLeaf(e,{focus:r});return}await e.openFile(n,{active:r})}}function rp(){let{app:t,commandQueue:e}=vt();return(0,hte.useCallback)((n,r)=>{if(!n)return;let o=r?.active??!1,a=r?.leaf??null,i=()=>RFe(t,n,a),s=async l=>{await MFe(t,l,n,o)};if(e){$(()=>e.executeOpenActiveFile(n,s,{active:o,getLeaf:i}));return}$(()=>s(i()))},[t,e])}var hte,fte,tw=U(()=>{hte=he(Ve()),fte=require("obsidian");fn();Ue();st();qb()});function nw(){let t=UF(),e=(0,fh.useRef)(t);e.current=t;let n=ar(),{app:r}=vt(),o=yt(),a=r.workspace,i=rp(),s=(0,fh.useCallback)((m,g,f)=>{let h=e.current,b=h.selectedFiles.has(m.path);if(b&&h.selectedFiles.size===1)return;let y=a.getActiveFile();if(b)if(n({type:"TOGGLE_FILE_SELECTION",file:m}),h.selectedFile&&h.selectedFile.path===m.path&&f){let v=f.find(S=>h.selectedFiles.has(S.path)&&S.path!==m.path);v&&(n({type:"UPDATE_CURRENT_FILE",file:v}),i(v))}else y&&y.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,fh.useCallback)((m,g,f)=>{let h=e.current,b=uB(f,h.selectedFile);if(b===-1){n({type:"SET_SELECTED_FILE",file:m});return}let y=Gb(f,b,g),{selectedFiles:v,changed:S}=jb(h.selectedFiles,y);n({type:"APPLY_FILE_SELECTION",selectedFiles:v,selectedFile:m,lastMovementDirection:S?null:h.lastMovementDirection}),i(m)},[n,i]),c=(0,fh.useCallback)((m,g,f,h)=>{let b=e.current;if(g===-1||!b.selectedFile)return-1;let y=b.selectedFile,v=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],T=!0,F=a.getActiveFile(),k=!1;b.selectedFiles.has(y.path)&&b.selectedFiles.has(w.path)&&(v.delete(y.path),T=!1,F&&F.path===y.path&&(k=!0)),b.selectedFiles.has(w.path)||v.add(w.path);let E=S;if(T){let L=m==="down"?S+1:S-1;for(;L>=0&&L{if(m.length===0)return;let f=e.current.selectedFile||m[0];n({type:"SET_FILE_SELECTION",files:m,selectedFile:f})},[n]),p=(0,fh.useCallback)(m=>e.current.selectedFiles.has(m.path),[]);return{handleMultiSelectClick:s,handleRangeSelectClick:l,handleShiftArrowSelection:c,selectAll:u,isFileSelected:p}}var fh,GA=U(()=>{fh=he(Ve());Ur();fn();on();tw();bi()});function bte({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,tagTreeService:b,propertyTreeService:y}=vt(),v=rp(),S=Ti(),w=yt(),T=jt(),F=T.includeDescendantNotes,k=T.showHiddenItems,P=UF(),E=(0,wm.useRef)(P);E.current=P;let C=nd(),L=(0,wm.useRef)(C);L.current=C;let z=ar(),G=So(),{handleShiftArrowSelection:Q,selectAll:R}=nw(),O=(0,wm.useCallback)(()=>{let A=E.current.selectedFile;return A?.path?o.get(A.path)??-1:-1},[o]),D=(0,wm.useCallback)((A,N)=>{if(A.type===tn.FILE){let M=A.data instanceof tC.TFile?A.data:null;if(!M)return;s(M,{markKeyboardNavigation:!0,suppressOpen:N?.suppressOpen,debounceOpen:N?.debounceOpen})}},[s]),x=(0,wm.useCallback)((A,N)=>{let M=A==="home"?0:a.length-1,H=a[M];if(!H)return;let q=Gb(a,A==="home"?0:N,A==="home"?N:a.length-1),X=E.current,{selectedFiles:V,changed:j}=jb(X.selectedFiles,q);if(z({type:"APPLY_FILE_SELECTION",selectedFiles:V,selectedFile:H,lastMovementDirection:j?null:X.lastMovementDirection}),w.enterToOpenFiles||v(H),A==="home"){n.scrollToIndex(0,{align:"start"});return}let _=o.get(H.path);_!==void 0&&l(_,"auto")},[a,z,w.enterToOpenFiles,v,n,o,l]),B=(0,wm.useCallback)((A,N)=>{if(!t)return;let M=O(),H=E.current,q=w.keyboardShortcuts,X=N.isRTL(),V=-1,j=!1,_=!1,W=()=>N.findNextIndex(-1),J=()=>{let Y=n.getVirtualItems(),ne=n.scrollElement;if(Y.length===0||!ne)return N.getPageSize();let le=n.scrollOffset??ne.scrollTop,ae=le+ne.clientHeight,ve=0;for(let de of Y){let Pe=N.getItemAt(de.index);if(!Pe||!jA(Pe))continue;let Fe=de.start;Fe+de.size>le&&Fe{let le=J(),ae=Y;for(let ve=le;ve>0;ve-=1){let de=ne==="down"?N.findNextIndex(ae):N.findPreviousIndex(ae);if(de<0||de===ae)break;ae=de}return ae};if(w.enterToOpenFiles&&Av(A)){let Y=Dv(A,w);if(Y==="rename"){A.preventDefault(),g?.();return}let ne=jc(f,H);if(!ne)return;if(A.preventDefault(),Y){$(()=>Vr({app:f,commandQueue:h,file:ne,context:Y,active:!1}));return}v(ne);return}if(cn(A,q,xt.PANE_RENAME)&&g?.()){A.preventDefault();return}let re=(Y,ne)=>{if(ne&&u){u(Y);return}v(Y)};if(cn(A,q,xt.LIST_MANUAL_SORT_DOWN)&&m?.("down")===!0){A.preventDefault();return}if(cn(A,q,xt.LIST_MANUAL_SORT_UP)&&m?.("up")===!0){A.preventDefault();return}if(cn(A,q,xt.LIST_EXTEND_SELECTION_DOWN)){if(A.preventDefault(),Kn()&&H.selectedFile?.path){let Y=i.get(H.selectedFile.path);if(Y!==void 0&&Y!==-1){let ne=A.key==="ArrowDown",le=Q("down",Y,a,{openFile:ae=>re(ae,ne)});if(le===-1&&ne&&c?.(),le>=0){let ae=a[le],ve=o.get(ae.path);ve!==void 0&&l(ve,"auto")}}}return}if(cn(A,q,xt.LIST_EXTEND_SELECTION_UP)){if(A.preventDefault(),Kn()&&H.selectedFile?.path){let Y=i.get(H.selectedFile.path);if(Y!==void 0&&Y!==-1){let ne=A.key==="ArrowUp",le=Q("up",Y,a,{openFile:ae=>re(ae,ne)});if(le===-1&&ne&&c?.(),le>=0){let ae=a[le],ve=o.get(ae.path);ve!==void 0&&l(ve,"auto")}}}return}if(cn(A,q,xt.PANE_MOVE_DOWN)){if(A.preventDefault(),V=N.findNextIndex(M),V===M&&M>=0){A.key==="ArrowDown"&&c?.();return}_=A.key==="ArrowDown"}else if(cn(A,q,xt.PANE_MOVE_UP)){if(A.preventDefault(),M===-1)V=N.findNextIndex(-1);else if(V=N.findPreviousIndex(M),V===M&&M>=0){A.key==="ArrowUp"&&c?.();return}_=A.key==="ArrowUp"}else if(cn(A,q,xt.PANE_PAGE_DOWN))A.preventDefault(),M!==-1&&(V=Z(M,"down")),_=A.key==="PageDown";else if(cn(A,q,xt.PANE_PAGE_UP)){A.preventDefault();let Y=W();if(M===-1)V=Y,Y>=0&&(j=!0);else{let ne=Z(M,"up");ne>=0?(V=ne,Y>=0&&ne===Y&&(j=!0)):(V=Y,Y>=0&&(j=!0))}_=A.key==="PageUp"}else if(cn(A,q,xt.LIST_FOCUS_EDITOR,{isRTL:X,directional:"horizontal"})){if(H.selectedFile){A.preventDefault();let ne=wp(f).find(le=>{let ae=le.view;return ae instanceof tC.FileView&&ae.file?.path===H.selectedFile?.path});ne&&f.workspace.setActiveLeaf(ne,{focus:!0})}}else if(cn(A,q,xt.LIST_FOCUS_NAVIGATION,{isRTL:X,directional:"horizontal"}))A.preventDefault(),G({type:"ACTIVATE_PANE",target:"navigation"});else if(cn(A,q,xt.DELETE_SELECTED)){if(H.selectedFile||H.selectedFiles.size>0){A.preventDefault();let Y={...L.current,selectedFiles:H.selectedFiles,selectedFile:H.selectedFile};$(()=>RA({app:f,fileSystemOps:S,settings:w,visibility:{includeDescendantNotes:F,showHiddenItems:k},selectionState:Y,selectionDispatch:z,tagTreeService:b,propertyTreeService:y,orderedFiles:a}))}}else if(cn(A,q,xt.LIST_SELECT_ALL)){if(A.preventDefault(),Kn()){let Y=e.filter(ne=>ne.type===tn.FILE).map(ne=>{let le=ne;return le.data instanceof tC.TFile?le.data:null}).filter(ne=>ne!==null);R(Y)}}else if(cn(A,q,xt.LIST_RANGE_TO_START)){if(A.preventDefault(),Kn()&&H.selectedFile?.path){let Y=i.get(H.selectedFile.path);Y!==void 0&&Y!==-1&&x("home",Y)}return}else if(cn(A,q,xt.LIST_RANGE_TO_END)){if(A.preventDefault(),Kn()&&H.selectedFile?.path){let Y=i.get(H.selectedFile.path);Y!==void 0&&Y!==-1&&x("end",Y)}return}else if(cn(A,q,xt.PANE_HOME)){A.preventDefault();let Y=W();V=Y,Y>=0&&(j=!0)}else if(cn(A,q,xt.PANE_END)){A.preventDefault();for(let Y=e.length-1;Y>=0;Y--){let ne=N.getItemAt(Y);if(ne&&jA(ne)){V=Y;break}}}if(V>=0&&V{t&&p&&(A.ctrlKey||A.metaKey||A.altKey||A.key!=="ArrowUp"&&A.key!=="ArrowDown"&&A.key!=="PageUp"&&A.key!=="PageDown"||p())},[t,p]);WA({items:e,virtualizer:n,focusedPane:"files",containerRef:r,isSelectable:jA,_getCurrentIndex:O,onKeyDown:B,onKeyUp:I})}var wm,tC,jA,Ste=U(()=>{wm=he(Ve()),tC=require("obsidian");Ur();fn();on();gr();wa();Ue();MA();bi();l1();GA();tw();Uh();st();_u();Md();$r();jA=t=>t.type===tn.FILE});function wte(t){return String(t).padStart(2,"0")}function Tte(t){let e=t.getFullYear(),n=wte(t.getMonth()+1),r=wte(t.getDate());return`${e}-${n}-${r}`}function DFe(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 qA(){let[t,e]=(0,my.useState)(()=>Tte(new Date)),n=(0,my.useRef)(null),r=(0,my.useRef)(0);return(0,my.useEffect)(()=>{if(typeof window>"u")return;let o=()=>{let c=n.current;c!==null&&(window.clearTimeout(c),n.current=null)},a=()=>{let c=Tte(new Date);e(u=>u===c?u:c)},i=()=>{o();let c=DFe(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 my,AFe,c1=U(()=>{my=he(Ve()),AFe=120});function h1(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(!Cte(o,r))return!1}for(let r of e.excludeDateRanges){let o=n(r);if(Cte(o,r))return!1}return!0}var ow,OFe,LFe,zFe,aw,Tm,kte,nC,rw,BFe,YA,Pte,_Fe,HFe,p1,VFe,KFe,Fte,UFe,u1,WFe,m1,g1,Cte,f1=U(()=>{ow=["today","yesterday","last7d","last30d","thisweek","thismonth"],OFe=new Set(ow),LFe=1,zFe=9999,aw=t=>Number.isFinite(t)&&t>=LFe&&t<=zFe,Tm=(t,e,n)=>{let r=new Date(0);return r.setFullYear(t,e,n),r.setHours(0,0,0,0),r},kte=(t,e,n)=>{let r=new Date(0);return r.setUTCFullYear(t,e,n),r.setUTCHours(0,0,0,0),r.getTime()},nC=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}},rw=null,BFe=()=>{if(rw)return rw;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)||!aw(t)||e<1||e>12||n<1||n>31)return null;let r=Tm(t,e-1,n);if(r.getFullYear()!==t||r.getMonth()!==e-1||r.getDate()!==n||Number.isNaN(r.getTime()))return null;let o=Tm(t,e-1,n+1);return Number.isNaN(o.getTime())?null:{startMs:r.getTime(),endMs:o.getTime()}},Pte=(t,e)=>{if(!Number.isFinite(t)||!Number.isFinite(e)||!aw(t)||e<1||e>12)return null;let n=Tm(t,e-1,1);if(n.getFullYear()!==t||n.getMonth()!==e-1||n.getDate()!==1||Number.isNaN(n.getTime()))return null;let r=Tm(t,e,1);return Number.isNaN(r.getTime())?null:{startMs:n.getTime(),endMs:r.getTime()}},_Fe=(t,e)=>{if(!Number.isFinite(t)||!Number.isFinite(e)||!aw(t)||e<1||e>4)return null;let n=(e-1)*3,r=Tm(t,n,1);if(r.getFullYear()!==t||r.getMonth()!==n||r.getDate()!==1||Number.isNaN(r.getTime()))return null;let o=Tm(t,n+3,1);return Number.isNaN(o.getTime())?null:{startMs:r.getTime(),endMs:o.getTime()}},HFe=t=>{if(!Number.isFinite(t)||!aw(t))return null;let e=Tm(t,0,1);if(e.getFullYear()!==t||e.getMonth()!==0||e.getDate()!==1||Number.isNaN(e.getTime()))return null;let n=Tm(t+1,0,1);return Number.isNaN(n.getTime())?null:{startMs:e.getTime(),endMs:n.getTime()}},p1=t=>{if(!Number.isFinite(t)||!aw(t))return null;let e=Tm(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},VFe=t=>{let e=p1(t),n=p1(t+1);if(!e||!n)return null;let r=kte(e.getFullYear(),e.getMonth(),e.getDate()),o=kte(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},KFe=(t,e)=>{if(!Number.isFinite(t)||!Number.isFinite(e)||!aw(t)||e<1||e>53)return null;let n=VFe(t);if(!n||e>n)return null;let r=p1(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()}},Fte=(t,e,n)=>{let r=YA(n,e,t),o=YA(n,t,e);return r&&!o?r:o&&!r?o:!r||!o?null:BFe()==="MDY"?o:r},UFe=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 YA(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 YA(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 Fte(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 Fte(i,s,l)}return null},u1=t=>{let e=t.trim();if(!e)return null;let n=e.match(/^(\d{3,4})$/);if(n){let s=Number(n[1]);return HFe(s)}let r=e.match(/^(\d{3,4})[-/.](\d{1,2})$/);if(r){let s=Number(r[1]),l=Number(r[2]);return Pte(s,l)}let o=e.match(/^(\d{4})(\d{2})$/);if(o){let s=Number(o[1]),l=Number(o[2]);return Pte(s,l)}let a=e.match(/^(\d{3,4})[-/.]?q([1-4])$/);if(a){let s=Number(a[1]),l=Number(a[2]);return _Fe(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 KFe(s,l)}return UFe(e)},WFe=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},m1=t=>{if(!t.startsWith("@"))return null;let e=t.slice(1),{field:n,remainder:r}=nC(e),o=r.trim().toLowerCase();if(!o)return null;if(OFe.has(o)){let s=WFe(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?u1(s):null,u=l?u1(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=u1(o);return i?{field:n,startMs:i.startMs,endMs:i.endMs}:null},g1=t=>{if(!t.startsWith("@"))return!1;let e=t.slice(1),{remainder:n}=nC(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 ow)if(a.startsWith(r))return!0;return!1},Cte=(t,e)=>!(!Number.isFinite(t)||e.startMs!==null&&t=e.endMs)});var Nte,rC,gy,GFe,jFe,Ite,xte,qFe,Ete,YFe,Rte,y1=U(()=>{Nte={AND:2,OR:1},rC=(t,e)=>!t||!e?!1:t===e||t.startsWith(`${e}/`),gy=(t,e)=>{if(e.value===null){for(let o of t.keys())if(o.startsWith(e.key))return!0;return!1}let n=t.get(e.key);if(!n)return!1;let r=e.value;return n.some(o=>o.includes(r))},GFe=t=>typeof t!="object"||t===null||!("key"in t)||typeof t.key!="string"||!("value"in t)?!1:typeof t.value=="string"||t.value===null,jFe=t=>t.kind==="operator"&&(t.operator==="AND"||t.operator==="OR"),Ite=(t,e)=>t.kind===e&&(typeof t.value=="string"||t.value===null),xte=(t,e)=>t.kind===e&&GFe(t.value),qFe=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(Nte[g]>=Nte[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())}},Ete=(t,e,n)=>{if(t.length===0)return!0;let r=[],o=a=>{for(let i of e)if(rC(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=gy(n,a.value):a.kind==="notProperty"&&(i=!gy(n,a.value)),r.push(i)}return r.length===0?!0:!!r[r.length-1]},YFe=(t,e)=>{if(t.length===0)return!0;let n=[],r=o=>{for(let a of e)if(rC(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]},Rte=(t,e,n)=>{let r=[];for(let f of t){if(jFe(f)){r.push(f);continue}if(Ite(f,"tag")||Ite(f,"tagNegation")){r.push(f);continue}if(xte(f,"property")||xte(f,"propertyNegation")){r.push(f);continue}return null}let o=qFe(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?!YFe(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 iw,$A=U(()=>{iw={tags:{include:[],exclude:[],includeOperators:{},excludeTagged:!1,includeUntagged:!1,requireTagged:!1},properties:{include:[],exclude:[],includeOperators:{}}}});function aC(t){let e=[],n=t.trim();if(!n)return e;let r="",o=!1,a=!1,i=!1,s=0,l=()=>{r.length>0&&e.push({text:r,literal:o,negated:a}),r="",o=!1,a=!1};for(;s{c&&r.add(c)}),n.excludeTagTokens.forEach(c=>{c&&o.add(c)}),n.propertyTokens.forEach(c=>{a.add(S1(c))}),n.excludePropertyTokens.forEach(c=>{i.add(S1(c))});let s={},l={};if(n.mode==="tag"){let c=aC(e),u=Gte(c),p=!1,m=null;for(let g of u.tokens){if(g.kind==="operator"){m=g.operator;continue}if(!oCe(g))continue;let f=p?m??"AND":null;g.kind==="tag"&&g.value&&f?s[g.value]=f:g.kind==="property"&&f&&(l[S1(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 Zte(t,e,n){let r=t.trim();if(!e)return{query:r,action:"removed",changed:!1};let o=`#${e}`,a=r.length>0?aC(r):[],i=Yte(r),s=zr(o),l=a.findIndex(p=>!p.literal&&zr(p.text)===s);if(l!==-1){let p=Xte(a,l,i),m=XA(p);return{query:m,action:"removed",changed:m!==r}}let c=Qte(a,o,n,i),u=XA(c);return{query:u,action:"added",changed:u!==r}}function Jte(t,e,n,r){let o=t.trim(),a=T1(e);if(!a)return{query:o,action:"removed",changed:!1};let i=null;if(typeof n=="string"){let b=Wte(n);if(!b)return{query:o,action:"removed",changed:!1};i=b}let s={key:a,value:i},l=$te(s),c=o.length>0?aC(o):[],u=Yte(o),p=zr(s.key),m=zr(s.value??""),g=c.findIndex(b=>{if(b.literal||b.text.startsWith("-"))return!1;let y=oC(b.text);if(!y)return!1;let v=zr(y.key),S=zr(y.value??"");return v===p&&S===m});if(g!==-1){let b=Xte(c,g,u),y=XA(b);return{query:y,action:"removed",changed:y!==o}}let f=Qte(c,l,r,u),h=XA(f);return{query:h,action:"added",changed:h!==o}}function ene(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 QA(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 tne(t){return t.requiresTags||t.excludeTagged||t.excludeTagTokens.length>0}function ZA(t){return t.requiresProperties||t.excludePropertyTokens.length>0}function nne(t){return t.hasInclusions&&t.allRequireTags}function dCe(t,e,n){let r=Array.from(new Set(n.filter(i=>!t.includes(i)))),o=new Set(r);if(o.size===0)return{aliasIndexes:[]};let a=[];for(;o.size>0;){let i=-1,s=0;if(e.forEach((c,u)=>{let p=0;o.forEach(m=>{c.includes(m)&&(p+=1)}),p>s&&(i=u,s=p)}),i===-1)return null;a.push(i);let l=e[i];o.forEach(c=>{l.includes(c)&&o.delete(c)})}a.sort((i,s)=>i-s);for(let i=a.length-1;i>=0;i-=1){let s=a.filter((c,u)=>u!==i);r.every(c=>s.some(u=>e[u]?.includes(c)))&&a.splice(i,1)}return{aliasIndexes:a}}function rne(t,e,n,r){let o=r?.hasUnfinishedTasks??!1,a=r?.foldedAliases??[],i=r?.foldedFolderPath??"",s=r?.foldedExtension??"",l=r?.propertyValuesByKey??$Fe;if(n.excludeUnfinishedTasks&&o||n.requireUnfinishedTasks&&!o)return us;if(n.mode==="filter"){let c=null,u=n.excludeFolderTokens.length>0||n.folderTokens.length>0,p=u?nCe(i):"",g=u&&(n.excludeFolderTokens.some(f=>f.mode==="segment")||n.folderTokens.some(f=>f.mode==="segment"))?p.split("/").filter(Boolean):null;if(n.excludeNameTokens.length>0&&n.excludeNameTokens.some(h=>t.includes(h)||a.some(b=>b.includes(h)))||n.excludeFolderTokens.length>0&&n.excludeFolderTokens.some(h=>_te(p,g,h))||n.excludeExtensionTokens.length>0&&n.excludeExtensionTokens.some(h=>Hte(s,h)))return us;if(n.excludeTagged){if(e.length>0)return us}else if(n.excludeTagTokens.length>0&&e.length>0&&n.excludeTagTokens.some(h=>e.some(b=>rC(b,h))))return us;return n.excludePropertyTokens.length>0&&n.excludePropertyTokens.some(h=>gy(l,h))||n.nameTokens.length>0&&(c=dCe(t,a,n.nameTokens),!c)||n.folderTokens.length>0&&!n.folderTokens.every(h=>_te(p,g,h))||n.extensionTokens.length>0&&!n.extensionTokens.every(h=>Hte(s,h))||n.propertyTokens.length>0&&!n.propertyTokens.every(h=>gy(l,h))||(n.requireTagged||n.tagTokens.length>0)&&(e.length===0||n.tagTokens.length>0&&!n.tagTokens.every(h=>e.some(b=>rC(b,h))))?us:c?{matches:!0,nameMatch:c}:w1}return n.excludeTagged&&e.length>0?us:n.expression.length===0||Ete(n.expression,e,l)?w1:us}var Mte,$Fe,XFe,QFe,Ute,T1,Wte,k1,ZFe,v1,b1,oC,Ate,sw,JFe,eCe,Dte,P1,F1,tCe,Ote,Lte,zte,Bte,nCe,_te,Hte,Gte,rCe,oCe,S1,qte,lw,Yte,Vte,aCe,iCe,Kte,$te,sCe,lCe,XA,Xte,Qte,us,w1,iC=U(()=>{f1();y1();$A();Et();un();_l();f1();Mte={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},$Fe=new Map,XFe=new Set(["and","or"]),QFe=new Set(["has:task","has:tasks"]),Ute=".",T1=t=>Ee(t.trim()),Wte=t=>Er(ug(t)),k1=t=>t.startsWith(Ute),ZFe=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},oC=t=>{if(!k1(t))return null;let e=t.slice(Ute.length);if(!e)return null;let n=ZFe(e);if(n===-1){let s=T1(b1(v1(e)));return s?{key:s,value:null}:null}let r=b1(v1(e.slice(0,n))),o=b1(v1(e.slice(n+1))),a=T1(r);if(!a)return null;let i=Wte(o);return i?{key:a,value:i}:{key:a,value:null}},Ate=t=>({key:zr(t.key),value:t.value===null?null:zr(t.value)}),sw=t=>({text:t,literal:!1,negated:!1});JFe=t=>t.hasTagOperand&&!t.hasNonTagOperand&&!t.hasInvalidToken,eCe=t=>t&&t.charAt(0)==="-"?"-":null,Dte=t=>QFe.has(t),P1="folder:",F1="ext:",tCe=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}},Ote=t=>t.startsWith(P1),Lte=t=>tCe(t.slice(P1.length)),zte=t=>t.startsWith(F1),Bte=t=>{let e=t.slice(F1.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},nCe=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},_te=(t,e,n)=>n.mode==="exact"?t===n.value:!n.value||!t?!1:(e??t.split("/").filter(Boolean)).some(o=>o.includes(n.value)),Hte=(t,e)=>!t||!e?!1:t===e,Gte=t=>{let e=[],n=!1,r=!1,o=!1;for(let a of t){if(!a.text)continue;if(a.literal){r=!0;let u=wu(a.text.toLowerCase());e.push(a.negated?{kind:"nameNegation",value:u}:{kind:"name",value:u});continue}let i=a.text.toLowerCase(),s=null,l=()=>(s!==null||(s=wu(i)),s);if(i==="and"){e.push({kind:"operator",operator:"AND"});continue}if(i==="or"){e.push({kind:"operator",operator:"OR"});continue}if(eCe(i)!==null){let u=i.slice(1),p=null,m=()=>(p!==null||(p=wu(u)),p);if(!u){o=!0;continue}if(Dte(u)){e.push({kind:"unfinishedTaskNegation"}),r=!0;continue}if(u.startsWith("@")){if(g1(u)){let g=m1(u);g&&(e.push({kind:"dateNegation",range:g}),r=!0);continue}r=!0,e.push({kind:"nameNegation",value:m()});continue}if(Ote(u)){let g=Lte(u);g&&(e.push({kind:"folderNegation",value:{...g,value:wu(g.value)}}),r=!0);continue}if(zte(u)){let g=Bte(u);g&&(e.push({kind:"extensionNegation",value:wu(g)}),r=!0);continue}if(k1(u)){let g=oC(u);g&&(e.push({kind:"propertyNegation",value:Ate(g)}),n=!0);continue}if(u.startsWith("#")){let g=u.slice(1);e.push({kind:"tagNegation",value:g.length>0?wu(g):null}),n=!0;continue}r=!0,e.push({kind:"nameNegation",value:m()});continue}if(Dte(i)){e.push({kind:"unfinishedTask"}),r=!0;continue}if(i.startsWith("@")){if(g1(i)){let u=m1(i);u&&(e.push({kind:"date",range:u}),r=!0);continue}r=!0,e.push({kind:"name",value:l()});continue}if(Ote(i)){let u=Lte(i);u&&(e.push({kind:"folder",value:{...u,value:wu(u.value)}}),r=!0);continue}if(zte(i)){let u=Bte(i);u&&(e.push({kind:"extension",value:wu(u)}),r=!0);continue}if(k1(i)){let u=oC(i);u&&(e.push({kind:"property",value:Ate(u)}),n=!0);continue}if(i.startsWith("#")){let u=i.slice(1);e.push({kind:"tag",value:u.length>0?wu(u):null}),n=!0;continue}r=!0,e.push({kind:"name",value:l()})}return{tokens:e,hasTagOperand:n,hasNonTagOperand:r,hasInvalidToken:o}},rCe=(t,e,n,r)=>{let o=[],a=[],i=[],s=[],l=[],c=[],u=[],p=[],m=[],g=[],f=[],h=!1,b=!1,y=!1;for(let k of t)switch(k.kind){case"name":o.push(k.value);break;case"nameNegation":p.push(k.value);break;case"tag":k.value&&a.push(k.value),y=!0;break;case"property":i.push(k.value);break;case"folder":s.push(k.value);break;case"extension":l.push(k.value);break;case"date":c.push(k.range);break;case"unfinishedTask":h=!0;break;case"unfinishedTaskNegation":b=!0;break;case"operator":u.push(k.operator.toLowerCase());break;case"tagNegation":break;case"propertyNegation":break;case"folderNegation":m.push(k.value);break;case"extensionNegation":g.push(k.value);break;case"dateNegation":f.push(k.range);break}u.length>0&&o.push(...u);let v=o.length>0||a.length>0||i.length>0||s.length>0||l.length>0||c.length>0||y||h,S=y||a.length>0,w=i.length>0,T=v?S:!1,F=a.slice();return{mode:"filter",expression:[],hasInclusions:v,requiresTags:S,allRequireTags:T,requireUnfinishedTasks:h,excludeUnfinishedTasks:b,includedTagTokens:F,propertyTokens:i,excludePropertyTokens:n,requiresProperties:w,nameTokens:o,tagTokens:a,dateRanges:c,requireTagged:y,includeUntagged:r,excludeNameTokens:p,excludeTagTokens:e,folderTokens:s,excludeFolderTokens:m,extensionTokens:l,excludeExtensionTokens:g,excludeDateRanges:f,excludeTagged:r}};oCe=t=>t.kind==="tag"||t.kind==="tagNegation"||t.kind==="property"||t.kind==="propertyNegation",S1=t=>t.value===null?or(t.key):fa(t.key,t.value);qte=t=>t?XFe.has(t.toLowerCase()):!1,lw=t=>!t||t.literal?!1:qte(t.text),Yte=t=>{let e=t.trim();if(!e)return!0;let n=aC(e),r=!1;for(let o of n){if(o.literal)return!1;let a=o.text.toLowerCase();if(qte(a))continue;let i=a.startsWith("-")?a.slice(1):a;if(!i)return!1;if(i.startsWith("#")){r=!0;continue}if(oC(i)){r=!0;continue}return!1}return r},Vte=t=>t.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),aCe=t=>/\s/.test(t)||t.includes('"')||t.includes("\\")||t.includes("="),iCe=(t,e=!1)=>{let n="";for(let r of t)(r==="\\"||r==="="||e&&r==='"')&&(n+="\\"),n+=r;return n},Kte=t=>{let e=aCe(t),n=iCe(t,e);return e?`"${n}"`:n},$te=(t,e=!1)=>{let n=e?"-.":".",r=Kte(t.key);if(t.value===null)return`${n}${r}`;let o=Kte(t.value);return`${n}${r}=${o}`},sCe=[P1,F1,"#"],lCe=t=>{if(t.literal)return`${t.negated?"-":""}"${Vte(t.text)}"`;let e=t.text,n=e.toLowerCase();if(n.startsWith("-.")||n.startsWith(".")){let r=n.startsWith("-."),o=r?n.slice(1):n,a=oC(o);if(a)return $te(a,r)}if(/\s/.test(e)||e.includes('"')||e.includes("\\")){let r=e.startsWith("-")?"-":"",o=e.slice(r.length),a=o.toLowerCase(),i=sCe.find(c=>a.startsWith(c)),s=i?o.slice(0,i.length):"",l=o.slice(s.length);return`${r}${s}"${Vte(l)}"`}return e},XA=t=>t.map(e=>lCe(e)).join(" ").trim(),Xte=(t,e,n)=>{let r=t.slice();if(r.splice(e,1),!n)return r;let o=e-1;for(o>=0&&lw(r[o])&&r.splice(o,1);r.length>0&&lw(r[0]);)r.shift();for(let a=0;a0&&lw(r[r.length-1]);)r.pop();return r},Qte=(t,e,n,r)=>{let o=t.slice();if(!r)return o.push(sw(e)),o;let a=n==="OR"?"OR":"AND";return o.length===0?o.push(sw(e)):lw(o[o.length-1])?(o[o.length-1]=sw(a),o.push(sw(e))):o.push(sw(a),sw(e)),o};us={matches:!1,nameMatch:null},w1={matches:!0,nameMatch:null}});function N1(t){return t.trim().toLowerCase()}function I1(t){return t.normalize("NFD").replace(pCe,"")}function sne(t){return cCe.test(t)}function ane(t,e){return e.startsWith(t)||t.startsWith(e)}function yCe(t){return uCe.test(t)}function vCe(t,e,n,r){return n.length===0?!1:t.length===1?n.some(o=>o===t)?!0:yCe(t)?n.some(o=>o.includes(t)):!1:n.some(o=>o===t||ane(t,o))?!0:r.some(o=>o===e||ane(e,o))}function ine(t,e,n,r){return!t||!sne(t)?!1:vCe(t,e,n,r)}function bCe(t){return t.replace(mCe,(e,n)=>typeof n=="string"&&n.length>0?n:" ")}function SCe(t){return N1(t).replace(hCe,"").replace(fCe,"").trim()}function C1(t,e,n){let r=SCe(n);!r||!sne(r)||r==="path"||r==="ext"||r.startsWith("path:")||r.startsWith("ext:")||e.has(r)||(e.add(r),t.push(r))}function wCe(t){let e=[],n=new Set;return bCe(t).replace(gCe,(a,i,s)=>{let l=typeof i=="string"?i:s;return typeof l=="string"&&l.length>0&&(C1(e,n,l),l.split(one).forEach(c=>C1(e,n,c)))," "}).split(one).forEach(a=>C1(e,n,a)),e}function lne(t){let e=wCe(t);return{queryTokens:e,foldedQueryTokens:e.map(n=>I1(n))}}function dne(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=N1(p.text);if(!m)continue;let g=I1(m);!(Number.isFinite(p.offset)&&Number.isFinite(p.length)&&p.offset>=0&&p.length>0)||!ine(m,g,r,o)||(a.push(p),s.add(m),l.add(g))}for(let p of e){let m=N1(p);if(!m)continue;let g=I1(m);ine(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 one,cCe,uCe,pCe,mCe,gCe,hCe,fCe,cne=U(()=>{one=/\s+/,cCe=/[\p{L}\p{N}]/u,uCe=/^[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}]$/u,pCe=/\p{M}+/gu,mCe=/(^|\s)-?(?:path|ext)\s*:\s*(?:"[^"]*"|'[^']*'|[^\s]+)/gi,gCe=/"([^"]+)"|'([^']+)'/g,hCe=/^["'`]+|["'`]+$/g,fCe=/^[-+]+/});function PCe(t){return t.map(e=>zr(Mt(e))).filter(e=>e.length>0)}function FCe(t){let e=[...t.propertyTokens,...t.excludePropertyTokens];return e.length===0?mne:{keyPrefixes:e.filter(n=>n.value===null).map(n=>n.key),exactKeys:new Set(e.filter(n=>n.value!==null).map(n=>n.key))}}function CCe(t,e){if(!t||t.length===0||e.keyPrefixes.length===0&&e.exactKeys.size===0)return x1;let n=new Map;t.forEach(o=>{let a=zr(o.fieldKey.trim());if(!a||!e.exactKeys.has(a)&&!e.keyPrefixes.some(c=>a.startsWith(c)))return;let i=n.get(a);if(i||(i=new Set,n.set(a,i)),!e.exactKeys.has(a))return;let s=ug(o.value),l=zr(s);l&&i.add(l)});let r=new Map;return n.forEach((o,a)=>{r.set(a,Array.from(o))}),r}function NCe(t,e){return t.size===0||e.propertyTokens.length===0?[]:e.propertyTokens.filter(n=>gy(t,n)).map(n=>({clause:n}))}function gne({basePathSet:t,omnisearchPathScope:e,omnisearchService:n,trimmedQuery:r,useOmnisearch:o}){let[a,i]=(0,op.useState)(null),s=(0,op.useRef)(0);return(0,op.useEffect)(()=>{o||i(null)},[o]),(0,op.useEffect)(()=>{if(!o)return;if(!n){i(null);return}let l=++s.current,c=!1;return $(async()=>{try{let u=await n.search(r,{pathScope:e});if(c||s.current!==l)return;let p=new Map,m=[],g=lne(r);u.forEach(f=>{if(!t.has(f.path))return;m.push(f.file);let{matches:h,terms:b}=dne(f.matches,f.foundWords,g),y=typeof f.excerpt=="string"?ly.normalizeExcerpt(f.excerpt,{stripHtml:!1}):void 0;p.set(f.path,{score:f.score,terms:b,matches:h,excerpt:y})}),i({files:m,meta:p})}catch{s.current===l&&i({files:[],meta:new Map})}}),()=>{c=!0}},[t,e,n,r,o]),a}function une(t,e){let n=[],r=[];for(let o of(0,pne.parseFrontMatterAliases)(e)??[]){let a=zr(o);a&&(n.push(o),r.push(a))}return{foldedDisplayName:zr(t),aliases:n,foldedAliases:r}}function ICe(t,e){return!t||t.foldedDisplayName!==e.foldedDisplayName||t.aliases.length!==e.aliases.length?!1:t.aliases.every((n,r)=>n===e.aliases[r]&&t.foldedAliases[r]===e.foldedAliases[r])}function hne({app:t,baseFiles:e,getFileDisplayName:n}){let[r,o]=(0,op.useState)(new Map);return(0,op.useEffect)(()=>{let a=new Map;e.forEach(i=>{let s=i.extension==="md"?t.metadataCache.getFileCache(i)?.frontmatter??null:null;a.set(i.path,une(n(i),s))}),o(a)},[t.metadataCache,e,n]),(0,op.useEffect)(()=>{let a=new Set(e.map(s=>s.path)),i=t.metadataCache.on("changed",(s,l,c)=>{if(!s||!a.has(s.path))return;let u=s.extension==="md"?c.frontmatter??null:null,p=une(n(s),u);o(m=>{if(ICe(m.get(s.path),p))return m;let g=new Map(m);return g.set(s.path,p),g})});return()=>{t.metadataCache.offref(i)}},[t.metadataCache,e,n]),r}function fne({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{files:e,matchedAliases:sC,matchedProperties:lC};if(u){if(!o)return{files:e,matchedAliases:sC,matchedProperties:lC};let L=new Set(o.files.map(z=>z.path));return L.size===0?{files:[],matchedAliases:sC,matchedProperties:lC}:{files:e.filter(z=>L.has(z.path)),matchedAliases:sC,matchedProperties:lC}}let p=a??yh(c);if(!QA(p))return{files:e,matchedAliases:sC,matchedProperties:lC};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=gI(l,s.alphabeticalDateMode??"modified"),y=tne(p),v=ZA(p),S=nne(p),w=p.mode==="tag"||p.tagTokens.length>0||p.excludeTagTokens.length>0,T=n(),F=[],k=new Map,P=new Map,E=v?FCe(p):mne;return{files:e.filter(L=>{let z=i.get(L.path),G=z?.foldedDisplayName??"",Q=z?.foldedAliases??F,R=g||y||v?T.getFile(L.path):null,D={hasUnfinishedTasks:g&&typeof R?.taskUnfinished=="number"&&R.taskUnfinished>0,foldedAliases:Q};f&&(D.foldedFolderPath=zr(L.parent?.path??"")),h&&(D.foldedExtension=zr(L.extension));let x=v?CCe(R?.properties??null,E):x1;v&&(D.propertyValuesByKey=x);let B=F;if(y){let A=Br({app:t,file:L,db:T,fileData:R}),N=A.length>0;if(S&&!N)return!1;N&&(B=w?PCe(A):TCe)}let I=rne(G,B,p,D);if(!I.matches)return!1;if(m){let A=r(L);if(!h1({created:A.created,modified:A.modified,defaultField:b},p))return!1}if(z&&I.nameMatch&&I.nameMatch.aliasIndexes.length>0){let A=I.nameMatch.aliasIndexes.flatMap(N=>{let M=z.aliases[N];return M===void 0?[]:[{value:M,foldedTerms:p.nameTokens}]});A.length>0&&k.set(L.path,A)}if(R&&p.propertyTokens.length>0){let A=NCe(x,p);A.length>0&&P.set(L.path,A)}return!0}),matchedAliases:k,matchedProperties:P}}function yne({app:t,files:e,getDB:n,hiddenFileNames:r,hiddenFilePropertyMatcher:o,hiddenFileTags:a,hiddenFolders:i,hideDrawingPreviewImages:s,showHiddenItems:l}){if(!l||e.length===0)return kCe;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?ax(r):null,b=f?Yr(a,!1):null,y=p?new Map:null,v=new Map,S=w=>{if(!y||!w)return!1;if(y.has(w.path))return y.get(w.path)??!1;let T=fi(w,i);return y.set(w.path,T),T};return e.forEach(w=>{let T=u.get(w.path),F=!1;m&&w.extension==="md"&&(F=T?.metadata?.hidden===void 0?oa(w,o,t):!!T.metadata?.hidden);let k=h?h.matches(w):!1,P=p?S(w.parent??null):!1,E=Kp(t,w,{hideDrawingPreviewImages:s}),C=b!==null&&b.hasHiddenRules&&w.extension==="md"&&Br({app:t,file:w,db:c,fileData:T??null}).some(L=>!b.isTagVisible(L));(F||k||P||E||C)&&v.set(w.path,!0)}),v}var op,pne,TCe,kCe,sC,lC,x1,mne,vne=U(()=>{op=he(Ve()),pne=require("obsidian");iC();Ln();SV();Cn();cne();Et();_l();y1();wr();Hr();st();Vl();TCe=["__nn_tag_present__"],kCe=new Map,sC=new Map,lC=new Map;x1=new Map,mne={keyPrefixes:[],exactKeys:new Set}});function E1(t){return t.split("/").filter(Boolean)}function bne(t,e){let n=E1(t);return n.length>0?n[n.length-1]:e}function Sne(t,e){let n=E1(t),r=E1(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 wne(t){return kne(t,!0,!1).items}function Tne(t){let{groupItemCountByKey:e,manualSortGroupHeaderFileByMemberPath:n}=kne(t,!1,!0);return{groupItemCountByKey:e,manualSortGroupHeaderFileByMemberPath:n}}function kne({app:t,dayKey:e,fileVisibility:n,files:r,getDB:o,getFileTimestamps:a,hiddenFileState:i,hiddenTags:s,listConfig:l,collapsedListGroups:c,matchedAliases:u,matchedProperties:p,searchMetaMap:m,selectedFolder:g,selectedTag:f=null,selectedProperty:h=null,selectionType:b,showHiddenItems:y,sortOption:v,propertySortKey:S="",isManualSortActive:w=!1,manualSortGroupHeaderPropertyKey:T=null,wordCountTargetProperty:F="",groupItemCountData:k},P,E){let C=[{type:tn.TOP_SPACER,data:"",key:"top-spacer"}],L=E?new Map:null,z=E?new Map:null,G=b===K.TAG?K.TAG:b===K.FOLDER?K.FOLDER:b===K.PROPERTY?K.PROPERTY:void 0,Q=o(),R=l.filterPinnedByFolder&&b===K.FOLDER&&g?{restrictToFolderPath:g.path}:void 0,{pinnedFiles:O,unpinnedFiles:D}=dB(r,l.pinnedNotes,G,R),x=P&&l.showFileTags,B=x?Yr(s,y):null,I=x?pe=>{let ue=Br({app:t,file:pe,db:Q});return B?B.hasVisibleTags(ue):ue.length>0}:()=>!1,A=l.groupBy,N=g?.path??null,M=pe=>OJ({selectionType:b,selectedFolderPath:N,selectedTag:f,selectedProperty:h,groupingMode:A,groupId:pe}),H=!1,q=null,X=null,V=null,j=null,_=0,W=pe=>NI(Q.getFile(pe.path)?.wordCount),J=pe=>ck(Q.getFile(pe.path)?.properties,F)??wI(t,pe,F),Z=new Map,re=pe=>{if(A!=="custom"||!T||pe.extension!=="md")return null;if(Z.has(pe.path))return Z.get(pe.path)??null;let ue=cg(t,pe,T);return Z.set(pe.path,ue),ue},Y=null,ne=()=>{Y&&(Y.item.data=Vj(Y.header,Y.wordCount,Y.targetWordCount),Y.item.manualSortHeaderWordCount=Y.wordCount,Y.item.manualSortHeaderTargetWordCount=Y.targetWordCount)},le=(pe,ue={})=>{if(X?.groupFilePaths?.push(pe.path),V&&L&&L.set(V,(L.get(V)??0)+1),j&&z&&z.set(pe.path,j),P&&Y&&Lp(Y.header)&&pe.extension==="md"){if(Y.wordCount+=W(pe),Y.header.targetWordCount===null){let ee=J(pe);ee!==null&&(Y.targetWordCount=(Y.targetWordCount??0)+ee)}ne()}if(H||!P)return;let Se={type:tn.FILE,data:pe,parentFolder:g?.path,key:pe.path,fileIndex:_++,matchedAliases:u?.get(pe.path),matchedProperties:p?.get(pe.path),searchMeta:m.get(pe.path),hasTags:I(pe),isHidden:i.get(pe.path)??!1};C.push({...Se,...ue})},ae=({data:pe,key:ue,headerFolderPath:Se,headerFolderSegments:ee,headerKind:ie,collapseKey:Ce,manualSortHeader:we,manualSortHeaderFilePath:Le,groupFiles:We})=>{if(ie!=="manual-sort-custom"&&(j=null),H&&q!=="manual-sort-custom"&&ie==="manual-sort-custom")return;let Nt=Ce?c?.has(Ce)===!0:!1;H=Nt,q=Nt?ie??null:null,C.length>1&&C.push({type:tn.HEADER_SPACER,data:"",key:`${ue}-spacer-before`});let Zt={type:tn.HEADER,data:pe,headerFolderPath:Se,headerFolderSegments:ee,manualSortHeaderFilePath:Le,groupFilePaths:E?void 0:We?We.map(ze=>ze.path):[],groupTotalItemCount:k?.groupItemCountByKey.get(ue),manualSortHeaderShowsWordCount:we?Lp(we):void 0,manualSortHeader:we,manualSortHeaderWordCount:we?0:void 0,manualSortHeaderTargetWordCount:we?we.targetWordCount:void 0,headerKind:ie,collapseKey:Ce,isCollapsed:Nt,key:ue};C.push(Zt),X=We||E?null:Zt,L&&L.set(ue,We?.length??0),V=We||!L?null:ue,Y=null,P&&ie==="manual-sort-custom"&&we&&(Y={item:Zt,header:we,wordCount:0,targetWordCount:we.targetWordCount},ne())},ve=pe=>k?k.manualSortGroupHeaderFileByMemberPath.get(pe.path)??null:re(pe)?pe:null,de=pe=>{let ue=ve(pe);if(!ue||j?.path===ue.path)return;let Se=re(ue);Se&&(ae({data:Se.title,manualSortHeader:Se,manualSortHeaderFilePath:ue.path,headerKind:"manual-sort-custom",collapseKey:M(`manual-sort-custom:${ue.path}`),key:`manual-sort-custom-header-${ue.path}`}),j=ue)},Pe=(pe,ue={})=>{de(pe),le(pe,ue)};O.length>0&&(ae({data:d.listPane.pinnedSection,key:Qy,headerKind:"pinned",groupFiles:O}),l.pinnedGroupExpanded&&O.forEach(pe=>{Pe(pe,{isPinned:!0})}));let Fe=A==="date"&&of(v),te=A==="folder"&&b===K.FOLDER,ye=jo(A),ce=Bl(v)&&w&&S.trim().length>0;if(!Fe&&!te&&ye===null){let pe=[],ue=[];ce?D.forEach(ie=>{if(ie.extension==="md"&&mk(t,ie,S)===null){ue.push(ie);return}pe.push(ie)}):pe.push(...D);let Se=pe[0]??null,ee=A==="custom"&&Se!==null&&ve(Se)!==null;if(O.length>0&&pe.length>0&&!ee){let ie=n===xr.DOCUMENTS?d.listPane.notesSection:d.listPane.filesSection;ae({data:ie,key:`header-${ie}`,headerKind:"section",groupFiles:pe})}pe.forEach(ie=>{Pe(ie)}),ue.length>0&&(ae({data:d.listPane.unsortedSection,collapseKey:M("section:unsorted"),key:"header-unsorted",headerKind:"section",groupFiles:ue}),ue.forEach(ie=>{Pe(ie)}))}else if(Fe){let pe=Gr.parseLocalDayKey(e)??new Date,ue=SL(v),Se=null;D.forEach(ee=>{let ie=a(ee),Ce=ue==="ctime"?ie.created:ie.modified,we=Gr.getDateGroupInfo(Ce,pe),Le=we.key;Le!==Se&&(Se=Le,ae({data:we.label,collapseKey:M(`date:${ue}:${Le}`),key:`header-${Le}`,headerKind:"date"})),le(ee)})}else if(ye!==null){let pe=nj(A,v),ue=new Map,Se=[];D.forEach(Le=>{let We=Le.extension==="md"?YG(t.metadataCache.getFileCache(Le)?.frontmatter,ye):null;if(We===null){Se.push(Le);return}let Nt=We.parts.join("\0"),Pt=ue.get(Nt);if(Pt){Pt.files.push(Le);return}ue.set(Nt,{label:We.parts.join(", "),numericValue:We.numericValue,files:[Le]})});let ee=pe==="desc"?-1:1,ie=pe==="desc"?"alpha-desc":"alpha-asc",Ce=Array.from(ue.entries()).map(([Le,We])=>({bucketKey:Le,...We})).sort((Le,We)=>{if(Le.numericValue!==null&&We.numericValue!==null){if(Le.numericValue!==We.numericValue)return ee*(Le.numericValue{ae({data:Le,collapseKey:M(Nt),key:`header-${Nt}`,headerKind:"property",groupFiles:We}),We.forEach(Pt=>{le(Pt)})};Ce.forEach(Le=>{we(Le.label,Le.files,`property-value:${Le.bucketKey}`)}),Se.length>0&&we(d.listPane.propertyGroupNoValue,Se,"property-none")}else{let pe=g?.path??null,ue=g?.name??null,Se=pe&&pe!=="/"?`${pe}/`:null,ee=d.navigationPane.vaultRootLabel,ie=l.folderGroupSortOrder,Ce=l.showFolderGroupPaths,we=new Map,Le=(De,Me,nt)=>{let Ge=(0,hy.normalizePath)(De);return{label:Ce?Me:bne(Me,nt),sortLabel:Me,folderPath:Ge,folderSegments:Ce?Sne(Ge,Me):void 0}},We=De=>{let Me=De.parent;if(!(Me instanceof hy.TFolder))return{key:"folder:/",label:ee,sortLabel:ee,isCurrentFolder:!1,folderPath:null};if(b===K.FOLDER&&pe){if(Me.path===pe){let Tt=ue??Me.name;return{key:`folder:${pe}`,label:Tt,sortLabel:Tt,isCurrentFolder:!0,folderPath:pe==="/"?null:pe}}if(pe==="/"&&Me.path!=="/"){let Tt=Le(Me.path,Me.path,Me.name);return{key:`folder:/${Me.path}`,label:Tt.label,sortLabel:Tt.sortLabel,isCurrentFolder:!1,folderPath:Tt.folderPath,folderSegments:Tt.folderSegments}}if(Se&&Me.path.startsWith(Se)){let Tt=Me.path.slice(Se.length);if(Tt.length>0){let gt=Le(Me.path,Tt,Me.name);return{key:`folder:${Me.path}`,label:gt.label,sortLabel:gt.sortLabel,isCurrentFolder:!1,folderPath:gt.folderPath,folderSegments:gt.folderSegments}}}}let nt=Me.path==="/"?"":Me.path,[Ge]=nt.split("/");return Ge&&Ge.length>0?{key:`folder:/${Ge}`,label:Ce?Ge:bne(Ge,Ge),sortLabel:Ge,isCurrentFolder:!1,folderPath:Ge,folderSegments:Ce?Sne(Ge,Ge):void 0}:{key:"folder:/",label:ee,sortLabel:ee,isCurrentFolder:!1,folderPath:null}};D.forEach(De=>{let Me=We(De),nt=we.get(Me.key);if(nt){nt.files.push(De);return}we.set(Me.key,{label:Me.label,sortLabel:Me.sortLabel,files:[De],isCurrentFolder:Me.isCurrentFolder,folderPath:Me.folderPath,folderSegments:Me.folderSegments})});let Nt=Array.from(we.entries()).map(([De,Me])=>({key:De,...Me})).sort((De,Me)=>{let nt=Cu(De.sortLabel,Me.sortLabel,ie);return nt!==0?nt:De.key===Me.key?0:De.keyDe.isCurrentFolder)??null,Zt=Nt.filter(De=>!De.isCurrentFolder),ze=Pt!==null&&(l.showCurrentFolderFilesAtBottom&&(O.length>0||Zt.length>0)||!l.showCurrentFolderFilesAtBottom&&O.length>0),Ie=De=>{De.files.length!==0&&(De.isCurrentFolder?ze&&ae({data:d.listPane.filesSection,key:`header-${De.key}-current-folder-boundary`,headerKind:"section",groupFiles:De.files}):ae({data:De.label,collapseKey:M(De.key),headerFolderPath:De.folderPath,headerFolderSegments:De.folderSegments,key:`header-${De.key}`,headerKind:"folder",groupFiles:De.files}),De.files.forEach(Me=>{le(Me)}))};Pt&&!l.showCurrentFolderFilesAtBottom&&Ie(Pt),Zt.forEach(Ie),Pt&&l.showCurrentFolderFilesAtBottom&&Ie(Pt)}return C.push({type:tn.BOTTOM_SPACER,data:"",key:"bottom-spacer"}),{items:C,groupItemCountByKey:L??xCe,manualSortGroupHeaderFileByMemberPath:z??ECe}}function Pne(t){let e=new Map;return t.forEach((n,r)=>{n.type===tn.FILE&&n.data instanceof hy.TFile&&e.set(n.data.path,r)}),e}function Fne(t){let e=new Map;return t.forEach((n,r)=>{e.set(n.path,r)}),e}function Cne(t){let e=[],n=new Map;return t.forEach(r=>{r.type===tn.FILE&&r.data instanceof hy.TFile&&(n.set(r.data.path,e.length),e.push(r.data))}),{orderedFiles:e,orderedFileIndexMap:n}}function Nne(t,e,n){for(let r of t)if(!(r.type!==tn.HEADER||!r.groupFilePaths?.includes(e))){if(r.key===Qy){if(!n)return{type:"pinned"};continue}if(r.collapseKey&&r.isCollapsed===!0)return{type:"list-group",collapseKey:r.collapseKey}}return null}function Ine(t,e,n,r){let o=new Set,a=!1,i=!1;t.forEach(l=>{if(l.type===tn.HEADER){if(l.key===Qy){a=!0,i||=e;return}l.collapseKey&&(o.add(l.collapseKey),i||=l.isCollapsed!==!0)}});let s=a||o.size>0;return s&&!i&&n.forEach(l=>{l.startsWith(r)&&o.add(l)}),{collapseKeys:Array.from(o),hasPinnedGroup:a,canToggle:s,shouldCollapse:i}}var hy,xCe,ECe,R1=U(()=>{hy=require("obsidian");Ue();Oe();Lr();Ln();hn();hc();vP();hi();sg();Hr();Cn();Id();vA();xCe=new Map,ECe=new Map});function xne(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"?Gr.getDateGroupInfo(n.stat.mtime,Gr.parseLocalDayKey(e)??void 0).key:"ungrouped";return`${a}\0${o}\0${s}\0${r.length}`}function RCe(t){return!t.hasDateSearchFilters&&!t.showFileDate&&!t.showTooltips&&t.boundaryRefreshKey!==null&&t.previousBoundaryRefreshKey===t.boundaryRefreshKey}function MCe(t,e){return t.some(n=>n.changes.properties!==void 0&&e.has(n.path))}function ACe({app:t,basePathSet:e,cachedCustomGroupHeaderFilePaths:n,customGroupHeaderFilePaths:r,file:o,manualSortGroupHeaderPropertyKey:a,shouldRefreshOnCustomGroupHeaderMetadataChange:i}){return!i||a===null||o.extension!=="md"||!e.has(o.path)?!1:r.has(o.path)||n.has(o.path)?!0:cg(t,o,a)!==null}function DCe(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 Rne({app:t,basePathSet:e,cachedCustomGroupHeaderFilePaths:n,commandQueue:r,customGroupHeaderFilePaths:o,dayKey:a,files:i,getDB:s,groupBy:l,hasDateSearchFilters:c,hasManualSortWordCountGroupHeaders:u,hasPropertySearchFilters:p,hasTaskSearchFilters:m,hiddenFilePropertyMatcher:g,hiddenFileTags:f,includeDescendantNotes:h,manualSortGroupHeaderPropertyKey:b,onRefresh:y,propertyTreeService:v,tagTreeService:S,selectedFolder:w,selectedProperty:T,selectedTag:F,selectionType:k,settings:P,shouldRefreshOnCustomGroupHeaderMetadataChange:E,showFileDate:C,showHiddenItems:L,sortOption:z,propertySortKey:G,propertySortSecondary:Q}){let R=(0,ap.useRef)(y),O=(0,ap.useRef)(!1),D=(0,ap.useRef)(!1),x=(0,ap.useRef)(!1),B=(0,ap.useRef)(new Map);(0,ap.useEffect)(()=>{R.current=y},[y]),(0,ap.useEffect)(()=>{if(B.current.clear(),i.length===0||z!=="modified-desc"&&z!=="modified-asc")return;let I=z==="modified-desc"?i[0]:i[i.length-1];if(!I)return;let A=xne({dayKey:a,file:I,files:i,groupBy:l,sortOption:z});A!==null&&B.current.set(I.path,A)},[a,i,l,z]),(0,ap.useEffect)(()=>{let I=()=>{D.current=!1,x.current=!1,R.current()},A=(0,Ene.debounce)(I,_t.FILE_OPERATION_DELAY,!0),N=()=>!!r?.hasActiveOperation("delete-files"),M=()=>!!(r?.hasActiveOperation("move-file")||N());O.current=M();let H=()=>O.current||M(),q=()=>{if(!(!D.current||H())){if(x.current){A.cancel(),I();return}A()}},X=()=>{B.current.clear()},V=ae=>{if(D.current=!0,ae?.immediateWhenIdle&&(x.current=!0),!H()){if(x.current){A.cancel(),I();return}A()}},j=null;r&&(j=r.onOperationChange((ae,ve)=>{(ae==="move-file"||ae==="delete-files")&&(O.current=ve,ve||q())})),q();let _=null;k===K.PROPERTY&&T&&v&&(_=v.addTreeUpdateListener(()=>{V()}));let W=null;k===K.TAG&&F&&F!==Lt&&F!==wt&&S&&(W=S.addTreeUpdateListener(()=>{V()}));let J=XG(z,Q),Z=jo(l)!==null||QG({sortOption:z,propertySortKey:G,propertySortSecondary:Q,useFrontmatterMetadata:P.useFrontmatterMetadata,frontmatterNameField:P.frontmatterNameField,frontmatterCreatedField:P.frontmatterCreatedField,frontmatterModifiedField:P.frontmatterModifiedField}),re=[t.vault.on("create",()=>{X(),V()}),t.vault.on("delete",()=>{X(),V({immediateWhenIdle:N()})}),t.vault.on("rename",()=>{X(),V()}),t.vault.on("modify",ae=>{if(!J||!(ae instanceof M1.TFile)||!e.has(ae.path))return;let ve=xne({dayKey:a,file:ae,files:i,groupBy:l,sortOption:z});if(ve!==null){let de=B.current.get(ae.path);if(B.current.set(ae.path,ve),RCe({previousBoundaryRefreshKey:de,boundaryRefreshKey:ve,hasDateSearchFilters:c,showFileDate:C,showTooltips:P.showTooltips}))return}else B.current.delete(ae.path);V()})],Y=t.metadataCache.on("changed",ae=>{if(!(ae instanceof M1.TFile))return;let ve=()=>{if(!g.hasCriteria||ae.extension!=="md")return!1;let Fe=!!s().getFile(ae.path)?.metadata?.hidden;return oa(ae,g,t)!==Fe};if(ACe({app:t,basePathSet:e,cachedCustomGroupHeaderFilePaths:n,customGroupHeaderFilePaths:o,file:ae,manualSortGroupHeaderPropertyKey:b,shouldRefreshOnCustomGroupHeaderMetadataChange:E})){V();return}if(k===K.TAG&&F){if(ae.extension!=="md")return;if(!L&&ve()){V();return}Z&&e.has(ae.path)&&V();return}if(k===K.PROPERTY&&T){if(ae.extension!=="md")return;if(!L&&ve()){V();return}Z&&e.has(ae.path)&&V();return}if(!(k!==K.FOLDER||!DCe(ae,h,w))){if(g.hasCriteria&&ae.extension==="md"&&ve()){V();return}if(u&&P.wordCountTargetProperty.trim().length>0&&ae.extension==="md"&&e.has(ae.path)){V();return}Z&&ae.extension==="md"&&e.has(ae.path)&&V()}}),le=s().onContentChange(ae=>{let ve=!1,de=k===K.PROPERTY&&T,Pe=ae.some(te=>te.changes.tags!==void 0),Fe=ae.some(te=>te.changes.properties!==void 0);if(p&&MCe(ae,e)&&(ve=!0),!ve&&(Pe||Fe)){let te=k===K.TAG&&F,ye=k===K.FOLDER&&w;if(te&&Pe)ve=!0;else if(ye&&Pe&&w){let ce=w.path,pe=ce==="/",ue=f.length>0;ve=ae.some(Se=>{if(!ue)return e.has(Se.path);if(pe)return!0;if(!h){let ee=Se.path.lastIndexOf("/");return(ee===-1?"/":Se.path.slice(0,ee))===ce}return Se.path.startsWith(`${ce}/`)})}else if(de){if(Fe)ve=!0;else if(Pe){let ce=ae.some(ue=>e.has(ue.path)),pe=f.length>0&&!L;ve=ce||pe}}}!ve&&g.hasCriteria&&(ve=ae.some(te=>te.metadataHiddenChanged===!0&&e.has(te.path))),!ve&&(m||P.showFileBackgroundUnfinishedTask)&&(ve=ae.some(te=>te.changes.taskUnfinished!==void 0&&e.has(te.path))),!ve&&u&&(ve=ae.some(te=>(te.changes.wordCount!==void 0||te.changes.properties!==void 0)&&e.has(te.path))),ve&&V()});return()=>{re.forEach(ae=>t.vault.offref(ae)),t.metadataCache.offref(Y),le(),j?.(),_?.(),W?.(),A.cancel()}},[t,e,n,r,o,a,i,s,l,c,u,p,m,g,f,h,b,v,S,w,T,F,k,E,P.frontmatterCreatedField,P.frontmatterModifiedField,P.frontmatterNameField,G,Q,P.showFileBackgroundUnfinishedTask,C,P.showTooltips,P.useFrontmatterMetadata,P.wordCountTargetProperty,L,z])}var ap,M1,Ene,Mne=U(()=>{ap=he(Ve()),M1=require("obsidian"),Ene=require("obsidian");hn();po();Z0();wr();Ln();Ue();hi();Id()});function Dne({selectionType:t,selectedFolder:e,selectedTag:n,selectedProperty:r,settings:o,activeProfile:a,groupBy:i,showFileTags:s,showFileDate:l,pinnedGroupExpanded:c,collapsedListGroups:u,searchProvider:p,searchQuery:m,searchTokens:g,visibility:f,propertySortOrderOverride:h}){let{app:b,tagTreeService:y,propertyTreeService:v,commandQueue:S,omnisearchService:w}=vt(),{getFileTimestamps:T,getDB:F,getFileDisplayName:k}=_o(),{includeDescendantNotes:P,showHiddenItems:E}=f,C=qA(),[L,z]=(0,xo.useState)(0),G=m?.trim()??"",Q=G.length>0,R=w?.isAvailable()??!1,O=p==="omnisearch"&&R&&Q,D=(0,xo.useMemo)(()=>{if(!G||O)return null;let De=g??yh(G);return QA(De)?De:null},[G,O,g]),x=D!==null&&(D.requireUnfinishedTasks||D.excludeUnfinishedTasks),B=D!==null&&ZA(D),I=D!==null&&(D.dateRanges.length>0||D.excludeDateRanges.length>0),A=(0,xo.useMemo)(()=>{if(!(t!==K.FOLDER||!e)&&e.path!=="/")return e.path},[t,e]),{hiddenFolders:N,descendantExcludedFolders:M,hiddenFileProperties:H,hiddenFileNames:q,hiddenTags:X,hiddenFileTags:V,fileVisibility:j}=a,_=(0,xo.useMemo)(()=>oo(H),[H]),W=t===K.FOLDER?e?.path??null:null,J=sf(o,t,e,n,r),Z=o.folderTreeSortOverrides?.[W??"/"]??o.folderSortOrder,re=(0,xo.useMemo)(()=>({pinnedNotes:o.pinnedNotes,filterPinnedByFolder:o.filterPinnedByFolder,pinnedGroupExpanded:c,showFileTags:s,showFolderGroupPaths:o.showFolderGroupPaths,showCurrentFolderFilesAtBottom:o.showCurrentFolderFilesAtBottom,groupBy:i,folderGroupSortOrder:Z}),[o.filterPinnedByFolder,Z,i,c,o.pinnedNotes,o.showCurrentFolderFilesAtBottom,o.showFolderGroupPaths,s]),Y=(0,xo.useMemo)(()=>Js(o,J),[o,J]),ne=Y.option,le=(0,xo.useMemo)(()=>Kk(a.propertyKeys),[a.propertyKeys]),ae=(0,xo.useMemo)(()=>ba({selectionType:t,selectedFolder:e,selectedTag:n,selectedProperty:r},o,f,b,y,v),[t,e,n,r,a.profile.id,a.hiddenFolders,M,a.hiddenFileProperties,a.hiddenFileNames,a.hiddenTags,a.hiddenFileTags,a.fileVisibility,o.enableFolderNotes,o.hideFolderNoteInList,o.hideDrawingPreviewImages,o.folderNoteNamePattern,o.useFrontmatterMetadata,o.frontmatterNameField,o.frontmatterCreatedField,o.frontmatterModifiedField,o.frontmatterDateFormat,o.filterPinnedByFolder,o.pinnedNotes,o.defaultFolderSort,o.defaultFolderSortPropertyKey,o.propertySortKey,o.manualSortPropertyKey,o.propertySortSecondary,le,o.showProperties,J,v,P,E,b,y,L]),ve=(0,xo.useMemo)(()=>new Set(ae.map(De=>De.path)),[ae]),de=gne({basePathSet:ve,omnisearchPathScope:A,omnisearchService:w,trimmedQuery:G,useOmnisearch:O}),Pe=hne({app:b,baseFiles:ae,getFileDisplayName:k}),Fe=(0,xo.useMemo)(()=>({alphabeticalDateMode:o.alphabeticalDateMode}),[o.alphabeticalDateMode]),te=(0,xo.useMemo)(()=>fne({app:b,baseFiles:ae,getDB:F,getFileTimestamps:T,omnisearchResult:de,searchTokens:g,searchableNames:Pe,settings:Fe,sortOption:ne,trimmedQuery:G,useOmnisearch:O}),[b,ae,F,T,Fe,de,g,Pe,ne,G,O]),ye=te.files,ce=(0,xo.useMemo)(()=>!h||h.length===0?ye:pk(ye,h),[ye,h]),pe=(0,xo.useMemo)(()=>!Q||!o.showGroupHeaderItemCounts?null:!h||h.length===0?ae:pk(ae,h),[ae,Q,h,o.showGroupHeaderItemCounts]),ue=(0,xo.useMemo)(()=>yne({app:b,files:ce,getDB:F,hiddenFileNames:q,hiddenFilePropertyMatcher:_,hiddenFileTags:V,hiddenFolders:N,hideDrawingPreviewImages:o.hideDrawingPreviewImages,showHiddenItems:E}),[ce,F,N,_,q,V,o.hideDrawingPreviewImages,E,b]),Se=(0,xo.useMemo)(()=>O&&de?de.meta:Ane,[O,de]),ee=(0,xo.useMemo)(()=>qi({manualSortPropertyKey:o.manualSortPropertyKey},Y.propertyKey),[o.manualSortPropertyKey,Y.propertyKey]),ie=el(o),Ce=i==="custom"&&ie!==null,we=(0,xo.useMemo)(()=>{if(pe)return Tne({app:b,dayKey:C,fileVisibility:j,files:pe,getDB:F,getFileTimestamps:T,hiddenFileState:OCe,hiddenTags:[],listConfig:re,collapsedListGroups:u,searchMetaMap:Ane,selectedFolder:e,selectedTag:n,selectedProperty:r,selectionType:t,showHiddenItems:!1,sortOption:ne,propertySortKey:Y.propertyKey,isManualSortActive:ee,manualSortGroupHeaderPropertyKey:ie})},[b,u,C,j,F,T,pe,ee,re,ie,e,r,n,t,ne,Y.propertyKey]),Le=(0,xo.useMemo)(()=>{if(!we)return LCe;let De=new Set;return we.manualSortGroupHeaderFileByMemberPath.forEach(Me=>{De.add(Me.path)}),De},[we]),We=(0,xo.useMemo)(()=>wne({app:b,dayKey:C,fileVisibility:j,files:ce,getDB:F,getFileTimestamps:T,hiddenFileState:ue,hiddenTags:X,listConfig:re,collapsedListGroups:u,matchedAliases:te.matchedAliases,matchedProperties:te.matchedProperties,searchMetaMap:Se,selectedFolder:e,selectedTag:n,selectedProperty:r,selectionType:t,showHiddenItems:E,sortOption:ne,propertySortKey:Y.propertyKey,isManualSortActive:ee,manualSortGroupHeaderPropertyKey:ie,wordCountTargetProperty:o.wordCountTargetProperty,groupItemCountData:we}),[b,C,j,ce,F,T,ue,X,re,u,te.matchedAliases,te.matchedProperties,e,n,r,t,Se,E,ne,Y.propertyKey,ee,ie,o.wordCountTargetProperty,we]),Nt=(0,xo.useMemo)(()=>Pne(We),[We]),Pt=(0,xo.useMemo)(()=>Fne(ce),[ce]),{orderedFiles:Zt,orderedFileIndexMap:ze}=(0,xo.useMemo)(()=>Cne(We),[We]),Ie=(0,xo.useMemo)(()=>{let De=new Set,Me=!1;return We.forEach(nt=>{nt.type!==tn.HEADER||nt.headerKind!=="manual-sort-custom"||(nt.manualSortHeaderFilePath&&De.add(nt.manualSortHeaderFilePath),nt.manualSortHeaderShowsWordCount===!0&&(Me=!0))}),{filePaths:De,hasWordCountGroupHeaders:Me}},[We]);return Rne({app:b,basePathSet:ve,cachedCustomGroupHeaderFilePaths:Le,commandQueue:S,customGroupHeaderFilePaths:Ie.filePaths,dayKey:C,files:ce,getDB:F,groupBy:i,hasDateSearchFilters:I,hasManualSortWordCountGroupHeaders:Ie.hasWordCountGroupHeaders,hasPropertySearchFilters:B,hasTaskSearchFilters:x,hiddenFilePropertyMatcher:_,hiddenFileTags:V,includeDescendantNotes:P,manualSortGroupHeaderPropertyKey:ie,onRefresh:()=>z(De=>De+1),propertyTreeService:v,tagTreeService:y,selectedFolder:e,selectedProperty:r,selectedTag:n,selectionType:t,settings:o,shouldRefreshOnCustomGroupHeaderMetadataChange:Ce,showFileDate:l,showHiddenItems:E,sortOption:ne,propertySortKey:Y.propertyKey,propertySortSecondary:Y.propertySortSecondary}),{listItems:We,orderedFiles:Zt,orderedFileIndexMap:ze,filePathToIndex:Nt,fileIndexMap:Pt,files:ce,hiddenFileState:ue,searchMeta:Se,localDayKey:C}}var xo,Ane,OCe,LCe,One=U(()=>{xo=he(Ve());fn();cs();c1();Ue();wr();iC();bi();Ln();hi();sn();vne();R1();Mne();Ane=new Map,OCe=new Map,LCe=new Set});function Lne(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 fy(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 A1(t,e){if(t===void 0)throw new Error(`Unexpected undefined${e?`: ${e}`:""}`);return t}var Bne,_ne,Hne=U(()=>{Bne=(t,e)=>Math.abs(t-e)<1.01,_ne=(t,e,n)=>{let r;return function(...o){t.clearTimeout(r),r=t.setTimeout(()=>e.apply(this,o),n)}}});function UCe(t,e,n){let r=0;for(;r<=e;){let o=(r+e)/2|0,a=t[o*2];if(an)e=o-1;else return o}return r>0?r-1:0}function WCe(t,e,n,r,o){let a=t.length-1;if(t.length<=r)return{startIndex:0,endIndex:a};if(r===1&&o!==null){let c=UCe(o,a,n),u=c,p=n+e;for(;ut[c].start,n),l=s;if(r===1)for(;l1){let c=Array(r).fill(0);for(;lp=0&&u.some(p=>p>=n);){let p=t[s];u[p.lane]=p.start,s--}s=Math.max(0,s-s%r),l=Math.min(a,l+(r-1-l%r))}return{startIndex:s,endIndex:l}}var dC,D1,Vne,zCe,BCe,Kne,JA,_Ce,HCe,Une,VCe,KCe,Wne,eD,Gne,O1=U(()=>{zne();Hne();D1=()=>{if(dC!==void 0)return dC;if(typeof navigator>"u")return dC=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return dC=!0;let t=navigator.maxTouchPoints;return dC=navigator.platform==="MacIntel"&&t!==void 0&&t>0},Vne=t=>{let{offsetWidth:e,offsetHeight:n}=t;return{width:e,height:n}},zCe=t=>t,BCe=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(Vne(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(Vne(n))};t.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(s):s()});return a.observe(n,{box:"border-box"}),()=>{a.unobserve(n)}},JA={passive:!0},_Ce=typeof window>"u"?!0:"onscrollend"in window,HCe=(t,e,n)=>{let r=t.scrollElement;if(!r)return;let o=t.targetWindow;if(!o)return;let a=t.options.useScrollendEvent&&_Ce,i=0,s=a?null:_ne(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,JA),a&&r.addEventListener("scrollend",u,JA),()=>{r.removeEventListener("scroll",c),a&&r.removeEventListener("scrollend",u)}},Une=(t,e)=>HCe(t,e,n=>{let{horizontal:r,isRtl:o}=t.options;return r?n.scrollLeft*(o&&-1||1):n.scrollTop}),VCe=(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"]},KCe=(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})},Wne=KCe,eD=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:zCe,rangeExtractor:BCe,onChange:()=>{},measureElement:VCe,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,y=0;for(;y{var r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=fy(()=>(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._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,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)=>{if(i&&this._intendedScrollOffset===null&&a===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(a-this._intendedScrollOffset)<1.5&&(a=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let s=this.getScrollOffset();this.scrollDirection=i?s===a?this.scrollDirection:s{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},s=()=>{this._iosTouching=!1,!(!D1()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};a.addEventListener("touchstart",i,JA),a.addEventListener("touchend",s,JA),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&&(D1()&&(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;if(this._iosDeferredAdjustment<0&&n>=r-1){this._iosDeferredAdjustment=0;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.getMeasurementOptions=fy(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode,this.options.gap],(n,r,o,a,i,s,l,c)=>(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,gap:c}),{key:!1}),this.getMeasurements=fy(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:n,paddingStart:r,scrollMargin:o,getItemKey:a,enabled:i,lanes:s,laneAssignmentMode:l,gap:c},u)=>{let p=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>n)for(let y of this.laneAssignments.keys())y>=n&&this.laneAssignments.delete(y);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(y=>{this.itemSizeCache.set(y.key,y.size)}));let m=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===n&&(this.lanesSettling=!1),s===1){let y=n*2,v=this._flatMeasurements;if(!v||v.length0&&T.set(v.subarray(0,m*2)),v=T,this._flatMeasurements=v}let S;if(m===0)S=r+o;else{let T=m-1;S=v[T*2]+v[T*2+1]+c}for(let T=m;T1){w=S;let C=f[w],L=C!==void 0?g[C]:void 0;T=L?L.end+c:r+o}else if(b===s){let C=0,L=h[0],z=f[0];for(let G=1;Gthis.options.debug}),this.calculateRange=fy(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(n,r,o,a)=>n.length===0||r===0?(this.range=null,null):(this.range=WCe(n,r,o,a,a===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=fy(()=>{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=this.getScrollOffset()+this.scrollAdjustments,b=!this.itemSizeCache.has(l)?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=Gne(0,r.length-1,a?s=>o[s*2]:s=>A1(r[s]).start,n);return A1(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"}={})=>{this._iosDeferredAdjustment=0;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"}={})=>{this._iosDeferredAdjustment=0,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){return e===0?!1:D1()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?(this._iosDeferredAdjustment+=e,!1):(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:n}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollOffset<0&&(this.scrollOffset=0),this.scrollAdjustments=0),!0)}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&&Bne(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()}},Gne=(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 GCe({useFlushSync:t=!0,directDomUpdates:e=!1,directDomUpdatesMode:n="transform",...r}){let o=ip.useReducer(u=>u+1,0)[1],a=ip.useRef({enabled:e,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=e,a.current.mode=n;let i=u=>{let p=a.current;if(!p.enabled||!p.container)return;let m=u.getTotalSize();if(m!==p.lastSize){p.lastSize=m;let g=u.options.horizontal?"width":"height";p.container.style[g]=`${m}px`}},s=u=>{let p=a.current;if(!p.enabled||!p.container)return;i(u);let m=!!u.options.horizontal,g=p.mode==="transform",f=m?"left":"top",h=u.options.scrollMargin,b=u.getVirtualItems();for(let y of b){let v=y.start-h,S=u.elementsCache.get(y.key);S&&p.lastPositions.get(S)!==v&&(p.lastPositions.set(S,v),g?S.style.transform=m?`translate3d(${v}px, 0, 0)`:`translate3d(0, ${v}px, 0)`:S.style[f]=`${v}px`)}},l={...r,onChange:(u,p)=>{var m;let g=a.current,f=!0;if(g.enabled){s(u);let h=u.range,b=g.prevRange;f=!b||b.isScrolling!==u.isScrolling||b.startIndex!==h?.startIndex||b.endIndex!==h?.endIndex,f&&(g.prevRange=h?{startIndex:h.startIndex,endIndex:h.endIndex,isScrolling:u.isScrolling}:null)}f&&(t&&p?(0,jne.flushSync)(o):o()),(m=r.onChange)==null||m.call(r,u,p)}},[c]=ip.useState(()=>{let u=new eD(l);return Object.assign(u,{containerRef:p=>{let m=a.current;if(m.container=p,m.lastSize=null,p&&m.enabled){let g=u.getTotalSize();m.lastSize=g;let f=u.options.horizontal?"width":"height";p.style[f]=`${g}px`}}})});return c.setOptions(l),L1(()=>c._didMount(),[]),L1(()=>(i(c),c._willUpdate())),L1(()=>{s(c)}),c}function tD(t){return GCe({observeElementRect:Kne,observeElementOffset:Une,scrollToFn:Wne,...t})}var ip,jne,L1,z1=U(()=>{ip=he(Ve(),1),jne=he(FF(),1);O1();O1();L1=typeof document<"u"?ip.useLayoutEffect:ip.useEffect});function nD(t){switch(t){case"visibilityToggle":case"mobile-visibility":return"auto";case"selection":return B1.Platform.isMobile?"center":"auto";case"reveal":case"external":return"auto";default:return"center"}}function qne(t){switch(t){case"folder-navigation":return B1.Platform.isMobile?"center":"auto";case"visibility-change":return"auto";case"list-structure-change":return"auto";default:return"auto"}}function cC(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 B1,_1=U(()=>{B1=require("obsidian")});function $ne(t){return jCe[t]}function dw(t){return t?YCe:qCe}function H1(t,e){return t?.type===tn.HEADER&&t.headerKind==="manual-sort-custom"&&t.manualSortHeader!==void 0&&yf(t.manualSortHeader,t.manualSortHeaderTargetWordCount)?e.manualSortGoalHeaderHeight:e.groupHeaderHeight}function rD({selectionType:t,selectedTag:e,showSelectedNavigationPills:n}){return n||t!==K.TAG?null:at(e)}function oD({selectionType:t,selectedProperty:e,showSelectedNavigationPills:n}){return n||t!==K.PROPERTY||!e||!Nn(e)?.valuePath?null:en(e)??e}function Xne({tags:t,hiddenTagVisibility:e,selectedTagToHide:n}){for(let r of t)if(!(e?.shouldFilterHiddenTags&&!e.isTagVisible(r))&&!(n&&at(r)===n))return!0;return!1}function V1({properties:t,visiblePropertyKeys:e,hiddenPropertyValueNodeId:n,visitor:r}){if(!(!t||t.length===0))for(let o of t){let a=Ee(o.fieldKey);if(e&&!e.has(a))continue;let i=o.value;if(i.trim().length===0)continue;let s=Er(i),l=o.valueKind==="boolean"?!1:sx(s,o.valueKind);if(o.valueKind===void 0&&l)continue;let c=o.fieldKey.trim(),u=c.length===0?void 0:l?or(c):fa(c,s),p=u?en(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 Qne(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 K1({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,isPinned:r,shouldShowMultilinePreview:n&&!u&&(o||l),shouldReplaceEmptyPreviewWithPills:u,shouldShowDateForItem:e&&!r,isPinnedImageRow:c}}function $Ce({heights:t,titleRows:e,previewRows:n,layoutState:r,showFeatureImageArea:o,showExtensionBadgeThumbnail:a,showParentFolderLine:i,showTaskProgressLine:s,visiblePillRowCount:l}){let c=t.titleLineHeight*e,u=Math.max(0,l),p=u>0,m=r.shouldShowMultilinePreview,g=m?t.multilineTextLineHeight*n:0,f=r.shouldShowDateForItem||i||s?t.singleTextLineHeight:0,h=f>0?1:0,b=h+u,y=o&&!a,S=r.shouldReplaceEmptyPreviewWithPills&&y?t.multilineTextLineHeight*n:0,w=!m&&!y,T=R=>o?Math.max(R,t.featureImageMinHeight):R;if(w&&b===0)return t.basePadding+T(c);if(w&&b<=1){let R=Math.max(h>0?t.singleTextLineHeight:0,p?t.tagRowHeight:0);return t.basePadding+T(c+R)}let F=r.isPinned&&s&&m,k=F?Math.max(g,f):Math.max(g,S),P=y&&!r.isPinnedImageRow,E=F?0:P?t.singleTextLineHeight:f,C=P&&f===0?E:0,L=c+k+E,z=t.tagRowHeight*u,G=S+C,Q=Math.max(0,z-G);return t.basePadding+T(L+Q)}function Zne(t,e){let{heights:n,titleRows:r,previewRows:o,compactPaddingTotal:a}=e,i=Math.max(0,t.visiblePillRowCount),s=K1({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 $Ce({heights:n,titleRows:r,previewRows:t.isPinned?1:o,layoutState:s,showFeatureImageArea:t.showFeatureImageArea,showExtensionBadgeThumbnail:t.showExtensionBadgeThumbnail,showParentFolderLine:t.showParentFolderLine,showTaskProgressLine:t.showTaskProgressLine,visiblePillRowCount:i})}function cw({showTaskProgress:t,hideWhenComplete:e,taskTotal:n,taskUnfinished:r}){return!(!t||typeof n!="number"||n<=0||e&&r===0)}function aD({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 iD({showImage:t,file:e,featureImageStatus:n,hasFeatureImageUrl:r,showDrawingFeatureImage:o}){return!t||!e?!1:r||e.extension==="canvas"||e.extension==="base"||qs(e)||o?!0:n==="has"}function sD({showFeatureImageArea:t,file:e,hasFeatureImageUrl:n,showDrawingMissingFeatureImage:r}){return!t||!e||n?!1:r?!0:e.extension==="canvas"||e.extension==="base"}function XCe({properties:t,visiblePropertyKeys:e,hiddenPropertyValueNodeId:n}){if(!t||t.length===0)return Jne;let r=Yne.get(t);r||(r={unfiltered:new Map,filtered:new WeakMap},Yne.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;V1({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 ere({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?XCe({properties:l,visiblePropertyKeys:c,hiddenPropertyValueNodeId:u}):Jne;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 jCe,qCe,YCe,Jne,Yne,uw=U(()=>{Ue();Lr();un();Et();Cn();hi();jCe=Object.freeze({64:{listMaxSize:64},96:{listMaxSize:96},128:{listMaxSize:128}}),qCe=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}),YCe=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});Jne={hasVisiblePills:!1,separateRowCount:0},Yne=new WeakMap});function vh(t,e=!0){let[n,r]=(0,lD.useState)(()=>xk());return(0,lD.useEffect)(()=>{if(!e)return;let o=()=>{r(i=>{let s=xk();return i===s?i:s})},a=q2(t,o);return o(),a},[t,e]),n}var lD,uC=U(()=>{lD=he(Ve());ZL()});function QCe(t,e){return t.type==="file"&&t.filePath!==e}function ZCe(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 JCe(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 eNe({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,showParentFolder:e.showParentFolder,showPreview:e.showPreview,showImage:e.showImage,showTags:e.showTags,showProperties:e.showProperties,showTaskProgress:e.showTaskProgress,textCountDisplay:e.textCountDisplay},rowContent:{showFilePropertiesInCompactMode:n.showFilePropertiesInCompactMode,showPropertiesOnSeparateRows:n.showPropertiesOnSeparateRows,textCountPlacement:n.textCountPlacement,characterCountSpaces:n.characterCountSpaces,showSelectedNavigationPills:n.showSelectedNavigationPills,visiblePropertyKeySignature:c,hideFileTaskProgressWhenComplete:n.hideFileTaskProgressWhenComplete,selectionType:o??null,selectedTagToHide:a,selectedPropertyValueNodeIdToHide:i,includeDescendantNotes:s,hiddenTagVisibilitySignature:l},rowSizing:{compactItemHeight:n.compactItemHeight,compactItemHeightScaleText:n.compactItemHeightScaleText},measurements:u})}function tNe({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 nNe(t,e){let{changes:n}=t;if(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")return!0;if(e.showTaskProgress&&t.previousTaskCounters){let r=t.previousTaskCounters,o=n.taskTotal!==void 0?n.taskTotal:r.taskTotal,a=n.taskUnfinished!==void 0?n.taskUnfinished:r.taskUnfinished,i=cw({showTaskProgress:!0,hideWhenComplete:e.hideTaskProgressWhenComplete,taskTotal:r.taskTotal,taskUnfinished:r.taskUnfinished}),s=cw({showTaskProgress:!0,hideWhenComplete:e.hideTaskProgressWhenComplete,taskTotal:o,taskUnfinished:a});return i!==s}return!1}function rNe(t){let e=null;return{schedule(){e===null&&(e=window.requestAnimationFrame(()=>{e=null,t()}))},cancel(){e!==null&&(window.cancelAnimationFrame(e),e=null)}}}function oNe(t,e,n){let r=t[e];if(r?.type!==tn.FILE||!(r.data instanceof U1.TFile))return 0;for(let o=e-1;o>=0;o-=1){let a=t[o];if(a?.type===tn.HEADER)return H1(a,n)}return 0}function aNe(t,e){return e.showImage||e.propertyRowsPossible||e.showTaskProgress?!0:e.tagsBaseEnabled&&!!t.hasTags&&e.selectedTagToHide!==null}function iNe({app:t,db:e,hasPreview:n,item:r,file:o,config:a}){let i=null;aNe(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=bc(t,o);u=v?.showsFeatureImageBox??!1,p=u&&!v?.supportsCompanionImages?!0:u&&v?tx(t,o,v.providerId,a.themeMode)===null:!1}let m=iD({showImage:a.showImage,file:o,featureImageStatus:i?.featureImageStatus??null,showDrawingFeatureImage:u}),g=sD({showFeatureImageArea:m,file:o,showDrawingMissingFeatureImage:p}),f=!1;!p&&a.tagsBaseEnabled&&r.hasTags&&(a.selectedTagToHide?f=Xne({tags:Br({app:t,file:o,db:e,fileData:i}),hiddenTagVisibility:a.hiddenTagVisibility,selectedTagToHide:a.selectedTagToHide}):f=!0);let h=aD({showParentFolder:a.showParentFolder,isPinned:!!r.isPinned,selectionType:a.selectionType,includeDescendantNotes:a.includeDescendantNotes,parentFolder:r.parentFolder,fileParentPath:o.parent?.path??null}),b=cw({showTaskProgress:a.showTaskProgress,hideWhenComplete:a.hideTaskProgressWhenComplete,taskTotal:o.extension==="md"?i?.taskTotal??null:null,taskUnfinished:o.extension==="md"?i?.taskUnfinished??null:null}),y=!p&&a.propertyRowsPossible?ere({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,showTaskProgressLine:b,visiblePillRowCount:(f?1:0)+y}}function tre({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:y,visiblePropertyKeySignature:v,hiddenTagVisibility:S,scrollMargin:w=0,scrollPaddingEnd:T=0,onVirtualizerScrollingChange:F,onScrollContainerVisibilityChange:k}){let{app:P,isMobile:E}=vt(),C=dw(E),{hasPreview:L,getDB:z,isStorageReady:G}=_o(),Q=vh(P),R=z(),O=(0,Qt.useMemo)(()=>AA({compactItemHeight:s.compactItemHeight,scaleText:s.compactItemHeightScaleText,titleLineHeight:C.titleLineHeight}),[C.titleLineHeight,s.compactItemHeight,s.compactItemHeightScaleText]),D=(0,Qt.useRef)(null),[x,B]=(0,Qt.useState)(null),[I,A]=(0,Qt.useState)(!1),N=(0,Qt.useRef)(!1),M=(0,Qt.useRef)(F),H=(0,Qt.useRef)(k),q=(0,Qt.useRef)(""),X=(0,Qt.useRef)(null),V=(0,Qt.useRef)(void 0),j=(0,Qt.useRef)(b),_=(0,Qt.useRef)(null),[W,J]=(0,Qt.useState)(0),Z=r?.path??null,re=(0,Qt.useRef)(Z);re.current=Z;let Y=(0,Qt.useRef)(0),ne=(0,Qt.useRef)(n.size),le=(0,Qt.useRef)(null),ae=(0,Qt.useRef)(null),ve=(0,Qt.useRef)(!1);(0,Qt.useEffect)(()=>{M.current=F},[F]),(0,Qt.useEffect)(()=>{H.current=k},[k]);let de=(0,Qt.useCallback)((me,se)=>{A(fe=>fe===me?fe:me),N.current!==me&&(N.current=me,!me&&ve.current&&(ve.current=!1,M.current?.(!1,se)),H.current?.(me,se))},[]),Pe=l.mode==="compact",Fe=s.revealFileOnListChanges,te=!!r,ye=(0,Qt.useMemo)(()=>rD({selectionType:u.selectionType,selectedTag:u.selectedTag,showSelectedNavigationPills:s.showSelectedNavigationPills}),[u.selectedTag,u.selectionType,s.showSelectedNavigationPills]),ce=(0,Qt.useMemo)(()=>oD({selectionType:u.selectionType,selectedProperty:u.selectedProperty,showSelectedNavigationPills:s.showSelectedNavigationPills}),[u.selectedProperty,u.selectionType,s.showSelectedNavigationPills]),pe=(0,Qt.useMemo)(()=>{let me=l.textCountDisplay!=="none"&&s.textCountPlacement==="property",se=me&&Ss(l.textCountDisplay),fe=me&&Al(l.textCountDisplay),Ne=!Pe||s.showFilePropertiesInCompactMode,xe=l.showProperties&&y.size>0,Be=Ne&&xe;return{heights:C,titleRows:l.titleRows||1,previewRows:l.previewRows,showDate:l.showDate,showPreview:l.showPreview,showImage:l.showImage,compactPaddingTotal:E?O.mobilePaddingTotal:O.desktopPaddingTotal,isCompactMode:Pe,tagsBaseEnabled:l.showTags,frontmatterPropertyRowsPossible:Be,propertyRowsPossible:Ne&&(xe||me),showTextCountProperty:me,showWordCountProperty:se,showCharacterCountProperty:fe,showFileProperties:l.showProperties,showPropertiesOnSeparateRows:s.showPropertiesOnSeparateRows,showFilePropertiesInCompactMode:s.showFilePropertiesInCompactMode,characterCountSpaces:s.characterCountSpaces,showParentFolder:l.showParentFolder,showTaskProgress:l.showTaskProgress,hideTaskProgressWhenComplete:s.hideFileTaskProgressWhenComplete,selectionType:u.selectionType,includeDescendantNotes:h,selectedTagToHide:ye,selectedPropertyValueNodeIdToHide:ce,hiddenTagVisibility:S,visiblePropertyKeys:y,themeMode:Q}},[O.desktopPaddingTotal,O.mobilePaddingTotal,l.previewRows,l.showDate,l.showImage,l.showParentFolder,l.showPreview,l.showProperties,l.showTags,l.showTaskProgress,l.textCountDisplay,l.titleRows,S,h,Pe,E,C,ce,ye,u.selectionType,s.characterCountSpaces,s.showFilePropertiesInCompactMode,s.hideFileTaskProgressWhenComplete,s.showPropertiesOnSeparateRows,s.textCountPlacement,Q,y]),ue=(0,Qt.useCallback)(me=>e[me]?.key??me,[e]),Se=Number.isFinite(w)&&w>0?w:0,ee=Number.isFinite(T)&&T>0?T:0,ie=tD({count:t?e.length:0,getItemKey:ue,getScrollElement:()=>{if(!t)return null;let me=D.current;return me},enabled:t,scrollMargin:Se,scrollPaddingStart:Se,estimateSize:me=>{let se=e[me],fe=pe.heights;return se.type===tn.HEADER?H1(se,fe):se.type===tn.HEADER_SPACER?fe.groupHeaderSpacerBefore:se.type===tn.TOP_SPACER?f:se.type===tn.BOTTOM_SPACER?fe.bottomSpacer:se.type===tn.FILE&&se.data instanceof U1.TFile?Zne(iNe({app:P,db:R,hasPreview:L,item:se,file:se.data,config:pe}),pe):fe.titleLineHeight},overscan:cN,scrollPaddingEnd:ee,useScrollendEvent:!0,onChange:me=>{if(!t)return;let se=me.isScrolling;se&&!N.current||ve.current!==se&&(ve.current=se,M.current?.(se,me.scrollElement))}}),Ce=(0,Qt.useRef)(()=>{});Ce.current=()=>ie.measure();let we=(0,Qt.useRef)(null);we.current===null&&(we.current=rNe(()=>Ce.current()));let Le=(0,Qt.useCallback)(me=>{D.current=me,B(me),me||de(!1,null)},[de]);(0,Qt.useLayoutEffect)(()=>{let me=x;if(!t){de(!1,me);return}if(!me){de(!1,null);return}let se=()=>{let Ne=me.getBoundingClientRect(),xe=Ne.width>0&&Ne.height>0;de(xe,me)};if(se(),typeof ResizeObserver>"u"){let Ne=()=>se();return window.addEventListener("resize",Ne),()=>{window.removeEventListener("resize",Ne)}}let fe=new ResizeObserver(Ne=>{let xe=Ne[0];if(!xe)return;let{width:Be,height:dt}=xe.contentRect,St=Be>0&&dt>0;de(St,me)});return fe.observe(me),()=>fe.disconnect()},[t,de,x]);let We=t&&c&&I,Nt=(0,Qt.useMemo)(()=>JCe(S),[S]),Pt=(0,Qt.useMemo)(()=>({compactItemHeight:s.compactItemHeight,compactItemHeightScaleText:s.compactItemHeightScaleText,showFilePropertiesInCompactMode:s.showFilePropertiesInCompactMode,showPropertiesOnSeparateRows:s.showPropertiesOnSeparateRows,textCountPlacement:s.textCountPlacement,characterCountSpaces:s.characterCountSpaces,hideFileTaskProgressWhenComplete:s.hideFileTaskProgressWhenComplete,showSelectedNavigationPills:s.showSelectedNavigationPills}),[s.compactItemHeight,s.compactItemHeightScaleText,s.showFilePropertiesInCompactMode,s.showPropertiesOnSeparateRows,s.textCountPlacement,s.characterCountSpaces,s.hideFileTaskProgressWhenComplete,s.showSelectedNavigationPills]),Zt=(0,Qt.useMemo)(()=>eNe({topSpacerHeight:f,folderSettings:l,settings:Pt,themeMode:Q,selectionType:u.selectionType,selectedTagToHide:ye,selectedPropertyValueNodeIdToHide:ce,includeDescendantNotes:h,hiddenTagVisibilitySignature:Nt,visiblePropertyKeySignature:v,listMeasurements:C}),[f,l,Pt,Q,u.selectionType,ye,ce,h,Nt,v,C]),ze=(0,Qt.useCallback)(()=>{t&&E&&D.current&&D.current.scrollTo({top:0,behavior:"smooth"})},[t,E]),Ie=(0,Qt.useCallback)(me=>{let se=D.current;if(!se)return;let fe=se.querySelector(`[data-index="${me}"]`);if(!(fe instanceof HTMLElement))return;let Ne=se.getBoundingClientRect(),xe=fe.getBoundingClientRect(),Be=s.stickyGroupHeaders?oNe(e,me,C):0,dt=Ne.top+Be,St=Ne.bottom-ee;if(Be>0&&xe.top0&&xe.bottom>St&&(se.scrollTop+=Math.round(xe.bottom-St))},[ee,e,C,s.stickyGroupHeaders]),De=(0,Qt.useCallback)((me,se)=>{ie.scrollToIndex(me,{align:se});let fe=0,Ne=()=>{fe+=1,Ie(me),fe<3&&window.requestAnimationFrame(Ne)};window.requestAnimationFrame(Ne)},[Ie,ie]),Me=(0,Qt.useCallback)(me=>{let se=n.get(me);if(se===void 0||se===-1)return-1;let fe=-1;for(let xe=se-1;xe>=0;xe-=1){let Be=e[xe];if(Be?.type!==tn.HEADER_SPACER){Be?.type===tn.HEADER&&(fe=xe);break}}return fe===-1?se:fe===1?fe:se},[n,e]);(0,Qt.useLayoutEffect)(()=>{let me=le.current;if(me===null||!ZCe(me,n)){ne.current=n.size,le.current=n,Y.current=Y.current+1;return}(ne.current!==n.size||le.current!==n)&&(ne.current=n.size,le.current=n)},[n,n.size]);let nt=(0,Qt.useCallback)(()=>{_.current&&(_.current=null,J(me=>me+1))},[]),Ge=(0,Qt.useCallback)(me=>{let se=_.current;if(!se){_.current=me,J(xe=>xe+1);return}let fe=cC(me),Ne=cC(se);fe>=Ne&&(_.current=me,J(xe=>xe+1))},[]),Tt=(0,Qt.useCallback)(me=>{if(!ie||!We)return!1;let se=me.minIndexVersion??Y.current;if(Y.current{let St=dt?Me(dt):-1;dt&&St>=0&&St!==Be&&Fe&&Ge({type:"file",filePath:dt,reason:"list-structure-change",minIndexVersion:Y.current})})}return!0}return ie.scrollToOffset(0,{align:"start",behavior:"auto"}),!0},[Me,We,Fe,ie,De,u.revealSource,Ge]),gt=(0,Qt.useCallback)(me=>{let se=_.current;if(se&&cC(se)>cC(me)){Tt(se)&&(_.current=null);return}if(Tt(me)){se&&(_.current=null);return}Ge(me)},[Tt,Ge]);(0,Qt.useLayoutEffect)(()=>{if(!ie||!_.current||!We)return;let me=_.current;Tt(me)&&(_.current=null)},[Tt,ie,We,W,Z]),(0,Qt.useEffect)(()=>{if(!t||!ie)return;let me=z(),se=we.current,fe=me.onContentChange(Ne=>{Ne.some(Be=>n.has(Be.path)&&nNe(Be,pe))&&se?.schedule()});return()=>{fe(),se?.cancel()}},[t,n,z,pe,ie]),(0,Qt.useEffect)(()=>{if(!t||!E)return;let me=()=>{r&&ie&&Ge({type:"file",filePath:r.path,reason:"visibility-change",minIndexVersion:Y.current})};return window.addEventListener("notebook-navigator-visible",me),()=>window.removeEventListener("notebook-navigator-visible",me)},[t,E,r,ie,n,Ge]),(0,Qt.useEffect)(()=>{!t||!ie||ie.measure()},[t,Zt,ie]),(0,Qt.useLayoutEffect)(()=>{t&&G&&ie&&ie.measure()},[t,G,ie]);let wn=sf(s,u.selectionType,o,a,i),it=(0,Qt.useMemo)(()=>Js(s,wn),[s,wn]),yn=it.option,rt=(0,Qt.useMemo)(()=>tNe({includeDescendantNotes:h,listLayoutSignature:Zt,groupBy:l.groupBy,noteGrouping:s.noteGrouping,stickyGroupHeaders:s.stickyGroupHeaders,effectiveSort:yn,propertySortKey:it.propertyKey,propertySortSecondary:it.propertySortSecondary}),[h,Zt,l.groupBy,s.noteGrouping,s.stickyGroupHeaders,yn,it.propertyKey,it.propertySortSecondary]);return(0,Qt.useLayoutEffect)(()=>{if(!ie||!We)return;let me=X.current;if(me===null){X.current={signature:rt,includeDescendantNotes:h};return}if(me.signature===rt)return;let se=me.includeDescendantNotes,fe=h;X.current={signature:rt,includeDescendantNotes:h},Fe&&r?gt({type:"file",filePath:r.path,reason:"list-structure-change",minIndexVersion:Y.current}):se&&!fe&>({type:"top",reason:"list-structure-change",minIndexVersion:Y.current})},[We,ie,r,h,Fe,rt,gt]),(0,Qt.useLayoutEffect)(()=>{if(!ie||!We)return;let me=i??"",se=`${o?.path||""}_${a||""}_${me}`,fe=ae.current,Ne=j.current!==b;if(j.current=b,!fe||fe.key!==se){ae.current={key:se,version:Y.current};return}if(Y.current>fe.version){if(ae.current={key:se,version:Y.current},Ne)return;let xe=!!(r&&n.has(r.path));Fe&&xe&&r&>({type:"file",filePath:r.path,reason:"list-structure-change",minIndexVersion:Y.current})}},[ie,We,o?.path,a,i,b,n,n.size,r,gt,Fe]),(0,Qt.useLayoutEffect)(()=>{if(!t||!ie)return;let me=i??"",se=`${o?.path||""}_${a||""}_${me}`,fe=q.current!==se;fe&&nt();let Ne=u.isFolderNavigation;if(!(fe||Ne&&te)){Ne&&p({type:"SET_FOLDER_NAVIGATION",isFolderNavigation:!1});return}if(fe&&e.length===0)return;let Be=r?{type:"file",filePath:r.path,reason:"folder-navigation",minIndexVersion:Y.current}:{type:"top",reason:"folder-navigation",minIndexVersion:Y.current};if(!We&&(Ne||fe)){fe&&(q.current=se),Ne&&p({type:"SET_FOLDER_NAVIGATION",isFolderNavigation:!1}),gt(Be);return}Ne&&e.length>0&&We?(fe&&(q.current=se),p({type:"SET_FOLDER_NAVIGATION",isFolderNavigation:!1}),gt(Be)):(fe&&(q.current=se),gt(Be))},[We,t,ie,o?.path,a,i,r,u.isFolderNavigation,p,n.size,e.length,nt,gt,te]),(0,Qt.useLayoutEffect)(()=>{u.isRevealOperation&&r&&We&&(gt({type:"file",filePath:r.path,reason:"reveal",minIndexVersion:Y.current}),p({type:"CLEAR_REVEAL_OPERATION"}))},[u.isRevealOperation,r,We,p,n,gt]),(0,Qt.useLayoutEffect)(()=>{if(m===void 0){V.current=m;return}if(!r){V.current=m;return}if(!We||!ie)return;let me=n.has(r.path),se=V.current!==m;V.current=m;let fe=g?.current??!1;if(!me&&e.length>0){if(fe&&g){g.current=!1;return}gt({type:"top",reason:"list-structure-change",minIndexVersion:Y.current});return}fe&&g&&(g.current=!1)},[m,r,n,We,ie,e.length,gt,g]),{rowVirtualizer:ie,scrollContainerRef:D,scrollContainerRefCallback:Le,handleScrollToTop:ze,scrollToIndexSafely:De}}var Qt,U1,nre=U(()=>{Qt=he(Ve()),U1=require("obsidian");z1();fn();cs();Ue();_1();hn();ZV();uw();Cn();Vl();uC();Ln()});function rre(t,e,n,r){let o=cc(n,r);if(!o||o.includes("/"))return;let a=e==="/"?"":`${e}/`;for(let i of sNe)t.add(`${a}${o}.${i}`);t.add(`${a}${o}${Oa}.md`)}function are(){let{app:t}=vt(),e=yt(),r=jt().showHiddenItems,o=(0,Jd.useMemo)(()=>_a(e),[e]),a=hr(),i=a.selectedFolder?.path??null,s=a.selectedFolder?.name??null,{getTagDisplayPath:l,getPropertyTree:c}=_o(),u=la(),p=Zo(),[m,g]=(0,Jd.useState)(0),f=(0,Jd.useMemo)(()=>{if(!e.enableFolderNotes||a.selectionType!==K.FOLDER||!i)return new Set;let w={folderNoteNamePattern:e.folderNoteNamePattern},T=new Set;if(i==="/"){let P=a.selectedFolder,E=P?mb(P,t.vault):s??"";return rre(T,"/",E,w),T}let F=i.split("/").filter(Boolean),k="";return F.forEach(P=>{k=k?`${k}/${P}`:P,rre(T,k,P,w)}),T},[s,i,t.vault,a.selectedFolder,a.selectionType,e.enableFolderNotes,e.folderNoteNamePattern]);(0,Jd.useEffect)(()=>{if(f.size===0)return;let w=Ft(),T=Array.from(f).map(F=>w.onFileContentChange(F,k=>{k.metadata!==void 0&&g(P=>P+1)}));return()=>{T.forEach(F=>{F()})}},[f]),(0,Jd.useEffect)(()=>{if(f.size===0)return;let w=(P,E)=>{P instanceof ore.TFile&&(f.has(P.path)||typeof E=="string"&&f.has(E))&&g(C=>C+1)},T=t.vault.on("create",P=>{w(P)}),F=t.vault.on("delete",P=>{w(P)}),k=t.vault.on("rename",(P,E)=>{w(P,E)});return()=>{t.vault.offref(T),t.vault.offref(F),t.vault.offref(k)}},[t.vault,f]);let h=(0,Jd.useMemo)(()=>JSON.stringify({folderIcons:e.folderIcons||{},tagIcons:e.tagIcons||{},propertyIcons:e.propertyIcons||{},enableFolderNotes:e.enableFolderNotes,folderNoteNamePattern:e.folderNoteNamePattern,useFrontmatterMetadata:e.useFrontmatterMetadata,frontmatterNameField:e.frontmatterNameField}),[e]),b=(0,Jd.useMemo)(()=>`${h}::${m}`,[m,h]),y=(0,Jd.useMemo)(()=>{if(a.selectionType===K.FOLDER&&a.selectedFolder){if(!e.showFolderIcons)return"";let w=a.selectedFolder,T=p.getFolderDisplayData(w.path,{includeDisplayName:!1,includeColor:!1,includeBackgroundColor:!1,includeIcon:!0}).icon;if(T)return T;let P=gg(w,o,r),E=da(w.path,u.expandedFolders,e.showRootFolder);return P&&E?Je(e.interfaceIcons,"nav-folder-open"):Je(e.interfaceIcons,"nav-folder-closed")}if(a.selectionType===K.TAG&&a.selectedTag)return e.showTagIcons?p.getTagIcon(a.selectedTag)||Je(e.interfaceIcons,"nav-tag"):"";if(a.selectionType===K.PROPERTY&&a.selectedProperty){if(!e.showPropertyIcons)return"";let w=a.selectedProperty;if(w===_e)return Je(e.interfaceIcons,"nav-properties");let T=p.getPropertyIcon(w);return T||(Nn(w)?.valuePath?Je(e.interfaceIcons,"nav-property-value"):Je(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.showRootFolder,e.showTagIcons,b]),{desktopTitle:v,breadcrumbSegments:S}=(0,Jd.useMemo)(()=>{if(a.selectionType===K.FOLDER&&a.selectedFolder){let T=a.selectedFolder;if(T.path==="/"){let P=ns({app:t,metadataService:p,settings:{customVaultName:e.customVaultName},folderPath:T.path,fallbackName:T.name});return{desktopTitle:P,breadcrumbSegments:[{label:P,targetType:"none",isLast:!0}]}}let F=h0({metadataService:p,folderPath:T.path}),k=F.map((P,E)=>E===F.length-1?{label:P.label,targetType:"none",isLast:!0}:{label:P.label,targetType:"folder",targetPath:P.path,isLast:!1});return{desktopTitle:F[F.length-1]?.label??T.name,breadcrumbSegments:k}}if(a.selectionType===K.TAG&&a.selectedTag){let T=a.selectedTag;if(T===Lt){let E=Rc(ql.TAGGED).getLabel();return{desktopTitle:E,breadcrumbSegments:[{label:E,targetType:"none",isLast:!0}]}}if(T===wt){let E=[{label:d.common.untagged,targetType:"none",isLast:!0}];return{desktopTitle:d.common.untagged,breadcrumbSegments:E}}let F=l(T),k=F.split("/").filter(Boolean),P=k.map((E,C)=>C===k.length-1?{label:E,targetType:"none",isLast:!0}:{label:E,targetType:"tag",targetPath:k.slice(0,C+1).join("/"),isLast:!1});return{desktopTitle:k[k.length-1]||F,breadcrumbSegments:P}}if(a.selectionType===K.PROPERTY&&a.selectedProperty){let T=a.selectedProperty;if(T===_e){let z=[{label:d.navigationPane.properties,targetType:"none",isLast:!0}];return{desktopTitle:d.navigationPane.properties,breadcrumbSegments:z}}let F=Nn(T);if(!F)return{desktopTitle:d.navigationPane.properties,breadcrumbSegments:[{label:d.navigationPane.properties,targetType:"none",isLast:!0}]};let P=c().get(F.key)??null,E=P?.name??F.key,C=F.valuePath?P?.children.get(T)??null:null,L=or(F.key);return{desktopTitle:F.valuePath?C?.displayPath??F.valuePath:E,breadcrumbSegments:F.valuePath?[{label:E,targetType:"property",targetPath:L,isLast:!1},{label:C?.displayPath??F.valuePath,targetType:"none",isLast:!0}]:[{label:E,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:v,breadcrumbSegments:S,iconName:y,showIcon:a.selectionType===K.FOLDER&&e.showFolderIcons&&y.length>0||a.selectionType===K.TAG&&e.showTagIcons&&y.length>0||a.selectionType===K.PROPERTY&&e.showPropertyIcons&&y.length>0,selectionType:a.selectionType}}var Jd,ore,sNe,ire=U(()=>{Jd=he(Ve()),ore=require("obsidian");fn();on();gr();Ur();cs();Tl();Oe();Vn();Ue();pb();wr();Tu();ws();Og();sn();lr();un();em();Ja();qc();sNe=Object.values(Cc)});function lre(){let t=yt(),{selectedFolder:e,selectedTag:n,selectedProperty:r,selectionType:o}=nd(),a=o===K.FOLDER?e?.path??null:null,i=o===K.TAG?n:null,s=o===K.PROPERTY?r:null,l=a!==null?t.folderAppearances?.[a]:i!==null?t.tagAppearances?.[i]:s!==null?t.propertyAppearances?.[s]:void 0;return(0,sre.useMemo)(()=>uR({settings:t,appearance:l,selectionType:o}),[l,o,t])}var sre,dre=U(()=>{sre=he(Ve());on();Ur();Zb();Ue()});function lNe(t){return t==="/"||t.startsWith("/")?t:`/${t}`}function dNe(t){return t===Lt?d.tagList.tags:t===wt?d.common.untagged:t.startsWith("#")?t:`#${t}`}function cNe(t){if(t===_e)return d.navigationPane.properties;let e=Nn(t);return e?e.valuePath?e.valuePath:e.key:t}function uNe(t){switch(t.type){case yi.FOLDER:return lNe(t.path);case yi.TAG:return dNe(t.tagPath);case yi.PROPERTY:return cNe(t.nodeId)}}function pNe(t,e){if(!px(e))return null;let n=eI(e.path);return n?W4(t,n)?.path??null:null}function cre({rootContainerRef:t,onSearchTokensChange:e,onNavigateToFolder:n,onRevealTag:r,onRevealProperty:o,ensureSelectionForCurrentFilterRef:a}){let{app:i,plugin:s}=vt(),l=yt(),c=hr(),u=Xd(),p=So(),m=jt(),{setSearchActive:g}=$d(),{addSearchShortcut:f,removeSearchShortcut:h,searchShortcutsByName:b}=u,y=(0,fr.useMemo)(()=>Array.from(b.values()),[b]),v=m.searchActive,S=l.searchProvider??"internal",[w,T]=(0,fr.useState)(""),[F,k]=(0,fr.useState)(""),[P,E]=(0,fr.useState)(!1),[C,L]=(0,fr.useState)(!1),z=(0,fr.useRef)(!1),G=(0,fr.useMemo)(()=>yh(v?F:""),[F,v]),Q=(0,fr.useMemo)(()=>{if(!v)return;let re=yh(w);if(!(re.mode==="tag"||re.nameTokens.length===0))return re.nameTokens},[v,w]),R=(0,fr.useMemo)(()=>{let re=w.trim();if(!re)return null;let Y=S??"internal",ne=null;for(let le of y){if(le.query!==re)continue;if(ne||(ne=le),(le.provider??"internal")===Y)return le}return ne},[S,w,y]);(0,fr.useEffect)(()=>{!v&&w&&T("")},[v,w]),(0,fr.useEffect)(()=>{if(!v){F&&k("");return}if(F===w)return;let re=window.setTimeout(()=>{k(w)},_t.DEBOUNCE_KEYBOARD);return()=>{window.clearTimeout(re)}},[F,v,w]),(0,fr.useEffect)(()=>{if(!e)return;let re=w.trim()?jte(w):iw;e(re)},[e,w]);let O=(0,fr.useMemo)(()=>{if(c.selectionType==="folder"&&c.selectedFolder)return{type:yi.FOLDER,path:c.selectedFolder.path};if(c.selectionType==="tag"&&c.selectedTag)return{type:yi.TAG,tagPath:c.selectedTag};if(c.selectionType==="property"&&c.selectedProperty)return{type:yi.PROPERTY,nodeId:c.selectedProperty}},[c.selectedFolder,c.selectedProperty,c.selectedTag,c.selectionType]),D=(0,fr.useMemo)(()=>O?d.searchInput.shortcutStartIn.replace("{path}",uNe(O)):null,[O]),x=(0,fr.useCallback)((re="search")=>{v||g(!0),re&&p({type:"ACTIVATE_PANE",target:re})},[v,g,p]),B=(0,fr.useCallback)(()=>{g(!1),p({type:"ACTIVATE_PANE",target:"files"})},[g,p]),I=(0,fr.useCallback)(()=>{if(!v){E(!0),x();return}B()},[x,B,v]),A=(0,fr.useCallback)(()=>{let re=w.trim();if(!re||C)return;let Y=O,ne=D,le=null;le=new Ll(i,d.searchInput.shortcutModalTitle,d.searchInput.shortcutNamePlaceholder,async(ae,ve)=>{let de=ae.trim();if(de.length===0){oe(d.shortcuts.emptySearchName,{variant:"warning"});return}L(!0);try{let Pe=ve?.checkboxValue?Y:void 0;await f({name:de,query:re,provider:S,startTarget:Pe})&&le?.close()}finally{L(!1)}},re,{closeOnSubmit:!1,checkbox:ne?{label:ne,defaultChecked:!1}:void 0}),le.open()},[O,D,f,i,C,S,w]),N=(0,fr.useCallback)(async()=>{if(!(!R||C)){L(!0);try{await h(R.name)}finally{L(!1)}}},[R,C,h]),M=(0,fr.useCallback)((re,Y)=>{let ne=Y?.focusSearch!==!1;ne&&E(!0),x(ne?"search":null);let le=null;T(ae=>{let ve=re(ae);return le=ve,ve}),le!==null&&k(le)},[x]),H=(0,fr.useCallback)((re,Y,ne)=>{let le=at(re);!le||le===wt||M(ae=>Zte(ae,le,Y).query,ne)},[M]),q=(0,fr.useCallback)((re,Y,ne,le)=>{let ae=re.trim();ae&&M(ve=>Jte(ve,ae,Y,ne).query,le)},[M]),X=(0,fr.useCallback)((re,Y)=>{let ne=re.trim();ne&&(S!=="internal"&&s.setSearchProvider("internal"),M(le=>ene(le,ne).query,Y))},[s,S,M]),V=(0,fr.useCallback)(()=>new Promise(re=>{window.requestAnimationFrame(()=>re())}),[]),j=(0,fr.useCallback)(async()=>{let re=t.current;if(!re||!re.classList.contains("nn-single-pane"))return;let Y=l.paneTransitionDuration,ne=performance.now()+Y+20;for(;performance.now(){let Y=(t.current??activeDocument).querySelector(".nn-list-pane-scroller");Y instanceof HTMLElement&&Gi(Y)},[t]),W=(0,fr.useCallback)(()=>{window.setTimeout(()=>{let Y=(t.current??activeDocument).querySelector(".nn-search-input");Y instanceof HTMLInputElement&&(Y.focus(),p({type:"ACTIVATE_PANE",target:"search"}))},0)},[t,p]),J=(0,fr.useCallback)(()=>{if(v){W();return}E(!0),x()},[x,W,v]),Z=(0,fr.useCallback)(async({searchShortcut:re})=>{let Y=re.query.trim(),ne=re.provider??"internal",le=re.startTarget;if(s.setSearchProvider(ne),le)if(px(le)){let ae=pNe(i,le);ae&&n(ae,{source:"shortcut",suppressAutoSelect:!0,skipScroll:l.skipAutoScroll})}else pz(le)?r(le.tagPath,{source:"shortcut",skipScroll:l.skipAutoScroll}):mz(le)&&o(le.nodeId,{source:"shortcut",skipScroll:l.skipAutoScroll});p({type:"ACTIVATE_PANE",target:"files"}),t.current?.classList.contains("nn-single-pane")&&(z.current=!0,await j()),v||g(!0),E(!1),T(Y),k(Y),await V(),await V(),Kn()&&a.current?.({openInEditor:!1,clearIfEmpty:!0,selectFallback:!0}),_()},[i,a,_,v,n,o,r,s,t,g,l.skipAutoScroll,p,j,V]);return{isSearchActive:v,searchProvider:S,searchQuery:w,debouncedSearchQuery:F,debouncedSearchTokens:G,searchHighlightTerms:Q,shouldFocusSearch:P,activeSearchShortcut:R,isSavingSearchShortcut:C,suppressSearchTopScrollRef:z,setSearchQuery:T,setShouldFocusSearch:E,handleSearchToggle:I,closeSearch:B,focusSearchComplete:()=>E(!1),handleSaveSearchShortcut:A,handleRemoveSearchShortcut:N,modifySearchWithTag:H,modifySearchWithProperty:q,modifySearchWithDateToken:X,toggleSearch:J,executeSearchShortcut:Z}}var fr,ure=U(()=>{fr=he(Ve());Ur();fn();on();ph();wa();gr();Oe();yv();Ue();po();Ha();$A();Ts();iC();bn();$r();ra();un();Ob();Cn()});function mre({rootContainerRef:t,orderedFiles:e,filePathToIndex:n,scrollToIndexSafely:r}){let{app:o,commandQueue:a,isMobile:i}=vt(),s=rp(),l=hr(),c=ar(),u=yt(),p=Qr(),m=So(),f=jt().searchActive,{handleMultiSelectClick:h,handleRangeSelectClick:b,isFileSelected:y}=nw(),v=(0,yr.useRef)(!1),S=(0,yr.useRef)(!1),w=(0,yr.useRef)(0),T=(0,yr.useRef)(null),F=(0,yr.useRef)(!1),k=(0,yr.useRef)(()=>{}),P=(0,yr.useRef)(p.focusedPane),E=(0,yr.useRef)(null),C=(0,yr.useMemo)(()=>(0,pre.debounce)((N,M)=>{M===w.current&&(S.current=!1,T.current=null,s(N))},_t.DEBOUNCE_KEYBOARD_FILE_OPEN,!0),[s]);(0,yr.useEffect)(()=>()=>{C.cancel()},[C]);let L=(0,yr.useCallback)(()=>{w.current+=1,S.current=!1,T.current=null,C.cancel()},[C]),z=(0,yr.useCallback)((N,M)=>{if(v.current=M?.markUserSelection??!1,c({type:"SET_SELECTED_FILE",file:N}),M?.markKeyboardNavigation&&c({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!0}),M?.suppressOpen){L();return}if(M?.debounceOpen){w.current+=1;let H=w.current;S.current=!0,T.current=N,C(N,H);return}L(),s(N)},[L,C,s,c]),G=(0,yr.useCallback)(N=>{w.current+=1;let M=w.current;S.current=!0,T.current=N,C(N,M)},[C]),Q=(0,yr.useCallback)(()=>{if(u.enterToOpenFiles)return;let M=jc(o,l)??T.current;M&&G(M)},[o,G,l,u.enterToOpenFiles]),R=(0,yr.useCallback)(N=>{u.enterToOpenFiles||G(N)},[G,u.enterToOpenFiles]),O=(0,yr.useCallback)(()=>{if(u.enterToOpenFiles||!S.current)return;let N=T.current??jc(o,l);N&&(L(),s(N))},[o,L,s,l,u.enterToOpenFiles]),D=(0,yr.useMemo)(()=>{if(l.selectedFile)return l.selectedFile.path;let N=l.selectedFiles.values().next();return N.done?null:N.value},[l.selectedFile,l.selectedFiles]);(0,yr.useEffect)(()=>{k.current=O},[O]),(0,yr.useEffect)(()=>{if(!S.current)return;let N=T.current?.path??null;(!N||N!==D)&&L()},[L,D]),(0,yr.useEffect)(()=>{!u.enterToOpenFiles||!S.current||L()},[L,u.enterToOpenFiles]),(0,yr.useEffect)(()=>{P.current=p.focusedPane,p.focusedPane!=="navigation"&&(F.current=!1)},[p.focusedPane]),(0,yr.useEffect)(()=>{let N=()=>{F.current=!1};return window.addEventListener("blur",N),()=>{window.removeEventListener("blur",N)}},[]),(0,yr.useEffect)(()=>{let N=t.current;if(!N)return;let M=V=>V.key==="ArrowUp"||V.key==="ArrowDown"||V.key==="PageUp"||V.key==="PageDown",H=V=>V.ctrlKey||V.metaKey||V.altKey,q=V=>{if(P.current!=="navigation"||Cp(V)||H(V)){F.current=!1;return}F.current=M(V)},X=V=>{if(P.current!=="navigation"||Cp(V)||H(V)){F.current=!1;return}if(!M(V)){F.current=!1;return}k.current(),F.current=!1};return N.addEventListener("keydown",q,!0),N.addEventListener("keyup",X),()=>{N.removeEventListener("keydown",q,!0),N.removeEventListener("keyup",X)}},[t]);let x=(0,yr.useCallback)(N=>{let H=(N?.openInEditor??!1)&&!u.enterToOpenFiles,q=N?.debounceOpen??!1,X=N?.clearIfEmpty??!1,V=N?.selectFallback??!0,j=l.selectedFile,_=!j,W=j?n.has(j.path):!1;if(_||!W){if(V&&e.length>0){let Z=e[0];return z(Z,{suppressOpen:!H,debounceOpen:H&&q}),{selectionStateChanged:!0}}return!V&&X&&e.length===0?(c({type:"SET_SELECTED_FILE",file:null}),{selectionStateChanged:!0}):{selectionStateChanged:!1}}if(H&&j&&W){if(q)return G(j),{selectionStateChanged:!1};s(j)}return{selectionStateChanged:!1}},[n,s,e,G,z,c,l.selectedFile,u.enterToOpenFiles]),B=(0,yr.useCallback)(N=>{let M=jc(o,l),H=YE(e,M,N);if(!H)return!1;z(H,{markKeyboardNavigation:!0,markUserSelection:!0,suppressOpen:u.enterToOpenFiles});let q=n.get(H.path);return q!==void 0&&r(q,"auto"),!0},[o,n,e,r,z,l,u.enterToOpenFiles]),I=(0,yr.useCallback)((N,M,H,q)=>{if(M.button===1)return;v.current=!0;let X=q??e,V=M.shiftKey,j=Pk(M),_=Kn(),W=_&&Pf(M,u.multiSelectModifier),J=_&&!W&&u.multiSelectModifier==="optionAlt"&&j;W?h(N,H,X):_&&V&&H!==void 0?b(N,H,X):z(N,{markUserSelection:!0,suppressOpen:J}),m({type:"ACTIVATE_PANE",target:"files"}),!W&&!V&&J&&$(()=>Vr({app:o,commandQueue:a,file:N,context:"tab"})),i&&o.workspace.leftSplit&&!W&&!V&&o.workspace.leftSplit.collapse()},[o,a,h,b,i,e,z,u.multiSelectModifier,m]),A=(0,yr.useCallback)((N,M,H,q)=>{I(N,H,M,q)},[I]);return(0,yr.useEffect)(()=>{l.selectedFile&&(E.current=l.selectedFile.path)},[l.selectedFile]),(0,yr.useEffect)(()=>{let{selectedFile:N}=l,M=l.isRevealOperation,H=l.isFolderChangeWithAutoSelect,q=l.isKeyboardNavigation;if(M||q){q&&c({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!1});return}let X=H&&F.current,V=!1,j=!1;f&&u.autoSelectFirstFileOnFocusChange&&Kn()&&H&&(V=x({openInEditor:!0,clearIfEmpty:!0,debounceOpen:X}).selectionStateChanged,j=!0),!j&&!V&&N&&!v.current&&u.autoSelectFirstFileOnFocusChange&&Kn()&&H&&!u.enterToOpenFiles&&(X?G(N):s(N)),H&&(V||c({type:"SET_FOLDER_CHANGE_WITH_AUTO_SELECT",isFolderChangeWithAutoSelect:!1}),F.current=!1),v.current=!1},[x,f,s,G,c,l,u.autoSelectFirstFileOnFocusChange,u.enterToOpenFiles]),(0,yr.useEffect)(()=>{if(!(p.singlePane||!Kn())&&p.focusedPane==="files"&&l.isKeyboardNavigation){c({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!1});let N=l.selectedFile,M=!N,H=N?!e.some(X=>X.path===N.path):!1;if((M||H)&&e.length>0){let X=o.workspace.getActiveFile(),V=X?e.some(j=>j.path===X.path):!1;X&&V?c({type:"SET_SELECTED_FILE",file:X}):x({openInEditor:!0})}}},[o.workspace,x,e,c,l.isKeyboardNavigation,l.selectedFile,p.focusedPane,p.singlePane]),{selectFileFromList:z,selectAdjacentFile:B,ensureSelectionForCurrentFilter:x,handleFileItemClick:A,lastSelectedFilePath:E.current,isFileSelected:y,scheduleKeyboardSelectionOpen:Q,scheduleKeyboardSelectionOpenForFile:R,commitPendingKeyboardSelectionOpen:O}}var yr,pre,gre=U(()=>{yr=he(Ve()),pre=require("obsidian");Ur();fn();on();wa();gr();tw();GA();po();st();Ts();Md();_u();$r();bi()});var pC,hre=U(()=>{pC="empty-list"});function mt(t,e){return t.onClick(()=>{$(e)})}function kr(t,e,n){return e.onClick(()=>{t.hide(),$(n)})}function Ls(t){if(typeof t.setSubmenu!="function")return null;if(t.setSubmenu.length>0){let e=new mw.Menu;try{return t.setSubmenu(e),e}catch{}}try{let e=t.setSubmenu();if(e instanceof mw.Menu)return e}catch{}try{let e=new mw.Menu;return t.setSubmenu(e),e}catch{return null}}function dD(t){if(typeof mw.MenuItem.prototype.setSubmenu!="function")return!1;let e=!1;return t.menu.addItem(n=>{let r=Ls(n);if(!r){n.setTitle(d.contextMenu.copy.title).setIcon("lucide-copy").setDisabled(!0);return}n.setTitle(d.contextMenu.copy.title).setIcon("lucide-copy"),e=!0;let o=t.linkItems;o&&(r.addItem(a=>{kr(t.menu,a.setTitle(o.isMarkdownFile?d.contextMenu.copy.noteLink:d.contextMenu.copy.fileLink).setIcon("lucide-brackets"),async()=>{await pw(`[[${o.getLinkText()}]]`)&&oe(d.fileSystem.notifications.linkCopied,{variant:"success"})})}),r.addItem(a=>{kr(t.menu,a.setTitle(o.isMarkdownFile?d.contextMenu.copy.noteLinkAsFootnote:d.contextMenu.copy.fileLinkAsFootnote).setIcon("lucide-superscript"),async()=>{await pw(`^[[[${o.getLinkText()}]]]`)&&oe(d.fileSystem.notifications.footnoteLinkCopied,{variant:"success"})})}),r.addItem(a=>{kr(t.menu,a.setTitle(o.isMarkdownFile?d.contextMenu.copy.noteEmbed:d.contextMenu.copy.fileEmbed).setIcon("lucide-picture-in-picture-2"),async()=>{await pw(`![[${o.getLinkText()}]]`)&&oe(d.fileSystem.notifications.embedLinkCopied,{variant:"success"})})}),r.addSeparator()),t.getObsidianUrl&&r.addItem(a=>{kr(t.menu,a.setTitle(d.contextMenu.copy.obsidianUrl).setIcon("lucide-link"),async()=>{let i=t.getObsidianUrl?.();i&&await pw(i)&&oe(d.fileSystem.notifications.deepLinkCopied,{variant:"success"})})}),r.addItem(a=>{kr(t.menu,a.setTitle(d.contextMenu.copy.pathFromVaultFolder).setIcon("vault"),async()=>{let i=t.getVaultPath();await pw(i)&&oe(d.fileSystem.notifications.relativePathCopied,{variant:"success"})})}),t.getSystemPath&&r.addItem(a=>{kr(t.menu,a.setTitle(d.contextMenu.copy.pathFromSystemRoot).setIcon("lucide-hard-drive"),async()=>{let i=t.getSystemPath?.();i&&await pw(i)&&oe(d.fileSystem.notifications.pathCopied,{variant:"success"})})})}),e}async function pw(t){try{return await navigator.clipboard.writeText(t),!0}catch{return oe(d.common.clipboardWriteError,{variant:"warning"}),!1}}var mw,$c=U(()=>{mw=require("obsidian");Oe();bn();st()});function mNe(t,e){if(!t)return e;if(ia(t)||Do(t)||Oo(t)||ya(t)){let n=t.alias;if(n&&n.length>0)return n}return Qi(t)?t.name:e}function sp(t){let{app:e,menu:n,shortcutKey:r,defaultLabel:o,existingShortcut:a,title:i,placeholder:s,renameShortcut:l,closeOnSubmit:c}=t;n.addItem(u=>{mt(u.setTitle(i).setIcon("lucide-pencil"),async()=>{let p=mNe(a,o),{InputModal:m}=await Promise.resolve().then(()=>(yv(),PG)),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 gw=U(()=>{Ha();$c()});function mC(t){return!!(t.icon||t.color||t.background)}function yre(t){mC(t)&&(fre={data:t})}function W1(){return fre}var fre,vre=U(()=>{fre=null});var Sre,gNe,bre,hw,yy,cD,wre=U(()=>{Sre=require("obsidian");Oe();ei();Vx();a0();eP();po();st();Nd();gNe=5,bre=50,hw="all",yy="vault",cD=class t{constructor(e){this.iconService=Fn();this.currentProvider=hw;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(kt(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(hw,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(kt(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(kt(this.searchInput,"input",()=>{this.searchDebounceTimer&&window.clearTimeout(this.searchDebounceTimer),this.searchDebounceTimer=window.setTimeout(()=>{this.updateResults()},_t.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=[yy,"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[yy],r=Array.isArray(n)?n:[],o=n!==void 0&&!Array.isArray(n);if(r.length===0&&!o)return;if(o){delete e[yy],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!==yy){i=!0;return}let c=this.app.vault.getAbstractFileByPath(l.identifier);if(c instanceof Sre.TFile&&zd(c)){a.push(s);return}i=!0}),i&&(a.length===0?delete e[yy]:e[yy]=a,this.settingsProvider.setRecentIcons(e))}resolveInitialProvider(e){if(!e.length)return hw;let n=new Set(e.map(o=>o.id)),r=[t.getLastUsedProvider(),this.currentProvider];for(let o of r)if(o&&(o===hw||n.has(o)))return o;return hw}searchAllProvidersExcludingVault(e){let n=[];return this.iconService.getAllProviders().forEach(r=>{if(r.id===yy)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===hw,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,bre).forEach(i=>{this.createIconItem(i,a,r)}),o.length>bre&&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:Hx(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&&$(()=>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*gNe;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=Xx(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 fw={};En(fw,{AppearanceModal:()=>G1});var uD,G1,yw=U(()=>{uD=require("obsidian");Oe();ei();Nd();n0();wre();G1=class extends uD.Modal{constructor(n,r){super(n);this.iconService=Fn();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=Zp.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(kt(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(kt(this.resetButton,"click",()=>this.resetActiveTab()));let s=i.createDiv("nn-appearance-footer-actions"),l=s.createEl("button",{text:d.common.cancel});this.domDisposers.push(kt(l,"click",()=>this.close()));let c=s.createEl("button",{text:d.modals.appearance.apply,cls:"mod-cta"});if(this.domDisposers.push(kt(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(kt(s,"click",()=>this.setActiveTab(o))),u}mountIconTab(n){let r=n.createDiv("nn-appearance-picker-host");this.iconSurface=new cD({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 Zp({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(){let n=this.params.metadataService.getSettingsProvider().settings,r=n.colorIconOnly,o=r||n.showCategoryIcons,i=r&&!n.showCategoryIcons&&!this.stagedColor&&!this.stagedIcon&&!!this.params.colorIconPlaceholder?null:this.stagedIcon??this.params.defaultIcon??(o?this.params.colorIconPlaceholder:null);this.previewIconEl.empty(),i?(this.iconService.renderIcon(this.previewIconEl,i),this.previewIconEl.removeClass("nn-appearance-preview-icon-empty")):this.previewIconEl.addClass("nn-appearance-preview-icon-empty"),this.previewItem.style.removeProperty("--nn-preview-fg"),this.previewIconEl.style.removeProperty("color"),this.stagedColor&&(r?this.previewIconEl.style.setProperty("color",this.stagedColor):this.previewItem.style.setProperty("--nn-preview-fg",this.stagedColor)),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,uD.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 pD(t){let{menu:e,app:n,metadataService:r,folderPath:o,showFolderIcons:a,defaultIcon:i}=t,s=r.getFolderIcon(o)??null,l=a||o==="/",c=i??Rf({interfaceIcons:r.getSettingsProvider().settings.interfaceIcons,isRoot:o==="/",hasChildren:!1,isExpanded:!1}),u=ns({app:n,metadataService:r,settings:r.getSettingsProvider().settings,folderPath:o,fallbackName:o.split("/").pop()||o}),p=async m=>{let{AppearanceModal:g}=await Promise.resolve().then(()=>(yw(),fw));new g(n,{title:u,metadataService:r,initialTab:m,defaultIcon:l?c:null,icon:l?{initial:s,apply:async h=>{if(h===null){await r.removeFolderIcon(o);return}await r.setFolderIcon(o,h)}}:void 0,color:{initial:r.getFolderColor(o)??null,apply:async h=>{if(h===null){await r.removeFolderColor(o);return}await r.setFolderColor(o,h)}},background:{initial:r.getFolderBackgroundColor(o)??null,apply:async h=>{if(h===null){await r.removeFolderBackgroundColor(o);return}await r.setFolderBackgroundColor(o,h)}}}).open()};l&&e.addItem(m=>{mt(m.setTitle(d.contextMenu.folder.changeIcon).setIcon("lucide-image"),()=>p("icon"))}),e.addItem(m=>{mt(m.setTitle(d.contextMenu.folder.changeColor).setIcon("lucide-palette"),()=>p("color"))}),e.addItem(m=>{mt(m.setTitle(d.contextMenu.folder.changeBackground).setIcon("lucide-paint-bucket"),()=>p("background"))})}function hNe(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 mD(t){let{menu:e,metadataService:n,folderPath:r,inheritFolderColors:o,showFolderIcons:a}=t,i=hNe({metadataService:n,folderPath:r,inheritFolderColors:o});km({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 km(t){if(typeof Tre.MenuItem.prototype.setSubmenu!="function")return;let e=!!t.hasIcon,n=!!t.hasColor,r=!!t.hasBackground,a=W1()?.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=mC(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(y=>{let v=Ls(y);if(!v){y.setTitle(d.contextMenu.style.title).setIcon("lucide-brush").setDisabled(!0);return}y.setTitle(d.contextMenu.style.title).setIcon("lucide-brush"),m&&v.addItem(S=>{kr(t.menu,S.setTitle(d.contextMenu.style.copy).setIcon("lucide-copy"),async()=>{yre(t.styleData)})}),g&&v.addItem(S=>{kr(t.menu,S.setTitle(d.contextMenu.style.paste).setIcon("lucide-clipboard-check"),async()=>{let w=W1();if(!w||!mC(w.data)||!t.applyStyle)return;let T={icon:e?w.data.icon:void 0,color:n?w.data.color:void 0,background:r?w.data.background:void 0};mC(T)&&await t.applyStyle(T)})}),h&&s&&v.addItem(S=>{kr(t.menu,S.setTitle(d.contextMenu.style.removeIcon).setIcon("lucide-image-off"),async()=>{await t.removeIcon?.()})}),h&&l&&v.addItem(S=>{kr(t.menu,S.setTitle(d.contextMenu.style.removeColor).setIcon("lucide-palette"),async()=>{await t.removeColor?.()})}),h&&c&&v.addItem(S=>{kr(t.menu,S.setTitle(d.contextMenu.style.removeBackground).setIcon("lucide-paint-bucket"),async()=>{await t.removeBackground?.()})}),b&&p&&v.addItem(S=>{kr(t.menu,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 Tre,vw=U(()=>{Tre=require("obsidian");Oe();em();lr();$c();vre()});function j1(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,y=e??ns({app:l,metadataService:u,settings:s,folderPath:n.path,fallbackName:n.name}),v=()=>m.selectionType===K.FOLDER&&m.selectedFolder&&m.selectedFolder.path===n.path?!1:(f({type:"SET_SELECTED_FOLDER",folder:n}),!0),S=C=>{C&&(f({type:"SET_SELECTED_FILE",file:C}),b({type:"ACTIVATE_PANE",target:"files"}))};r.addItem(C=>{mt(C.setTitle(d.contextMenu.folder.newNote).setIcon("lucide-pen-box"),async()=>{let L=v(),z=await c.getManualSortNewFileContextForTarget("folder",n.path,{waitForSelectionUpdate:L}),G=await c.createNewFile(n,t.settings.createNewNotesInNewTab,z);S(G)})});let w=rb(l);w&&r.addItem(C=>{mt(C.setTitle(d.contextMenu.folder.newNoteFromTemplate).setIcon("templater-icon"),()=>(v(),w(n)))}),r.addItem(C=>{mt(C.setTitle(d.contextMenu.folder.newFolder).setIcon("lucide-folder-plus"),async()=>{v(),await c.createNewFolder(n,()=>{if(!da(n.path,g,s.showRootFolder)){let L=s.collapseOtherBranchesOnExpand?[...tp(n,{includeRootFolder:s.showRootFolder}),n.path]:[n.path];Os({type:"folder",ids:L,collapseOtherBranches:s.collapseOtherBranchesOnExpand,dispatch:h})}})})}),Um(l,"canvas")?.enabled&&r.addItem(C=>{mt(C.setTitle(d.contextMenu.folder.newCanvas).setIcon("lucide-layout-grid"),async()=>{v();let L=await c.createCanvas(n);S(L)})}),Um(l,"bases")?.enabled&&r.addItem(C=>{mt(C.setTitle(d.contextMenu.folder.newBase).setIcon("lucide-database"),async()=>{v();let L=await c.createBase(n);S(L)})});let k=Yy(l,_h),P=Yy(l,Hh),E=k&&P;if(k&&r.addItem(C=>{let L=E?d.contextMenu.folder.newExcalidrawDrawing:d.contextMenu.folder.newDrawing;mt(C.setTitle(L).setIcon("excalidraw-icon"),async()=>{v();let z=await c.createNewDrawing(n,"excalidraw");S(z)})}),P&&r.addItem(C=>{let L=E?d.contextMenu.folder.newTldrawDrawing:d.contextMenu.folder.newDrawing;mt(C.setTitle(L).setIcon("lucide-pencil"),async()=>{v();let z=await c.createNewDrawing(n,"tldraw");S(z)})}),s.enableFolderNotes){let C=Rn(n,s),L=!!C,z=!C;(L||z)&&r.addSeparator(),C?(r.addItem(G=>{mt(G.setTitle(d.contextMenu.folder.detachFolderNote).setIcon("lucide-unlink"),async()=>{await c.renameFile(C)})}),r.addItem(G=>{mt(G.setTitle(d.contextMenu.folder.deleteFolderNote).setIcon("lucide-trash").setWarning(!0),async()=>{await c.deleteFile(C,s.confirmBeforeDelete)})})):z&&r.addItem(G=>{mt(G.setTitle(d.contextMenu.folder.createFolderNote).setIcon("lucide-pen-box"),async()=>{v();let Q=await qY(l,n,{folderNoteType:s.folderNoteType,folderNoteNamePattern:s.folderNoteNamePattern,folderNoteTemplate:s.folderNoteTemplate},o.commandQueue,{folderDisplayName:y,openContext:s.folderNoteOpenLocation==="right-sidebar"?"right-sidebar":null,openInRightSidebar:R=>p.openFolderNoteInRightSidebar(R)});if(S(Q),Q&&s.pinCreatedFolderNote)try{u.isFilePinned(Q.path,"folder")||await u.togglePin(Q.path,"folder")}catch(R){console.error("Failed to pin created folder note",{path:Q.path,error:R})}})})}}function gC(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=ns({app:l,metadataService:u,settings:o,folderPath:e.path,fallbackName:e.name});r.isMobile&&n.addItem(P=>{P.setTitle(b).setIsLabel(!0)}),j1(t,b),n.addSeparator(),pD({menu:n,app:l,metadataService:u,folderPath:e.path,showFolderIcons:o.showFolderIcons,defaultIcon:Rf({interfaceIcons:o.interfaceIcons,isRoot:e.path==="/",hasChildren:gg(e,_a(o),r.visibility.showHiddenItems),isExpanded:da(e.path,g,o.showRootFolder)})}),mD({menu:n,metadataService:u,folderPath:e.path,inheritFolderColors:o.inheritFolderColors,showFolderIcons:o.showFolderIcons}),typeof bh.MenuItem.prototype.setSubmenu=="function"&&(n.addSeparator(),n.addItem(P=>{let E=u.getFolderChildSortOrderOverride(e.path),C=E??o.folderSortOrder,L=E?C==="alpha-desc"?"lucide-sort-desc":"lucide-sort-asc":"lucide-sliders-horizontal",z=Ls(P);if(!z){P.setTitle(d.paneHeader.changeChildSortOrder).setIcon(L).setDisabled(!0);return}let G=o.folderSortOrder==="alpha-desc"?d.settings.items.folderSortOrder.options.alphaDesc:d.settings.items.folderSortOrder.options.alphaAsc;P.setTitle(d.paneHeader.changeChildSortOrder).setIcon(L),z.addItem(Q=>{Q.setTitle(`${d.folderAppearance.defaultLabel} (${G})`).setChecked(!E),kr(n,Q,async()=>{await u.removeFolderChildSortOrderOverride(e.path),l.workspace.requestSaveLayout()})}),z.addSeparator(),z.addItem(Q=>{Q.setTitle(d.settings.items.folderSortOrder.options.alphaAsc).setChecked(E==="alpha-asc"),kr(n,Q,async()=>{await u.setFolderChildSortOrderOverride(e.path,"alpha-asc"),l.workspace.requestSaveLayout()})}),z.addItem(Q=>{Q.setTitle(d.settings.items.folderSortOrder.options.alphaDesc).setChecked(E==="alpha-desc"),kr(n,Q,async()=>{await u.setFolderChildSortOrderOverride(e.path,"alpha-desc"),l.workspace.requestSaveLayout()})})}));let y={type:"folder",path:e.path},v=u.hasNavigationSeparator(y),S=!!s?.disableNavigationSeparatorActions;if(n.addSeparator(),r.shortcuts){let{folderShortcutKeysByPath:P,addFolderShortcut:E,removeShortcut:C,renameShortcut:L,shortcutMap:z}=r.shortcuts,G=P.get(e.path);if(G){let Q=z.get(G);sp({app:l,menu:n,shortcutKey:G,defaultLabel:b,existingShortcut:Q,title:d.shortcuts.rename,placeholder:d.searchInput.shortcutNamePlaceholder,renameShortcut:L})}n.addItem(Q=>{G?mt(Q.setTitle(d.shortcuts.remove).setIcon(Qn(o.interfaceIcons,"nav-shortcuts","lucide-star-off")),async()=>{await C(G)}):mt(Q.setTitle(d.shortcuts.add).setIcon(Qn(o.interfaceIcons,"nav-shortcuts","lucide-star")),async()=>{await E(e.path)})})}S||n.addItem(P=>{let E=v?d.contextMenu.navigation.removeSeparator:d.contextMenu.navigation.addSeparator;mt(P.setTitle(E).setIcon("lucide-separator-horizontal"),async()=>{if(v){await u.removeNavigationSeparator(y);return}await u.addNavigationSeparator(y)})}),n.addSeparator(),n.addItem(P=>{P.setTitle(d.contextMenu.folder.searchInFolder).setIcon("lucide-search").onClick(()=>{let E=Um(l,"global-search");E?.instance&&E.instance.openGlobalSearch(`path:"${e.path}"`)})}),e.path==="/"&&n.addItem(P=>{P.setTitle(d.commands.navigateToFolder).setIcon("lucide-folder").onClick(()=>{yu(l,`${p.manifest.id}:navigate-to-folder`)})}),n.addSeparator();let w=l.vault.adapter,T=w instanceof bh.FileSystemAdapter?w:null;if(dD({menu:n,getVaultPath:()=>e.path,getSystemPath:T?()=>T.getFullPath(e.path):void 0})&&n.addSeparator(),r.isMobile||(n.addItem(P=>{mt(P.setTitle(c.getRevealInSystemExplorerText()).setIcon(bh.Platform.isMacOS?"lucide-app-window-mac":"lucide-app-window"),async()=>{await c.revealInSystemExplorer(e)})}),n.addSeparator()),(r.plugin.api?.[Ka].menus.applyFolderMenuExtensions({menu:n,folder:e})??0)>0&&n.addSeparator(),e.path==="/"&&(o.showRootFolder?n.addItem(P=>{mt(P.setTitle(d.contextMenu.folder.hideRootFolder).setIcon("lucide-eye-off"),async()=>{r.plugin.settings.showRootFolder=!1,await r.plugin.saveSettingsAndUpdate()})}):n.addItem(P=>{mt(P.setTitle(d.contextMenu.folder.showRootFolder).setIcon("lucide-eye"),async()=>{h({type:"EXPAND_FOLDERS",folderPaths:[e.path]}),r.plugin.settings.showRootFolder=!0,await r.plugin.saveSettingsAndUpdate()})})),e.path!=="/"){let P=nn(r.plugin.settings),E=P.hiddenFolders,C=fi(e,E),L=Ee(nl(e.path)),z=E.find(x=>{let B=Hq(x);return!!(B&&Ee(B.normalizedPrefix)===L)});z?n.addItem(x=>{mt(x.setTitle(d.contextMenu.folder.unhideFolder).setIcon("lucide-eye"),async()=>{let B=P.hiddenFolders;P.hiddenFolders=B.filter(I=>I!==z),await r.plugin.saveSettingsAndUpdate()})}):C||n.addItem(x=>{mt(x.setTitle(d.contextMenu.folder.excludeFolder).setIcon("lucide-eye-off"),async()=>{let B=P.hiddenFolders,I=e.path.startsWith("/")?e.path:`/${e.path}`,A=ix(B,I);P.hiddenFolders=A,await r.plugin.saveSettingsAndUpdate()})});let G=P.descendantExcludedFolders,Q=G.length>0&&Tc(e.name,G,e.path),R=G.filter(x=>{let B=x.trim();return B.startsWith("/")&&!B.includes("*")&&Ee(nl(B))===L}),O=G.filter(x=>!R.includes(x));R.length>0&&!Tc(e.name,O,e.path)?n.addItem(x=>{mt(x.setTitle(d.contextMenu.folder.includeInDescendants).setIcon("lucide-list-plus"),async()=>{P.descendantExcludedFolders=P.descendantExcludedFolders.filter(B=>!R.includes(B)),await r.plugin.saveSettingsAndUpdate(),oe(d.fileSystem.notices.folderIncludedInDescendants.replace("{name}",b),{variant:"success"})})}):Q||n.addItem(x=>{mt(x.setTitle(d.contextMenu.folder.excludeFromDescendants).setIcon("lucide-list-minus"),async()=>{let B=e.path.startsWith("/")?e.path:`/${e.path}`;P.descendantExcludedFolders=Array.from(new Set([...P.descendantExcludedFolders,B])),await r.plugin.saveSettingsAndUpdate(),oe(d.fileSystem.notices.folderExcludedFromDescendants.replace("{name}",b),{variant:"success"})})})}n.addItem(P=>{let E=P.setTitle(d.contextMenu.folder.renameFolder).setIcon("lucide-pencil"),C=s?.onStartInlineRename;mt(E,async()=>{C?.(e)||await c.renameFolder(e,o)})}),e.path!=="/"&&n.addItem(P=>{mt(P.setTitle(d.contextMenu.folder.moveFolder).setIcon("lucide-folder-input"),async()=>{let E=await c.moveFolderWithModal(e);if(E.status!=="success")return;let{oldPath:C,newPath:L,targetFolder:z}=E.data,G=l.vault.getAbstractFileByPath(L);if(!G||!(G instanceof bh.TFolder))return;m.selectedFolder===e&&f({type:"SET_SELECTED_FOLDER",folder:G});let R=new Set,O=`${C}/`;g.forEach(x=>{if(x===C){R.add(L);return}if(x.startsWith(O)){let B=x.substring(O.length),I=B.length>0?`${L}/${B}`:L;R.add(I);return}R.add(x)});let D=z.path;D!=="/"&&!R.has(D)&&R.add(D),h({type:"SET_EXPANDED_FOLDERS",folders:R})})}),n.addItem(P=>{mt(P.setTitle(d.contextMenu.folder.duplicateFolder).setIcon("lucide-copy"),async()=>{await c.duplicateFolder(e)})}),e.path!=="/"&&n.addItem(P=>{mt(P.setTitle(d.contextMenu.folder.deleteFolder).setIcon("lucide-trash").setWarning(!0),async()=>{let E=e.parent;await c.deleteFolder(e,o.confirmBeforeDelete,()=>{if(m.selectedFolder){let C=e.path===m.selectedFolder.path,L=pW(e,m.selectedFolder);(C||L)&&(E&&(E.path!=="/"||o.showRootFolder||r.visibility.showHiddenItems)?f({type:"SET_SELECTED_FOLDER",folder:E}):f({type:"SET_SELECTED_FOLDER",folder:null}))}})})})}var bh,q1=U(()=>{bh=require("obsidian");Oe();bn();mo();Hu();wr();Ue();$c();gw();lr();sn();Et();jy();vw();zu();em();Lg();qc()});function hC(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(A=>{let N=cl(e)?Rc(e).getLabel():`#${e}`;A.setTitle(N).setIsLabel(!0)}),n.addSeparator());let b=e===wt||e===Lt,y=()=>g.selectionType===K.TAG&&g.selectedTag===e?!1:(f({type:"SET_SELECTED_TAG",tag:e}),!0),v=A=>{A&&(f({type:"SET_SELECTED_FILE",file:A}),h({type:"ACTIVATE_PANE",target:"files"}))};b||(n.addItem(A=>{mt(A.setTitle(d.contextMenu.folder.newNote).setIcon("lucide-pen-box"),async()=>{let N=y(),M=g.selectedFile?.path??l.workspace.getActiveFile()?.path??"",H=at(e),q=H?await p.getManualSortNewFileContextForTarget("tag",H,{waitForSelectionUpdate:N}):null,X=await p.createNewFileForTag(e,M,o.createNewNotesInNewTab,q);v(X)})}),n.addSeparator());let S=async A=>{let{AppearanceModal:N}=await Promise.resolve().then(()=>(yw(),fw));new N(l,{title:`#${e}`,metadataService:c,initialTab:A,defaultIcon:o.showTagIcons?Je(o.interfaceIcons,"nav-tag"):null,icon:o.showTagIcons?{initial:c.getTagIcon(e)??null,apply:async H=>{if(H===null){await c.removeTagIcon(e);return}await c.setTagIcon(e,H)}}:void 0,color:{initial:c.getTagColor(e)??null,apply:async H=>{if(H===null){await c.removeTagColor(e);return}await c.setTagColor(e,H)}},background:{initial:c.getTagBackgroundColor(e)??null,apply:async H=>{if(H===null){await c.removeTagBackgroundColor(e);return}await c.setTagBackgroundColor(e,H)}}}).open()};o.showTagIcons&&n.addItem(A=>{mt(A.setTitle(d.contextMenu.tag.changeIcon).setIcon("lucide-image"),()=>S("icon"))}),n.addItem(A=>{mt(A.setTitle(d.contextMenu.tag.changeColor).setIcon("lucide-palette"),()=>S("color"))}),n.addItem(A=>{mt(A.setTitle(d.contextMenu.tag.changeBackground).setIcon("lucide-paint-bucket"),()=>S("background"))});let w=c.getTagIcon(e),T=c.getTagColorData(e),F=T.color,k=T.background,P=at(e),E=P?o.tagColors?.[P]:void 0,C=P?o.tagBackgroundColors?.[P]:void 0,L=!!w,z=!!E,G=!!C;km({menu:n,styleData:{icon:w,color:F,background:k},hasIcon:o.showTagIcons,hasColor:!0,hasBackground:!0,applyStyle:async A=>{let{icon:N,color:M,background:H}=A,q=[];N&&q.push(c.setTagIcon(e,N)),M&&q.push(c.setTagColor(e,M)),H&&q.push(c.setTagBackgroundColor(e,H)),await Promise.all(q)},removeIcon:L?async()=>c.removeTagIcon(e):void 0,removeColor:z?async()=>c.removeTagColor(e):void 0,removeBackground:G?async()=>c.removeTagBackgroundColor(e):void 0}),typeof kre.MenuItem.prototype.setSubmenu=="function"&&(n.addSeparator(),n.addItem(A=>{let N=c.getTagChildSortOrderOverride(e),M=N??o.tagSortOrder,H=N?M.endsWith("-desc")?"lucide-sort-desc":"lucide-sort-asc":"lucide-sliders-horizontal",q=Ls(A);if(!q){A.setTitle(d.paneHeader.changeChildSortOrder).setIcon(H).setDisabled(!0);return}let X=(()=>{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}})();A.setTitle(d.paneHeader.changeChildSortOrder).setIcon(H),q.addItem(V=>{V.setTitle(`${d.folderAppearance.defaultLabel} (${X})`).setChecked(!N),kr(n,V,async()=>{await c.removeTagChildSortOrderOverride(e),l.workspace.requestSaveLayout()})}),q.addSeparator(),q.addItem(V=>{V.setTitle(d.settings.items.tagSortOrder.options.alphaAsc).setChecked(N==="alpha-asc"),kr(n,V,async()=>{await c.setTagChildSortOrderOverride(e,"alpha-asc"),l.workspace.requestSaveLayout()})}),q.addItem(V=>{V.setTitle(d.settings.items.tagSortOrder.options.alphaDesc).setChecked(N==="alpha-desc"),kr(n,V,async()=>{await c.setTagChildSortOrderOverride(e,"alpha-desc"),l.workspace.requestSaveLayout()})})}));let Q=!!s?.disableNavigationSeparatorActions;if((r.shortcuts||!Q)&&n.addSeparator(),r.shortcuts){let{tagShortcutKeysByPath:A,addTagShortcut:N,removeShortcut:M,renameShortcut:H,shortcutMap:q}=r.shortcuts,X=at(e),V=X?A.get(X):void 0;if(V){let j=q.get(V),_=cl(e)?Rc(e).getLabel():FE(e,r.tagTreeService);sp({app:l,menu:n,shortcutKey:V,defaultLabel:_,existingShortcut:j,title:d.shortcuts.rename,placeholder:d.searchInput.shortcutNamePlaceholder,renameShortcut:H})}n.addItem(j=>{V?mt(j.setTitle(d.shortcuts.remove).setIcon(Qn(o.interfaceIcons,"nav-shortcuts","lucide-star-off")),async()=>{await M(V)}):mt(j.setTitle(d.shortcuts.add).setIcon(Qn(o.interfaceIcons,"nav-shortcuts","lucide-star")),async()=>{await N(e)})})}if(!Q){let A={type:"tag",path:e},N=c.hasNavigationSeparator(A);n.addItem(M=>{let H=N?d.contextMenu.navigation.removeSeparator:d.contextMenu.navigation.addSeparator;mt(M.setTitle(H).setIcon("lucide-separator-horizontal"),async()=>{if(N){await c.removeNavigationSeparator(A);return}await c.addNavigationSeparator(A)})})}let O=e!==wt,D=nn(u.settings),x=Sx(u.settings),B=O||!b,I=r.plugin.api?.[Ka].menus.applyTagMenuExtensions({menu:n,tag:P??e})??0;if(I>0&&B&&n.addSeparator(),O||!b){if(I===0&&n.addSeparator(),O){let A=mg(x),N=A.pathPatterns.length>0||A.prefixes.length>0||A.startsWithNames.length>0||A.endsWithNames.length>0,M=e.split("/").pop()??e,H=N&&Fs(e,M,A),q=at(e),X=q!==null&&x.some(V=>{let j=at(V);return j!==null&&!j.includes("*")&&j===q});H?X&&q&&n.addItem(V=>{mt(V.setTitle(d.contextMenu.tag.showTag).setIcon("lucide-eye"),async()=>{D.hiddenTags=x.filter(j=>{let _=at(j);return!(_&&!_.includes("*")&&_===q)}),await u.saveSettingsAndUpdate()})}):n.addItem(V=>{mt(V.setTitle(d.contextMenu.tag.hideTag).setIcon("lucide-eye-off"),async()=>{let j=L2(x,e);D.hiddenTags=j,await u.saveSettingsAndUpdate()})})}b||(n.addItem(A=>{mt(A.setTitle(d.modals.tagOperation.confirmRename).setIcon("lucide-pencil"),async()=>{await r.tagOperations.promptRenameTag(e)})}),n.addItem(A=>{mt(A.setTitle(d.modals.tagOperation.confirmDelete).setIcon("lucide-trash").setWarning(!0),async()=>{await r.tagOperations.promptDeleteTag(e)})}))}}var kre,Pre=U(()=>{kre=require("obsidian");Oe();Hr();Ue();Cn();$c();gw();vw();lr();Og();sn();pP();Lg()});function fNe(t){let{propertyNodeId:e,propertyNodeName:n,keyNodeName:r}=t,o=Nn(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 Fre(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);sp({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){mt(g.setTitle(d.shortcuts.remove).setIcon(Qn(r.interfaceIcons,"nav-shortcuts","lucide-star-off")),async()=>{await c(m)});return}mt(g.setTitle(d.shortcuts.add).setIcon(Qn(r.interfaceIcons,"nav-shortcuts","lucide-star")),async()=>{await s(a)})})}function fC(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===_e){let I=d.navigationPane.properties;g&&(n.addItem(N=>{N.setTitle(I).setIsLabel(!0)}),n.addSeparator()),(r.plugin.api?.[Ka].menus.applyPropertyMenuExtensions({menu:n,nodeId:_e})??0)>0&&r.shortcuts&&n.addSeparator(),r.shortcuts&&Fre({app:l,menu:n,settings:o,shortcuts:r.shortcuts,nodeId:_e,label:I});return}let y=en(e);if(!y)return;let v=p?.findNode(y),S=v?.kind==="key"?v.key:null,w=v?.kind==="key"?v:v?p?.getKeyNode(v.key):null,T=fNe({propertyNodeId:y,propertyNodeName:v?.name,keyNodeName:w?.name});g&&(n.addItem(I=>{I.setTitle(T).setIsLabel(!0)}),n.addSeparator());let F=()=>f.selectionType===K.PROPERTY&&f.selectedProperty===y?!1:(h({type:"SET_SELECTED_PROPERTY",nodeId:y}),!0),k=I=>{I&&(h({type:"SET_SELECTED_FILE",file:I}),b({type:"ACTIVATE_PANE",target:"files"}))};n.addItem(I=>{mt(I.setTitle(d.contextMenu.folder.newNote).setIcon("lucide-pen-box"),async()=>{let A=F(),N=f.selectedFile?.path??l.workspace.getActiveFile()?.path??"",M=await m.getManualSortNewFileContextForTarget("property",y,{waitForSelectionUpdate:A}),H=await m.createNewFileForProperty(y,N,o.createNewNotesInNewTab,M);k(H)})}),n.addSeparator();let P=async I=>{let{AppearanceModal:A}=await Promise.resolve().then(()=>(yw(),fw));new A(l,{title:T,metadataService:c,initialTab:I,defaultIcon:o.showPropertyIcons?Je(o.interfaceIcons,Nn(y)?.valuePath?"nav-property-value":"nav-property"):null,icon:o.showPropertyIcons?{initial:c.getPropertyIcon(y)??null,apply:async M=>{if(M===null){await c.removePropertyIcon(y);return}await c.setPropertyIcon(y,M)}}:void 0,color:{initial:c.getPropertyColor(y)??null,apply:async M=>{if(M===null){await c.removePropertyColor(y);return}await c.setPropertyColor(y,M)}},background:{initial:c.getPropertyBackgroundColor(y)??null,apply:async M=>{if(M===null){await c.removePropertyBackgroundColor(y);return}await c.setPropertyBackgroundColor(y,M)}}}).open()};o.showPropertyIcons&&n.addItem(I=>{mt(I.setTitle(d.contextMenu.tag.changeIcon).setIcon("lucide-image"),()=>P("icon"))}),n.addItem(I=>{mt(I.setTitle(d.contextMenu.tag.changeColor).setIcon("lucide-palette"),()=>P("color"))}),n.addItem(I=>{mt(I.setTitle(d.contextMenu.tag.changeBackground).setIcon("lucide-paint-bucket"),()=>P("background"))});let E=c.getPropertyIcon(y),C=c.getPropertyColorData(y),L=C.color,z=C.background,G=o.propertyIcons?.[y],Q=o.propertyColors?.[y],R=o.propertyBackgroundColors?.[y];km({menu:n,styleData:{icon:E,color:L,background:z},hasIcon:o.showPropertyIcons,hasColor:!0,hasBackground:!0,applyStyle:async I=>{let{icon:A,color:N,background:M}=I,H=[];A&&H.push(c.setPropertyIcon(y,A)),N&&H.push(c.setPropertyColor(y,N)),M&&H.push(c.setPropertyBackgroundColor(y,M)),await Promise.all(H)},removeIcon:G?async()=>c.removePropertyIcon(y):void 0,removeColor:Q?async()=>c.removePropertyColor(y):void 0,removeBackground:R?async()=>c.removePropertyBackgroundColor(y):void 0}),typeof Cre.MenuItem.prototype.setSubmenu=="function"&&(n.addSeparator(),n.addItem(I=>{let A=c.getPropertyChildSortOrderOverride(y),N=A??o.propertySortOrder,M=A?N.endsWith("-desc")?"lucide-sort-desc":"lucide-sort-asc":"lucide-sliders-horizontal",H=Ls(I);if(!H){I.setTitle(d.paneHeader.changeChildSortOrder).setIcon(M).setDisabled(!0);return}let q=(()=>{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}})();I.setTitle(d.paneHeader.changeChildSortOrder).setIcon(M),H.addItem(X=>{X.setTitle(`${d.folderAppearance.defaultLabel} (${q})`).setChecked(!A),kr(n,X,async()=>{await c.removePropertyChildSortOrderOverride(y),l.workspace.requestSaveLayout()})}),H.addSeparator(),H.addItem(X=>{X.setTitle(d.settings.items.propertySortOrder.options.alphaAsc).setChecked(A==="alpha-asc"),kr(n,X,async()=>{await c.setPropertyChildSortOrderOverride(y,"alpha-asc"),l.workspace.requestSaveLayout()})}),H.addItem(X=>{X.setTitle(d.settings.items.propertySortOrder.options.alphaDesc).setChecked(A==="alpha-desc"),kr(n,X,async()=>{await c.setPropertyChildSortOrderOverride(y,"alpha-desc"),l.workspace.requestSaveLayout()})})}));let O=!!s?.disableNavigationSeparatorActions;if((r.shortcuts||!O)&&n.addSeparator(),r.shortcuts&&Fre({app:l,menu:n,settings:o,shortcuts:r.shortcuts,nodeId:y,label:T}),!O){let I={type:"property",nodeId:y},A=c.hasNavigationSeparator(I);n.addItem(N=>{let M=A?d.contextMenu.navigation.removeSeparator:d.contextMenu.navigation.addSeparator;mt(N.setTitle(M).setIcon("lucide-separator-horizontal"),async()=>{if(A){await c.removeNavigationSeparator(I);return}await c.addNavigationSeparator(I)})})}let x=v?.kind==="key"&&v.notesWithValue.size>0,B=r.plugin.api?.[Ka].menus.applyPropertyMenuExtensions({menu:n,nodeId:y})??0;B>0&&x&&n.addSeparator(),S&&x&&(B===0&&n.addSeparator(),n.addItem(I=>{mt(I.setTitle(d.contextMenu.property.renameKey).setIcon("lucide-pencil"),async()=>{await u.promptRenamePropertyKey(S)})}),n.addItem(I=>{mt(I.setTitle(d.contextMenu.property.deleteKey).setIcon("lucide-trash").setWarning(!0),async()=>{await u.promptDeletePropertyKey(S)})}))}var Cre,Nre=U(()=>{Cre=require("obsidian");Oe();Ue();$c();gw();vw();lr();un();Lg()});var $1={};En($1,{ManualSortGroupHeaderModal:()=>Y1});var bw,Y1,X1=U(()=>{bw=require("obsidian");Oe();Ue();st();ei();hi();r0();Y1=class extends bw.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=()=>{$(async()=>{let{IconPickerModal:n}=await Promise.resolve().then(()=>(nE(),tE)),r=new n(this.app,this.options.metadataService,"",K.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 Qk(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 bw.Setting(p).setName(d.modals.manualSortGroupHeader.wordCount).addToggle(y=>y.setValue(this.showWordCount).onChange(v=>{this.showWordCount=v,!v&&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",y=>{let v=activeDocument.activeElement;!(v instanceof HTMLElement)||!this.contentEl.contains(v)||(y.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?Fn().renderIcon(this.iconPreviewEl,this.iconId,16):(0,bw.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?FI(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(),$(async()=>{try{await this.onSubmit(r)}finally{this.isSubmitting=!1}})}}});function yNe(t){Rre={showWordCount:t.showWordCount,targetWordCount:t.showWordCount?t.targetWordCount:null,iconId:t.iconId,color:t.color}}function Ire(){return Rre}function vNe(t,e){return{title:t,showWordCount:e.showWordCount,targetWordCount:e.showWordCount?e.targetWordCount:null,iconId:e.iconId,color:e.color}}function xre(t,e,n,r,o,a,i){t.addItem(s=>{mt(s.setTitle(a).setIcon("lucide-pencil"),async()=>{let{ManualSortGroupHeaderModal:l}=await Promise.resolve().then(()=>(X1(),$1));new l(e,i,async u=>{await fk(e,n,r,u)},{metadataService:o}).open()})})}async function bNe(t,e,n,r,o){let{ManualSortGroupHeaderModal:a}=await Promise.resolve().then(()=>(X1(),$1));new a(t,{title:"",showWordCount:o.showWordCount,targetWordCount:o.showWordCount?o.targetWordCount:null,iconId:o.iconId,color:o.color},async s=>{await fk(t,e,n,s)},{metadataService:r}).open()}async function SNe(t,e,n,r,o,a){if(!o){await bNe(t,e,n,r,a);return}await fk(t,e,n,vNe(o.title,a))}function Ere(t,e,n,r,o,a){let i=Ire();if(!a&&!i)return!1;let s=!1;return t.addItem(l=>{let c=Ls(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=>{kr(t,u.setTitle(d.contextMenu.file.manualSortGroupHeader.copyStyle).setIcon("lucide-copy"),()=>{yNe(a)})}),i&&c.addItem(u=>{kr(t,u.setTitle(d.contextMenu.file.manualSortGroupHeader.pasteStyle).setIcon("lucide-clipboard-check"),async()=>{let p=Ire();p&&await SNe(e,n,r,o,a,p)})}),a&&c.addItem(u=>{kr(t,u.setTitle(d.contextMenu.file.manualSortGroupHeader.remove).setIcon("lucide-eraser"),async()=>{await fk(e,n,r,"")})})}),s}function Sw({menu:t,app:e,file:n,propertyKey:r,metadataService:o}){if(n.extension!=="md")return!1;let a=cg(e,n,r);return a?(xre(t,e,n,r,o,d.contextMenu.file.changeManualSortGroupHeader,a),Ere(t,e,n,r,o,a),!0):(xre(t,e,n,r,o,d.contextMenu.file.setManualSortGroupHeader,a),Ere(t,e,n,r,o,a),!0)}var Rre,gD=U(()=>{Oe();hi();$c();Rre=null});function hD({menu:t,app:e,commandQueue:n,fileSystemOps:r,files:o,outputFolder:a,defaultOutputName:i,title:s}){let l=Sm(o);return l.length<2?!1:(t.addItem(c=>{mt(c.setTitle(s).setIcon("lucide-git-merge"),async()=>{await VA({app:e,commandQueue:n,fileSystemOps:r,files:l,outputFolder:a,defaultOutputName:i})})}),!0)}var Q1=U(()=>{ZS();i1();$c()});function wNe(t,e,n){let r=e.getPropertyIcon(n.nodeId),o=Ef(r);if(o)return o;let a=e.getPropertyIcon(n.keyNodeId),i=Ef(a);return i||Qn(t.interfaceIcons,"nav-property-value","lucide-equal")}function ww(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:y}=i;c&&n.addItem(R=>{R.setTitle(e.basename).setIsLabel(!0)});let S=b.selectedFiles.size>1,w=b.selectedFiles.has(e.path),T=e.extension==="md",F=S&&w,k=!F&&o.enableFolderNotes&&e.parent instanceof Sh.TFolder&&al(e,e.parent,o),P=null,E=()=>P||(s?.orderedFiles?.some(R=>R.path===e.path||b.selectedFiles.has(R.path))?(P=[...s.orderedFiles],P):(P=ba({selectionType:b.selectionType,selectedFolder:b.selectedFolder,selectedTag:b.selectedTag,selectedProperty:b.selectedProperty},o,h,l,m,g),P)),C=F?FNe(b.selectedFiles,l,s?.orderedFiles):[],L=C.length;F?RNe(n,C,l,c,f):ENe(n,e,l,c,f),n.addSeparator();let z=PNe({file:e,isFolderNoteFile:k,shouldShowMultiOptions:F,selectedFiles:C});CNe({menu:n,app:l,metadataService:p,settings:o,file:e,styleTarget:z}),n.addSeparator(),kNe({menu:n,app:l,metadataService:p,settings:o,file:e,source:s?.source,selectionState:b,shouldShowMultiOptions:F})&&n.addSeparator();let G=F?C:[e];if(G.length>0&&G.every(R=>R.extension==="md")){let R=r.tagOperations.getTagsFromFiles(G),O=R.length>0,D=R.length>1;n.addItem(B=>{mt(B.setTitle(d.contextMenu.file.addTag).setIcon("lucide-tag"),()=>{QS({app:l,plugin:r.plugin,tagOperations:r.tagOperations,files:G})})});let x=_A(o,g);x.length>0&&n.addItem(B=>{let I=Ls(B);if(B.setTitle(d.contextMenu.file.addPropertyKey).setIcon(Qn(o.interfaceIcons,"nav-property","lucide-align-left")),!I){B.setDisabled(!0);return}x.forEach(A=>{I.addItem(N=>{let M=N.setTitle(A.label);M.setIcon(wNe(o,p,A)),kr(n,M,async()=>{await u.applyPropertyNodeToFiles(A.nodeId,G)})})})}),O&&(n.addItem(B=>{mt(B.setTitle(d.contextMenu.file.removeTag).setIcon("lucide-minus"),async()=>{await LA({app:l,tagOperations:r.tagOperations,files:G})})}),D&&n.addItem(B=>{mt(B.setTitle(d.contextMenu.file.removeAllTags).setIcon("lucide-x"),()=>{zA({app:l,tagOperations:r.tagOperations,files:G})})})),n.addSeparator()}if(!F){if(r.shortcuts){let{noteShortcutKeysByPath:O,addNoteShortcut:D,removeShortcut:x,renameShortcut:B,shortcutMap:I}=r.shortcuts,A=O.get(e.path);if(A){let N=I.get(A),M=Xy(e)?`${kp(e)}${jh(e)}`:kp(e);sp({app:l,menu:n,shortcutKey:A,defaultLabel:M,existingShortcut:N,title:d.shortcuts.rename,placeholder:d.searchInput.shortcutNamePlaceholder,renameShortcut:B})}n.addItem(N=>{A?mt(N.setTitle(d.shortcuts.remove).setIcon(Qn(o.interfaceIcons,"nav-shortcuts","lucide-star-off")),async()=>{await x(A)}):mt(N.setTitle(d.shortcuts.add).setIcon(Qn(o.interfaceIcons,"nav-shortcuts","lucide-star")),async()=>{await D(e.path)})})}let R=bP(b.selectionType);MNe(n,e,p,R),n.addSeparator()}if(F){r.shortcuts&&ANe(n,C,b,l,o,r.shortcuts);let R=bP(b.selectionType);DNe(n,C,p,R),n.addSeparator(),(r.plugin.api?.[Ka].menus.applyFileMenuExtensions({menu:n,file:e,selection:{mode:"multiple",files:[...C]}})??0)>0&&n.addSeparator(),ONe(n,C,l,f,u);let D=C.every(x=>x.extension==="md");n.addItem(x=>{mt(x.setTitle(D?d.contextMenu.file.moveMultipleNotesToFolder.replace("{count}",L.toString()):d.contextMenu.file.moveMultipleFilesToFolder.replace("{count}",L.toString())).setIcon("lucide-folder-input"),async()=>{let B=Array.from(b.selectedFiles).map(I=>l.vault.getFileByPath(I)).filter(I=>!!I);await u.moveFilesWithModal(B,{selectedFile:b.selectedFile,dispatch:y,allFiles:E()})})}),zNe(n,C,b,l,u),_Ne(n,C,b,o,u,y,E)}if(!F){let R=l.vault.adapter,O=R instanceof Sh.FileSystemAdapter?R:null;dD({menu:n,linkItems:{getLinkText:()=>TNe(l,e),isMarkdownFile:T},getObsidianUrl:()=>{let x=l.vault.getName(),B=encodeURIComponent(x),I=encodeURIComponent(e.path);return`obsidian://open?vault=${B}&file=${I}`},getVaultPath:()=>e.path,getSystemPath:O?()=>O.getFullPath(e.path):void 0})&&n.addSeparator()}if(!F){let O=!(b.selectedFolder&&e.parent&&e.parent.path===b.selectedFolder.path),D=!c;O&&n.addItem(x=>{mt(x.setTitle(d.contextMenu.file.revealInFolder).setIcon("lucide-folder-search"),async()=>{await r.plugin.activateView(),await r.plugin.revealFileInActualFolder(e,{showHiddenFileNotice:!0})})}),D&&(n.addItem(x=>{mt(x.setTitle(u.getRevealInSystemExplorerText()).setIcon(Sh.Platform.isMacOS?"lucide-app-window-mac":"lucide-app-window"),async()=>{await u.revealInSystemExplorer(e)})}),n.addItem(x=>{mt(x.setTitle(d.contextMenu.file.openInDefaultApp).setIcon("lucide-external-link"),async()=>{await u.openInDefaultApp(e)})})),(O||D)&&n.addSeparator()}if(F||(r.plugin.api?.[Ka].menus.applyFileMenuExtensions({menu:n,file:e,selection:{mode:"single",files:[e]}})??0)>0&&n.addSeparator(),!F){let R=Um(l,"sync");R&&"enabled"in R&&R.enabled&&n.addItem(O=>{mt(O.setTitle(d.contextMenu.file.openVersionHistory).setIcon("lucide-history"),async()=>{await u.openVersionHistory(e)})}),n.addItem(O=>{let D=k?d.contextMenu.folder.detachFolderNote:T?d.contextMenu.file.renameNote:d.contextMenu.file.renameFile,x=k?"lucide-unlink":"lucide-pencil",B=O.setTitle(D).setIcon(x),I=k?void 0:s?.onStartInlineRename;mt(B,async()=>{I?.(e)||await u.renameFile(e)})}),n.addItem(O=>{mt(O.setTitle(T?d.contextMenu.file.moveNoteToFolder:d.contextMenu.file.moveFileToFolder).setIcon("lucide-folder-input"),async()=>{await u.moveFilesWithModal([e],{selectedFile:b.selectedFile,dispatch:y,allFiles:E()})})}),LNe(n,e,u),BNe(n,e,b,o,u,y,k,E)}}function TNe(t,e){if(e.extension!=="md")return e.path;let n=e.path.slice(0,-3);return t.metadataCache.getFirstLinkpathDest(n,"")===e?n:e.path}function kNe(t){let{menu:e,app:n,metadataService:r,settings:o,file:a,source:i,selectionState:s,shouldShowMultiOptions:l}=t,c=el(o);if(i!=="list-pane"||l||a.extension!=="md"||!c)return!1;let u=rg(o,s.selectionType,s.selectedFolder,s.selectedTag,s.selectedProperty),p=hI({settings:o,selectionType:s.selectionType,folderPath:s.selectedFolder?.path??null,tag:s.selectedTag??null,propertyNodeId:s.selectedProperty??null});return og({groupBy:p.effectiveGrouping,sortOption:u.option,selectionType:s.selectionType,isManualSortActive:qi(o,u.propertyKey)})!=="custom"?!1:Sw({menu:e,app:n,file:a,propertyKey:c,metadataService:r})}function PNe(t){let{file:e,isFolderNoteFile:n,shouldShowMultiOptions:r,selectedFiles:o}=t;return n&&e.parent instanceof Sh.TFolder?{type:"folder",folderPath:e.parent.path}:{type:"files",files:r?o:[e]}}function FNe(t,e,n){let r=Array.from(t).map(o=>e.vault.getFileByPath(o)).filter(o=>o!==null);return qE(r,n)}function CNe(t){let{menu:e,app:n,metadataService:r,settings:o,file:a,styleTarget:i}=t;if(i.type==="folder"){NNe({menu:e,app:n,metadataService:r,settings:o,folderPath:i.folderPath});return}INe({menu:e,app:n,metadataService:r,settings:o,file:a,targetFiles:i.files})}function NNe(t){let{menu:e,app:n,metadataService:r,settings:o,folderPath:a}=t;pD({menu:e,app:n,metadataService:r,folderPath:a,showFolderIcons:o.showFolderIcons}),mD({menu:e,metadataService:r,folderPath:a,inheritFolderColors:o.inheritFolderColors,showFolderIcons:o.showFolderIcons})}function INe(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=o.useFolderIconForFiles&&a.parent?r.getFolderDisplayData(a.parent.path,{includeIcon:!0}).icon:void 0,p=!bs(a,xr.SUPPORTED,n),m=VS(a,o,{customIconId:u,metadataCache:n.metadataCache,isExternalFile:p,allowCategoryIcons:!0,fallbackMode:"file",fileNameForMatch:kp(a)})??"file",g=xNe(i,r),{hasRemovableIcon:f,hasRemovableColor:h,hasRemovableBackground:b}=g,y=async v=>{let{AppearanceModal:S}=await Promise.resolve().then(()=>(yw(),fw));new S(n,{title:a.basename,metadataService:r,initialTab:v,colorIconPlaceholder:o.showFileIcons?m:null,icon:o.showFileIcons?{initial:r.getFileIcon(a.path)??null,apply:async T=>{await Promise.all(i.map(F=>T===null?r.removeFileIcon(F.path):r.setFileIcon(F.path,T)))}}:void 0,color:{initial:r.getFileColor(a.path)??null,apply:async T=>{await Promise.all(i.map(F=>T===null?r.removeFileColor(F.path):r.setFileColor(F.path,T)))}},background:{initial:r.getFileBackgroundColor(a.path)??null,apply:async T=>{await Promise.all(i.map(F=>T===null?r.removeFileBackgroundColor(F.path):r.setFileBackgroundColor(F.path,T)))}}}).open()};o.showFileIcons&&e.addItem(v=>{mt(v.setTitle(d.contextMenu.file.changeIcon).setIcon("lucide-image"),()=>y("icon"))}),e.addItem(v=>{mt(v.setTitle(d.contextMenu.file.changeColor).setIcon("lucide-palette"),()=>y("color"))}),e.addItem(v=>{mt(v.setTitle(d.contextMenu.folder.changeBackground).setIcon("lucide-paint-bucket"),()=>y("background"))}),km({menu:e,styleData:{icon:s,color:l,background:c},hasIcon:o.showFileIcons,hasColor:!0,hasBackground:!0,applyStyle:async v=>{let{icon:S,color:w,background:T}=v,F=[];i.forEach(k=>{S&&F.push(r.setFileIcon(k.path,S)),w&&F.push(r.setFileColor(k.path,w)),T&&F.push(r.setFileBackgroundColor(k.path,T))}),await Promise.all(F)},removeIcon:f?async()=>{let v=i.filter(S=>r.getFileIcon(S.path)).map(S=>r.removeFileIcon(S.path));await Promise.all(v)}:void 0,removeColor:h?async()=>{let v=i.filter(S=>r.getFileColor(S.path)).map(S=>r.removeFileColor(S.path));await Promise.all(v)}:void 0,removeBackground:b?async()=>{let v=i.filter(S=>r.getFileBackgroundColor(S.path)).map(S=>r.removeFileBackgroundColor(S.path));await Promise.all(v)}:void 0})}function xNe(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 ENe(t,e,n,r,o){t.addItem(a=>{mt(a.setTitle(d.contextMenu.file.openInNewTab).setIcon("lucide-file-plus"),async()=>{await Vr({app:n,commandQueue:o,file:e,context:"tab"})})}),t.addItem(a=>{mt(a.setTitle(d.contextMenu.file.openToRight).setIcon("lucide-separator-vertical"),async()=>{await Vr({app:n,commandQueue:o,file:e,context:"split"})})}),r||t.addItem(a=>{mt(a.setTitle(d.contextMenu.file.openInNewWindow).setIcon("lucide-external-link"),async()=>{await Vr({app:n,commandQueue:o,file:e,context:"window"})})})}function RNe(t,e,n,r,o){let a=e.length,i=e.every(s=>s.extension==="md");t.addItem(s=>{mt(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 Vr({app:n,commandQueue:o??null,file:l,context:"tab"})})}),t.addItem(s=>{mt(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 Vr({app:n,commandQueue:o??null,file:l,context:"split"})})}),r||t.addItem(s=>{mt(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 Vr({app:n,commandQueue:o??null,file:l,context:"window"})})})}function MNe(t,e,n,r){let o=n.isFilePinned(e.path,r);t.addItem(a=>{mt(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 ANe(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=>{mt(c.setTitle(l).setIcon(Qn(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:zn.NOTE,path:m.path}));await a.addShortcutsBatch(p)})})}function DNe(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=>{mt(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 ONe(t,e,n,r,o){if(e.length<2||!e.every(s=>s.extension==="md"))return;let a=e[0],i=a.parent instanceof Sh.TFolder?a.parent:n.vault.getRoot();hD({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 LNe(t,e,n){t.addItem(r=>{mt(r.setTitle(e.extension==="md"?d.contextMenu.file.duplicateNote:d.contextMenu.file.duplicateFile).setIcon("lucide-copy"),async()=>{await n.duplicateNote(e)})})}function zNe(t,e,n,r,o){let a=e.every(s=>s.extension==="md"),i=e.length;t.addItem(s=>{mt(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 BNe(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;mt(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 _Ne(t,e,n,r,o,a,i){let s=e.every(c=>c.extension==="md"),l=e.length;t.addItem(c=>{mt(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 Sh,Mre=U(()=>{Sh=require("obsidian");Oe();mo();ws();Lr();Ha();$c();gw();_u();BA();vw();lr();Ja();bi();n1();Lg();hi();Ln();gD();Q1();hc();zF()});function Z1(t){j1(t)}var Are=U(()=>{q1()});function HNe(t){return t===Ot.SHORTCUTS?{uxIconId:"nav-shortcuts",title:d.navigationPane.shortcutsHeader}:t===Ot.RECENT?{uxIconId:"nav-recent-files",title:d.navigationPane.recentFilesHeader}:t===Ot.TAGS?{uxIconId:"nav-tags",title:d.tagList.tags}:t===Ot.PROPERTIES?{uxIconId:"nav-properties",title:d.navigationPane.properties}:null}function VNe(t){return t===Ot.SHORTCUTS?qa:t===Ot.RECENT?Ya:t===Ot.TAGS?_n:t===Ot.PROPERTIES?_e:null}function J1({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===Ot.SHORTCUTS,g=n===Ot.TAGS,f=n===Ot.PROPERTIES,h={type:"section",id:n},b=r?o.hasNavigationSeparator(h):!1,y=new Dre.Menu,v=!1,S=g?p.tagShortcutKeysByPath.get(Lt):void 0,w=f?p.propertyShortcutKeysByNodeId.get(_e):void 0,T=S??w;f&&(y.addItem(k=>{k.setTitle(d.contextMenu.property.addKey).setIcon("lucide-settings-2").onClick(()=>{u()})}),v=!0,y.addSeparator());let F=VNe(n);if(F){let k=o.getSettingsProvider(),P=HNe(n),E=k.settings.virtualFolderColors?.[F],C=k.settings.virtualFolderBackgroundColors?.[F],L=P?.title??"",z=(x,B,I)=>{let A=k.settings[x],N=dn(A,Hn);return I===null?Object.prototype.hasOwnProperty.call(N,B)?(delete N[B],k.settings[x]=N,!0):!1:Object.prototype.hasOwnProperty.call(N,B)&&N[B]===I?!1:(N[B]=I,k.settings[x]=N,!0)},G=async(x,B)=>{let I=!1;B.color!==void 0&&(I=z("virtualFolderColors",x,B.color)||I),B.background!==void 0&&(I=z("virtualFolderBackgroundColors",x,B.background)||I),I&&await k.saveSettingsAndUpdate()},Q=async(x,B)=>{let I=He(k.settings.interfaceIcons,Hn),A=rr(Je(void 0,x)),N=!1;if(!B)Object.prototype.hasOwnProperty.call(I,x)&&(delete I[x],N=!0);else{let M=rr(B),H=gi(M);!H||M===A?Object.prototype.hasOwnProperty.call(I,x)&&(delete I[x],N=!0):I[x]!==H&&(I[x]=H,N=!0)}N&&(k.settings.interfaceIcons=I,await k.saveSettingsAndUpdate())},R=async x=>{let{AppearanceModal:B}=await Promise.resolve().then(()=>(yw(),fw));new B(t,{title:L,metadataService:o,initialTab:x,defaultIcon:P?Je(void 0,P.uxIconId):null,icon:P?{initial:Je(k.settings.interfaceIcons,P.uxIconId),apply:async A=>{await Q(P.uxIconId,A)}}:void 0,color:{initial:E??null,apply:async A=>{await G(F,{color:A})}},background:{initial:C??null,apply:async A=>{await G(F,{background:A})}}}).open()};P&&y.addItem(x=>{x.setTitle(d.contextMenu.folder.changeIcon).setIcon("lucide-image").onClick(()=>{$(()=>R("icon"))})}),y.addItem(x=>{x.setTitle(d.contextMenu.folder.changeColor).setIcon("lucide-palette").onClick(()=>{$(()=>R("color"))})}),y.addItem(x=>{x.setTitle(d.contextMenu.folder.changeBackground).setIcon("lucide-paint-bucket").onClick(()=>{$(()=>R("background"))})});let O=!!E,D=!!C;km({menu:y,styleData:{color:E,background:C},hasColor:!0,hasBackground:!0,applyStyle:async x=>{await G(F,{color:x.color??void 0,background:x.background??void 0})},removeColor:O?async()=>G(F,{color:null}):void 0,removeBackground:D?async()=>G(F,{background:null}):void 0,clearStyle:O&&D?async()=>G(F,{color:null,background:null}):void 0}),v=!0,y.addSeparator()}if((g||f)&&(y.addItem(k=>{if(T){k.setTitle(d.shortcuts.remove).setIcon(Qn(a.interfaceIcons,"nav-shortcuts","lucide-star-off")).onClick(()=>{$(()=>p.removeShortcut(T))});return}k.setTitle(d.shortcuts.add).setIcon(Qn(a.interfaceIcons,"nav-shortcuts","lucide-star")).onClick(()=>{$(async()=>{if(g){await p.addTagShortcut(Lt);return}await p.addPropertyShortcut(_e)})})}),v=!0),m){y.addItem(C=>{C.setTitle(s).setIcon(l?"lucide-pin-off":"lucide-pin").onClick(()=>{c()})}),v=!0;let k=r&&!l,P=p.shortcutsCount>0;(k||P)&&y.addSeparator(),k&&(y.addItem(C=>{C.setTitle(b?d.contextMenu.navigation.removeSeparator:d.contextMenu.navigation.addSeparator).setIcon("lucide-separator-horizontal").onClick(()=>{$(async()=>{if(b){await o.removeNavigationSeparator(h);return}await o.addNavigationSeparator(h)})})}),v=!0),P&&(k&&y.addSeparator(),y.addItem(C=>{C.setTitle(d.shortcuts.removeAll).setIcon("lucide-trash-2").setWarning(!0).onClick(()=>{new Pn(t,d.shortcuts.removeAll,d.shortcuts.removeAllConfirm,()=>p.clearShortcuts(),d.common.remove).open()})}),v=!0)}else r&&(y.addItem(k=>{k.setTitle(b?d.contextMenu.navigation.removeSeparator:d.contextMenu.navigation.addSeparator).setIcon("lucide-separator-horizontal").onClick(()=>{$(async()=>{if(b){await o.removeNavigationSeparator(h);return}await o.addNavigationSeparator(h)})})}),v=!0);if((g||f)&&(v&&y.addSeparator(),y.addItem(k=>{let P=g?d.settings.items.filterTagsBySelection.name:d.settings.items.filterPropertiesBySelection.name,E=g?i.settings.scopeTagsToCurrentContext:i.settings.scopePropertiesToCurrentContext;k.setTitle(P).setIcon("lucide-filter").setChecked(E).onClick(()=>{$(async()=>{g?i.settings.scopeTagsToCurrentContext=!i.settings.scopeTagsToCurrentContext:i.settings.scopePropertiesToCurrentContext=!i.settings.scopePropertiesToCurrentContext,await i.saveSettingsAndUpdate()})})}),v=!0),g||f){v&&y.addSeparator();let k=g?"navigate-to-tag":"navigate-to-property",P=g?d.commands.navigateToTag:d.commands.navigateToProperty,E=g?Qn(a.interfaceIcons,"nav-tag","lucide-hash"):Qn(a.interfaceIcons,"nav-property","lucide-list-filter");y.addItem(C=>{C.setTitle(P).setIcon(E).onClick(()=>{yu(t,`${i.manifest.id}:${k}`)})}),v=!0}v&&(e.preventDefault(),e.stopPropagation(),y.showAtMouseEvent(e.nativeEvent))}var Dre,Ore=U(()=>{Dre=require("obsidian");$a();Ue();mo();Et();lr();vw();Oe();Mi();st()});var yC=U(()=>{hre();q1();Pre();Nre();Mre();Are();Ore()});function eK(){Tw&&(Tw.hide(),Tw=null)}function wh(t,e){let{app:n,plugin:r,isMobile:o,tagTreeService:a,propertyTreeService:i}=vt(),s=yt(),l=Ti(),c=Zo(),u=HS(),p=pA(),m=vl(),g=Xd(),f=jt(),h=f.includeDescendantNotes,b=f.showHiddenItems,y=hr(),{expandedFolders:v,expandedTags:S,expandedProperties:w}=la(),T=ar(),F=Wa(),k=So(),[P,E]=(0,vy.useState)(null),C=(0,vy.useCallback)(L=>{if(!e||!t.current)return;let z=L.target;if(!(z instanceof Node)||!t.current.contains(z))return;let G=z.instanceOf(HTMLElement)?z:z.parentElement,Q=t.current,R=e;if(R.type===pC){if(!G)return;let N=G.closest(".nn-file");if(N instanceof HTMLElement){let M=N.dataset.path,H=M?n.vault.getFileByPath(M):null;if(!(H instanceof kw.TFile))return;R={type:K.FILE,item:H,options:{source:"list-pane",orderedFiles:R.options?.orderedFiles,onStartInlineRename:R.options?.onStartInlineRename}},Q=N}}if(s.enableFolderNoteLinks&&R.type===K.FOLDER&&G?.closest(".nn-navitem-name")){let N=Rn(R.item,s);N&&(R={type:K.FILE,item:N})}let O=R.type===K.FILE,D=null;if(R.type===pC){let N=R.item;if(!(N instanceof kw.TFolder)||!G)return;let M=G.closest(".nn-file")!==null,H=G.closest(".nn-list-group-header")!==null;if(M||H)return;D=q=>{Z1({folder:N,menu:q,services:B,settings:s,state:I,dispatchers:A})}}else R.type===K.FOLDER?D=N=>{gC({folder:R.item,menu:N,services:B,settings:s,state:I,dispatchers:A,options:R.options})}:R.type===K.TAG?D=N=>{hC({tagPath:R.item,menu:N,services:B,settings:s,state:I,dispatchers:A})}:R.type===K.PROPERTY?D=N=>{fC({propertyNodeId:R.item,menu:N,services:B,settings:s,state:I,dispatchers:A})}:R.type===K.FILE&&(D=N=>{ww({file:R.item,menu:N,services:B,settings:s,state:I,dispatchers:A,options:R.options})});if(!D)return;L.preventDefault(),L.stopPropagation(),eK();let x=new kw.Menu;if(Tw=x,Q.classList.add("nn-context-menu-active"),O){let N=Q.closest(".nn-virtual-file-item");if(N instanceof HTMLElement){N.classList.add("nn-hide-separator-context-menu");let M=N.previousElementSibling;M instanceof HTMLElement&&M.classList.contains("nn-virtual-file-item")&&M.classList.add("nn-hide-separator-context-menu")}}let B={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}},I={selectionState:y,expandedFolders:v,expandedTags:S,expandedProperties:w},A={selectionDispatch:T,expansionDispatch:F,uiDispatch:k};D(x),x.showAtMouseEvent(L),x.onHide(()=>{if(Tw===x&&(Tw=null),Q.classList.remove("nn-context-menu-active"),O){let N=Q.closest(".nn-virtual-file-item");if(N instanceof HTMLElement){N.classList.remove("nn-hide-separator-context-menu");let M=N.previousElementSibling;M instanceof HTMLElement&&M.classList.contains("nn-virtual-file-item")&&M.classList.remove("nn-hide-separator-context-menu")}}})},[e,t,n,r,s,l,c,u,p,y,v,S,w,T,F,k,o,a,i,m,g,h,b]);(0,vy.useEffect)(()=>{if(!e){P!==null&&E(null);return}let L=t.current;L!==P&&E(L)},[P,e,t]),(0,vy.useEffect)(()=>{if(!(!e||!P))return P.addEventListener("contextmenu",C),()=>{P.removeEventListener("contextmenu",C)}},[P,C,e])}var vy,kw,Tw,vC=U(()=>{vy=he(Ve()),kw=require("obsidian");Tl();Ur();fn();on();wa();ph();gr();Ue();yC();Ja();Tw=null});var Pw,Lre,qt,rd=U(()=>{Pw=he(Ve());ei();Lre=he($e()),qt=(0,Pw.memo)(function({iconId:e,size:n,className:r,style:o,"data-has-color":a,"aria-label":i,"aria-hidden":s}){let l=(0,Pw.useRef)(null),c=ts();return(0,Pw.useEffect)(()=>{l.current&&Fn().renderIcon(l.current,e,n)},[e,c,n]),(0,Lre.jsx)("span",{ref:l,className:r,style:o,"data-has-color":a,"aria-label":i,"aria-hidden":s})})});function Bre({event:t,settings:e,selectedFolder:n,selectedTag:r,selectedProperty:o,selectionType:a,updateSettings:i,descendantAction:s,defaultSettingsAction:l}){let c=kB(e),p=a===K.TAG&&r?{key:r,getRecord:R=>R.tagAppearances,setRecord:(R,O)=>{R.tagAppearances=O}}:a===K.FOLDER&&n?{key:n.path,getRecord:R=>R.folderAppearances,setRecord:(R,O)=>{R.folderAppearances=O}}:a===K.PROPERTY&&o?{key:o,getRecord:R=>R.propertyAppearances,setRecord:(R,O)=>{R.propertyAppearances=O}}:null,m=R=>{p&&$(()=>i(O=>{let D=He(dn(p.getRecord(O))),B={...D[p.key]??{},...R},I=_g(Yl(B),B.groupBy);I?D[p.key]=I:delete D[p.key],p.setRecord(O,D)}))},g=new zre.Menu,f=p?p.getRecord(e)?.[p.key]:void 0,h=Yl(f),b=uR({settings:e,appearance:f,selectionType:a}),y=b.mode,v=y==="compact",S=EP(f),w=(R,O)=>O?`${R} ${O}`:R,T=(R,O,D)=>{if(!D){R.setTitle(O);return}let x=createFragment();x.append(createSpan({cls:"nn-menu-title-custom",text:O})),R.setTitle(x)},F=R=>d.folderAppearance.textCount.options[R],k=[1,2,3,4,5],P=({title:R,isCustom:O,icon:D,options:x,onSelect:B})=>{let I=null;g.addItem(M=>{T(M,R,O),M.setIcon(D),I=Ls(M),I||M.setDisabled(!0)});let A=I??g,N=I?"":" ";x.forEach(M=>{A.addItem(H=>{let q=H.setTitle(`${N}${M.title}`).setIcon(D).setChecked(M.checked);if(I){kr(g,q,()=>{B(M.value)});return}q.onClick(()=>{B(M.value)})})})};g.addItem(R=>{R.setTitle(d.folderAppearance.appearance).setIcon(Qn(e.interfaceIcons,"list-appearance")).setDisabled(!0)}),g.addItem(R=>{let O=w(d.folderAppearance.standardPreset,c==="standard"?d.folderAppearance.defaultSuffix:null);T(R,O,f?.mode==="standard"),R.setIcon("lucide-list").setChecked(y==="standard").onClick(()=>{m({mode:c==="standard"?void 0:"standard"})})}),g.addItem(R=>{let O=w(d.folderAppearance.compactPreset,c==="compact"?d.folderAppearance.defaultSuffix:null);T(R,O,f?.mode==="compact"),R.setIcon("lucide-align-left").setChecked(y==="compact").onClick(()=>{m({mode:c==="compact"?void 0:"compact"})})}),g.addSeparator(),g.addItem(R=>{R.setTitle(d.settings.pages.fileDisplay.label).setIcon("lucide-file-text").setDisabled(!0)});let E=h?.titleRows,C=E??e.fileNameRows;if(P({title:`${d.folderAppearance.titleRows.label}: ${b.titleRows}`,isCustom:E!==void 0,icon:"lucide-text",options:k.slice(0,3).map(R=>({value:R,title:w(d.folderAppearance.titleRows.option(R),R===e.fileNameRows?d.folderAppearance.defaultSuffix:null),checked:C===R})),onSelect:R=>m({titleRows:R===e.fileNameRows?void 0:R})}),e.showFilePreview&&!v){let R=h?.previewRows,O=R??e.previewRows;P({title:`${d.folderAppearance.previewRows.label}: ${O===0?d.folderAppearance.previewRows.none:O}`,isCustom:R!==void 0,icon:"lucide-file-text",options:[{value:0,title:d.folderAppearance.previewRows.none,checked:O===0},...k.map(D=>({value:D,title:w(d.folderAppearance.previewRows.option(D),D===e.previewRows?d.folderAppearance.defaultSuffix:null),checked:O===D}))],onSelect:D=>m({previewRows:D===e.previewRows?void 0:D})})}if(!v||e.textCountPlacement!=="property"||e.showFilePropertiesInCompactMode){let R=h?.textCount,O=b.textCountDisplay,D=Qn(e.interfaceIcons,O==="characters"?"file-character-count":"file-word-count"),x=["none","words","characters","both"];P({title:`${d.folderAppearance.textCount.label}: ${F(O)}`,isCustom:R!==void 0,icon:D,options:x.map(B=>({value:B,title:w(F(B),B===e.textCountDisplay?d.folderAppearance.defaultSuffix:null),checked:O===B})),onSelect:B=>m({textCount:B===e.textCountDisplay?void 0:B})})}let z=[{key:"showTags",title:d.folderAppearance.tags,icon:Qn(e.interfaceIcons,"nav-tags"),globalDefault:e.showFileTags,available:e.showTags&&(!v||e.showFileTagsInCompactMode)},{key:"showProperties",title:d.folderAppearance.properties,icon:Qn(e.interfaceIcons,"nav-properties"),globalDefault:e.showFileProperties,available:!v||e.showFilePropertiesInCompactMode},{key:"showTaskProgress",title:d.folderAppearance.tasks,icon:Qn(e.interfaceIcons,"file-unfinished-task"),globalDefault:e.showFileTaskProgress,available:!v}],G=[{key:"showDate",title:d.folderAppearance.date,icon:"lucide-calendar",globalDefault:e.showFileDate,available:!v},{key:"showParentFolder",title:d.folderAppearance.parentFolder,icon:Qn(e.interfaceIcons,"nav-folder-closed"),globalDefault:e.showParentFolder,available:!v}],Q=R=>{let O=R.filter(D=>D.available);O.length!==0&&(g.addSeparator(),O.forEach(D=>{let x=h?.[D.key],B=x??D.globalDefault;g.addItem(I=>{T(I,D.title,x!==void 0),I.setIcon(D.icon).setChecked(B).onClick(()=>{let A=!B,N={};N[D.key]=A===D.globalDefault?void 0:A,m(N)})})}))};Q(z),Q(G),s&&(g.addSeparator(),g.addItem(R=>{R.setTitle(s.menuTitle).setIcon("lucide-squares-unite").setDisabled(!!s.disabled).onClick(()=>{s.onApply()})})),l&&(g.addSeparator(),g.addItem(R=>{R.setTitle(d.folderAppearance.resetAppearance).setIcon("lucide-rotate-ccw").setDisabled(!S).onClick(()=>{if(!S)return;let O={};h&&Object.keys(h).forEach(D=>{O[D]=void 0}),m(O)})}),g.addSeparator(),g.addItem(R=>{R.setTitle(l.menuTitle).setIcon("lucide-settings").setDisabled(!!l.disabled).onClick(()=>{l.onOpen()})})),g.showAtMouseEvent(t)}var zre,_re=U(()=>{zre=require("obsidian");Zb();Oe();Ue();st();$c();Et();lr()});function WNe(t){return`${KNe}${t}${UNe}`}function GNe(t,e,n){return e.reduce((r,o)=>o.extension!=="md"?r:_L(t,o,n)?r+1:r,0)}function jNe(t,e,n){return e.reduce((r,o)=>{if(o.extension!=="md")return r;r.markdownCount+=1;let a=CI(t,o,n);return a.hasProperty&&(a.rank===null?r.invalidPropertyCount+=1:r.validRankCount+=1),r},{markdownCount:0,validRankCount:0,invalidPropertyCount:0})}function Hre(t,e){return Ee(t)===Ee(e)}function qNe(t,e){return e.type===K.FOLDER?He(dn(t.folderSortOverrides)):e.type===K.TAG?He(dn(t.tagSortOverrides)):He(dn(t.propertySortOverrides))}function YNe(t,e,n){if(e.type===K.FOLDER){t.folderSortOverrides=n;return}if(e.type===K.TAG){t.tagSortOverrides=n;return}t.propertySortOverrides=n}function Vre(t,e,n){let r=qNe(t,e);r[e.key]=gL(n),YNe(t,e,r)}function $Ne(t){let e=[],n=[];for(t.children.forEach(r=>{r instanceof Th.TFolder&&n.push(r)});n.length>0;){let r=n.pop();r&&(e.push(r.path),r.children.forEach(o=>{o instanceof Th.TFolder&&n.push(o)}))}return e}function XNe(t){let e=0,n=[];for(t.children.forEach(r=>{r instanceof Th.TFolder&&n.push(r)});n.length>0;){let r=n.pop();r&&(e+=1,r.children.forEach(o=>{o instanceof Th.TFolder&&n.push(o)}))}return e}function QNe(t,e){return e===t?!1:t==="/"?e!=="/":e.startsWith(`${t}/`)}function ZNe(t,e){return e===t||t===wt?!1:t===Lt?e!==Lt&&e!==wt:e.startsWith(`${t}/`)}function JNe(t,e){if(e===t)return!1;if(t===_e)return e!==_e;let n=Nn(t),r=Nn(e);return!n||!r||n.key!==r.key?!1:n.valuePath?r.valuePath?r.valuePath.startsWith(`${n.valuePath}/`):!1:r.valuePath!==null}function tK({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 Kre(t){switch(t){case"custom":return"lucide-heading";case"date":return"lucide-calendar";case"folder":return"lucide-folder";default:return"lucide-heading"}}function Ure(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 fD({onManualSortStart:t,getManualSortNewFileContext:e,trackRevealFileAvailability:n=!1}={}){let{app:r,plugin:o,tagTreeService:a,propertyTreeService:i}=vt(),s=yt(),l=s.vaultProfile,c=s.vaultProfiles,u=jt(),p=u.includeDescendantNotes,m=u.showHiddenItems,{setIncludeDescendantNotes:g}=$d(),f=bl(),h=hr(),b=ar(),y=Ti(),v=Zo(),S=h.selectionType===K.FOLDER&&!!h.selectedFolder,w=h.selectionType===K.TAG&&!!h.selectedTag,T=w&&h.selectedTag!==Lt&&h.selectedTag!==wt,F=h.selectionType===K.PROPERTY&&!!h.selectedProperty,k=F&&h.selectedProperty!==_e,P=S||w||F,E=(0,rn.useCallback)(()=>{o.openSettings()},[o]),C=(0,rn.useCallback)(()=>{o.openSettings()},[o]),L=!!h.selectedFolder||T||k,z=(0,rn.useCallback)(()=>{let se=r.workspace.getActiveFile();return se?.parent?se:null},[r.workspace]),[G,Q]=(0,rn.useState)(()=>n?!!z():!1),R=(0,rn.useCallback)(()=>h.selectionType===K.FOLDER&&h.selectedFolder?{type:K.FOLDER,key:h.selectedFolder.path}:h.selectionType===K.TAG&&h.selectedTag?{type:K.TAG,key:h.selectedTag}:h.selectionType===K.PROPERTY&&h.selectedProperty?{type:K.PROPERTY,key:h.selectedProperty}:null,[h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty]),O=(0,rn.useCallback)(async()=>{try{let se=e?.()??null;if(h.selectedFolder){await y.createNewFile(h.selectedFolder,s.createNewNotesInNewTab,se);return}if(T&&h.selectedTag){let fe=h.selectedFile?.path??r.workspace.getActiveFile()?.path??"";await y.createNewFileForTag(h.selectedTag,fe,s.createNewNotesInNewTab,se);return}if(k&&h.selectedProperty){let fe=h.selectedFile?.path??r.workspace.getActiveFile()?.path??"";await y.createNewFileForProperty(h.selectedProperty,fe,s.createNewNotesInNewTab,se)}}catch{}},[h.selectedFolder,h.selectedTag,h.selectedProperty,h.selectedFile,T,k,s.createNewNotesInNewTab,e,y,r]),D=(0,rn.useCallback)(async()=>{let se=z();se&&await o.revealFileInActualFolder(se,{showHiddenFileNotice:!0})},[z,o]),x=(0,rn.useCallback)(()=>sf(s,h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty),[h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty,s]),B=(0,rn.useCallback)(()=>{if(h.selectionType===K.FOLDER&&h.selectedFolder)return s.folderAppearances?.[h.selectedFolder.path];if(h.selectionType===K.TAG&&h.selectedTag)return s.tagAppearances?.[h.selectedTag];if(h.selectionType===K.PROPERTY&&h.selectedProperty)return s.propertyAppearances?.[h.selectedProperty]},[h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty,s.folderAppearances,s.tagAppearances,s.propertyAppearances]),I=(0,rn.useCallback)(()=>h.selectionType===K.FOLDER&&h.selectedFolder?$Ne(h.selectedFolder):h.selectionType===K.TAG&&h.selectedTag?h.selectedTag===Lt?Array.from(a?.getAllTagPaths()??[]):Array.from(a?.collectDescendantTagPaths(h.selectedTag)??[]):h.selectionType===K.PROPERTY&&h.selectedProperty&&i?h.selectedProperty===_e?Ure(i):Array.from(i.collectDescendantNodeIds(h.selectedProperty)):[],[i,h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty,a]),A=(0,rn.useCallback)(se=>h.selectionType===K.FOLDER&&h.selectedFolder?QNe(h.selectedFolder.path,se):h.selectionType===K.TAG&&h.selectedTag?ZNe(h.selectedTag,se):h.selectionType===K.PROPERTY&&h.selectedProperty?JNe(h.selectedProperty,se):!1,[h.selectionType,h.selectedFolder,h.selectedTag,h.selectedProperty]),N=(0,rn.useCallback)(()=>h.selectionType===K.FOLDER?d.paneHeader.subfolders:h.selectionType===K.TAG?d.paneHeader.subtags:h.selectionType===K.PROPERTY?h.selectedProperty===_e?d.paneHeader.descendants:d.paneHeader.childValues:d.paneHeader.descendants,[h.selectedProperty,h.selectionType]),M=(0,rn.useMemo)(()=>R(),[R]),H=(0,rn.useMemo)(()=>x(),[x]),q=(0,rn.useMemo)(()=>Js(s,H),[s,H]),X=qi(s,q.propertyKey),V=(0,rn.useCallback)(se=>{let fe=Ee(se);return fe?v.getPropertyIcon(or(fe))??null:null},[v]),j=(0,rn.useCallback)(()=>{let se=JG(s,H);if(qi(s,q.propertyKey))return"list-ordered";if(se==="list-sort-property"){let fe=V(q.propertyKey);if(fe)return fe}return Je(s.interfaceIcons,se)},[V,H,q.propertyKey,s]),_=(0,rn.useMemo)(()=>B(),[B]),W=(0,rn.useMemo)(()=>Yl(_),[_]),J=W!==null,Z=(0,rn.useMemo)(()=>hI({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]),re=Z.normalizedOverride,Y=Z.hasCustomOverride,ne=X?"custom":re===void 0?void 0:og({groupBy:re,sortOption:q.option,selectionType:h.selectionType}),le=(0,rn.useMemo)(()=>N(),[N]),[ae,ve]=(0,rn.useState)(0),[de,Pe]=(0,rn.useState)(0),[Fe,te]=(0,rn.useState)(0);(0,rn.useEffect)(()=>{let se=Be=>{Be instanceof Th.TFolder&&ve(dt=>dt+1)},fe=r.vault.on("create",se),Ne=r.vault.on("delete",se),xe=r.vault.on("rename",Be=>{se(Be)});return()=>{r.vault.offref(fe),r.vault.offref(Ne),r.vault.offref(xe)}},[r.vault]),(0,rn.useEffect)(()=>{if(a)return a.addTreeUpdateListener(()=>{Pe(se=>se+1)})},[a]),(0,rn.useEffect)(()=>{if(i)return i.addTreeUpdateListener(()=>{te(se=>se+1)})},[i]),(0,rn.useEffect)(()=>{if(!n){Q(!1);return}let se=()=>{Q(!!z())};return se(),GS({workspace:r.workspace,onChange:se})},[r.workspace,z,n]);let ye=(0,rn.useMemo)(()=>h.selectionType===K.FOLDER&&h.selectedFolder?XNe(h.selectedFolder):h.selectionType===K.TAG&&h.selectedTag?h.selectedTag===Lt?a?.getAllTagPaths().length??0:a?.collectDescendantTagPaths(h.selectedTag).size??0:h.selectionType===K.PROPERTY&&h.selectedProperty&&i?h.selectedProperty===_e?Ure(i).length:i.collectDescendantNodeIds(h.selectedProperty).size:0,[ae,i,Fe,h.selectedFolder,h.selectedProperty,h.selectedTag,h.selectionType,a,de]),ce=S||w&&h.selectedTag!==wt||F,pe=(0,rn.useCallback)(async()=>{let se=R();if(se){if(se.type===K.FOLDER){await v.removeFolderSortOverride(se.key);return}if(se.type===K.TAG){await v.removeTagSortOverride(se.key);return}await v.removePropertySortOverride(se.key)}},[R,v]),ue=(0,rn.useCallback)(async se=>{let fe=R();if(fe){if(fe.type===K.FOLDER){await v.setFolderSortOverride(fe.key,se);return}if(fe.type===K.TAG){await v.setTagSortOverride(fe.key,se);return}await v.setPropertySortOverride(fe.key,se)}},[R,v]),Se=(0,rn.useCallback)(async se=>{let fe=R();fe&&await f(Ne=>{let xe=fe.type===K.FOLDER?He(dn(Ne.folderAppearances)):fe.type===K.TAG?He(dn(Ne.tagAppearances)):He(dn(Ne.propertyAppearances)),Be=xe[fe.key],dt=_g(Yl(Be),se);if(dt?xe[fe.key]=dt:delete xe[fe.key],fe.type===K.FOLDER){Ne.folderAppearances=xe;return}if(fe.type===K.TAG){Ne.tagAppearances=xe;return}Ne.propertyAppearances=xe})},[R,f]),ee=(0,rn.useCallback)((se,fe,Ne)=>{new Pn(r,d.modals.manualSortConfirm.propertySortTitle,d.modals.manualSortConfirm.propertySortMessage(se,fe),Ne,d.modals.manualSortConfirm.propertySortConfirmButton).open()},[r]),ie=(0,rn.useCallback)((se,fe)=>{let Ne=zL(s);return fe!==void 0&&Vre(Ne,se,fe),zj(ba({selectionType:h.selectionType,selectedFolder:h.selectedFolder,selectedTag:h.selectedTag,selectedProperty:h.selectedProperty},Ne,{includeDescendantNotes:p,showHiddenItems:m},r,a,i))},[r,p,i,h.selectedFolder,h.selectedProperty,h.selectedTag,h.selectionType,s,m,a]),Ce=(0,rn.useCallback)(()=>{let se=zL(s);return ba({selectionType:h.selectionType,selectedFolder:h.selectedFolder,selectedTag:h.selectedTag,selectedProperty:h.selectedProperty},se,{includeDescendantNotes:p,showHiddenItems:m},r,a,i,{orderResults:!1})},[r,p,i,h.selectedFolder,h.selectedProperty,h.selectedTag,h.selectionType,s,m,a]),we=(0,rn.useCallback)(async(se,fe)=>{await f(Ne=>{Vre(Ne,fe,mI("property-asc",se));let xe=fe.type===K.FOLDER?He(dn(Ne.folderAppearances)):fe.type===K.TAG?He(dn(Ne.tagAppearances)):He(dn(Ne.propertyAppearances)),Be=Yl(xe[fe.key]);if(Be?xe[fe.key]=Be:delete xe[fe.key],fe.type===K.FOLDER){Ne.folderAppearances=xe;return}if(fe.type===K.TAG){Ne.tagAppearances=xe;return}Ne.propertyAppearances=xe}),r.workspace.requestSaveLayout()},[r.workspace,f]),Le=(0,rn.useCallback)(async(se,fe)=>{try{let Ne=await Yj(r,se,fe);return Ne.failed>0?(oe(d.dragDrop.errors.failedToSetProperty.replace("{error}",ff(Ne)),{variant:"warning"}),!1):!0}catch(Ne){return oe(d.dragDrop.errors.failedToSetProperty.replace("{error}",qr(Ne,d.common.unknownError)),{variant:"warning"}),!1}},[r]),We=(0,rn.useCallback)(async(se,fe)=>{try{let Ne=await $j(r,se,fe);if(Ne.updated>0){let xe=Ne.updated===1?d.fileSystem.notifications.manualSortPropertyRemovedFromNote:d.fileSystem.notifications.manualSortPropertyRemovedFromNotes.replace("{count}",Ne.updated.toString());oe(xe,{variant:"success"})}Ne.failed>0&&oe(d.dragDrop.errors.failedToSetProperty.replace("{error}",ff(Ne)),{variant:"warning"})}catch(Ne){oe(d.dragDrop.errors.failedToSetProperty.replace("{error}",qr(Ne,d.common.unknownError)),{variant:"warning"})}},[r]),Nt=(0,rn.useCallback)((se,fe,Ne)=>{!lg(se)||Ne===0||new Pn(r,d.modals.manualSortConfirm.removePropertyTitle,d.modals.manualSortConfirm.removePropertyMessage(se,Ne),async()=>{await We(fe,se)},d.modals.manualSortConfirm.removePropertyConfirmButton).open()},[r,We]),Pt=(0,rn.useCallback)(async()=>{let se=bv(s),fe=R();if(!fe||!lg(se))return;let Ne=Js(s,H),xe=qi(s,Ne.propertyKey),Be=ie(fe,H),dt=jNe(r,Be,se),St=dt.markdownCount>0&&dt.validRankCount===dt.markdownCount,ln=dt.invalidPropertyCount>0,vn=!xe&&dt.markdownCount>0&&dt.validRankCount===0,In=!xe&&!St&&(ln||s.confirmBeforeManualSort),eo=async()=>{vn&&!await Le(Be,se)||await we(se,fe)};if(In){ee(se,dt.markdownCount,eo);return}await eo()},[r,we,ie,R,ee,H,s,Le]),Zt=(0,rn.useCallback)(()=>{let se=M;if(!se)return tK({descendantCount:0,descendantEntries:[],hasCurrentOverride:!1,matchesCurrentOverride:()=>!1});let fe=se.type===K.FOLDER?s.folderSortOverrides:se.type===K.TAG?s.tagSortOverrides:s.propertySortOverrides,Ne=se.type===K.FOLDER?s.folderAppearances:se.type===K.TAG?s.tagAppearances:s.propertyAppearances,xe=Object.entries(fe??{}).filter(([ir])=>A(ir)),Be=Object.entries(Ne??{}).filter(([ir,Zn])=>A(ir)&&Zn.groupBy!==void 0),dt=new Map(xe),St=new Map(Be.map(([ir,Zn])=>[ir,Zn.groupBy])),ln=new Set([...dt.keys(),...St.keys()]),vn=new Set,In=new Set,eo=new Set,Dt=H!==void 0,an=ne!==void 0;ln.forEach(ir=>{let Zn=!1,Fr=!1;if(Dt?dt.has(ir)?yL(dt.get(ir),H)||(Zn=!0):Fr=!0:dt.has(ir)&&(Zn=!0),ne!==void 0){let co=St.get(ir);co===void 0?Fr=!0:TL(co,ne)||(Zn=!0)}else St.has(ir)&&(Zn=!0);Zn&&vn.add(ir),Fr&&In.add(ir),!Zn&&!Fr&&eo.add(ir)});let Sn=Dt||an?Math.max(ye-ln.size,0):0,_r=In.size+Sn,mn=new Set([...vn,...In]).size+Sn;return{descendantCount:ye,savedDescendantCount:ln.size,matchingSavedDescendantCount:eo.size,changedSavedDescendantCount:vn.size,missingSavedDescendantCount:_r,affectedCount:mn,disabled:ye===0||mn===0}},[A,ye,ne,H,M,s.folderAppearances,s.folderSortOverrides,s.propertyAppearances,s.propertySortOverrides,s.tagAppearances,s.tagSortOverrides]),ze=(0,rn.useCallback)(async()=>{let se=M;if(!se)return;let fe=I();fe.length!==0&&(await f(Ne=>{let xe=se.type===K.FOLDER?He(dn(Ne.folderSortOverrides)):se.type===K.TAG?He(dn(Ne.tagSortOverrides)):He(dn(Ne.propertySortOverrides));fe.forEach(dt=>{if(H!==void 0){xe[dt]=gL(H);return}delete xe[dt]}),se.type===K.FOLDER?Ne.folderSortOverrides=xe:se.type===K.TAG?Ne.tagSortOverrides=xe:Ne.propertySortOverrides=xe;let Be=se.type===K.FOLDER?He(dn(Ne.folderAppearances)):se.type===K.TAG?He(dn(Ne.tagAppearances)):He(dn(Ne.propertyAppearances));if(fe.forEach(dt=>{let St=_g(Yl(Be[dt]),ne);if(St){Be[dt]=St;return}delete Be[dt]}),se.type===K.FOLDER){Ne.folderAppearances=Be;return}if(se.type===K.TAG){Ne.tagAppearances=Be;return}Ne.propertyAppearances=Be}),r.workspace.requestSaveLayout())},[r,ne,I,H,M,f]),Ie=(0,rn.useCallback)(()=>{if(!M)return;let fe=Zt();if(fe.disabled)return;if(fe.changedSavedDescendantCount===0){$(async()=>{await ze()});return}let Ne=d.modals.bulkApply.applySortAndGroupTitle(le),xe=d.modals.bulkApply.affectedCountMessage(fe.changedSavedDescendantCount);new Pn(r,Ne,xe,async()=>{await ze()},d.modals.bulkApply.applyButton,{confirmButtonClass:"mod-cta"}).open()},[r,ze,Zt,le,M]),De=(0,rn.useCallback)(se=>{let fe=M;if(!fe)return tK({descendantCount:0,descendantEntries:[],hasCurrentOverride:!1,matchesCurrentOverride:()=>!1});let Ne=fe.type===K.FOLDER?s.folderAppearances:fe.type===K.TAG?s.tagAppearances:s.propertyAppearances,xe=se?new Set(se):null,Be=Object.entries(Ne??{}).filter(([dt,St])=>(xe?xe.has(dt):A(dt))&&EP(St));return tK({descendantCount:xe?.size??ye,descendantEntries:Be,hasCurrentOverride:J,matchesCurrentOverride:([,dt])=>J&&_!==void 0&&N8(dt,_)})},[J,A,_,ye,M,s.folderAppearances,s.propertyAppearances,s.tagAppearances]),Me=(0,rn.useCallback)(async()=>{let se=M;if(!se)return;let fe=I();fe.length!==0&&(await f(Ne=>{let xe=He(dn(se.type===K.FOLDER?Ne.folderAppearances:se.type===K.TAG?Ne.tagAppearances:Ne.propertyAppearances));fe.forEach(Be=>{let dt=_g(J?W:null,xe[Be]?.groupBy);if(dt){xe[Be]=dt;return}delete xe[Be]}),se.type===K.FOLDER?Ne.folderAppearances=xe:se.type===K.TAG?Ne.tagAppearances=xe:Ne.propertyAppearances=xe}),r.workspace.requestSaveLayout())},[r,I,J,W,M,f]),nt=(0,rn.useCallback)(()=>{if(!M)return;let fe=De(I());if(fe.disabled)return;let Ne=J?d.modals.bulkApply.applyAppearanceTitle(le):d.modals.bulkApply.resetAppearanceTitle(le),xe=J?d.modals.bulkApply.applyAppearanceMessage(fe.affectedCount,fe.changedSavedDescendantCount):d.modals.bulkApply.resetAppearanceMessage(fe.affectedCount);new Pn(r,Ne,xe,async()=>{await Me()},d.modals.bulkApply.applyButton,{confirmButtonClass:"mod-cta"}).open()},[r,Me,De,I,J,le,M]),Ge=(0,rn.useCallback)(se=>{P&&Bre({event:se.nativeEvent,settings:s,selectedFolder:h.selectedFolder,selectedTag:h.selectedTag,selectedProperty:h.selectedProperty,selectionType:h.selectionType,updateSettings:f,descendantAction:ce?{menuTitle:J?d.paneHeader.applyAppearanceToDescendants(le):d.paneHeader.resetAppearanceInDescendants(le),onApply:nt,disabled:De().disabled}:void 0,defaultSettingsAction:{menuTitle:d.folderAppearance.openPluginSettings,onOpen:C}})},[ce,De,P,J,C,nt,le,s,h.selectedFolder,h.selectedTag,h.selectedProperty,h.selectionType,f]),Tt=(0,rn.useCallback)(se=>{if(!P)return;let fe=new Th.Menu,Ne=Js(s,H),xe=Js(s),Be=Ne.option,dt=Ap(Be),St=ji(Be),ln=Ap(xe.option),vn=ji(xe.option),In=bv(s),eo=ik(s),Dt=lg(In),an=Dt&&M?Ce():[],Sn=Dt?GNe(r,an,In):0,Gn=St==="property"&&qi(s,Ne.propertyKey),mn={modified:d.settings.items.defaultSortOrder.fields.dateEdited,created:d.settings.items.defaultSortOrder.fields.dateCreated,title:d.settings.items.defaultSortOrder.fields.title,filename:d.settings.items.defaultSortOrder.fields.fileName,property:d.settings.items.defaultSortOrder.fields.property},ir={asc:d.settings.items.defaultSortOrder.directions.asc,desc:d.settings.items.defaultSortOrder.directions.desc},Zn=(ft,Tn)=>{if(ft==="property"){let Jn=Tn?.trim();return Jn?`${mn.property} ‘${WNe(Jn)}’`:mn.property}return mn[ft]},Fr=(ft,Tn)=>Tn?`${ft} ${d.folderAppearance.defaultSuffix}`:ft,co=(ft,Tn)=>{if(ft==="property"){let Jn=Ef(V(Tn??""));if(Jn)return Jn}return Qn(s.interfaceIcons,bL(ft))},Cr=mI(xe.option,xe.propertyKey),ud=(ft,Tn,Jn)=>{let qn=Sv(ft,Tn),ii=mI(qn,Jn),er=$G(ii,Cr);$(async()=>{er===void 0?await pe():await ue(er),r.workspace.requestSaveLayout()})},Ye=(ft,Tn)=>{ud(ft,pI(ft),Tn)},bt=H!==void 0,Wt=!bt&&!Y;fe.addItem(ft=>{ft.setTitle(d.folderAppearance.sortBy).setIcon("lucide-arrow-up-down").setDisabled(!0)}),["modified","created","title","filename"].forEach(ft=>{let Tn=vn===ft,Jn=St===ft;fe.addItem(qn=>{qn.setTitle(Fr(Zn(ft),Tn)).setIcon(co(ft)).setChecked(Jn).onClick(()=>{Jn||Ye(ft)})})}),eo.forEach(ft=>{let Tn=vn==="property"&&Hre(xe.propertyKey,ft),Jn=St==="property"&&Hre(Ne.propertyKey,ft);fe.addItem(qn=>{qn.setTitle(Fr(Zn("property",ft),Tn)).setIcon(co("property",ft)).setChecked(Jn).onClick(()=>{Jn||Ye("property",ft)})})}),eo.length===0&&fe.addItem(ft=>{ft.setTitle(Zn("property")).setIcon(co("property")).setDisabled(!0)}),fe.addSeparator(),["asc","desc"].forEach(ft=>{let Tn=ln===ft;fe.addItem(Jn=>{let qn=Sv(St,ft);Jn.setTitle(Fr(ir[ft],Tn)).setIcon(ej(qn)).setDisabled(Gn).setChecked(dt===ft).onClick(()=>{Gn||ud(St,ft,St==="property"?Ne.propertyKey:void 0)})})}),fe.addSeparator(),fe.addItem(ft=>{ft.setTitle(d.paneHeader.manualSort).setIcon("lucide-list-ordered").setDisabled(!Dt).setChecked(Gn).onClick(()=>{Dt&&$(Pt)})}),fe.addItem(ft=>{ft.setTitle(d.paneHeader.editSortOrder).setIcon("lucide-list-ordered").setDisabled(!Gn||!t).onClick(()=>{!Gn||!t||t(Ne.propertyKey)})}),fe.addItem(ft=>{ft.setTitle(d.paneHeader.removeSortProperty).setIcon("lucide-eraser").setDisabled(Sn===0).onClick(()=>{Sn!==0&&Nt(In,an,Sn)})}),fe.addSeparator(),fe.addItem(ft=>{ft.setTitle(d.folderAppearance.groupBy).setIcon("lucide-layers").setDisabled(!0)});let Ze=og({groupBy:Z.effectiveGrouping,sortOption:Be,selectionType:h.selectionType,isManualSortActive:Gn}),Vt=ft=>Gn||ft==="date"&&!of(Be),xn=ft=>{let Tn=rj(ft,Z.defaultGrouping);$(async()=>{await Se(Tn),r.workspace.requestSaveLayout()})},gn=(ft,Tn,Jn,qn)=>{let ii=kL(ft,Z.defaultGrouping);fe.addItem(er=>{er.setTitle(` ${Fr(Tn,ii)}`).setIcon(Jn).setDisabled(qn).setChecked(kL(Ze,ft)).onClick(()=>{qn||xn(ft)})})};["custom","date"].forEach(ft=>{gn(ft,d.settings.items.defaultGrouping.options[ft],Kre(ft),Vt(ft))}),fe.addSeparator(),S&&gn("folder",d.settings.items.defaultGrouping.options.folder,Kre("folder"),Vt("folder"));let ur=jo(Ze),jn=Td(Ze)??"follow",Ia=lf(s);if(Ia.forEach(ft=>{gn(Ys(ft,jn),Zn("property",ft),co("property",ft),Gn)}),Ia.length===0&&fe.addItem(ft=>{ft.setTitle(` ${Zn("property")}`).setIcon(co("property")).setDisabled(!0)}),ur!==null){fe.addSeparator();let ft=Td(Z.defaultGrouping),Tn={follow:d.settings.items.defaultGroupingDirection.options.follow,asc:ir.asc,desc:ir.desc},Jn={follow:"lucide-arrow-up-down",asc:"lucide-sort-asc",desc:"lucide-sort-desc"};["follow","asc","desc"].forEach(qn=>{let ii=Ys(ur,qn),er=ft===qn;fe.addItem(Ii=>{Ii.setTitle(` ${Fr(Tn[qn],er)}`).setIcon(Jn[qn]).setChecked(jn===qn).onClick(()=>{jn!==qn&&xn(ii)})})})}ce&&(fe.addSeparator(),fe.addItem(ft=>{let Tn=Zt();ft.setTitle(d.paneHeader.applySortAndGroupToDescendants(le)).setIcon("lucide-squares-unite").setDisabled(Tn.disabled).onClick(()=>{Ie()})})),fe.addSeparator(),fe.addItem(ft=>{ft.setTitle(d.paneHeader.resetViewToDefaults).setIcon("lucide-rotate-ccw").setDisabled(Wt).onClick(()=>{Wt||$(async()=>{bt&&await pe(),Y&&await Se(void 0),r.workspace.requestSaveLayout()})})}),fe.addSeparator(),fe.addItem(ft=>{ft.setTitle(d.settings.changeDefaultSettings).setIcon("lucide-settings").onClick(()=>{E()})}),fe.showAtMouseEvent(se.nativeEvent)},[ce,P,S,Y,r,Pt,Zt,Ce,Z.defaultGrouping,Z.effectiveGrouping,E,Ie,Nt,pe,V,le,M,H,h.selectionType,Se,ue,s,t]),gt=(0,rn.useCallback)(()=>{let se=p,fe=r.workspace.getActiveFile();g(!se),!se&&h.selectedFolder&&!h.selectedFile&&fe&&Wb(h.selectedFolder,s,{includeDescendantNotes:!0,showHiddenItems:m},r).some(xe=>xe.path===fe.path)&&b({type:"SET_SELECTED_FILE",file:fe})},[g,p,m,h.selectedFolder,h.selectedFile,r,b,s]),wn=H!==void 0||Y,it=se=>EP(se),yn=S&&h.selectedFolder&&it(s.folderAppearances?.[h.selectedFolder.path])||w&&h.selectedTag&&it(s.tagAppearances?.[h.selectedTag])||F&&h.selectedProperty&&it(s.propertyAppearances?.[h.selectedProperty]),rt=(0,rn.useMemo)(()=>Gk(c,l).fileVisibility,[l,c]),me=(0,rn.useMemo)(()=>{let se=rt===xr.DOCUMENTS;return h.selectionType===K.TAG?se?d.paneHeader.showNotesFromDescendants:d.paneHeader.showFilesFromDescendants:h.selectionType===K.PROPERTY?se?d.paneHeader.showNotesFromDescendants:d.paneHeader.showFilesFromDescendants:h.selectionType===K.FOLDER?se?d.paneHeader.showNotesFromSubfolders:d.paneHeader.showFilesFromSubfolders:se?d.paneHeader.showNotesFromSubfolders:d.paneHeader.showFilesFromSubfolders},[rt,h.selectionType]);return{handleNewFile:O,canCreateNewFile:L,handleRevealFile:D,canRevealFile:G,handleAppearanceMenu:Ge,handleSortMenu:Tt,handleToggleDescendants:gt,getSortIcon:j,hasAppearanceOrSortSelection:P,hasCustomSortOrGroup:wn,hasCustomAppearance:yn,descendantsTooltip:me}}var rn,Th,KNe,UNe,nK=U(()=>{rn=he(Ve()),Th=require("obsidian");Ur();fn();on();gr();Oe();$a();hn();Ue();Ln();_re();Zb();vP();st();Lr();hi();lr();un();bi();sn();Et();hc();Dp();bn();NA();KNe="",UNe=""});function Wre(t){let e=t.lastIndexOf("/");return e<=0?"/":t.slice(0,e)}function eIe(t,e=!1){let n=new Set,r=t;for(;r&&(n.add(r.path),!!e);)r=r.parent instanceof bC.TFolder?r.parent:null;return n}function tIe(t,e){return t?Array.from(eIe(t,e)).join(Gre):null}function nIe(t){return new Set(t.split(Gre))}function rIe(t,e,n){return t instanceof bC.TFolder?typeof n!="string"?!1:e.has(n)||e.has(t.path):t instanceof bC.TFile?e.has(Wre(t.path))?!0:typeof n!="string"?!1:e.has(Wre(n)):!1}function Fw(t,e,n,r){let[o,a]=(0,yD.useState)(0),i=r?.includeAncestors===!0,s=tIe(e,i);return(0,yD.useEffect)(()=>{if(!n||!s)return;let l=nIe(s),c=(g,f)=>{rIe(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 yD,bC,Gre,vD=U(()=>{yD=he(Ve()),bC=require("obsidian"),Gre="\0"});var ps,jre,dr,qre,Yre=U(()=>{ps=he(Ve()),jre=require("obsidian");Ur();fn();on();gr();wa();Oe();ei();rd();nK();vD();Ue();Hu();Md();$r();Cn();st();lr();dr=he($e()),qre=ps.default.memo(function({onHeaderClick:e,isSearchActive:n,onSearchToggle:r,onManualSortStart:o,getManualSortNewFileContext:a,canToggleGroupExpansion:i,shouldCollapseGroups:s,onToggleGroupExpansion:l,actionsDisabled:c=!1,desktopTitle:u,breadcrumbSegments:p,iconName:m,showIcon:g}){let f=ps.default.useRef(null),{app:h,plugin:b}=vt(),y=vl(),v=yt(),w=jt().includeDescendantNotes,T=hr(),F=ar(),k=Qr(),P=So(),E=v.listPaneTitle??"header",C=ts(),L=v.toolbarVisibility.list,z=L.reveal,G=Xa(),{handleNewFile:Q,canCreateNewFile:R,handleRevealFile:O,canRevealFile:D,handleAppearanceMenu:x,handleSortMenu:B,handleToggleDescendants:I,descendantsTooltip:A,getSortIcon:N,hasAppearanceOrSortSelection:M,hasCustomSortOrGroup:H,hasCustomAppearance:q}=fD({onManualSortStart:o,getManualSortNewFileContext:a,trackRevealFileAvailability:!G&&z}),X=L.back&&k.singlePane,V=L.search,j=L.descendants,_=L.groupExpansion,W=L.sort,J=L.appearance,Z=L.newNote,re=!!(T.selectedFolder||T.selectedTag||T.selectedProperty),Y=G,ne=!G&&E==="header",le=ne&&g,ae=X||ne||V||z||j||_||W||J||Z,ve=(0,ps.useMemo)(()=>jre.Platform.isAndroidApp?"arrow-left":"chevron-left",[]),de=(0,ps.useMemo)(()=>N(),[N]),Pe=T.selectionType===K.FOLDER?T.selectedFolder:null,Fe=Y||ne,te=Fw(h.vault,Pe,v.enableFolderNotes&&v.enableFolderNoteLinks&&Fe),ye=(0,ps.useMemo)(()=>!Pe||!v.enableFolderNotes||!v.enableFolderNoteLinks||!Fe?null:Rn(Pe,{enableFolderNotes:v.enableFolderNotes,folderNoteNamePattern:v.folderNoteNamePattern}),[Pe,v.enableFolderNotes,v.enableFolderNoteLinks,v.folderNoteNamePattern,Fe,te]),ce=ps.default.useCallback(we=>{if(!Pe||!ye)return;we.stopPropagation();let Le=Iu(we,v.folderNoteOpenLocation,v.multiSelectModifier);Ai(F,ye),$(()=>vi({app:h,commandQueue:y,folder:Pe,folderNote:ye,context:Le,openInRightSidebar:We=>b.openFolderNoteInRightSidebar(We)}))},[Pe,ye,v.folderNoteOpenLocation,v.multiSelectModifier,h,y,b,F]),pe=ps.default.useCallback(we=>{we.button!==1||!Pe||!ye||(we.preventDefault(),we.stopPropagation(),Ai(F,ye),$(()=>vi({app:h,commandQueue:y,folder:Pe,folderNote:ye,context:"tab"})))},[Pe,ye,h,y,F]),ue=(0,ps.useMemo)(()=>{if(!Y)return ye?(0,dr.jsx)("span",{className:"nn-pane-header-folder-note",onClick:ce,onMouseDown:pe,children:u}):u;let we=[];return p.forEach((Le,We)=>{let Nt=`${Le.label}-${We}`,Pt=Le.isLast&&!!ye;if(Le.isLast||Le.targetType==="none"||!Le.targetPath)we.push((0,dr.jsx)("span",{className:`nn-path-current${Pt?" nn-pane-header-folder-note":""}`,onClick:Pt?ce:void 0,onMouseDown:Pt?pe:void 0,children:Le.label},Nt));else{let Zt=ze=>{if(ze.stopPropagation(),Le.targetType==="folder"){let Ie=Le.targetPath,De=Ie?h.vault.getFolderByPath(Ie):null;De&&F({type:"SET_SELECTED_FOLDER",folder:De})}else Le.targetType==="tag"&&Le.targetPath?F({type:"SET_SELECTED_TAG",tag:at(Le.targetPath)}):Le.targetType==="property"&&Le.targetPath&&F({type:"SET_SELECTED_PROPERTY",nodeId:Le.targetPath})};we.push((0,dr.jsx)("span",{className:"nn-path-segment",onClick:Zt,children:Le.label},Nt))}Le.isLast||we.push((0,dr.jsx)("span",{className:"nn-path-separator",children:" / "},`${Nt}-separator`))}),we},[h.vault,p,u,F,Y,ye,ce,pe]),Se=ps.default.useRef(null),[ee,ie]=ps.default.useState(!1);(0,ps.useEffect)(()=>{if(!le||!f.current)return;Fn().renderIcon(f.current,m)},[m,C,le]),(0,ps.useEffect)(()=>{if(!G){ie(!1);return}if(!Se.current)return;let we=window.setTimeout(()=>{Se.current&&Se.current.scrollTo({left:Se.current.scrollWidth,behavior:"instant"})},0);return()=>window.clearTimeout(we)},[T.selectedFolder,T.selectedTag,T.selectedProperty,G]);let Ce=ps.default.useCallback(()=>{G&&Se.current&&ie(Se.current.scrollLeft>0)},[G]);return G?(0,dr.jsx)("div",{className:"nn-pane-header nn-pane-header-simple",onClick:e,children:(0,dr.jsxs)("div",{className:"nn-mobile-header nn-mobile-header-no-icon",children:[(0,dr.jsx)("button",{className:"nn-icon-button nn-back-button","aria-label":d.paneHeader.mobileBackToNavigation,"data-pane-toggle":"navigation",onClick:we=>{we.stopPropagation(),P({type:"ACTIVATE_PANE",target:"navigation"})},tabIndex:-1,children:(0,dr.jsx)(qt,{iconId:ve,"aria-hidden":!0})}),ee&&(0,dr.jsx)("div",{className:"nn-breadcrumb-fade"}),(0,dr.jsx)("div",{ref:Se,className:"nn-breadcrumb-scroll",onScroll:Ce,children:(0,dr.jsx)("span",{className:"nn-mobile-title",children:ue})})]})}):ae?(0,dr.jsx)("div",{className:"nn-pane-header",children:(0,dr.jsxs)("div",{className:"nn-header-actions nn-header-actions--space-between",children:[X?(0,dr.jsx)("button",{className:"nn-icon-button","data-pane-toggle":"navigation",onClick:()=>{P({type:"ACTIVATE_PANE",target:"navigation"})},"aria-label":d.paneHeader.showFolders,tabIndex:-1,children:(0,dr.jsx)(qt,{iconId:ve,"aria-hidden":!0})}):null,(0,dr.jsxs)("span",{className:"nn-pane-header-title",children:[le&&(0,dr.jsx)("span",{ref:f,className:"nn-pane-header-icon"}),ne&&(0,dr.jsx)("span",{className:"nn-pane-header-text",children:ue})]}),(0,dr.jsxs)("div",{className:"nn-header-actions",children:[V?(0,dr.jsx)("button",{className:`nn-icon-button ${n?"nn-icon-button-active":""}`,"aria-label":d.paneHeader.search,onClick:r,disabled:c||!re,tabIndex:-1,children:(0,dr.jsx)(qt,{iconId:Je(v.interfaceIcons,"list-search")})}):null,z?(0,dr.jsx)("button",{className:"nn-icon-button","aria-label":d.commands.revealFile,onClick:()=>{$(()=>O())},disabled:c||!D,tabIndex:-1,children:(0,dr.jsx)(qt,{iconId:Je(v.interfaceIcons,"list-reveal-file")})}):null,j?(0,dr.jsx)("button",{className:`nn-icon-button ${w?"nn-icon-button-active":""}`,"aria-label":A,onClick:I,disabled:c||!re,tabIndex:-1,children:(0,dr.jsx)(qt,{iconId:Je(v.interfaceIcons,"list-descendants")})}):null,_?(0,dr.jsx)("button",{className:"nn-icon-button","aria-label":s?d.paneHeader.collapseAllListGroups:d.paneHeader.expandAllListGroups,onClick:()=>{l()},disabled:c||!i,tabIndex:-1,children:(0,dr.jsx)(qt,{iconId:Je(v.interfaceIcons,s?"list-collapse-all":"list-expand-all")})}):null,W?(0,dr.jsx)("button",{className:`nn-icon-button ${H?"nn-icon-button-active":""}`,"aria-label":d.paneHeader.changeSortAndGroup,onClick:B,disabled:c||!M,tabIndex:-1,children:(0,dr.jsx)(qt,{iconId:de})}):null,J?(0,dr.jsx)("button",{className:`nn-icon-button ${q?"nn-icon-button-active":""}`,"aria-label":q?d.paneHeader.changeAppearanceCustomized:d.paneHeader.changeAppearance,"aria-haspopup":"menu",onClick:x,disabled:c||!M,tabIndex:-1,children:(0,dr.jsx)(qt,{iconId:Je(v.interfaceIcons,"list-appearance")})}):null,Z?(0,dr.jsx)("button",{className:"nn-icon-button","aria-label":d.paneHeader.newNote,onClick:()=>{$(()=>Q())},disabled:c||!R,tabIndex:-1,children:(0,dr.jsx)(qt,{iconId:Je(v.interfaceIcons,"list-new-note")})}):null]})]})}):null})});function $re({isSearchActive:t,onSearchToggle:e,onManualSortStart:n,getManualSortNewFileContext:r,canToggleGroupExpansion:o,shouldCollapseGroups:a,onToggleGroupExpansion:i,useFloatingLayout:s=!1}){let c=jt().includeDescendantNotes,u=hr(),p=yt(),m=p.toolbarVisibility.list,g=m.reveal,{handleNewFile:f,canCreateNewFile:h,handleRevealFile:b,canRevealFile:y,handleAppearanceMenu:v,handleSortMenu:S,handleToggleDescendants:w,descendantsTooltip:T,getSortIcon:F,hasAppearanceOrSortSelection:k,hasCustomSortOrGroup:P,hasCustomAppearance:E}=fD({onManualSortStart:n,getManualSortNewFileContext:r,trackRevealFileAvailability:g}),C=m.search,L=m.descendants,z=m.groupExpansion,G=m.sort,Q=m.appearance,R=m.newNote,O=!!(u.selectedFolder||u.selectedTag||u.selectedProperty),D=[C,g,L,z,G,Q].filter(Boolean).length,x=D+(R?1:0),B=D===1?"nn-mobile-toolbar-circle":"nn-mobile-toolbar-pill",I=D===1?"nn-mobile-toolbar-button nn-mobile-toolbar-button-circle":"nn-mobile-toolbar-button";if(x===0)return null;let A=[C?(0,ca.jsx)("button",{className:`${I}${t?" nn-mobile-toolbar-button-active":""}`,"aria-label":d.paneHeader.search,onClick:e,disabled:!O,tabIndex:-1,children:(0,ca.jsx)(qt,{iconId:Je(p.interfaceIcons,"list-search")})},"search"):null,g?(0,ca.jsx)("button",{className:I,"aria-label":d.commands.revealFile,onClick:()=>{$(()=>b())},disabled:!y,tabIndex:-1,children:(0,ca.jsx)(qt,{iconId:Je(p.interfaceIcons,"list-reveal-file")})},"reveal"):null,L?(0,ca.jsx)("button",{className:`${I}${c?" nn-mobile-toolbar-button-active":""}`,"aria-label":T,onClick:w,disabled:!O,tabIndex:-1,children:(0,ca.jsx)(qt,{iconId:Je(p.interfaceIcons,"list-descendants")})},"descendants"):null,z?(0,ca.jsx)("button",{className:I,"aria-label":a?d.paneHeader.collapseAllListGroups:d.paneHeader.expandAllListGroups,onClick:()=>{i()},disabled:!o,tabIndex:-1,children:(0,ca.jsx)(qt,{iconId:Je(p.interfaceIcons,a?"list-collapse-all":"list-expand-all")})},"group-expansion"):null,G?(0,ca.jsx)("button",{className:`${I}${P?" nn-mobile-toolbar-button-active":""}`,"aria-label":d.paneHeader.changeSortAndGroup,onClick:S,disabled:!k,tabIndex:-1,children:(0,ca.jsx)(qt,{iconId:F()})},"sort"):null,Q?(0,ca.jsx)("button",{className:`${I}${E?" nn-mobile-toolbar-button-active":""}`,"aria-label":E?d.paneHeader.changeAppearanceCustomized:d.paneHeader.changeAppearance,"aria-haspopup":"menu",onClick:v,disabled:!k,tabIndex:-1,children:(0,ca.jsx)(qt,{iconId:Je(p.interfaceIcons,"list-appearance")})},"appearance"):null].filter(Boolean),N=R?(0,ca.jsx)("button",{className:"nn-mobile-toolbar-button nn-mobile-toolbar-button-circle","aria-label":d.paneHeader.newNote,onClick:()=>{$(()=>f())},disabled:!h,tabIndex:-1,children:(0,ca.jsx)(qt,{iconId:Je(p.interfaceIcons,"list-new-note")})},"new-note"):null;return s?(0,ca.jsxs)("div",{className:"nn-mobile-toolbar",children:[(0,ca.jsx)("div",{className:"nn-mobile-toolbar-left",children:D>0?(0,ca.jsx)("div",{className:B,children:A}):null}),R?(0,ca.jsx)("div",{className:"nn-mobile-toolbar-right",children:(0,ca.jsx)("div",{className:"nn-mobile-toolbar-circle",children:N})}):null]}):(0,ca.jsxs)("div",{className:"nn-mobile-toolbar",children:[A,N]})}var ca,Xre=U(()=>{Ur();on();gr();Oe();rd();nK();st();lr();ca=he($e())});var Jre={};En(Jre,{InfoModal:()=>kh});function aIe(t,e){if(!e)return;let n=0;for(let r of e.matchAll(oIe)){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{Zre=require("obsidian"),oIe=/`([^`]+)`/g;kh=class extends Zre.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.emphasizedIntro&&n.createEl("p").createEl("strong",{text:this.modalContent.emphasizedIntro}),this.modalContent.intro&&n.createEl("p",{text:this.modalContent.intro});let r=this.modalContent.sections??[];if(r.length>0){for(let o of r)n.createEl("h3",{text:o.title}),Qre(n,o.items);return}this.modalContent.items&&this.modalContent.items.length>0&&Qre(n,this.modalContent.items)}onClose(){this.modalEl.removeClass("nn-search-help-modal"),this.contentEl.empty()}}});var od,by,eoe,toe=U(()=>{od=he(Ve()),by=he($e()),eoe=od.default.memo(function({className:e,ariaText:n,dayNumber:r,isMobile:o,showUnfinishedTaskIndicator:a,onClick:i,onMouseDown:s,onContextMenu:l,style:c,tooltipEnabled:u,tooltipData:p,onHideTooltip:m,onShowTooltip:g}){let f=(0,od.useRef)(null),{dateTimestamp:h,imageUrl:b,previewEnabled:y,previewPath:v,showDate:S,title:w}=p,T=(0,od.useMemo)(()=>({imageUrl:b,title:w,dateTimestamp:h,previewPath:v,previewEnabled:y,showDate:S}),[h,b,y,v,S,w]),F=(0,od.useCallback)(()=>{if(o||!u)return;let C=f.current;C&&g(C,T)},[o,g,T,u]),k=(0,od.useCallback)(()=>{let C=f.current;!C||o||m(C)},[o,m]),P=(0,od.useCallback)(C=>{let L=f.current;L&&m(L),i(C)},[i,m]),E=(0,od.useCallback)(C=>{if(C.button===1){let L=f.current;L&&m(L)}s(C)},[s,m]);return(0,od.useEffect)(()=>{let C=f.current;if(C&&!o){if(!u){m(C);return}C.matches(":hover")&&g(C,T)}},[o,m,g,T,u]),(0,by.jsxs)("button",{ref:f,type:"button",className:e,style:c,onMouseEnter:F,onMouseLeave:k,onMouseDown:E,onClick:P,onContextMenu:l,children:[(0,by.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),(0,by.jsx)("span",{className:"nn-navigation-calendar-day-number","aria-hidden":"true",children:r}),a?(0,by.jsx)("span",{className:"nn-navigation-calendar-day-unfinished-task-indicator","aria-hidden":"true"}):null,(0,by.jsx)("span",{className:"nn-visually-hidden",children:n})]})})});function Xc(t,e,n){return Math.min(Math.max(t,e),n)}function SC(t){return t.format("YYYY-MM-DD")}function noe(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 wC(t){return t==="day"||t==="week"||t==="month"}function roe(t,e){return Kn()?Pf(t,e):!1}function iIe(t){return t.toDate().getDay()}function rK(t,e){let r=(iIe(t)-e+7)%7;return t.clone().subtract(r,"day").startOf("day")}function ooe(t){let e=Xc(t.weeksToShow,1,6);if(e===6){let o=t.cursor.clone().startOf("month"),a=rK(o,t.weekStartsOn);if(t.alwaysRenderSixWeeks)return{windowStart:a,weekCount:6};let i=o.clone().endOf("month"),s=rK(i,t.weekStartsOn),l=Xc(s.diff(a,"weeks")+1,1,6);return{windowStart:a,weekCount:l}}let n=Math.floor((e-1)/2);return{windowStart:rK(t.cursor.clone(),t.weekStartsOn).clone().subtract(n,"week"),weekCount:e}}function aoe(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 sIe(t,e){let n=t.getFile(e)?.taskUnfinished;return typeof n!="number"||n<=0?null:n}function oK(t,e,n,r){if(!n)return;let o=sIe(r,n.path);o!==null&&t.set(e,o)}var SD=U(()=>{Md();$r()});function dIe(t,e){let n=`${e}|${t.iso}`,r=TC.get(n);if(r!==void 0)return r;let o=t.date.clone().locale(e).format("LL");if(TC.size>=lIe){let a=TC.keys().next().value;a!==void 0&&TC.delete(a)}return TC.set(n,o),o}var aK,Zr,lIe,TC,cIe,ioe,soe=U(()=>{aK=he(Ve());Id();toe();SD();Zr=he($e()),lIe=1024,TC=new Map;cIe=aK.default.memo(function({day:e,dayCellClassName:n,dayButtonClassName:r,featureImageUrl:o,hasFeatureImageKey:a,hasUnfinishedTasks:i,frontmatterTitle:s,displayLocale:l,dateFormat:c,isMobile:u,canCreateDayNotes:p,onShowTooltip:m,onHideTooltip:g,onDayClick:f,onDayMouseDown:h,onDayContextMenu:b}){let y=e.date.date(),v=o?{backgroundImage:`url(${o})`}:void 0,S=dIe(e,l),w=e.date.toDate().getTime(),T=s.trim().length>0,F=T?s:Gr.formatDate(w,c),k=T,P=T?`${S}, ${s}`:S,E=e.note.visibleFile,C=!!(E||o),L={imageUrl:o,title:F||S,dateTimestamp:w,previewPath:E?.path??null,previewEnabled:!!(E&&E.extension==="md"),showDate:k};return(0,Zr.jsx)("div",{className:n,children:(0,Zr.jsx)(eoe,{className:r,ariaText:P,style:v,tooltipEnabled:C,tooltipData:L,dayNumber:y,isMobile:u,showUnfinishedTaskIndicator:i,onShowTooltip:m,onHideTooltip:g,onMouseDown:z=>h(z,e),onClick:z=>f(z,e),onContextMenu:z=>b(z,e,p,a)})})}),ioe=aK.default.memo(function({activeEditorFilePath:e,showWeekNumbers:n,weekdays:r,weekStartsOn:o,trailingSpacerWeekCount:a,weeks:i,hideOutsideMonthDays:s,weekNotesEnabled:l,weekNoteTargetsByKey:c,weekUnfinishedTaskCountByKey:u,displayLocale:p,calendarWeekendDays:m,todayIso:g,unfinishedTaskCountByIso:f,featureImageUrls:h,featureImageKeysByIso:b,frontmatterTitlesByPath:y,dateFormat:v,isMobile:S,canCreateDayNotes:w,onShowTooltip:T,onHideTooltip:F,onDayClick:k,onDayMouseDown:P,onDayContextMenu:E,onWeekClick:C,onWeekMouseDown:L,onWeekLabelClick:z,onWeekContextMenu:G}){let Q=i[0]?.days,R=Q?Q.map(D=>aoe(D.date.toDate().getDay(),m)):[],O=i.map(D=>D.days.map((x,B)=>(R[B]??!1)&&(x.inMonth||!s)));return(0,Zr.jsxs)("div",{className:"nn-navigation-calendar-grid","data-weeknumbers":n?"true":void 0,children:[(0,Zr.jsxs)("div",{className:"nn-navigation-calendar-weekdays","data-weeknumbers":n?"true":void 0,children:[n?(0,Zr.jsx)("div",{className:"nn-navigation-calendar-weeknumber-spacer"}):null,n?(0,Zr.jsx)("div",{className:"nn-navigation-calendar-weeknumber-divider","aria-hidden":"true"}):null,r.map((D,x)=>(0,Zr.jsx)("div",{className:"nn-navigation-calendar-weekday",children:D},(o+x)%7))]}),(0,Zr.jsxs)("div",{className:"nn-navigation-calendar-weeks","data-weeknumbers":n?"true":void 0,children:[i.map((D,x)=>{let B=c.get(D.key)??null,I=B?.visibleFile??null,A=(u.get(D.key)??0)>0,N=!!(I&&e===I.path),M=O[x]??[],H=s&&D.days.every(q=>!q.inMonth);return(0,Zr.jsxs)("div",{className:`nn-navigation-calendar-week${xL(q,D,B),onClick:q=>C(q,D,B),onContextMenu:q=>G(q,D,B),children:[(0,Zr.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),(0,Zr.jsx)("span",{className:"nn-navigation-calendar-weeknumber-value",children:D.weekNumber})]}):(0,Zr.jsxs)("button",{type:"button",className:"nn-navigation-calendar-weeknumber nn-navigation-calendar-weeknumber-button",onClick:q=>z(q,D),onContextMenu:q=>G(q,D,null),children:[(0,Zr.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),(0,Zr.jsx)("span",{className:"nn-navigation-calendar-weeknumber-value",children:D.weekNumber})]}),H?(0,Zr.jsx)("div",{"aria-hidden":"true"}):(0,Zr.jsx)("div",{className:"nn-navigation-calendar-weeknumber-divider","aria-hidden":"true"})]}):null,D.days.map((q,X)=>{if(s&&!q.inMonth)return(0,Zr.jsx)("div",{className:"nn-navigation-calendar-day-spacer","aria-hidden":"true"},q.iso);let V=q.note.visibleFile,j=!!V,W=(j?f.get(q.iso)??0:0)>0,J=V?h[q.iso]??null:null,Z=!!(V&&b.has(q.iso)),re=g===q.iso,Y=!!(V&&e===V.path),ne=M[X]??!1,le=ne&&X>0&&!!M[X-1],ae=ne&&X(0,Zr.jsxs)("div",{className:"nn-navigation-calendar-week nn-navigation-calendar-week-spacer",children:[n?(0,Zr.jsx)("div",{className:"nn-navigation-calendar-weeknumber nn-navigation-calendar-weeknumber-spacer-row","aria-hidden":"true"}):null,Array.from({length:7}).map((B,I)=>(0,Zr.jsx)("div",{className:"nn-navigation-calendar-day-spacer","aria-hidden":"true"},`spacer-day-${x}-${I}`))]},`spacer-week-${x}`))]})]})})});var loe,Jr,doe,coe=U(()=>{loe=he(Ve());Oe();rd();Jr=he($e()),doe=loe.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:y,onNavigate:v,onToday:S,onOpenHelp:w,onPeriodClick:T,onPeriodMouseDown:F,onPeriodContextMenu:k}){let P=z=>{z.button===0&&z.preventDefault()},E=(z,G)=>{if(z.button===1){F(z,G);return}P(z)},C=o?(0,Jr.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:z=>E(z,"year"),onClick:z=>T(z,"year"),onContextMenu:z=>k(z,"year"),children:[(0,Jr.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),n]}):null,L=z=>(0,Jr.jsxs)("button",{type:"button",className:["nn-navigation-calendar-period-button","nn-navigation-calendar-quarter-button",z?"nn-navigation-calendar-quarter-inline":"",s?"has-period-note":"",u?"is-active-editor-file":""].filter(Boolean).join(" "),onMouseDown:G=>E(G,"quarter"),onClick:G=>T(G,"quarter"),onContextMenu:G=>k(G,"quarter"),children:[(0,Jr.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),(0,Jr.jsx)("span",{className:"nn-navigation-calendar-quarter-paren","aria-hidden":"true",children:"("}),(0,Jr.jsx)("span",{className:"nn-navigation-calendar-quarter-value",children:r}),(0,Jr.jsx)("span",{className:"nn-navigation-calendar-quarter-paren","aria-hidden":"true",children:")"})]});return(0,Jr.jsxs)("div",{className:"nn-navigation-calendar-header",children:[(0,Jr.jsxs)("div",{className:["nn-navigation-calendar-month",m?"has-inline-month-nav":"",b?"has-inline-help":""].filter(Boolean).join(" "),children:[m?(0,Jr.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:()=>v(-1),children:(0,Jr.jsx)(qt,{iconId:"lucide-chevron-left","aria-hidden":!0})}):null,(0,Jr.jsxs)("div",{className:"nn-navigation-calendar-inline-month-center",children:[(0,Jr.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:z=>E(z,"month"),onClick:z=>T(z,"month"),onContextMenu:z=>k(z,"month"),children:[(0,Jr.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),e]}),g?L(!0):null,b?(0,Jr.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,Jr.jsx)(qt,{iconId:"info","aria-hidden":!0})}):null]}),m?(0,Jr.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:()=>v(1),children:(0,Jr.jsx)(qt,{iconId:"lucide-chevron-right","aria-hidden":!0})}):null,f?C:null,f&&a?L(!1):null]}),h?(0,Jr.jsxs)("div",{className:"nn-navigation-calendar-nav",children:[y?(0,Jr.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,Jr.jsx)(qt,{iconId:"info","aria-hidden":!0})}):null,(0,Jr.jsx)("button",{type:"button",className:"nn-navigation-calendar-nav-button nn-navigation-calendar-nav-prev","aria-label":d.common.previous,onMouseDown:P,onClick:()=>v(-1),children:(0,Jr.jsx)(qt,{iconId:"lucide-chevron-left","aria-hidden":!0})}),(0,Jr.jsx)("button",{type:"button",className:"nn-navigation-calendar-today","aria-label":d.dateGroups.today,onMouseDown:P,onClick:S,children:d.dateGroups.today}),(0,Jr.jsx)("button",{type:"button",className:"nn-navigation-calendar-nav-button nn-navigation-calendar-nav-next","aria-label":d.common.next,onMouseDown:P,onClick:()=>v(1),children:(0,Jr.jsx)(qt,{iconId:"lucide-chevron-right","aria-hidden":!0})})]}):null]})})});var uoe,poe,Pm,moe,goe=U(()=>{uoe=he(Ve()),poe=he(FF()),Pm=he($e()),moe=uoe.default.memo(function({isMobile:e,hoverTooltip:n,hoverTooltipStyle:r,hoverTooltipRef:o,hoverTooltipPreviewText:a,shouldShowHoverTooltipPreview:i,hoverTooltipDateText:s}){return!n||e?null:(0,poe.createPortal)((0,Pm.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,Pm.jsx)("div",{className:"nn-navigation-calendar-hover-tooltip-image",style:{backgroundImage:`url(${n.tooltipData.imageUrl})`}}):null,(0,Pm.jsxs)("div",{className:"nn-compact-file-text-content",children:[(0,Pm.jsx)("div",{className:"nn-file-name",style:{"--filename-rows":2,height:"auto",minHeight:0},children:(0,Pm.jsx)("span",{className:"nn-file-name-label",children:n.tooltipData.title})}),i?(0,Pm.jsx)("div",{className:"nn-file-preview",style:{"--preview-rows":2},children:a}):null,s?(0,Pm.jsx)("div",{className:"nn-file-date",children:s}):null]})]}),activeDocument.body)})});var hoe,zs,foe,yoe=U(()=>{hoe=he(Ve());Oe();rd();zs=he($e()),foe=hoe.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,onYearPeriodMouseDown:g,onYearPeriodContextMenu:f,onSelectYearMonth:h}){return e?(0,zs.jsxs)("div",{className:"nn-navigation-calendar-year-panel",children:[(0,zs.jsxs)("div",{className:"nn-navigation-calendar-year-nav",children:[(0,zs.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,zs.jsx)(qt,{iconId:"lucide-chevron-left","aria-hidden":!0})}),(0,zs.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",onMouseDown:g,onClick:m,onContextMenu:f,children:[(0,zs.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),r]}),(0,zs.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,zs.jsx)(qt,{iconId:"lucide-chevron-right","aria-hidden":!0})})]}),(0,zs.jsx)("div",{className:"nn-navigation-calendar-year-grid",children:l.map(b=>{let y=r===o&&b.monthIndex===a,v=b.key===n,S=c.has(b.key),w=u[b.key]??null,T=`${b.fullLabel} ${r}`,F=w?{backgroundImage:`url(${w})`}:void 0;return(0,zs.jsxs)("button",{type:"button",className:["nn-navigation-calendar-year-month",v?"is-current-month":"",y?"is-selected-month":"",b.hasDailyNote?"has-daily-note":"",b.hasUnfinishedTasks?"has-unfinished-tasks":"",S?"has-feature-image-key":"",w?"has-feature-image":""].filter(Boolean).join(" "),"aria-label":T,style:F,onClick:k=>h(k,b.date),children:[(0,zs.jsx)("span",{className:"nn-navigation-calendar-active-outline","aria-hidden":"true"}),(0,zs.jsx)("span",{className:"nn-navigation-calendar-year-month-label",children:b.shortLabel}),b.hasUnfinishedTasks?(0,zs.jsx)("span",{className:"nn-navigation-calendar-year-month-unfinished-task-indicator","aria-hidden":"true"}):null]},b.key)})})]}):null})});function boe(t){return t.replace(/\.md$/iu,"")}function voe(t){return(0,iK.normalizePath)(t).replace(/^\/+/u,"").replace(/\/+$/u,"")}function uIe(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 pIe(t){let e=uIe(t);return/[YgG]/u.test(e)&&/[wW]/u.test(e)}function mIe(t,e){let n=voe(t),r=voe(e);return r?n===r?"":n.startsWith(`${r}/`)?n.slice(r.length+1):null:n}function gIe({filePath:t,resolverContext:e,parseLocale:n,calendarLocale:r,weekLocale:o,customCalendarRootFolderSettings:a,momentApi:i}){let s=boe(t),l=mIe(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(!pIe(m))continue;let g=u.slice(p).join("/"),f=i(g,m,n,!0);if(!f.isValid())continue;if(Nw({kind:"week",date:f,resolverContext:e,calendarLocale:r,weekLocale:o,customCalendarRootFolderSettings:a,momentApi:i})?.filePath===t)return f}return null}function Cw(t,e){let n=qp(t,e),r=yg(n.calendarCustomFilePattern,n.fallbackPattern);return{config:n,momentPattern:r}}function Nw({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=Yp(t,e,l,r,o);return vg(c,a,s.calendarCustomFilePattern,s.fallbackPattern)}function Soe({existingFile:t,targetPath:e,hiddenFolders:n,showHiddenItems:r,isExistingFileVisible:o}){let a=!r&&(e!==null&&n.length>0&&Za(e,n)||t!==null&&!o(t));return{existingFile:t,visibleFile:a?null:t,isHidden:a,targetPath:e}}function woe({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,iK.normalizePath)(t),{config:c,momentPattern:u}=n;if(!c.isPatternValid(u,i))return null;if(e==="week")return gIe({filePath:l,kind:e,resolverContext:n,calendarLocale:r,weekLocale:o,customCalendarRootFolderSettings:a,momentApi:i,parseLocale:s});let p=AT(a.calendarCustomRootFolder),m=p?`${p}/${u}`:u,g=i(boe(l),m,s,!0);if(!g.isValid())return null;let f=Nw({kind:e,date:g,resolverContext:n,calendarLocale:r,weekLocale:o,customCalendarRootFolderSettings:a,momentApi:i});return!f||f.filePath!==l?null:g}var iK,sK=U(()=>{iK=require("obsidian");Cd();wr();lb()});function lK(t,e){return!t||!e?null:`${t}\0${e}`}function Toe({regenerationKeys:t,filePath:e,featureImageKey:n}){let r=lK(e,n);return!r||t.has(r)?!1:(t.add(r),!0)}function koe(t,e){let n=`${e}\0`;for(let r of t)r.startsWith(n)&&t.delete(r)}function dK({db:t,showFeatureImages:e,targets:n,maxConcurrentLoads:r,onMissingFeatureImage:o}){let a=(0,Fm.useRef)(new Map),[i,s]=(0,Fm.useState)({}),l=(0,Fm.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,Fm.useEffect)(()=>()=>{l(!1)},[l]),(0,Fm.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 v=>{let S=u.get(v.id);if(S&&S.key===v.key){p.set(v.id,S);return}let w;try{w=await t.getFeatureImageBlob(v.file.path,v.key)}catch{return}if(!c)return;if(!w){o?.(v);return}let T=URL.createObjectURL(w);m.push(T),p.set(v.id,{key:v.key,url:T})},h=Math.min(Math.max(1,r),n.length||1),b=0,y=[];for(let v=0;v{for(;;){let S=b;if(b+=1,S>=n.length)return;await f(n[S])}})());if(await Promise.all(y),!c){m.forEach(v=>URL.revokeObjectURL(v));return}for(let[v,S]of u.entries()){let w=p.get(v);(!w||w.url!==S.url)&&URL.revokeObjectURL(S.url)}a.current=p,s(Object.fromEntries([...p.entries()].map(([v,S])=>[v,S.url])))}catch(f){m.forEach(h=>URL.revokeObjectURL(h)),c&&console.error("Failed to load calendar feature images",f)}};return $(()=>g()),()=>{c=!1}},[l,t,r,o,e,n]),i}var Fm,Poe=U(()=>{Fm=he(Ve());st()});function Foe(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 Coe({db:t,dateFormat:e,isMobile:n,previewVersion:r}){let[o,a]=(0,Ta.useState)(null),[i,s]=(0,Ta.useState)(null),l=(0,Ta.useRef)(null),c=(0,Ta.useRef)(null),u=(0,Ta.useRef)(null),p=(0,Ta.useRef)(null),m=(0,Ta.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?Gr.formatDate(o.tooltipData.dateTimestamp,e):"",h=(0,Ta.useCallback)(()=>{c.current=null,s(null),a(null)},[]);(0,Ta.useEffect)(()=>{p.current=o},[o]);let b=(0,Ta.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,T=S.offsetHeight,F=o.anchorEl.getBoundingClientRect(),k=Np(),P=10,E=8,C=F.top+F.height/2,L=T/2,z=E+L,G=window.innerHeight-E-L,Q=Number.isFinite(z)&&Number.isFinite(G)&&G>=z?Xc(C,z,G):Xc(C,E,window.innerHeight-E),R=window.innerWidth-F.right-E,O=F.left-E,D=w+P,x=R>=D,B=O>=D,I=k;k==="right"&&!x&&B?I="left":k==="left"&&!B&&x?I="right":!B&&!x&&(I=R>=O?"right":"left");let A=E,N=window.innerWidth-E-w,M=I==="right"?F.right+P:F.left-P-w;Number.isFinite(A)&&Number.isFinite(N)&&N>=A&&(M=Xc(M,A,N)),s({top:Q,left:M,transform:"translateY(-50%)",visibility:"visible"})},[o]);(0,Ta.useLayoutEffect)(()=>{b()},[b]),(0,Ta.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,Ta.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 y=(0,Ta.useCallback)((S,w)=>{c.current!==S&&(c.current=S,s(null));let T=p.current,F=T&&T.anchorEl===S?T.tooltipData:null,k=F!==null&&Foe(F,w),P=w.previewPath;!k&&w.previewEnabled&&P&&t&&$(()=>t.ensurePreviewTextLoaded(P)),a(E=>{if(E&&E.anchorEl===S){let C=E.tooltipData;if(Foe(C,w))return E}return{anchorEl:S,tooltipData:w}})},[t]),v=(0,Ta.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:y,handleHideTooltip:v,clearHoverTooltip:h}}var Ta,Noe=U(()=>{Ta=he(Ve());st();Id();Ts();SD()});function Ioe({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,resolveNoteTarget:y}){let v=(0,Qc.useRef)(y);v.current=y;let S=(0,Qc.useCallback)(()=>{!r||!t.workspace.leftSplit||t.workspace.leftSplit.collapse()},[t,r]),w=(0,Qc.useCallback)(L=>Cw(L,o),[o]),T=(0,Qc.useCallback)(async(L,z)=>{if(z?.context){await Vr({app:t,commandQueue:e,file:L,context:z.context});return}p(L,{active:!0})},[t,e,p]),F=(0,Qc.useCallback)(L=>{let z=t.vault.getAbstractFileByPath(L);return v.current(L,z instanceof wD.TFile?z:null)},[t.vault]),k=(0,Qc.useCallback)((L,z,G)=>{let Q=w(L),R=Nw({kind:L,date:z,resolverContext:Q,calendarLocale:l,weekLocale:c,customCalendarRootFolderSettings:u,momentApi:i});if(!R){oe(Q.config.parsingErrorText);return}m();let O=F(R.filePath);if(O.isHidden){oe(d.navigationCalendar.noteHiddenByProfile);return}let D=O.visibleFile;if(D){$(()=>T(D,G)),S();return}let x=async()=>{let I=F(R.filePath);if(I.isHidden){oe(d.navigationCalendar.noteHiddenByProfile);return}if(I.visibleFile){await T(I.visibleFile,G),S();return}let A;try{let N=ib(L,o);A=await sb(t,R.folderPath,R.fileName,N)}catch(N){console.error("Failed to create calendar note",N),oe(d.common.unknownError);return}g(),await T(A,G),S()},B=()=>$(()=>x());if(o.calendarConfirmBeforeCreate){new Pn(t,d.paneHeader.newNote,d.navigationCalendar.createDailyNote.message.replace("{filename}",R.filePath),B,d.navigationCalendar.createDailyNote.confirmButton,{confirmButtonClass:"mod-cta"}).open();return}B()},[t,m,S,u,l,w,i,g,T,F,o,c]),P=(0,Qc.useCallback)((L,z)=>{if(o.calendarIntegrationMode==="daily-notes"){let G=a;if(!G){oe(d.navigationCalendar.dailyNotesNotEnabled);return}let Q=L.clone().locale(s),R=sR(Q,G),O=Yb(Q,G),D=F(O);if(D.isHidden){oe(d.navigationCalendar.noteHiddenByProfile);return}let x=D.visibleFile;if(x){$(()=>T(x,z)),S();return}let B=async()=>{let I=F(O);if(I.isHidden){oe(d.navigationCalendar.noteHiddenByProfile);return}if(I.visibleFile){await T(I.visibleFile,z),S();return}let A=await Xb(t,Q,G);A&&(g(),await T(A,z),S())};if(o.calendarConfirmBeforeCreate){new Pn(t,d.navigationCalendar.createDailyNote.title,d.navigationCalendar.createDailyNote.message.replace("{filename}",R),()=>{$(B)},d.navigationCalendar.createDailyNote.confirmButton,{confirmButtonClass:"mod-cta"}).open();return}$(()=>B());return}k("day",L,z)},[t,S,s,a,g,T,k,F,o]),E=(0,Qc.useCallback)((L,z)=>{L.addItem(G=>{mt(G.setTitle(d.contextMenu.file.openInNewTab).setIcon("lucide-file-plus"),async()=>{await Vr({app:t,commandQueue:e,file:z,context:"tab"})})}),L.addItem(G=>{mt(G.setTitle(d.contextMenu.file.openToRight).setIcon("lucide-separator-vertical"),async()=>{await Vr({app:t,commandQueue:e,file:z,context:"split"})})}),r||L.addItem(G=>{mt(G.setTitle(d.contextMenu.file.openInNewWindow).setIcon("lucide-external-link"),async()=>{await Vr({app:t,commandQueue:e,file:z,context:"window"})})})},[t,e,r]),C=(0,Qc.useCallback)((L,z)=>{if(L.preventDefault(),L.stopPropagation(),m(),z.note.isHidden){oe(d.navigationCalendar.noteHiddenByProfile);return}let G=new wD.Menu,Q=z.currentMonthHighlightDayIso===z.dayIso,R=z.note.visibleFile;R&&(E(G,R),G.addSeparator());let O=!1;if(f&&z.kind==="day"&&z.hasFeatureImage&&z.monthKey&&z.dayIso){let{monthKey:D,dayIso:x}=z;Q||(O=!0,G.addItem(B=>{B.setTitle(d.contextMenu.file.setCalendarHighlight).setIcon("lucide-image").onClick(()=>{$(()=>h(D,x))})})),Q&&(O=!0,G.addItem(B=>{B.setTitle(d.contextMenu.file.removeCalendarHighlight).setIcon("lucide-image-off").onClick(()=>{$(()=>b(D))})}))}R?(O&&G.addSeparator(),G.addItem(D=>{D.setTitle(d.contextMenu.file.deleteNote).setIcon("lucide-trash").setWarning(!0).onClick(()=>{$(()=>n.deleteFile(R,o.confirmBeforeDelete,()=>{g(),S()}))})})):G.addItem(D=>{D.setTitle(d.contextMenu.folder.newNote).setIcon(Qn(o.interfaceIcons,"list-new-note","lucide-pen-box")).setDisabled(!z.canCreate).onClick(()=>{if(z.canCreate){if(z.kind==="day"){$(()=>P(z.date));return}$(()=>k(z.kind,z.date))}})}),G.showAtMouseEvent(L.nativeEvent)},[E,m,S,n,g,k,P,b,h,f,o.confirmBeforeDelete,o.interfaceIcons]);return{openOrCreateCustomCalendarNote:k,openOrCreateDailyNote:P,showCalendarNoteContextMenu:C}}var Qc,wD,xoe=U(()=>{Qc=he(Ve()),wD=require("obsidian");Oe();$a();st();PP();$c();bn();_u();lb();lr();sK()});function Eoe(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 fIe(t){let n=t.getActiveViewOfType(ms.FileView)?.file;return n instanceof ms.TFile?n:null}function Roe(t,e){let n=fIe(t),r=e instanceof ms.TFile?e:n;return r?r.path:null}function yIe(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 ms.FileView))return;let a=o.file;a instanceof ms.TFile&&a.path===e&&(n=!0)}),n}function vIe(t){return t.replace(/\.md$/iu,"")}function Cm({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}=vt(),m=yt(),g=bl(),{showHiddenItems:f}=jt(),h=m.calendarShowHiddenItems||f,b=nn(m),y=b.periodicNotesFolder,v=b.hiddenFolders,S=b.hiddenFileProperties.length>0,w=b.hiddenFileTags.length>0,T=(0,Xe.useMemo)(()=>({calendarCustomRootFolder:y}),[y]),F=n??m.calendarWeeksToShow,k=!m.calendarShowOutsideMonthDays&&Xc(F,1,6)===6,P=xJ(),[E,C]=(0,Xe.useState)(()=>mr()),L=P?.getDB()??E,z=P?.regenerateFeatureImageForFile,G=rp(),Q=(0,Xe.useId)(),R=ro(),[O]=(0,Xe.useState)(()=>p.getCalendarCursorDateIso()),[D]=(0,Xe.useState)(()=>Eoe(R,O)),[x,B]=(0,Xe.useState)(()=>D),[I,A]=(0,Xe.useState)(()=>D?.year()??null),N=qA(),[M,H]=(0,Xe.useState)(()=>Roe(s.workspace)??null),[q,X]=(0,Xe.useState)(0),[V,j]=(0,Xe.useState)(0),[_,W]=(0,Xe.useState)(0),[J,Z]=(0,Xe.useState)(0),[re,Y]=(0,Xe.useState)(0),[ne,le]=(0,Xe.useState)(0),ae=(0,Xe.useMemo)(()=>_v(s,m,{showHiddenItems:!1}),[s,m]),ve=(0,Xe.useCallback)((ge,ke)=>Soe({existingFile:ke,targetPath:ge,hiddenFolders:v,showHiddenItems:h,isExistingFileVisible:ae}),[v,ae,ne,h]),de=(0,Xe.useRef)(new Set),Pe=(0,Xe.useRef)(new Set),Fe=(0,Xe.useRef)(new Set),te=(0,Xe.useRef)(new Map),ye=(0,Xe.useRef)(new Set),ce=(0,Xe.useRef)(null),pe=(0,Xe.useRef)(O!==null),ue=(0,Xe.useRef)({resolver:null,targets:new Map}),Se=(0,Xe.useRef)(new Set),ee=(0,Xe.useRef)(null),ie=(0,Xe.useCallback)(()=>{if(typeof window>"u"){le(ge=>ge+1);return}ee.current===null&&(ee.current=window.requestAnimationFrame(()=>{ee.current=null,le(ge=>ge+1)}))},[]),Ce=(0,Xe.useRef)(null),we=(0,Xe.useCallback)(()=>{if(ue.current.targets.clear(),typeof window>"u"){X(ge=>ge+1);return}Ce.current===null&&(Ce.current=window.setTimeout(()=>{Ce.current=null,X(ge=>ge+1)},120))},[]),Le=(0,Xe.useCallback)(ge=>{let ke=Roe(s.workspace,ge);H(Re=>Re===ke?Re:ke!==null?ke:Re&&yIe(s.workspace,Re)?Re:null)},[s.workspace]),We=(0,Xe.useCallback)(ge=>{if(Toe({regenerationKeys:ye.current,filePath:ge.file.path,featureImageKey:ge.key})){if(z){z(ge.file);return}o?.(ge)}},[o,z]),Nt=(0,Xe.useCallback)(ge=>ge instanceof ms.TFile?ge.extension==="md":!0,[]),{hoverTooltip:Pt,hoverTooltipStyle:Zt,hoverTooltipRef:ze,hoverTooltipStateRef:Ie,hoverTooltipPreviewText:De,shouldShowHoverTooltipPreview:Me,hoverTooltipDateText:nt,handleShowTooltip:Ge,handleHideTooltip:Tt,clearHoverTooltip:gt}=Coe({db:L,dateFormat:m.dateFormat,isMobile:u,previewVersion:J});(0,Xe.useEffect)(()=>{if(P||E)return;let ge=!0;return $(async()=>{for(;ge&&!Ps();){let ke=await R2();if(!ge)return;if(ke){C(ke);return}await new Promise(Re=>{window.setTimeout(Re,250)})}}),()=>{ge=!1}},[E,P]),(0,Xe.useEffect)(()=>()=>{typeof window<"u"&&ee.current!==null&&(window.cancelAnimationFrame(ee.current),ee.current=null)},[]),(0,Xe.useEffect)(()=>{let ge=GS({workspace:s.workspace,commandQueue:l,onChange:({candidateFile:ke})=>{Le(ke)}});return Le(),()=>{ge()}},[s.workspace,l,Le]),(0,Xe.useEffect)(()=>{let ge=Rt=>{Nt(Rt)&&we()},ke=s.vault.on("create",ge),Re=s.vault.on("delete",ge),qe=s.vault.on("rename",ge);return()=>{s.vault.offref(ke),s.vault.offref(Re),s.vault.offref(qe),typeof window<"u"&&Ce.current!==null&&(window.clearTimeout(Ce.current),Ce.current=null)}},[s.vault,we,Nt]),(0,Xe.useEffect)(()=>{if(L)return L.onContentChange(ge=>{let ke=de.current,Re=Pe.current,qe=Ie.current,Rt=qe&&qe.tooltipData.previewEnabled?qe.tooltipData.previewPath:null,sr=m.calendarShowFeatureImage&&Re.size>0,Dr=m.calendarShowTasks&&ke.size>0,Mo=!!Rt,ci=!h&&(S||w),To=!sr,ko=!Dr,js=!Mo,bd=!ci;for(let Yn of ge){let Hi=Yn.changes.featureImage!==void 0||Yn.changes.featureImageKey!==void 0||Yn.changes.featureImageStatus!==void 0;if(Hi&&koe(ye.current,Yn.path),!js&&Rt&&Yn.path===Rt&&Yn.changes.preview!==void 0&&(js=!0),!ko&&ke.has(Yn.path)&&Yn.changes.taskUnfinished!==void 0&&(ko=!0),!To&&Re.has(Yn.path)&&Hi&&(To=!0),!bd&&Se.current.has(Yn.path)&&(S&&Yn.metadataHiddenChanged===!0||w&&Yn.changes.tags!==void 0)&&(bd=!0),To&&ko&&js&&bd)break}sr&&To&&j(Yn=>Yn+1),Dr&&ko&&W(Yn=>Yn+1),Mo&&js&&Z(Yn=>Yn+1),ci&&bd&&ie()})},[L,S,w,Ie,m.calendarShowFeatureImage,m.calendarShowTasks,ie,h]),(0,Xe.useEffect)(()=>{if(h||!S&&!w)return;let ge=s.metadataCache.on("changed",ke=>{!(ke instanceof ms.TFile)||!Se.current.has(ke.path)||ie()});return()=>{s.metadataCache.offref(ge)}},[s.metadataCache,S,w,ie,h]),(0,Xe.useEffect)(()=>{let ge=m.frontmatterNameField.trim();if(!m.useFrontmatterMetadata||ge.length===0)return;let ke=s.metadataCache.on("changed",Re=>{if(!(Re instanceof ms.TFile)||!Fe.current.has(Re.path))return;let qe=te.current.get(Re.path)??"",Rt=rB(s,Re,ge).trim();qe!==Rt&&Y(sr=>sr+1)});return()=>{s.metadataCache.offref(ke)}},[s,s.metadataCache,m.frontmatterNameField,m.useFrontmatterMetadata]),(0,Xe.useEffect)(()=>{if(!R||x)return;let ge=p.getCalendarCursorDateIso();ge!==null&&(pe.current=!0),B(Eoe(R,ge))},[x,R,p]),(0,Xe.useEffect)(()=>{x&&p.setCalendarCursorDateIso(SC(x))},[x,p]),(0,Xe.useEffect)(()=>{x&&A(ge=>ge===x.year()?ge:x.year())},[x]);let wn=Vi(),{displayLocale:it,calendarRulesLocale:yn}=(0,Xe.useMemo)(()=>Ip(m.calendarLocale,R,wn),[wn,R,m.calendarLocale]),rt=ku(R),me=xp(m.calendarPeriodicNotesLocaleSource,yn,R);(0,Xe.useEffect)(()=>{B(ge=>ge?.clone().locale(it)??ge)},[it]);let se=m.calendarIntegrationMode==="notebook-navigator",fe=se&&m.calendarCustomWeekPattern.trim()!=="",Ne=se&&m.calendarCustomMonthPattern.trim()!=="",xe=se&&m.calendarCustomQuarterPattern.trim()!=="",Be=se&&m.calendarCustomYearPattern.trim()!=="",dt=(0,Xe.useMemo)(()=>fe&<(m.calendarCustomWeekPattern)==="isoWeek"?"iso":"locale",[m.calendarCustomWeekPattern,fe]),St=(0,Xe.useMemo)(()=>{if(dt==="iso"||!R)return 1;let ke=R().locale(yn).localeData().firstDayOfWeek();return typeof ke=="number"&&Number.isInteger(ke)&&ke>=0&&ke<=6?ke:1},[yn,dt,R]),ln=(0,Xe.useMemo)(()=>{if(!R)return[];let ge=St,Re=R().locale(it).localeData().weekdaysMin();return!Array.isArray(Re)||Re.length!==7?[]:[...Re.slice(ge),...Re.slice(0,ge)].map(Rt=>Array.from(Rt.trim())[0]??"")},[it,R,St]),vn=(0,Xe.useMemo)(()=>m.calendarIntegrationMode!=="daily-notes"?null:zg(s),[s,m.calendarIntegrationMode,q]),In=(0,Xe.useMemo)(()=>Cw("day",m),[m]),eo=(0,Xe.useMemo)(()=>R?m.calendarIntegrationMode==="notebook-navigator"&&In.config.isPatternValid(In.momentPattern,R):!1,[In,R,m.calendarIntegrationMode]),Dt=(0,Xe.useCallback)((ge,ke)=>{let Re=Cw(ge,m),qe=Nw({kind:ge,date:ke,resolverContext:Re,calendarLocale:me,weekLocale:me,customCalendarRootFolderSettings:T,momentApi:R});if(!qe)return ve(null,null);let Rt=s.vault.getAbstractFileByPath(qe.filePath),sr=Rt instanceof ms.TFile?Rt:null;return ve(qe.filePath,sr)},[s.vault,T,R,me,ve,m]),an=(0,Xe.useCallback)(ge=>{let ke;if(eo)ke=Dt("day",ge);else if(m.calendarIntegrationMode==="daily-notes"&&vn){let Re=ge.clone().locale(rt),qe=Yb(Re,vn),Rt=$b(s,Re,vn);ke=ve(qe,Rt)}else ke=ve(null,null);return ke},[s,eo,vn,rt,Dt,ve,m.calendarIntegrationMode]),Sn=(0,Xe.useCallback)(ge=>{let ke=ue.current;ke.resolver!==an&&(ke.resolver=an,ke.targets.clear());let Re=SC(ge),qe=ke.targets.get(Re);if(qe!==void 0)return qe;let Rt=an(ge);return ke.targets.set(Re,Rt),Rt},[an]),_r=(0,Xe.useCallback)(ge=>{if(!R||!ge.toLowerCase().endsWith(".md"))return null;let ke=(0,ms.normalizePath)(ge),Re=vIe(ke);if(m.calendarIntegrationMode==="daily-notes"){if(!vn)return null;let ci=AT(vn.folder),To=ci?`${ci}/${vn.format}`:vn.format,ko=R(Re,To,rt,!0);if(!ko.isValid())return null;let js=(0,ms.normalizePath)(vn.folder.trim()).replace(/^\/+/u,"").replace(/\/+$/u,"");if(`${(0,ms.normalizePath)(js?`${js}/${ko.format(vn.format)}`:ko.format(vn.format))}.md`!==ke)return null;let Yn=ko.startOf("day");return Sn(Yn).visibleFile?.path===ke?Yn:null}if(!eo)return null;let qe=AT(T.calendarCustomRootFolder),Rt=qe?`${qe}/${In.momentPattern}`:In.momentPattern,sr=R(Re,Rt,me,!0);if(!sr.isValid())return null;let Dr=sr.startOf("day");return Sn(Dr).visibleFile?.path!==ke?null:Dr},[eo,T.calendarCustomRootFolder,vn,rt,In.momentPattern,Sn,R,me,m.calendarIntegrationMode]),Gn=(0,Xe.useCallback)(ge=>{if(!R||m.calendarIntegrationMode!=="notebook-navigator")return null;let ke=[{kind:"week",enabled:fe,parseLocale:me},{kind:"month",enabled:Ne,parseLocale:me},{kind:"quarter",enabled:xe,parseLocale:me},{kind:"year",enabled:Be,parseLocale:me}];for(let{enabled:Re,kind:qe,parseLocale:Rt}of ke){if(!Re)continue;let sr=Cw(qe,m),Dr=woe({filePath:ge,kind:qe,resolverContext:sr,calendarLocale:me,weekLocale:me,customCalendarRootFolderSettings:T,momentApi:R,parseLocale:Rt});if(!(!Dr||Dt(qe,Dr).visibleFile?.path!==(0,ms.normalizePath)(ge)))switch(qe){case"week":return{date:Dr.clone().locale(me).startOf(LT(sr.momentPattern)),shouldAutoReveal:wC(qe)};case"month":return{date:Dr.clone().locale(it).startOf("month"),shouldAutoReveal:wC(qe)};case"quarter":return{date:Dr.clone().locale(it).startOf("quarter"),shouldAutoReveal:wC(qe)};case"year":return{date:Dr.clone().locale(it).startOf("year"),shouldAutoReveal:wC(qe)}}}return null},[it,Dt,R,me,m,fe,Ne,xe,Be,T]),mn=(0,Xe.useMemo)(()=>{if(!R||!x)return[];let ge=Xc(F,1,6),ke=x.clone().startOf("day"),Re=ke.month(),qe=ke.year(),{windowStart:Rt,weekCount:sr}=ooe({cursor:ke,weekStartsOn:St,weeksToShow:ge,alwaysRenderSixWeeks:i}),Dr=[];for(let Mo=0;Mo{if(!M)return null;for(let ke of mn)for(let Re of ke.days)if(Re.note.visibleFile?.path===M)return{date:Re.date.clone().startOf("day").locale(it),shouldAutoReveal:!0};let ge=_r(M);return ge?{date:ge,shouldAutoReveal:!0}:Gn(M)},[M,it,_r,Gn,mn]),Zn=M&&ir?`${M}::${SC(ir.date)}`:null;(0,Xe.useLayoutEffect)(()=>{if(!ir||!Zn||!ir.shouldAutoReveal){ce.current=null,pe.current=!1;return}if(pe.current){pe.current=!1,ce.current=Zn;return}ce.current!==Zn&&(ce.current=Zn,B(ge=>{let ke=ir.date.clone().startOf("day").locale(it);return ge&&ge.year()===ke.year()&&ge.month()===ke.month()?ge:ke}))},[ir,Zn,it]);let Fr=(0,Xe.useMemo)(()=>{let ge=new Set;for(let ke of mn)for(let Re of ke.days)Re.note.visibleFile&&ge.add(Re.note.visibleFile.path);return ge},[mn]),co=(0,Xe.useMemo)(()=>{let ge=new Map;if(!L||!m.calendarShowFeatureImage)return ge;for(let ke of mn)for(let Re of ke.days){let qe=Re.note.visibleFile;if(!qe)continue;let Rt=L.getFile(qe.path),sr=Rt?.featureImageKey??null;(Rt?.featureImageStatus??null)==="has"&&sr&&sr!==""&&ge.set(Re.iso,sr)}return ge},[L,V,m.calendarShowFeatureImage,mn]),Cr=(0,Xe.useMemo)(()=>{let ge=[];if(!m.calendarShowFeatureImage)return ge;for(let ke of mn)for(let Re of ke.days){let qe=Re.note.visibleFile;if(!qe)continue;let Rt=co.get(Re.iso);Rt&&ge.push({id:Re.iso,file:qe,key:Rt})}return ge},[co,m.calendarShowFeatureImage,mn]),ud=(0,Xe.useMemo)(()=>{let ge=new Map;if(!L||!m.calendarShowTasks)return ge;for(let ke of mn)for(let Re of ke.days)oK(ge,Re.iso,Re.note.visibleFile,L);return ge},[L,m.calendarShowTasks,_,mn]),Ye=i&&m.calendarShowYearCalendar,bt=(0,Xe.useMemo)(()=>Xc(F,1,6)===6&&Ye?6:mn.length,[Ye,mn.length,F]),Wt=Math.max(0,bt-mn.length);(0,Xe.useLayoutEffect)(()=>{mn.length!==0&&t?.(bt)},[t,bt,mn.length]);let Ze=(0,Xe.useMemo)(()=>{if(!m.useFrontmatterMetadata||m.frontmatterNameField.trim().length===0)return new Map;let ge=new Map;for(let ke of mn)for(let Re of ke.days){let qe=Re.note.visibleFile;if(!qe)continue;let Rt=rB(s,qe,m.frontmatterNameField).trim();Rt&&ge.set(qe.path,Rt)}return ge},[s,re,m.frontmatterNameField,m.useFrontmatterMetadata,mn]);te.current=Ze;let Vt=dK({db:L,showFeatureImages:m.calendarShowFeatureImage,targets:Cr,maxConcurrentLoads:u?4:6,onMissingFeatureImage:We}),xn=(0,Xe.useCallback)(ge=>{if(!R)return;gt();let ke=Xc(F,1,6),Re=ke===6?"month":"week",qe=ke===6?ge:ge*ke;B(Rt=>(Rt??R().startOf("day").locale(it)).clone().add(qe,Re).locale(it)),e?.()},[gt,it,R,e,F]),gn=(0,Xe.useCallback)(ge=>{gt(),A(ke=>(ke??x?.year()??R?.().startOf("day").year()??new Date().getFullYear())+ge),e?.()},[gt,x,R,e]),ur=(0,Xe.useCallback)(()=>{let ge=m.multiSelectModifier==="optionAlt"?d.navigationCalendar.helpModal.dateFilterOptionAlt:d.navigationCalendar.helpModal.dateFilterCmdCtrl;new kh(s,{title:d.navigationCalendar.helpModal.title,items:[...d.navigationCalendar.helpModal.items,ge]}).open()},[s,m.multiSelectModifier]),jn=(0,Xe.useCallback)((ge,ke,Re)=>{if(!r||!roe(ge,m.multiSelectModifier))return!1;let qe=noe(ke,Re);return qe?(ge.preventDefault(),ge.stopPropagation(),gt(),r(qe),!0):!1},[gt,r,m.multiSelectModifier]),Ia=(0,Xe.useCallback)((ge,ke)=>{jn(ge,"month",ke)||(gt(),B(ke.clone().startOf("day").locale(it)),A(ke.year()),e?.())},[gt,it,jn,e]),ft=(0,Xe.useCallback)(ge=>ge.button!==1?!1:(ge.preventDefault(),ge.stopPropagation(),gt(),!0),[gt]),Tn=(0,Xe.useCallback)(()=>{we()},[we]),Jn=(0,Xe.useCallback)(async(ge,ke)=>{await g(Re=>{let qe=He(Re.calendarMonthHighlights,Hn);qe[ge]=ke,Re.calendarMonthHighlights=qe})},[g]),qn=(0,Xe.useCallback)(async ge=>{await g(ke=>{let Re=He(ke.calendarMonthHighlights,Hn);delete Re[ge],ke.calendarMonthHighlights=Re})},[g]),ii=m.calendarShowFeatureImage&&Ye,{openOrCreateCustomCalendarNote:er,openOrCreateDailyNote:Ii,showCalendarNoteContextMenu:hs}=Ioe({app:s,commandQueue:l,fileSystemOps:c,isMobile:u,settings:m,dailyNoteSettings:vn,momentApi:R,dailyNoteLocale:rt,calendarLocale:me,weekLocale:me,customCalendarRootFolderSettings:T,openFile:G,clearHoverTooltip:gt,onVaultChange:Tn,showMonthHighlightActions:ii,setCalendarMonthHighlight:Jn,removeCalendarMonthHighlight:qn,resolveNoteTarget:ve}),rc=(0,Xe.useCallback)(()=>{if(!R)return;let ge=R().startOf("day").locale(it);gt(),B(ge.clone()),e?.(),Sn(ge).existingFile&&Ii(ge)},[gt,it,Sn,R,e,Ii]),si=m.calendarShowWeekNumber,iu=m.calendarHighlightToday,su=i&&Ye,xa=!i||!Ye,Wo=m.showInfoButtons&&!Xa()&&su,pp=!1,to=su&&m.calendarShowQuarter,xi=!su,Am=!0,pd=Wo,lu=!1,no=I??x?.year()??null,Ea=(0,Xe.useMemo)(()=>{if(!R||no===null||!Ye)return[];let ge=[];for(let ke=0;ke<12;ke++){let Re=R(new Date(no,ke,1)).startOf("day").locale(it),qe=new Date(no,ke+1,0).getDate(),Rt=[],sr=[];for(let Dr=1;Dr<=qe;Dr++){let Mo=Re.clone().set({date:Dr}),ci=Sn(Mo),To=ci.visibleFile;ci.existingFile&&sr.push(ci.existingFile),To&&Rt.push(To)}ge.push({date:Re,dayFiles:Rt,existingDayFiles:sr,fullLabel:Re.format("MMMM"),hasDailyNote:Rt.length>0,key:Re.format("YYYY-MM"),monthIndex:ke,shortLabel:Re.format("MMM")})}return ge},[it,no,Sn,R,Ye,q]),du=(0,Xe.useMemo)(()=>Ea.map(ge=>({date:ge.date,fullLabel:ge.fullLabel,hasDailyNote:ge.hasDailyNote,hasUnfinishedTasks:L&&m.calendarShowTasks?ge.dayFiles.some(ke=>(L.getFile(ke.path)?.taskUnfinished??0)>0):!1,key:ge.key,monthIndex:ge.monthIndex,shortLabel:ge.shortLabel})),[L,m.calendarShowTasks,_,Ea]),md=(0,Xe.useMemo)(()=>{let ge=new Map;if(!R||!Ye)return ge;for(let ke of Ea){let Re=m.calendarMonthHighlights[ke.key]??null;if(Re){let qe=R(Re,"YYYY-MM-DD",!0);if(qe.isValid()&&qe.format("YYYY-MM")===ke.key){let Rt=Sn(qe.startOf("day")).visibleFile;Rt&&ge.set(ke.key,Rt)}continue}if(ke.hasDailyNote&&L)for(let qe of ke.dayFiles){let Rt=L.getFile(qe.path),sr=Rt?.featureImageKey??null;if(!((Rt?.featureImageStatus??null)!=="has"||!sr||sr==="")){ge.set(ke.key,qe);break}}}return ge},[L,V,Sn,R,m.calendarMonthHighlights,Ye,Ea]),gd=(0,Xe.useMemo)(()=>{let ge=[];return!L||!m.calendarShowFeatureImage||md.forEach((ke,Re)=>{let qe=L.getFile(ke.path),Rt=qe?.featureImageKey??null;(qe?.featureImageStatus??null)!=="has"||!Rt||Rt===""||ge.push({id:Re,file:ke,key:Rt})}),ge},[L,V,md,m.calendarShowFeatureImage]);(0,Xe.useEffect)(()=>{let ge=new Set;for(let Re of[...Cr,...gd]){let qe=lK(Re.file.path,Re.key);qe&&ge.add(qe)}let ke=ye.current;for(let Re of ke)ge.has(Re)||ke.delete(Re)},[Cr,gd]);let mp=(0,Xe.useMemo)(()=>{let ge=new Set;return gd.forEach(ke=>{ge.add(ke.id)}),ge},[gd]),Il=(0,Xe.useMemo)(()=>{let ge=new Set;return md.forEach(ke=>{ge.add(ke.path)}),ge},[md]),Dm=dK({db:L,showFeatureImages:m.calendarShowFeatureImage&&Ye,targets:gd,maxConcurrentLoads:u?2:4,onMissingFeatureImage:We}),ta=(0,Xe.useMemo)(()=>!R||!x||no===null?null:x.clone().set({year:no}).locale(it),[x,it,no,R]),uo=(0,Xe.useMemo)(()=>{if(!R||!x){let Rt=ve(null,null);return{month:Rt,quarter:Rt,year:Rt}}let ge=x.clone().locale(it),ke=Ne?Dt("month",ge):ve(null,null),Re=Be?Dt("year",ge):ve(null,null),qe=m.calendarShowQuarter&&xe?Dt("quarter",ge):ve(null,null);return{month:ke,quarter:qe,year:Re}},[x,it,Dt,R,Ne,xe,m.calendarShowQuarter,ve,q,Be]),wo=(0,Xe.useCallback)(ge=>{switch(ge){case"month":return{note:uo.month,canCreate:Ne};case"quarter":return{note:uo.quarter,canCreate:m.calendarShowQuarter&&xe};case"year":return{note:uo.year,canCreate:Be}}},[uo.month,uo.quarter,uo.year,Ne,xe,m.calendarShowQuarter,Be]),Ws=(0,Xe.useCallback)((ge,ke)=>{if(ge.button===1||!x)return;let Re=x.clone().locale(it);if(jn(ge,ke,Re))return;let{canCreate:qe}=wo(ke);qe&&er(ke,Re)},[x,it,wo,jn,er]),Om=(0,Xe.useCallback)((ge,ke)=>{if(!ft(ge)||!x)return;let Re=x.clone().locale(it),{canCreate:qe}=wo(ke);qe&&er(ke,Re,{context:"tab"})},[x,it,wo,ft,er]),fs=(0,Xe.useCallback)((ge,ke)=>{if(!x)return;let{note:Re,canCreate:qe}=wo(ke);hs(ge,{kind:ke,date:x.clone().locale(it),note:Re,canCreate:qe})},[x,it,wo,hs]),li=(0,Xe.useMemo)(()=>!ta||!Be?ve(null,null):Dt("year",ta),[Dt,ve,q,Be,ta]),cu=(0,Xe.useCallback)(ge=>{ge.button!==1&&ta&&(jn(ge,"year",ta)||Be&&er("year",ta))},[jn,er,Be,ta]),ma=(0,Xe.useCallback)(ge=>{!ft(ge)||!ta||Be&&er("year",ta,{context:"tab"})},[ft,er,Be,ta]),Lm=(0,Xe.useCallback)(ge=>{ta&&hs(ge,{kind:"year",date:ta,note:li,canCreate:Be})},[hs,Be,ta,li]),Ei=(0,Xe.useMemo)(()=>{if(!R||!x)return new Map;if(!si||!fe)return new Map;let ge=new Map;for(let ke of mn){let Re=ke.days[0]?.date;if(!Re)continue;let qe=Re.clone().locale(it),Rt=Dt("week",qe);ge.set(ke.key,Rt)}return ge},[x,it,Dt,R,si,q,fe,mn]),ys=(0,Xe.useMemo)(()=>{if(!L||!m.calendarShowTasks)return new Map;let ge=new Map;return Ei.forEach((ke,Re)=>{oK(ge,Re,ke.visibleFile,L)}),ge},[L,m.calendarShowTasks,_,Ei]),hd=(0,Xe.useMemo)(()=>{let ge=new Map;for(let ke of mn)for(let Re of ke.days){let qe=Re.note.visibleFile;qe&&ge.set(qe.path,qe)}Ei.forEach(ke=>{let Re=ke.visibleFile;Re&&ge.set(Re.path,Re)});for(let ke of Ea)for(let Re of ke.dayFiles)ge.set(Re.path,Re);return Array.from(ge.values()).filter(ke=>ke.extension==="md")},[Ei,mn,Ea]),oc=(0,Xe.useMemo)(()=>{let ge=new Set,ke=Re=>{Re.existingFile&&ge.add(Re.existingFile.path)};for(let Re of mn)for(let qe of Re.days)ke(qe.note);for(let Re of Ea)for(let qe of Re.existingDayFiles)ge.add(qe.path);return Ei.forEach(ke),ke(uo.month),ke(uo.quarter),ke(uo.year),ke(li),M&&ge.add(M),ge},[M,uo,Ei,mn,Ea,li]);Se.current=oc,(0,Xe.useEffect)(()=>{a?.(hd)},[a,hd]);let ac=(0,Xe.useMemo)(()=>{let ge=new Set;return hd.forEach(ke=>{ge.add(ke.path)}),ge},[hd]);de.current=ac;let fd=(0,Xe.useMemo)(()=>{let ge=new Set(Fr);return Il.forEach(ke=>{ge.add(ke)}),ge},[Il,Fr]);Pe.current=fd,Fe.current=Fr;let Oh=(0,Xe.useCallback)((ge,ke)=>{if(ge.button===1)return;let Re=ke.days[0]?.date;if(!Re)return;let qe=Re.clone().locale(it);jn(ge,"week",qe)||fe&&er("week",qe)},[it,jn,er,fe]),ic=(0,Xe.useCallback)((ge,ke)=>{if(!ft(ge))return;let Re=ke.days[0]?.date;Re&&fe&&er("week",Re.clone().locale(it),{context:"tab"})},[it,ft,er,fe]),sc=(0,Xe.useCallback)((ge,ke)=>{let Re=ke.days[0]?.date;Re&&jn(ge,"week",Re.clone().locale(it))},[it,jn]),gp=(0,Xe.useCallback)((ge,ke,Re)=>{let qe=ke.days[0]?.date;qe&&hs(ge,{kind:"week",date:qe.clone().locale(it),note:Re??ve(null,null),canCreate:fe})},[it,ve,hs,fe]),uu=(0,Xe.useCallback)((ge,ke)=>{ge.button!==1&&(jn(ge,"day",ke.date)||Ii(ke.date))},[jn,Ii]),pu=(0,Xe.useCallback)((ge,ke)=>{ft(ge)&&Ii(ke.date,{context:"tab"})},[ft,Ii]),hp=(0,Xe.useCallback)((ge,ke,Re,qe)=>{let Rt=ke.date.format("YYYY-MM");hs(ge,{kind:"day",date:ke.date,note:ke.note,canCreate:Re,monthKey:Rt,dayIso:ke.iso,hasFeatureImage:qe,currentMonthHighlightDayIso:m.calendarMonthHighlights[Rt]??null})},[m.calendarMonthHighlights,hs]);if(!R||!x)return null;let lc=x.year(),mu=N?N.slice(0,7):null,yd=x.clone().locale(it),zm=m.calendarMonthHeadingFormat==="short"?"MMM":"MMMM",Bm=yd.format(zm),Gs=yd.format("YYYY"),vd=yd.format("[Q]Q"),di=m.calendarIntegrationMode!=="daily-notes"||!!vn,_i=!!(M&&uo.month.visibleFile?.path===M),xl=!!(M&&uo.quarter.visibleFile?.path===M),je=!!(M&&uo.year.visibleFile?.path===M),Bt=!!(M&&li.visibleFile?.path===M);return(0,Zc.jsxs)(Zc.Fragment,{children:[(0,Zc.jsx)(moe,{isMobile:u,hoverTooltip:Pt,hoverTooltipStyle:Zt,hoverTooltipRef:ze,hoverTooltipPreviewText:De,shouldShowHoverTooltipPreview:Me,hoverTooltipDateText:nt}),(0,Zc.jsxs)("div",{className:"nn-navigation-calendar",role:"group","aria-labelledby":Q,"data-highlight-today":iu?"true":void 0,"data-weeknumbers":si?"true":void 0,"data-split-header":"true",children:[(0,Zc.jsx)("span",{id:Q,className:"nn-visually-hidden",children:d.navigationCalendar.ariaLabel}),(0,Zc.jsx)(doe,{monthLabel:Bm,yearLabel:Gs,quarterLabel:vd,showYearInHeader:xa,showQuarter:m.calendarShowQuarter,hasMonthPeriodNote:!!uo.month.visibleFile,hasQuarterPeriodNote:!!uo.quarter.visibleFile,hasYearPeriodNote:!!uo.year.visibleFile,isMonthPeriodActive:_i,isQuarterPeriodActive:xl,isYearPeriodActive:je,showInlineMonthNavigation:pp,showCompactQuarterInMonthRow:to,showHeaderPeriodDetails:xi,showHeaderNavRow:Am,showCompactHeaderInlineInfoButton:pd,showInfoInNavRow:lu,onNavigate:xn,onToday:rc,onOpenHelp:ur,onPeriodClick:Ws,onPeriodMouseDown:Om,onPeriodContextMenu:fs}),(0,Zc.jsx)(ioe,{activeEditorFilePath:M,showWeekNumbers:si,weekdays:ln,weekStartsOn:St,trailingSpacerWeekCount:Wt,weeks:mn,hideOutsideMonthDays:k,weekNotesEnabled:fe,weekNoteTargetsByKey:Ei,weekUnfinishedTaskCountByKey:ys,displayLocale:it,calendarWeekendDays:m.calendarWeekendDays,todayIso:N,unfinishedTaskCountByIso:ud,featureImageUrls:Vt,featureImageKeysByIso:co,frontmatterTitlesByPath:Ze,dateFormat:m.dateFormat,isMobile:u,canCreateDayNotes:di,onShowTooltip:Ge,onHideTooltip:Tt,onDayClick:uu,onDayMouseDown:pu,onDayContextMenu:hp,onWeekClick:Oh,onWeekMouseDown:ic,onWeekLabelClick:sc,onWeekContextMenu:gp}),(0,Zc.jsx)(foe,{showYearCalendar:Ye,currentMonthKey:mu,displayedYearValue:no??lc,activeYearValue:lc,activeMonthIndex:x.month(),hasYearPeriodNote:!!li.visibleFile,isYearPeriodActive:Bt,yearMonthEntries:du,highlightedMonthFeatureImageKeys:mp,highlightedMonthImageUrls:Dm,onNavigateYear:gn,onYearPeriodClick:cu,onYearPeriodMouseDown:ma,onYearPeriodContextMenu:Lm,onSelectYearMonth:Ia})]})]})}var Xe,ms,Zc,hIe,Moe=U(()=>{Xe=he(Ve()),ms=require("obsidian");Oe();bD();fn();on();cs();gr();Vn();st();Cd();PP();pc();tw();c1();Kb();Cd();$r();sn();wr();NA();soe();coe();goe();yoe();sK();SD();Poe();Noe();xoe();Et();Zc=he($e()),hIe={existingFile:null,visibleFile:null,isHidden:!1,targetPath:null}});var kC=U(()=>{Moe()});var Iw,bIe,Aoe,SIe,wIe,TD,Doe=U(()=>{Iw=require("obsidian");iC();Ln();bIe=20,Aoe=/^[a-z0-9:./-]*$/i,SIe=/^[a-z0-9:./-]*/i,wIe=t=>t?/\s/.test(t)||t==="!":!0,TD=class extends Iw.AbstractInputSuggest{constructor(n,r,o){super(n,r);this.activeRange=null;this.applySuggestion=o.onApply,this.searchInputEl=r,this.limit=bIe,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 ow.slice(0,this.limit).map(s=>({token:s,match:null}));let a=(0,Iw.prepareFuzzySearch)(o),i=[];for(let s of ow){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?At(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,Iw.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(!wIe(g))return null}let s=r.slice(i+1,o);if(!Aoe.test(s))return null;let c=r.slice(o).match(SIe)?.[0]??"",u=s+c;if(!Aoe.test(u))return null;let{prefix:p,remainder:m}=nC(u);return{start:i,end:o+c.length,prefix:p,query:m}}}});var xw,TIe,Ooe,kIe,kD,Loe=U(()=>{xw=require("obsidian");Ln();Cn();TIe=50,Ooe=new RegExp(`^[^${Ff}]*$`,"u"),kIe=new RegExp(`^[^${Ff}]*`,"u"),kD=class extends xw.AbstractInputSuggest{constructor(n,r,o){super(n,r);this.activeRange=null;this.getTags=o.getTags,this.applySuggestion=o.onApply,this.searchInputEl=r,this.limit=TIe,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,xw.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?At(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,xw.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&&!QI(p))return null}let s=r.slice(i+1,o);if(!Ooe.test(s))return null;let c=r.slice(o).match(kIe)?.[0]??"",u=s+c;return Ooe.test(u)?{start:i,end:o+c.length,query:u}:null}}});function zoe({searchQuery:t,onSearchQueryChange:e,onClose:n,onFocusFiles:r,onEmptySearchExit:o,isWholeVaultSearch:a=!1,shouldFocus:i,onFocusComplete:s,containerRef:l,onSaveShortcut:c,onRemoveShortcut:u,isShortcutSaved:p,isShortcutDisabled:m,searchProvider:g}){let f=(0,Fi.useRef)(null),h=(0,Fi.useRef)(null),b=(0,Fi.useRef)(null),{isMobile:y,omnisearchService:v,app:S,tagTreeService:w,plugin:T}=vt(),F=yt(),k=So(),P=g??F.searchProvider??"internal",E=v?.isAvailable()??!1,C=P==="omnisearch"&&E,L=a&&!C,z=(0,Fi.useMemo)(()=>Je(F.interfaceIcons,"nav-shortcuts"),[F.interfaceIcons]),G=(0,Fi.useMemo)(()=>C?"text-search":L?"folder-search":Je(F.interfaceIcons,"list-search"),[C,F.interfaceIcons,L]),Q=C?d.searchInput.placeholderOmnisearch:L?d.searchInput.placeholderVault:d.searchInput.placeholder,R=t.trim().length>0,O=R&&!!(c||p&&u),D=m||!p&&!c||p&&!u,x=`nn-search-input-container${O?" nn-search-input-container--has-shortcut":""}`,B=(0,Fi.useCallback)(()=>{R||o?.()},[R,o]),I=(0,Fi.useCallback)(V=>{let j=f.current;if(!j)return;j.focus();let _=V?.start??j.selectionStart,W=V?.end??j.selectionEnd;_!==null&&W!==null&&j.setSelectionRange(_,W)},[]),A=(0,Fi.useCallback)(V=>{if(!E)return;let j=f.current,_=j?{start:j.selectionStart,end:j.selectionEnd}:void 0;T.setSearchProvider(C?"internal":"omnisearch"),V?.restoreFocus&&window.requestAnimationFrame(()=>I(_))},[E,C,T,I]);(0,Fi.useEffect)(()=>{i&&(f.current?.focus(),s&&s())},[i,s]);let N=(0,Fi.useCallback)((V,j)=>{e(V),window.requestAnimationFrame(()=>{let _=f.current;_&&(_.focus(),_.setSelectionRange(j,j))})},[e]);(0,Fi.useEffect)(()=>{let V=f.current;if(!V||!w||!F.showTags||C){h.current?.dispose(),h.current=null;return}if(h.current)return;let j=new kD(S,V,{getTags:()=>w.getFlattenedTagNodes()??[],onApply:N,isMobile:y});return h.current=j,()=>{j.dispose(),h.current=null}},[S,w,F.showTags,C,N,y]),(0,Fi.useEffect)(()=>{let V=f.current;if(!V||C){b.current?.dispose(),b.current=null;return}if(b.current)return;let j=new TD(S,V,{onApply:N,isMobile:y});return b.current=j,()=>{j.dispose(),b.current=null}},[S,N,y,C]),(0,Fi.useEffect)(()=>{t.trim().length>0||(h.current?.close(),b.current?.close())},[t]);let M=()=>{window.setTimeout(()=>{let j=(l?.current??activeDocument).querySelector(".nn-list-pane-scroller");j instanceof HTMLElement&&Gi(j)},0)},H=V=>{let j=V.nativeEvent,_=F.keyboardShortcuts,W=Reflect.get(j,"keyCode");if(!(j.isComposing||W===229)){if((V.key==="ArrowUp"||V.key==="ArrowDown")&&E){if(j.repeat||!!(h.current?.containerEl?.isConnected||b.current?.containerEl?.isConnected))return;V.preventDefault(),A({restoreFocus:!0});return}if(cn(j,_,xt.SEARCH_CLOSE)){V.preventDefault(),n(),M();return}if(cn(j,_,xt.SEARCH_FOCUS_NAVIGATION)){V.preventDefault(),B(),k({type:"ACTIVATE_PANE",target:"navigation"});return}if(cn(j,_,xt.SEARCH_FOCUS_LIST)){if(V.preventDefault(),B(),k({type:"ACTIVATE_PANE",target:"files"}),!Kn()){M();return}r&&r(),M()}}},q=()=>{k({type:"ACTIVATE_PANE",target:"search"})},X=(0,Fi.useCallback)(()=>{h.current?.close(),b.current?.close();let V=d.searchInput.searchHelpModal,j=E?`${C?V.activeOmnisearch:V.activeFilterSearch} ${V.introSwitching}`:void 0;if(C){new kh(S,{title:d.searchInput.searchHelpTitle,intro:V.omnisearchIntro,emphasizedIntro:j,sections:[V.sections.omnisearch]}).open();return}let{fileNames:_,tags:W,properties:J,tasks:Z,connectors:re,dates:Y}=V.sections,ne=[_,J,W,Y,Z,re];new kh(S,{title:d.searchInput.searchHelpTitle,intro:E?V.intro:`${V.intro} ${V.introInstallOmnisearch}`,emphasizedIntro:j,sections:ne}).open()},[S,C,E]);return(0,ad.jsx)("div",{className:"nn-search-input-wrapper",children:(0,ad.jsxs)("div",{className:x,children:[(0,ad.jsx)("div",{className:"nn-search-input-icon",role:"button",tabIndex:E?0:-1,"aria-label":C?d.searchInput.switchToFilterSearch:d.searchInput.switchToOmnisearch,style:E?void 0:{pointerEvents:"none"},onMouseDown:E?V=>{V.preventDefault()}:void 0,onClick:E?()=>A({restoreFocus:!0}):void 0,onKeyDown:E?V=>{(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),A({restoreFocus:!0}))}:void 0,children:(0,ad.jsx)(qt,{iconId:G,"aria-hidden":!0})}),(0,ad.jsx)("input",{ref:f,type:"search",className:`nn-search-input ${t?"nn-search-active":""}`,placeholder:Q,spellCheck:!1,enterKeyHint:"search",value:t,onChange:V=>e(V.target.value),onKeyDown:H,onClick:q,onBlur:B}),!R&&F.showInfoButtons&&(0,ad.jsx)("div",{className:"nn-search-help-button",role:"button",tabIndex:0,"aria-label":d.searchInput.searchHelp,onClick:()=>{X()},onKeyDown:V=>{(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),X())},children:(0,ad.jsx)(qt,{iconId:"info","aria-hidden":!0})}),O&&(0,ad.jsx)("div",{className:`nn-search-star-button ${p?"nn-search-star-button--active":""}`,role:"button",tabIndex:0,"aria-label":p?d.searchInput.removeSearchShortcut:d.searchInput.saveSearchShortcut,"aria-pressed":p||!1,onClick:()=>{if(D)return;let V=p?u:c;V&&$(V),f.current?.focus()},onKeyDown:V=>{if((V.key==="Enter"||V.key===" ")&&!D){V.preventDefault();let j=p?u:c;j&&$(j),f.current?.focus()}},children:(0,ad.jsx)(qt,{iconId:z,"aria-hidden":!0})}),R&&(0,ad.jsx)("div",{className:"nn-search-clear-button",role:"button",tabIndex:0,"aria-label":d.searchInput.clearSearch,onClick:()=>{e(""),f.current?.focus()},onKeyDown:V=>{(V.key==="Enter"||V.key===" ")&&(V.preventDefault(),e(""),f.current?.focus())},children:(0,ad.jsx)(qt,{iconId:"circle-x","aria-hidden":!0})})]})})}var Fi,ad,Boe=U(()=>{Fi=he(Ve());rd();wa();on();fn();Oe();Uh();$r();st();Doe();Loe();lr();bD();Ts();ad=he($e())});var Sy,PC,_oe,Hoe=U(()=>{Sy=he(Ve());Ur();fn();on();vD();Ue();st();Hu();Md();PC=he($e()),_oe=Sy.default.memo(function({desktopTitle:e}){let{app:n,plugin:r}=vt(),o=vl(),a=yt(),i=hr(),s=ar(),l=i.selectionType===K.FOLDER?i.selectedFolder:null,c=Fw(n.vault,l,a.enableFolderNotes&&a.enableFolderNoteLinks),u=(0,Sy.useMemo)(()=>!l||!a.enableFolderNotes||!a.enableFolderNoteLinks?null:Rn(l,{enableFolderNotes:a.enableFolderNotes,folderNoteNamePattern:a.folderNoteNamePattern}),[l,a.enableFolderNotes,a.enableFolderNoteLinks,a.folderNoteNamePattern,c]),p=(0,Sy.useCallback)(g=>{if(!l||!u)return;g.stopPropagation();let f=Iu(g,a.folderNoteOpenLocation,a.multiSelectModifier);Ai(s,u),$(()=>vi({app:n,commandQueue:o,folder:l,folderNote:u,context:f,openInRightSidebar:h=>r.openFolderNoteInRightSidebar(h)}))},[l,u,a.folderNoteOpenLocation,a.multiSelectModifier,n,o,r,s]),m=(0,Sy.useCallback)(g=>{g.button!==1||!l||!u||(g.preventDefault(),g.stopPropagation(),Ai(s,u),$(()=>vi({app:n,commandQueue:o,folder:l,folderNote:u,context:"tab"})))},[l,u,n,o,s]);return(0,PC.jsx)("div",{className:"nn-list-title-area",children:(0,PC.jsx)("div",{className:"nn-list-title-content",children:(0,PC.jsx)("span",{className:"nn-list-title-text",children:(0,PC.jsx)("span",{className:`nn-list-title-label${u?" nn-list-title-label--folder-note":""}`,onClick:u?p:void 0,onMouseDown:u?m:void 0,children:e})})})})})});function wy(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=k4({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 PD=U(()=>{Ig()});function PIe(t,e,n){return n?.startsWith("created-")?`${d.tooltips.createdAt} ${t}
${d.tooltips.lastModifiedAt} ${e}`:`${d.tooltips.lastModifiedAt} ${e}
${d.tooltips.createdAt} ${t}`}function FC({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=Gr.formatDate(c.created,l),p=Gr.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}: ${Ed(s)}`),g.push("",PIe(u,p,a)),g.join(`
`)}function CD({app:t,folder:e,displayName:n,fileVisibility:r,hiddenFolders:o,settings:a,showHiddenItems:i}){let s=0,l=0,c=Bg(a,i),u=oo(c);for(let f of e.children)f instanceof FD.TFile?bs(f,r,t)&&!oa(f,u,t)&&s++:f instanceof FD.TFolder&&(i||!wc(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 FD,ND=U(()=>{FD=require("obsidian");Oe();Id();Qb();wr();Lr();sg()});function NIe(t){let e=zr(t),n=[],r=[],o=0,a=0;for(let i of t){let s=a+i.length,l=zr(t.slice(0,s)).length;for(let c=o;c0&&(r[l-1]=s),o=l,a=s}return{foldedText:e,sourceStarts:n,sourceEnds:r}}function Ty(t,e){if(!t||e.length===0)return[];let n=NIe(t),r=[],o=new Set;for(let a of e){if(!a||o.has(a))continue;o.add(a);let i=n.foldedText.indexOf(a);for(;i!==-1;){let s=i+a.length,l=n.sourceStarts[i],c=n.sourceEnds[s-1];l!==void 0&&c!==void 0&&r.push({start:l,end:c}),i=n.foldedText.indexOf(a,i+a.length)}}return Hd(r)}function Ew(t,e){let n=[...t];return e==="include"?n.push(FIe):e==="exclude"&&n.push(CIe),n.join(" ")}var FIe,CIe,Rw=U(()=>{ll();Et();FIe="nn-navitem-content--search-include",CIe="nn-navitem-content--search-exclude"});function xIe(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}${IIe}=${Math.trunc(e)}${o}`}function CC(t,e,n=e.stat.mtime){return xIe(t.vault.getResourcePath(e),n)}var IIe,cK=U(()=>{IIe="nn-mtime"});function RIe(t){let{db:e,filePath:n,loadSnapshot:r,applySnapshot:o,onChange:a}=t,i=e.onFileContentChange(n,a);return o(r()),i}function MIe({changes:t,shouldLoadFeatureImage:e,refreshMetadataVersionOnFeatureImageChange:n}){return t.metadata!==void 0?!0:(t.featureImageKey!==void 0||t.featureImageStatus!==void 0)&&!e&&n}function Voe(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,loadTaskCounts:t?.loadTaskCounts??!0}}function AIe({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,loadTaskCounts:f}=Voe(s),h=c||u||p||m||g||f,b=l&&n&&e.extension==="md"?i.getCachedPreviewText(e.path):"",y=h?i.getFile(e.path):null,v=c?[...Br({app:t,file:e,db:i,fileData:y})]:[],S=u&&r&&!o&&qs(e),w=u&&y?.featureImageKey?y.featureImageKey:S?`direct-image:${e.path}@${a}`:null,T=u?y?.featureImageStatus??"unprocessed":"unprocessed",F=p?yk(y?.properties??null):null,k=m?y?.wordCount??null:null,P=g?y?.characterCountWithSpaces??null:null,E=g?y?.characterCountWithoutSpaces??null:null,C=f?y?.taskTotal??null:null,L=f?y?.taskUnfinished??null:null,z=null;if(S)try{z=CC(t,e,a)}catch{z=null}return{previewText:b,tags:v,featureImageKey:w,featureImageStatus:T,featureImageUrl:z,properties:F,wordCount:k,characterCountWithSpaces:P,characterCountWithoutSpaces:E,taskTotal:C,taskUnfinished:L}}function Koe(t){return{previewText:t.previewText,tags:t.tags,featureImageKey:t.featureImageKey,featureImageStatus:t.featureImageStatus,properties:t.properties,wordCount:t.wordCount,characterCountWithSpaces:t.characterCountWithSpaces,characterCountWithoutSpaces:t.characterCountWithoutSpaces,taskTotal:t.taskTotal,taskUnfinished:t.taskUnfinished,metadataVersion:0}}function DIe(t,e){let n=ao(t.tags,e.tags)?t.tags:e.tags,r=vf(t.properties,e.properties)?t.properties:e.properties;return t.previewText===e.previewText&&n===t.tags&&t.featureImageKey===e.featureImageKey&&t.featureImageStatus===e.featureImageStatus&&r===t.properties&&t.wordCount===e.wordCount&&t.characterCountWithSpaces===e.characterCountWithSpaces&&t.characterCountWithoutSpaces===e.characterCountWithoutSpaces&&t.taskTotal===e.taskTotal&&t.taskUnfinished===e.taskUnfinished?t:{...Koe(e),tags:n,properties:r,metadataVersion:t.metadataVersion}}function OIe({prev:t,changes:e,shouldLoadPreviewText:n,shouldLoadTags:r,shouldLoadFeatureImage:o,shouldLoadProperties:a,shouldLoadWordCount:i,shouldLoadCharacterCount:s,shouldLoadTaskCounts:l,showPreview:c,fileExtension:u,shouldRefreshMetadataVersion:p}){let m=t,g=()=>(m===t&&(m={...t}),m);if(e.preview!==void 0&&n&&c&&u==="md"){let f=e.preview||"";t.previewText!==f&&(g().previewText=f)}if(e.featureImageKey!==void 0&&o){let f=e.featureImageKey??null;t.featureImageKey!==f&&(g().featureImageKey=f)}if(e.featureImageStatus!==void 0&&o&&t.featureImageStatus!==e.featureImageStatus&&(g().featureImageStatus=e.featureImageStatus),e.tags!==void 0&&r){let f=e.tags??[];ao(t.tags,f)||(g().tags=[...f])}if(e.wordCount!==void 0&&i){let f=e.wordCount??null;t.wordCount!==f&&(g().wordCount=f)}if(e.characterCountWithSpaces!==void 0&&s){let f=e.characterCountWithSpaces??null;t.characterCountWithSpaces!==f&&(g().characterCountWithSpaces=f)}if(e.characterCountWithoutSpaces!==void 0&&s){let f=e.characterCountWithoutSpaces??null;t.characterCountWithoutSpaces!==f&&(g().characterCountWithoutSpaces=f)}if(e.taskTotal!==void 0&&l){let f=e.taskTotal??null;t.taskTotal!==f&&(g().taskTotal=f)}if(e.taskUnfinished!==void 0&&l){let f=e.taskUnfinished??null;t.taskUnfinished!==f&&(g().taskUnfinished=f)}if(e.properties!==void 0&&a){let f=e.properties??null;vf(t.properties,f)||(g().properties=yk(f))}return p&&(g().metadataVersion=t.metadataVersion+1),m}function Uoe({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?.loadTaskCounts,y=(0,gs.useMemo)(()=>Voe({loadPreviewText:u,loadTags:p,loadFeatureImage:m,loadProperties:g,loadWordCount:f,loadCharacterCount:h,loadTaskCounts:b}),[h,m,u,g,p,b,f]),{loadPreviewText:v,loadTags:S,loadFeatureImage:w,loadProperties:T,loadWordCount:F,loadCharacterCount:k,loadTaskCounts:P}=y,E=(0,gs.useCallback)(()=>AIe({app:t,file:e,showPreview:n,showImage:r,skipFeatureImage:o,fileStatMtime:a,db:i(),loadOptions:y}),[t,e,a,i,y,r,n,o]),C=(0,gs.useRef)(null),L=C.current??E();C.current=L;let[z,G]=(0,gs.useState)(()=>Koe(L)),[Q,R]=(0,gs.useState)(L.featureImageUrl),O=(0,gs.useRef)(null),D=(0,gs.useRef)(null);return(0,gs.useLayoutEffect)(()=>{let x=i(),B=RIe({db:x,filePath:e.path,loadSnapshot:E,applySnapshot:I=>{G(A=>DIe(A,I))},onChange:I=>{let A=MIe({changes:I,shouldLoadFeatureImage:w,refreshMetadataVersionOnFeatureImageChange:c});G(N=>OIe({prev:N,changes:I,shouldLoadPreviewText:v,shouldLoadTags:S,shouldLoadFeatureImage:w,shouldLoadProperties:T,shouldLoadWordCount:F,shouldLoadCharacterCount:k,shouldLoadTaskCounts:P,showPreview:n,fileExtension:e.extension,shouldRefreshMetadataVersion:A}))}});return v&&n&&e.extension==="md"&&x.ensurePreviewTextLoaded(e.path),()=>{B()}},[e,e.path,i,E,k,w,v,T,S,P,F,c,n]),(0,gs.useEffect)(()=>()=>{O.current&&(URL.revokeObjectURL(O.current),O.current=null)},[]),(0,gs.useEffect)(()=>{let x=!0;if(O.current&&(URL.revokeObjectURL(O.current),O.current=null),!w||!r||o)return R(null),()=>{x=!1};if(qs(e)){try{R(CC(t,e,a))}catch{R(null)}return()=>{x=!1}}if(z.featureImageStatus!=="has"||!z.featureImageKey)return R(null),()=>{x=!1};let B=i(),I=z.featureImageKey;return B.getFeatureImageBlob(e.path,I).then(A=>{if(!x)return;if(!A){R(null);let M=Date.now(),H=D.current;(!H||H.key!==I||M-H.at>=EIe)&&(D.current={key:I,at:M},s(e));return}let N=URL.createObjectURL(A);O.current=N,R(N)}),()=>{x=!1}},[t,z.featureImageKey,z.featureImageStatus,e,a,i,s,w,r,o]),{previewText:z.previewText,tags:z.tags,featureImageKey:z.featureImageKey,featureImageStatus:z.featureImageStatus,featureImageUrl:Q,properties:z.properties,wordCount:z.wordCount,characterCountWithSpaces:z.characterCountWithSpaces,characterCountWithoutSpaces:z.characterCountWithoutSpaces,taskTotal:z.taskTotal,taskUnfinished:z.taskUnfinished,metadataVersion:z.metadataVersion}}var gs,EIe,Woe=U(()=>{gs=he(Ve());Cn();Lr();_l();ll();cK();EIe=1e4});function Goe(){let t=yt(),e=la(),n=ar(),r=Wa(),o=So(),{findTagInTree:a,getPropertyTree:i}=_o(),s=(0,ID.useCallback)(u=>{o({type:"ACTIVATE_PANE",target:u})},[o]),l=(0,ID.useCallback)((u,p)=>{YF({showTags:t.showTags,showAllTagsFolder:t.showAllTagsFolder,expandedTags:e.expandedTags,expandedVirtualFolders:e.expandedVirtualFolders,collapseOtherBranchesOnExpand:t.collapseOtherBranchesOnExpand,expansionDispatch:r,selectionDispatch:n,activatePane:s,findTagInTree:a},u,{...p,preserveNavigationFocus:p?.preserveNavigationFocus??!1,requireTagInTree:p?.requireTagInTree??!1})},[n,r,e.expandedTags,e.expandedVirtualFolders,t.showAllTagsFolder,t.collapseOtherBranchesOnExpand,t.showTags,a,s]),c=(0,ID.useCallback)((u,p)=>{$F({showProperties:t.showProperties,showAllPropertiesFolder:t.showAllPropertiesFolder,propertyTree:i(),expandedProperties:e.expandedProperties,expandedVirtualFolders:e.expandedVirtualFolders,collapseOtherBranchesOnExpand:t.collapseOtherBranchesOnExpand,expansionDispatch:r,selectionDispatch:n,activatePane:s},u,{...p,preserveNavigationFocus:p?.preserveNavigationFocus??!1,requirePropertyInTree:p?.requirePropertyInTree??!1})},[r,e.expandedProperties,e.expandedVirtualFolders,i,n,t.showAllPropertiesFolder,t.collapseOtherBranchesOnExpand,t.showProperties,s]);return{navigateToTag:l,navigateToProperty:c}}var ID,joe=U(()=>{ID=he(Ve());Tl();Ur();on();wa();cs();UV();WV()});function pK(t,e,n,r){let o=r??((s,l)=>At(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 Mw(t,e,n,r){if(!n||n.size===0)return r?r(t,e):At(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):At(t.name,e.name)}function xD(t,e,n,r){if(!n||n.size===0)return r?r(t,e):At(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):At(t.name,e.name)}function qoe({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=>ZG(g,S),h=S=>(w,T)=>{let F=a?a(w):w.name,k=a?a(T):T.name,P=Cu(F,k,S);return P!==0?P:w.path.localeCompare(T.path)},b=S=>{let w=e.length>0&&fi(S,e),T=i?i(S):!1;return w||T},y=(S,w)=>{if(S.length<=1)return S;let T=f(w),F=h(T),k=S.slice();return w==="/"?k.sort((P,E)=>pK(P,E,n,F)):k.sort(F)},v=(S,w,T)=>{let F=y(w.filter(k=>!l.has(k.path)),S).map(k=>({folder:k,level:T,isExcluded:b(k),parentPath:S}));u?.({parentPath:S,level:T,entries:F}),F.forEach(k=>{if(l.add(k.folder.path),c?.(k),p?.(k)===!1)return;let P=k.folder.children.filter(E=>E instanceof uK.TFolder);P.length!==0&&v(k.folder.path,P,T+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 T=S.children.filter(F=>F instanceof uK.TFolder);T.length>0&&v("/",T,s+1);return}v("/",t,s)}function Yoe(t,e,n,r=0,o=new Set,a={}){let i=[];return qoe({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:be.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 $oe({rootFolders:t,excludePatterns:e,rootOrderMap:n,defaultSortOrder:r,childSortOrderOverrides:o,getFolderSortName:a,isFolderExcluded:i,includeDescendantSiblingGroups:s=!0}){let l=new Map;return qoe({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 Aw(t,e,n=0,r={}){let o=[],{hiddenMatcher:a,comparator:i,childSortOrderOverrides:s}=r,l=i??((g,f)=>At(g.name,f.name)),c=t.slice().sort(l),u=g=>(f,h)=>{let b=Cu(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?Fs(g.path,g.name,a):!1,y=h||b,v={type:be.TAG,data:g,level:f,path:g.path,key:g.path};if(y&&(v.isHidden=!0),o.push(v),e.has(g.path)&&g.children&&g.children.size>0){let S=p(g.path);Array.from(g.children.values()).sort(S).forEach(T=>m(T,f+1,y))}}return c.forEach(g=>m(g,n)),o}var uK,Dw=U(()=>{uK=require("obsidian");Ln();Ue();wr();Hr()});function LIe(){return{colorsByPath:new Map,rootColor:void 0,getInheritedColor:t=>{}}}function Xoe(){return{colorsByNodeId:new Map,rootColor:void 0,rootColorsByKey:new Map}}function zIe(t,e){let n=At(t.name,e.name);return n!==0?n:t.path.localeCompare(e.path)}function BIe(t,e){let n=At(t.name,e.name);return n!==0?n:(t.valuePath??"").localeCompare(e.valuePath??"")}function Qoe(t){return(e,n)=>-t(e,n)}function _Ie(t){let{order:e,keyNode:n,includeDescendantNotes:r}=t,o=BIe;if(e==="alpha-asc")return o;if(e==="alpha-desc")return Qoe(o);let a=(i,s)=>{let l=u=>r&&u.valuePath?hg(n,u.valuePath):u.notesWithValue.size,c=l(i)-l(s);return c!==0?c:o(i,s)};return e==="frequency-asc"?a:Qoe(a)}function HIe(t,e){return(n,r)=>{let o=Cu(n.name,r.name,t);return o!==0?o:e(n).localeCompare(e(r))}}function Zoe(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 LIe();let u=Array.from(e.values()),p=o??zIe,m=r.size>0?(b,y)=>Mw(b,y,r,p):p,g=new Set;u.forEach(b=>{Hl(b,g)});let f=s?1:0,h;if(n&&n.length>0){let b=new Set;h=[],n.forEach(y=>{if(y===wt){let S={name:wt,path:wt,displayPath:wt,children:new Map,notesWithTag:new Set};h.push({type:be.UNTAGGED,data:S,level:f,key:wt});return}let v=e.get(y);!v||b.has(v.path)||(b.add(v.path),h.push(...Aw([v],g,f,{comparator:p,childSortOrderOverrides:c})))}),u.filter(y=>!b.has(y.path)).sort(m).forEach(y=>{h.push(...Aw([y],g,f,{comparator:p,childSortOrderOverrides:c}))})}else h=Aw(u,g,f,{comparator:m,childSortOrderOverrides:c});return dE({items:h,palette:a,scope:i,rootLevel:f,showAllTagsFolder:s,inheritColors:l})}function Joe(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 Xoe();let p=Array.from(e.values()).filter(y=>n.has(y.key));if(p.length===0)return Xoe();let m=r.size>0?(y,v)=>xD(y,v,r,o):o,g=p.slice().sort(m),f=s?1:0,h=f+1,b=[];return g.forEach(y=>{b.push({type:be.PROPERTY_KEY,data:y,level:f,key:y.id});let v=Array.from(y.children.values());if(v.length===0)return;let S=c?.[y.id],w=S?HIe(S,T=>T.valuePath??""):_Ie({order:l,keyNode:y,includeDescendantNotes:u});v.sort(w).forEach(T=>{b.push({type:be.PROPERTY_VALUE,data:T,level:h,key:T.id})})}),cE({items:b,palette:a,scope:i,showAllPropertiesFolder:s})}function eae(t){let{model:e,tagPath:n,color:r,backgroundColor:o}=t,a=Mt(n),i=a.length>0?a:n,s=e.tagRainbowColors.colorsByPath.get(i),l=s?void 0:e.tagRainbowColors.getInheritedColor(i),c=Rb({mode:e.navRainbowMode,rainbowColor:s??l,color:r,backgroundColor:o});return{color:c.color,backgroundColor:c.backgroundColor}}function tae(t){let{model:e,nodeId:n,color:r,backgroundColor:o}=t,a=e.propertyRainbowColors.colorsByNodeId.get(n),i=Xi(n),s=i?Nn(i):null,l=a||!e.inheritPropertyColors||!i||i===n||!s?.key?void 0:e.propertyRainbowColors.rootColorsByKey.get(s.key),c=Rb({mode:e.navRainbowMode,rainbowColor:a??l,color:r,backgroundColor:o});return{color:c.color,backgroundColor:c.backgroundColor}}var mK=U(()=>{Ue();Ig();un();Ln();Hr();Qa();Dw()});function VIe(t,e){let n=At(t.name,e.name);return n!==0?n:t.path.localeCompare(e.path)}function nae(t,e){let n=At(t,e);return n!==0?n:t.localeCompare(e)}function rae(t){return t?t.split("/").filter(e=>e.length>0):[]}function oae(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 aae(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 KIe({leftNode:t,rightNode:e,parentPath:n,orderModel:r,childSortOrderOverrides:o}){let a=n?o?.[n]:void 0;if(a){let i=Cu(t.name,e.name,a);return i!==0?i:t.path.localeCompare(e.path)}return Mw(t,e,r.rootTagOrderMap,r.tagComparator??VIe)}function iae({leftTag:t,rightTag:e,orderModel:n,childSortOrderOverrides:r}){let o=Mt(t),a=Mt(e);if(o===a)return 0;let i=rae(o),s=rae(a),l=Math.min(i.length,s.length);for(let c=0;c{Et();Ln();Hr();Dw()});function ky(t,e){if(!t||e.length===0)return t;let n=[],r=0;return e.forEach((o,a)=>{o.start>r&&n.push(t.slice(r,o.start)),n.push((0,NC.jsx)("mark",{className:"nn-search-highlight",children:t.slice(o.start,o.end)},`h-${a}`)),r=o.end}),r{NC=he($e())});function ED(t,e,n){return`${Ee(t.trim())}\0${e??""}\0${n}`}function hK(t,e,n){t.sort((r,o)=>iae({leftTag:r,rightTag:o,orderModel:e,childSortOrderOverrides:n}))}function fK(t){t.sort((e,n)=>{let r=At(e.label,n.label);if(r!==0)return r;let o=At(e.value,n.value);return o!==0?o:At(e.fieldKey??"",n.fieldKey??"")})}function GIe(t,e){if(t.length<=1)return[...t];if(!e){let o=[...t];return fK(o),o}let n=[],r=[];return t.forEach(o=>{if(o.hasCustomColor===!0){n.push(o);return}r.push(o)}),fK(n),fK(r),[...n,...r]}function dae(t){return t?t.some(e=>e.hasCustomColor===!0):!1}function jIe(t,e,n,r,o){if(t.length<=1)return[...t];let a=[...t];return a.sort((i,s)=>{if(n){let l=dae(e.get(i)),c=dae(e.get(s));if(l!==c)return l?-1:1}return sae(i,s,r.rootPropertyNavigationOrderMap,o)}),a}function cae(t){let e=t?.trim()??"";if(!e)return;let n=or(e);return en(n)??n}function uae(t){if(!t)return!1;for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!0;return!1}function pae({file:t,isCompactMode:e,tags:n,properties:r,wordCount:o,characterCount:a,wordCountDisplayText:i,characterCountDisplayText:s,settings:l,showTags:c,showProperties:u,textCountDisplay:p,visiblePropertyKeys:m,visibleNavigationPropertyKeys:g,matchedProperties:f,hiddenTagVisibility:h,onModifySearchWithTag:b,onModifySearchWithProperty:y,fileItemPillDecorationModel:v,fileItemPillOrderModel:S}){let{app:w}=vt(),T=Zo(),{selectionType:F,selectedTag:k,selectedProperty:P}=nd(),{navigateToTag:E,navigateToProperty:C}=Goe(),L=(0,Pr.useMemo)(()=>Je(l.interfaceIcons,"file-word-count"),[l.interfaceIcons]),z=(0,Pr.useMemo)(()=>Je(l.interfaceIcons,"file-character-count"),[l.interfaceIcons]),G=(0,Pr.useMemo)(()=>rD({selectionType:F,selectedTag:k,showSelectedNavigationPills:l.showSelectedNavigationPills}),[k,F,l.showSelectedNavigationPills]),Q=(0,Pr.useMemo)(()=>oD({selectionType:F,selectedProperty:P,showSelectedNavigationPills:l.showSelectedNavigationPills}),[P,F,l.showSelectedNavigationPills]),R=(0,Pr.useCallback)((ce,pe)=>{if(ce.stopPropagation(),b){let ue=Ov(ce,l.multiSelectModifier);if(ue){ce.preventDefault(),b(pe,ue);return}}E(pe,{preserveNavigationFocus:!1})},[E,b,l.multiSelectModifier]),O=(0,Pr.useCallback)((ce,pe)=>{let ue=pe.propertyNodeId,Se=pe.propertySearchKey,ee=pe.canNavigateToProperty===!0;if(ce.stopPropagation(),pe.linkTarget?.kind==="unsupported")return;if(ee&&y&&Se){let Ce=Ov(ce,l.multiSelectModifier);if(Ce){ce.preventDefault(),y(Se,pe.propertySearchValuePath??null,Ce);return}}let ie=pe.linkTarget;if(ie?.kind==="internal"&&l.enablePropertyInternalLinks){ce.preventDefault(),$(()=>w.workspace.openLinkText(ie.target,t.path,!1));return}if(ie?.kind==="external"&&l.enablePropertyExternalLinks){ce.preventDefault(),window.open(ie.target);return}!ee||!ue||!Se||C(ue,{preserveNavigationFocus:!1})},[w.workspace,t.path,C,y,l.enablePropertyExternalLinks,l.enablePropertyInternalLinks,l.multiSelectModifier]),D=(0,Pr.useCallback)(ce=>T.getTagColorData(ce),[T]),x=(0,Pr.useMemo)(()=>n.length===0||!h.shouldFilterHiddenTags&&!G?n:n.filter(ce=>h.shouldFilterHiddenTags&&!h.isTagVisible(ce)?!1:G?at(ce)!==G:!0),[h,G,n]),B=(0,Pr.useMemo)(()=>{if(l.tagColors,l.tagBackgroundColors,l.inheritTagColors,!l.colorFileTags||x.length===0)return UIe;let ce=new Map;return x.forEach(pe=>{let ue=D(pe),Se=!!(ue.color||ue.background),ee=eae({model:v,tagPath:pe,color:ue.color,backgroundColor:ue.background});(ee.color||ee.backgroundColor)&&ce.set(pe,{color:ee.color,background:ee.backgroundColor,hasCustomColor:Se})}),ce},[v,D,l.colorFileTags,l.inheritTagColors,l.tagBackgroundColors,l.tagColors,x]),I=(0,Pr.useMemo)(()=>{if(x.length===0)return x;if(!l.prioritizeColoredFileTags||!l.colorFileTags){let ue=[...x];return hK(ue,S,l.tagTreeSortOverrides),ue}let ce=[],pe=[];return x.forEach(ue=>{if(B.get(ue)?.hasCustomColor===!0){ce.push(ue);return}pe.push(ue)}),hK(ce,S,l.tagTreeSortOverrides),hK(pe,S,l.tagTreeSortOverrides),[...ce,...pe]},[S,l.colorFileTags,l.prioritizeColoredFileTags,l.tagTreeSortOverrides,B,x]),A=(0,Pr.useMemo)(()=>!(!c||I.length===0),[I,c]),N=(0,Pr.useMemo)(()=>{let ce=[];return V1({properties:r,visiblePropertyKeys:m,hiddenPropertyValueNodeId:Q,visitor:pe=>{ce.push(pe)}}),ce},[r,Q,m]),M=(0,Pr.useMemo)(()=>{if(!u||!l.colorFileProperties||N.length===0)return"";let ce=l.propertyColors,pe=l.propertyBackgroundColors,ue=l.inheritPropertyColors?"inherit:1":"inherit:0",Se=[],ee=new Set,ie=new Set;for(let Ce of N){let we=Ce.propertyNodeId;if(!we)continue;ee.has(we)||(ee.add(we),Se.push(`v:${we}\0${ce?.[we]??""}\0${pe?.[we]??""}`));let Le=Xi(we);!Le||ie.has(Le)||(ie.add(Le),Se.push(`k:${Le}\0${ce?.[Le]??""}\0${pe?.[Le]??""}`))}return Se.length===0?ue:Se.length===1?`${ue}${Se[0]??""}`:(Se.sort(),`${ue}${Se.join("")}`)},[l.colorFileProperties,l.inheritPropertyColors,l.propertyBackgroundColors,l.propertyColors,u,N]),H=(0,Pr.useMemo)(()=>!(t.extension!=="md"||e&&!l.showFilePropertiesInCompactMode),[t.extension,e,l.showFilePropertiesInCompactMode]),q=(0,Pr.useMemo)(()=>{if(!f||f.length===0||!r||r.length===0)return[];let ce=[],pe=new Set;return r.forEach(ue=>{let Se=zr(ue.fieldKey.trim());if(!Se)return;let ee=null,ie=null;f.forEach(Ce=>{let{clause:we}=Ce;if(!(we.value===null?Se.startsWith(we.key):Se===we.key)||(ee??=ug(ue.value),we.value!==null&&(ie??=zr(ee),!ie.includes(we.value))))return;let We=`${we.key}\0${we.value??""}\0${Se}\0${ue.valueKind??""}\0${ue.value}`;pe.has(We)||(pe.add(We),ce.push({clause:we,propertyKey:ue.fieldKey,rawValue:ue.value,valueKind:ue.valueKind,displayValue:ee}))})}),ce},[f,r]),X=(0,Pr.useMemo)(()=>{if(q.length===0)return{groups:[],hiddenGroupCount:0};let ce=new Set;H&&u&&N.forEach(({entry:ue})=>{ce.add(ED(ue.fieldKey,ue.valueKind,ue.value))});let pe=q.filter(ue=>ue.clause.value===null||!ce.has(ED(ue.propertyKey,ue.valueKind,ue.rawValue)));return n2(pe)},[H,q,u,N]),V=(0,Pr.useMemo)(()=>!H||!Ss(p)||l.textCountPlacement!=="property"||i===null||typeof o!="number"||!Number.isFinite(o)||o<=0?null:{value:Math.trunc(o).toString(),label:i,linkTarget:null,iconId:L},[H,p,l.textCountPlacement,o,i,L]),j=(0,Pr.useMemo)(()=>!H||!Al(p)||l.textCountPlacement!=="property"||s===null||typeof a!="number"||!Number.isFinite(a)||a<=0?null:{value:Math.trunc(a).toString(),label:s,linkTarget:null,iconId:z},[H,a,s,z,p,l.textCountPlacement]),_=(0,Pr.useMemo)(()=>[V,j].filter(ce=>ce!==null),[j,V]),W=(0,Pr.useMemo)(()=>{let ce=new Map;return q.forEach(pe=>{if(!pe.clause.value)return;let ue=ED(pe.propertyKey,pe.valueKind,pe.rawValue),Se=ce.get(ue);Se||(Se=new Set,ce.set(ue,Se)),Se.add(pe.clause.value)}),ce},[q]),J=(0,Pr.useMemo)(()=>{let ce=[],pe=[];if(!H||!u||N.length===0)return ce;let ue=new Map;for(let we of N){let{entry:Le,rawValue:We,trimmedFieldKey:Nt,normalizedValuePath:Pt,isKeyOnlyValue:Zt,propertyNodeId:ze}=we,Ie=Zt?null:xI(We),De=Ie?Ie.displayText:We,Me=ze??`${Le.fieldKey}\0${We}`,nt=ue.get(Me);if(!nt){if(l.colorFileProperties&&ze){let rt=T.getPropertyColorData(ze),me=!!(rt.color||rt.background),se=tae({model:v,nodeId:ze,color:rt.color,backgroundColor:rt.background});nt={color:se.color,background:se.backgroundColor,hasCustomColor:me}}else nt={hasCustomColor:!1};ue.set(Me,nt)}let Ge=ze?Nn(ze):null,Tt=ze?Xi(ze)??cae(Nt):cae(Nt),gt=Ge?.key||Nt,wn=Zt?null:Ge?.valuePath??Pt,it=Ee(gt),yn=ze!==void 0&&it.length>0&&g.has(it);pe.push({value:We,label:De,linkTarget:Ie,fieldKey:Le.fieldKey,propertyKeyNodeId:Tt,color:nt.color,background:nt.background,hasCustomColor:nt.hasCustomColor,propertyNodeId:ze,propertySearchKey:gt.length>0?gt:void 0,propertySearchValuePath:wn,canNavigateToProperty:yn,searchMatchTerms:Array.from(W.get(ED(Le.fieldKey,Le.valueKind,Le.value))??[])})}let Se=l.prioritizeColoredFileProperties&&l.colorFileProperties,ee=new Map,ie=[];return pe.forEach(we=>{let Le=we.fieldKey??"",We=ee.get(Le);if(We){We.push(we);return}ee.set(Le,[we]),ie.push(Le)}),jIe(ie,ee,Se,S,g).forEach(we=>{let Le=ee.get(we);!Le||Le.length===0||ce.push(...GIe(Le,Se))}),ce},[H,v,S,T,M,W,l.colorFileProperties,l.prioritizeColoredFileProperties,u,g,N]),Z=(0,Pr.useMemo)(()=>{let ce=new Map;if(J.length===0)return ce;for(let pe of J){let ue=pe.color?.trim()??"",Se=pe.background?.trim()??"";if(!ue&&!Se)continue;let ee=`${ue}\0${Se}`;if(ce.has(ee))continue;let ie={},Ce=!1,we=!1;Se&&VL(Se)&&(ie["--nn-file-tag-custom-bg"]=Se,we=!0),ue&&VL(ue)&&(ie.color=ue,Ce=!0),ce.set(ee,{style:Ce||we?ie:void 0,hasColor:Ce,hasBackground:we})}return ce},[J]),re=J.length>0,Y=_.length>0,ne=(0,Pr.useMemo)(()=>{if(!l.showPropertiesOnSeparateRows)return[];let ce=[],pe=new Map,ue=null;for(let Se of J){let ee=Se.fieldKey?.trim()??"";if(!ee){ue||(ue=[],ce.push(ue)),ue.push(Se);continue}let ie=pe.get(ee);ie||(ie=[],pe.set(ee,ie),ce.push(ie)),ie.push(Se)}return ce},[J,l.showPropertiesOnSeparateRows]),le=(0,Pr.useCallback)(ce=>Qne(ce,l.showFileTagAncestors),[l.showFileTagAncestors]),ae=(0,Pr.useMemo)(()=>{let ce=new Map;return!l.tagIcons||!uae(l.tagIcons)||I.length===0||I.forEach(pe=>{let ue=T.getTagIcon(pe);ue&&ce.set(pe,ue)}),ce},[I,T,l.tagIcons]),ve=(0,Pr.useMemo)(()=>{let ce=new Map,pe=ue=>{if(ue.linkTarget?.kind==="external"&&l.enablePropertyExternalLinks)return WIe;if(ue.iconId)return ue.iconId;if(!l.propertyIcons||!uae(l.propertyIcons))return;let Se=null;if(ue.propertyNodeId){let ie=T.getPropertyIcon(ue.propertyNodeId);if(ie)return ie;let Ce=Xi(ue.propertyNodeId);if(Ce&&(Se=Ce,Ce!==ue.propertyNodeId)){let we=T.getPropertyIcon(Ce);if(we)return we}}let ee=ue.propertyKeyNodeId;if(!(!ee||Se===ee))return T.getPropertyIcon(ee)};J.forEach(ue=>{let Se=pe(ue);Se&&ce.set(ue,Se)});for(let ue of _)ue.iconId&&ce.set(ue,ue.iconId);return ce},[T,J,l.enablePropertyExternalLinks,l.propertyIcons,_]),de=(0,Pr.useCallback)((ce,pe)=>{let ue=ce.linkTarget?.kind==="unsupported",Se=ce.canNavigateToProperty===!0&&!ue,ee=ce.linkTarget?.kind==="internal"&&l.enablePropertyInternalLinks||ce.linkTarget?.kind==="external"&&l.enablePropertyExternalLinks,ie=Se||ee,Ce=["nn-file-tag","nn-file-property",ie?"nn-clickable-tag":"",ee?"nn-file-property-link":""].filter(Me=>Me.length>0).join(" "),we=ce.color?.trim()??"",Le=ce.background?.trim()??"",We=`${we}\0${Le}`,Nt=we||Le?Z.get(We):void 0,Pt=!!Nt?.hasColor,Zt=!!Nt?.hasBackground,ze=ve.get(ce),Ie=Ty(ce.label,ce.searchMatchTerms??[]),De=ky(ce.label,Ie);return(0,Bs.jsxs)("span",{className:Ce,"data-has-color":Pt?"true":void 0,"data-has-background":Zt?"true":void 0,onClick:ie?Me=>O(Me,ce):void 0,role:ie?"button":void 0,tabIndex:ie?0:void 0,style:Nt?.style,children:[ze?(0,Bs.jsx)(qt,{iconId:ze,className:"nn-file-pill-inline-icon","aria-hidden":!0}):null,De]},pe)},[O,Z,ve,l.enablePropertyExternalLinks,l.enablePropertyInternalLinks]),Pe=(0,Pr.useMemo)(()=>A?(0,Bs.jsx)("div",{className:"nn-file-tags",children:I.map((ce,pe)=>{let ue=B.get(ce),Se=ue?.color,ee=ue?.background,ie=le(ce),Ce=ae.get(ce),we={};return ee&&(we["--nn-file-tag-custom-bg"]=ee),Se&&(we.color=Se),(0,Bs.jsxs)("span",{className:"nn-file-tag nn-clickable-tag","data-has-color":Se?"true":void 0,"data-has-background":ee?"true":void 0,onClick:Le=>R(Le,ce),role:"button",tabIndex:0,style:Se||ee?we:void 0,children:[Ce?(0,Bs.jsx)(qt,{iconId:Ce,className:"nn-file-pill-inline-icon","aria-hidden":!0}):null,ie]},pe)})}):null,[I,le,R,A,B,ae]),Fe=(0,Pr.useMemo)(()=>re?l.showPropertiesOnSeparateRows?(0,Bs.jsx)(Bs.Fragment,{children:ne.map((ce,pe)=>(0,Bs.jsx)("div",{className:"nn-file-property-row",children:ce.map((ue,Se)=>de(ue,Se))},pe))}):(0,Bs.jsx)("div",{className:"nn-file-property-row",children:J.map(de)}):null,[J,ne,de,l.showPropertiesOnSeparateRows,re]),te=(0,Pr.useMemo)(()=>Y?(0,Bs.jsx)("div",{className:"nn-file-property-row",children:_.map(de)}):null,[de,Y,_]),ye=(0,Pr.useMemo)(()=>(0,Bs.jsxs)(Bs.Fragment,{children:[Pe,Fe,te]}),[Fe,Pe,te]);return{shouldShowFileTags:A,shouldShowProperty:re,shouldShowTextCountProperty:Y,hasVisiblePillRows:A||re||Y,propertySearchEvidenceGroups:X.groups,propertySearchEvidenceHiddenGroupCount:X.hiddenGroupCount,pillRows:ye}}var Pr,Bs,UIe,WIe,mae=U(()=>{Pr=he(Ve());fn();Ur();joe();hn();st();uw();Ln();Cn();_l();Et();lr();Rw();un();mK();lae();gK();rd();Bs=he($e()),UIe=new Map,WIe="external-link"});function gae(t){let{app:e,file:n,enabled:r,source:o,metadataVersion:a}=t,[i,s]=(0,Py.useState)(0),l=o!==void 0,c=o?.providerId??null,u=o?.iconId??null,p=o?.showsFeatureImageBox??!1,m=o?.supportsCompanionImages??!1,g=(0,Py.useMemo)(()=>l?c===null||u===null?null:{providerId:c,iconId:u,showsFeatureImageBox:p,supportsCompanionImages:m}:bc(e,n),[e,n,l,a,u,c,p,m]),f=r&&g!==null&&g.supportsCompanionImages,h=vh(e,f);return(0,Py.useEffect)(()=>{if(f)return tq(n.path,()=>{s(b=>b+1)})},[n.path,f]),(0,Py.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=tx(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 y=null;try{y=CC(e,b)}catch{y=null}return{isDrawing:!0,showsFeatureImageBox:g.showsFeatureImageBox,supportsCompanionImages:!0,isMissing:y===null,iconId:g.iconId,key:`${b.path}@${b.stat.mtime}:${h}:${i}`,url:y}},[e,i,r,n,g,h])}var Py,hae=U(()=>{Py=he(Ve());Vl();uC();cK()});function Ph({initialValue:t,ariaLabel:e,onCommit:n,onCancel:r,onRestoreFocus:o,inputFilter:a,onInputChange:i,className:s}){let[l,c]=(0,_s.useState)(t),[u,p]=(0,_s.useState)(!1),m=(0,_s.useRef)(null),g=(0,_s.useRef)(!1),f=(0,_s.useRef)(!1);(0,_s.useEffect)(()=>{let w=m.current;w&&(w.focus({preventScroll:!0}),w.select())},[]);let h=(0,_s.useCallback)(()=>{window.requestAnimationFrame(()=>{let w=m.current;!w||g.current||(w.focus({preventScroll:!0}),w.select())})},[]),b=(0,_s.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(T){console.error("[Notebook Navigator] Inline rename commit failed",T)}f.current=!1,p(!1),h()}},[n,o,h,l]),y=(0,_s.useCallback)(w=>{let T=w.currentTarget.value,F=a?a(T):T;c(F),i?.({rawValue:T,filteredValue:F})},[a,i]),v=(0,_s.useCallback)(w=>{g.current||(g.current=!0,r(),w?.restoreFocus&&o?.())},[r,o]),S=(0,_s.useCallback)(w=>{if(w.stopPropagation(),w.key==="Enter"){w.preventDefault(),b({restoreFocus:!0});return}w.key==="Escape"&&(w.preventDefault(),v({restoreFocus:!0}))},[v,b]);return(0,fae.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:y,onBlur:()=>{b()},onClick:w=>w.stopPropagation(),onMouseDown:w=>w.stopPropagation(),onDoubleClick:w=>w.stopPropagation(),onKeyDown:S})}var _s,fae,IC=U(()=>{_s=he(Ve()),fae=he($e())});function Hs({name:t,className:e,"aria-label":n,"aria-hidden":r}){let o=(0,RD.useRef)(null);return(0,RD.useEffect)(()=>{o.current&&(o.current.empty(),(0,yae.setIcon)(o.current,t))},[t]),(0,vae.jsx)("span",{ref:o,className:e,"aria-label":n,"aria-hidden":r})}var RD,yae,vae,Fh=U(()=>{RD=he(Ve()),yae=require("obsidian"),vae=he($e())});function Sae(t,e){return t.replace("{count}",e)}function qIe(t){return typeof t!="number"||!Number.isFinite(t)||t<=0?null:Ed(t)}function YIe(t){let{wordCountDisplayText:e,characterCountDisplayText:n}=t;if(e&&n){let r=!e.includes("/")&&!e.includes("%")?Sae(d.fileCounts.words,e):e,o=Sae(d.fileCounts.characters,n);return`${r}${d.fileCounts.separator}${o}`}return e??n}function $Ie(t,e,n){let[r,o]=(0,Dn.useState)(e.stat.mtime);return(0,Dn.useEffect)(()=>{o(e.stat.mtime)},[e,e.stat.mtime]),(0,Dn.useEffect)(()=>{if(!n)return;let a=t.vault.on("modify",i=>{i instanceof id.TFile&&i.path===e.path&&o(i.stat.mtime)});return()=>{t.vault.offref(a)}},[t,n,e.path]),n?r:e.stat.mtime}function XIe(t,e,n){if(!t)return[];if(n){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)};return n.matches.forEach(s=>i(s.text)),n.terms.forEach(s=>i(s)),o.length===0?[]:Hd(o)}return e&&e.length>0?Ty(t,e):[]}function wae(t,e,n){return ky(t,XIe(t,e,n))}function QIe(t){let e=Ty(t.value,t.foldedTerms);return ky(t.value,e)}function ZIe(t){let e=Ty(t.displayValue,t.foldedTerms);return ky(t.displayValue,e)}function JIe(t){let e=Ty(t.propertyKey,t.foldedKeyTerms);return ky(t.propertyKey,e)}function exe({iconId:t,label:e,iconVersion:n,color:r,backgroundColor:o,showIcon:a,applyColorToName:i,onReveal:s}){let l=(0,Dn.useRef)(null),c=!!r,u=!!o,p=r?{color:r}:void 0,m=i&&r?{color:r}:void 0,g=o?{backgroundColor:o}:void 0,f=i?"nn-parent-folder-label nn-parent-folder-label--colored":"nn-parent-folder-label",h=!!s,b=(0,Dn.useCallback)(y=>{s&&(y.preventDefault(),y.stopPropagation(),s())},[s]);return(0,Dn.useEffect)(()=>{let y=l.current;if(!y||(y.innerHTML="",!t||!a))return;Fn().renderIcon(y,t)},[t,n,a]),(0,Yt.jsx)("div",{className:"nn-parent-folder","data-dot-separator":a?"false":"true",children:(0,Yt.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,Yt.jsx)("span",{className:"nn-parent-folder-icon",ref:l,"aria-hidden":"true","data-has-color":c?"true":"false",style:p}):null,(0,Yt.jsx)("span",{className:f,style:m,"data-has-color":i?"true":"false",children:e})]})})}function txe(t,e){if(typeof t!="number"||t<=0||typeof e!="number")return null;let n=Math.min(Math.max(t-e,0),t);return{completed:n,total:t,percent:n/t*100,isComplete:n>=t}}var Dn,id,Yt,bae,MD,yK=U(()=>{Dn=he(Ve()),id=require("obsidian");fn();fn();on();Oe();Ue();Id();st();Ts();_u();Lr();PD();zF();ND();Rw();uw();ei();ll();Et();BA();lr();bi();Ln();em();Woe();mae();gK();rd();Vl();hae();uC();_f();sg();hn();IC();Fh();Yt=he($e()),bae=16/9;MD=Dn.default.memo(function({file:e,paneProps:n,isSelected:r,hasSelectedAbove:o,hasSelectedBelow:a,showQuickActionsPanel:i,fileIndex:s,groupHeaderLabel:l,parentFolder:c,isPinned:u=!1,searchMeta:p,matchedAliases:m,matchedProperties:g,isHidden:f=!1,shortcutKey:h,manualSortDisabled:b=!1,inlineRename:y}){let{onFileClick:v,selectionType:S,sortOption:w,searchHighlightTerms:T,onModifySearchWithTag:F,onModifySearchWithProperty:k,localDayReference:P,fileIconSize:E,appearanceSettings:C,includeDescendantNotes:L,hiddenTagVisibility:z,fileNameIconNeedles:G,visiblePropertyKeys:Q,visibleNavigationPropertyKeys:R,fileItemStorage:O,onToggleNoteShortcut:D,folderDecorationModel:x,fileItemPillDecorationModel:B,fileItemPillOrderModel:I,getSolidBackground:A,disableNativeDrag:N=!1}=n,{app:M,isMobile:H,plugin:q,commandQueue:X,fileSystemOps:V,tagOperations:j}=vt(),_=yt(),W=Zo(),{getFileDisplayName:J,getDB:Z,getFileTimestamps:re,hasPreview:Y,regenerateFeatureImageForFile:ne}=O,le=C.mode==="compact",ae=Ss(C.textCountDisplay),ve=Al(C.textCountDisplay),de=e.extension==="md",Pe=de&&(!le||_.showFilePropertiesInCompactMode),Fe=de&&C.showTags,te=de&&ae&&(_.textCountPlacement==="title"||_.textCountPlacement==="property"&&Pe),ye=te||de&&!H&&_.showTooltips&&_.showTooltipWordCount,ce=de&&ve&&(_.textCountPlacement==="title"||_.textCountPlacement==="property"&&Pe),pe=de&&(Pe&&C.showProperties&&Q.size>0||te&&_.wordCountTargetProperty.trim().length>0||(g?.length??0)>0),ue=_.unfinishedTaskIcon==="all"||_.unfinishedTaskIcon==="compact"&&le,Se=_.showFileIcons&&ue,ee=de&&(Se||C.showTaskProgress||_.showFileBackgroundUnfinishedTask||!H&&_.showTooltips),ie=de&&C.showImage,Ce=$Ie(M,e,C.showImage&&qs(e)),we=bc(M,e),Le=we!==null,{previewText:We,tags:Nt,featureImageKey:Pt,featureImageStatus:Zt,featureImageUrl:ze,properties:Ie,wordCount:De,characterCountWithSpaces:Me,characterCountWithoutSpaces:nt,taskTotal:Ge,taskUnfinished:Tt,metadataVersion:gt}=Uoe({app:M,file:e,showPreview:C.showPreview,showImage:C.showImage,skipFeatureImage:Le,fileStatMtime:Ce,getDB:Z,regenerateFeatureImageForFile:ne,loadOptions:{loadPreviewText:C.showPreview&&de&&!p?.excerpt,loadTags:Fe,loadFeatureImage:C.showImage&&!Le,loadProperties:pe,loadWordCount:ye,loadCharacterCount:ce,loadTaskCounts:ee},refreshMetadataVersionOnFeatureImageChange:ie}),wn=gae({app:M,file:e,enabled:C.showImage,source:we,metadataVersion:gt}),it=wn.url??(wn.isDrawing?null:ze),yn=wn.key??Pt,[rt,me]=(0,Dn.useState)(null),[se,fe]=(0,Dn.useState)(!1),Ne=(0,Dn.useRef)(null),xe=(0,Dn.useRef)(null),Be=(0,Dn.useRef)(null),dt=(0,Dn.useRef)(null),St=(0,Dn.useRef)(null),ln=(0,Dn.useRef)(null),vn=(0,Dn.useRef)(null),In=(0,Dn.useRef)(null),eo=(0,Dn.useId)(),Dt=_.showQuickActions&&_.quickActionOpenInNewTab,an=_.showQuickActions&&_.quickActionPinNote,Sn=_.showQuickActions&&_.quickActionRevealInFolder&&e.parent&&e.parent.path!==c,_r=e.extension==="md",Gn=_.showQuickActions&&_.quickActionAddTag&&_r&&!!j,mn=_.showQuickActions&&_.quickActionAddToShortcuts,ir=Dt||an||Sn||Gn||mn,Zn=typeof h=="string",Fr=ts(),co=vh(M,_.showFileBackgroundUnfinishedTask),Cr=_.showFileIcons,ud=typeof Tt=="number"&&Tt>0,Ye=Cr&&ue&&ud,bt=Je(_.interfaceIcons,"file-unfinished-task"),Wt=ud&&typeof Tt=="number"?`${d.tooltips.unfinishedTasks}: ${Tt}`:null,Ze=J(e),Vt=(0,Dn.useMemo)(()=>wae(Ze,T,p),[Ze,T,p]),xn=jh(e),gn=W.getFileIcon(e.path),ur=W.getFileColor(e.path),jn=e.parent,Ia=jn instanceof id.TFolder,Tn=aD({showParentFolder:C.showParentFolder,isPinned:u,selectionType:S,includeDescendantNotes:L,parentFolder:c,fileParentPath:jn?.path??null})&&Ia&&jn.path!=="/",Jn=Tn&&_.showParentFolderIcon,qn=Tn&&_.showParentFolderColor,ii=Tn&&!_.showParentFolderFullPath,er=!Ye&&_.useFolderIconForFiles&&!gn&&Ia,Ii=!Ye&&!ur&&Ia&&(_.useFolderColorForTitles||_.useFolderIconForFiles),hs=!_.colorIconOnly&&_.useFolderColorForTitles&&!ur&&Ia,rc=Ii||hs,si=Ia&&(er||rc||ii||Jn||qn)?W.getFolderDisplayData(jn.path,{includeDisplayName:ii,includeColor:rc||qn,includeBackgroundColor:qn,includeIcon:er||Jn,includeInheritedColors:rc||qn}):null,iu=er?si?.icon:void 0,su=rc&&Ia?wy({model:x,folderPath:jn.path,color:si?.color,backgroundColor:void 0}).color:void 0,xa=W.getFileBackgroundColor(e.path),Wo=C0({customBackgroundColor:xa,taskUnfinished:Tt,showUnfinishedTaskBackground:_.showFileBackgroundUnfinishedTask,unfinishedTaskBackgroundColor:co==="dark"?_.unfinishedTaskBackgroundColorDark:_.unfinishedTaskBackgroundColor,getSolidBackground:A}),pp=e.extension.toLowerCase(),to=pp==="base",xi=pp==="canvas",Am=!bs(e,xr.SUPPORTED,M),pd=ur??su,lu=_.showCategoryIcons||_.colorIconOnly&&!!pd,no=(0,Dn.useMemo)(()=>Ye?bt:VS(e,{showFilenameMatchIcons:_.showFilenameMatchIcons,fileNameIconMap:_.fileNameIconMap,showCategoryIcons:_.showCategoryIcons,fileTypeIconMap:_.fileTypeIconMap,fileTypeIconPreset:_.fileTypeIconPreset,externalIconProviders:_.externalIconProviders},{customIconId:gn??iu,metadataCache:M.metadataCache,isExternalFile:Am,allowCategoryIcons:lu,fallbackMode:lu?"file":"none",fileNameNeedles:G,fileNameForMatch:Ze}),[lu,M.metadataCache,Ze,G,gn,iu,e,Am,gt,_.fileNameIconMap,_.externalIconProviders,_.fileTypeIconPreset,_.fileTypeIconMap,_.showCategoryIcons,_.showFilenameMatchIcons,Ye,bt]),Ea=_.colorIconOnly?void 0:ur??(_.useFolderColorForTitles?su:void 0),du=!!Ea,md=(0,Dn.useMemo)(()=>hJ(e,_.fileTypeIconMap,M.metadataCache,void 0,_.fileTypeIconPreset,_.externalIconProviders),[M.metadataCache,e,gt,_.externalIconProviders,_.fileTypeIconMap,_.fileTypeIconPreset]),gd=no||md,mp=Cr&&!!no,Il=!!pd&&!Ye,Dm=pd&&!Ye?{color:pd}:void 0,ta=Ye?"nn-file-icon nn-file-icon-unfinished-task":"nn-file-icon",uo=Ye?void 0:pd??void 0,wo=le&&(to||xi),Ws=ae&&e.extension==="md"?Aj({wordCount:De,properties:Ie,targetProperty:_.wordCountTargetProperty,showTargetPercentage:_.showWordCountPercentage}):null,Om=_.characterCountSpaces==="include"?Me:nt,fs=ve&&e.extension==="md"?qIe(Om):null,li=YIe({wordCountDisplayText:Ws,characterCountDisplayText:fs}),cu=_.textCountPlacement==="title"&&li!==null,ma=(0,Dn.useMemo)(()=>y?V.getFileDisplayNameRenameInput(e):null,[e,V,y]),Lm=Je(_.interfaceIcons,"nav-property"),{shouldShowFileTags:Ei,hasVisiblePillRows:ys,propertySearchEvidenceGroups:hd,propertySearchEvidenceHiddenGroupCount:oc,pillRows:ac}=pae({file:e,isCompactMode:le,tags:Nt,properties:Ie,wordCount:De,characterCount:Om,wordCountDisplayText:Ws,characterCountDisplayText:fs,settings:_,showTags:C.showTags,showProperties:C.showProperties,textCountDisplay:C.textCountDisplay,visiblePropertyKeys:Q,visibleNavigationPropertyKeys:R,matchedProperties:g,hiddenTagVisibility:z,onModifySearchWithTag:F,onModifySearchWithProperty:k,fileItemPillDecorationModel:B,fileItemPillOrderModel:I}),fd=y&&ma?(0,Yt.jsxs)("div",{className:"nn-file-name nn-file-name--inline-renaming","data-has-color":du?"true":"false","data-title-rows":C.titleRows,style:{"--filename-rows":C.titleRows,...du?{"--nn-file-name-custom-color":Ea}:{}},children:[(0,Yt.jsx)(Ph,{initialValue:ma.initialValue,ariaLabel:e.extension==="md"?d.contextMenu.file.renameNote:d.contextMenu.file.renameFile,onCommit:Kt=>y.onCommit(e,Kt),onCancel:y.onCancel,onRestoreFocus:y.onRestoreFocus,inputFilter:ma.inputFilter,onInputChange:ma.onInputChange,className:"nn-file-inline-rename"}),xn.length>0&&(0,Yt.jsx)("span",{className:"nn-file-ext-suffix",children:xn})]}):(0,Yt.jsxs)("div",{className:"nn-file-name","data-has-color":du?"true":"false","data-title-rows":C.titleRows,style:{"--filename-rows":C.titleRows,...du?{"--nn-file-name-custom-color":Ea}:{}},children:[(0,Yt.jsxs)("span",{className:"nn-file-name-label",children:[Vt,m&&m.length>0?(0,Yt.jsxs)("span",{className:"nn-file-alias-match",children:[(0,Yt.jsx)(Hs,{name:"lucide-forward",className:"nn-file-alias-match-icon","aria-hidden":!0}),(0,Yt.jsx)("span",{children:m.map((Kt,Go)=>(0,Yt.jsxs)(Dn.default.Fragment,{children:[Go>0?", ":null,QIe(Kt)]},`${Kt.value}-${Go}`))})]}):null,hd.length>0?(0,Yt.jsxs)("span",{className:"nn-file-property-search-evidence",children:[(0,Yt.jsx)(qt,{iconId:Lm,className:"nn-file-property-search-evidence-icon","aria-hidden":!0}),hd.map((Kt,Go)=>(0,Yt.jsxs)(Dn.default.Fragment,{children:[Go>0?"; ":null,(0,Yt.jsx)("span",{className:"nn-file-property-search-evidence-key",children:JIe(Kt)}),Kt.values.length>0?": ":null,Kt.values.map((ga,El)=>(0,Yt.jsxs)(Dn.default.Fragment,{children:[El>0?", ":null,ZIe(ga)]},`${ga.displayValue}-${El}`)),Kt.hiddenValueCount>0?` +${Kt.hiddenValueCount}`:null]},Ee(Kt.propertyKey))),oc>0?`; +${oc}`:null]}):null,xn.length>0&&(0,Yt.jsx)("span",{className:"nn-file-ext-suffix",children:xn})]}),cu?(0,Yt.jsxs)("span",{className:"nn-file-name-suffix",children:[" (",li,")"]}):null]}),Oh=(0,Dn.useMemo)(()=>{if(!C.showDate||!w)return"";let Kt=re(e),ga=gI(w,_.alphabeticalDateMode??"modified")==="created"?Kt.created:Kt.modified;if(u){let El=Gr.getDateGroup(ga,P??void 0);return Gr.formatDateForGroup(ga,El,_.dateFormat,_.timeFormat)}return l&&l!==d.listPane.pinnedSection?Gr.formatDateForGroup(ga,l,_.dateFormat,_.timeFormat):Gr.formatDate(ga,_.dateFormat)},[e,e.stat.mtime,e.stat.ctime,w,l,u,C.showDate,_.dateFormat,_.timeFormat,_.alphabeticalDateMode,re,gt,P]),ic=p?.excerpt?p.excerpt:We,gp=(C.showPreview&&e.extension==="md"?Y(e.path):!1)||ic.length>0,uu=(0,Dn.useMemo)(()=>p?wae(ic,void 0,p):ic,[ic,p]),pu=u?1:C.previewRows,hp=iD({showImage:C.showImage,file:e,featureImageStatus:Zt,hasFeatureImageUrl:!!it,showDrawingFeatureImage:wn.showsFeatureImageBox}),lc=wn.isMissing,mu=sD({showFeatureImageArea:hp,file:e,hasFeatureImageUrl:!!it,showDrawingMissingFeatureImage:lc}),yd=!lc,zm=yd&&Ei,Bm=yd&&ys,Gs=yd?ac:null,{shouldShowMultilinePreview:vd,shouldShowDateForItem:di}=K1({isCompactMode:le,showDate:C.showDate,showPreview:C.showPreview,isPinned:u,hasPreviewContent:gp,showFeatureImageArea:hp,showExtensionBadgeThumbnail:mu,hasVisiblePillRows:Bm}),_i=null;if(Tn&&Ia){let Kt=Jn?si?.icon:void 0,Go="lucide-folder-closed",ga=qn?wy({model:x,folderPath:jn.path,color:si?.color,backgroundColor:si?.backgroundColor}):{color:void 0,backgroundColor:void 0},El=ga.color,fp=!!El,EO=S===K.FOLDER?c:null;_i={name:_.showParentFolderFullPath?v3({metadataService:W,folderPath:jn.path,baseFolderPath:EO}):si?.displayName||jn.name,iconId:Kt??Go,color:fp?El:void 0,backgroundColor:ga.backgroundColor,applyColorToName:fp&&!_.colorIconOnly,showIcon:Jn}}let xl=()=>_i?(0,Yt.jsx)(exe,{iconId:_i.iconId,label:_i.name,iconVersion:Fr,color:_i.color,backgroundColor:_i.backgroundColor,showIcon:_i.showIcon,applyColorToName:_i.applyColorToName,onReveal:_.parentFolderClickRevealsFile?Hi:void 0}):null,je=cw({showTaskProgress:C.showTaskProgress,hideWhenComplete:_.hideFileTaskProgressWhenComplete,taskTotal:Ge,taskUnfinished:Tt})?txe(Ge,Tt):null,Bt=Kt=>{if(!je)return null;let Go=_.showFileTaskProgressBar,ga=_.showFileTaskProgressCount;return(0,Yt.jsxs)("div",{className:je.isComplete?"nn-file-task-progress nn-file-task-progress--complete":"nn-file-task-progress",style:Go?{"--nn-file-task-progress-width":`${je.percent}%`}:void 0,"data-dot-separator":Kt?"true":"false",children:[(0,Yt.jsx)(qt,{iconId:bt,className:"nn-file-task-progress-icon","aria-hidden":!0}),Go?(0,Yt.jsx)("div",{className:"nn-file-task-progress-track",children:(0,Yt.jsx)("div",{className:"nn-file-task-progress-fill"})}):null,ga?(0,Yt.jsx)("span",{className:"nn-file-task-progress-count",children:`${je.completed}/${je.total}`}):null]})},ge=di||je!==null||_i!==null,ke=u&&(je!==null||vd);(0,Dn.useEffect)(()=>{fe(!1)},[yn,it]);let Re=wn.isDrawing,qe=!it||_.forceSquareFeatureImage,Rt=["nn-file-thumbnail"];qe?Rt.push("nn-file-thumbnail--square"):Rt.push("nn-file-thumbnail--natural"),it&&Rt.push("nn-file-thumbnail--inset-highlight"),Re&&Rt.push("nn-file-thumbnail--drawing"),(mu||lc)&&Rt.push("nn-file-thumbnail--extension-badge"),se&&Rt.push("nn-file-thumbnail--hidden");let sr=Rt.join(" "),Dr=it?`url("${it.replace(/[\\"]/g,"\\$&")}")`:null,Mo;qe||(Mo={"--nn-file-thumbnail-aspect-ratio":rt??1}),Dr&&(Mo={...Mo,"--nn-file-thumbnail-mask-image":Dr});let ci=(0,Dn.useCallback)(()=>{if(qe)return;let Kt=In.current;if(!Kt)return;let Go=Kt.naturalWidth||Kt.width||0,ga=Kt.naturalHeight||Kt.height||0;if(Go<=0||ga<=0){me(null);return}let El=Go/ga,fp=Math.min(El,bae);me(fp)},[qe]),To=_.showTooltips,ko=["nn-file"];r&&ko.push("nn-selected"),le&&ko.push("nn-compact"),r&&o&&ko.push("nn-has-selected-above"),r&&a&&ko.push("nn-has-selected-below"),Wo&&ko.push("nn-has-custom-background"),f&&ko.push("nn-hidden-file"),b&&ko.push("nn-file-manual-sort-disabled");let js=ko.join(" "),bd=Wo?{"--nn-file-custom-bg-color":Wo}:void 0,Yn=f?d.listPane.hiddenItemAriaLabel.replace("{name}",Ze):void 0;(0,Dn.useEffect)(()=>{if(qe){me(null);return}me(null);let Kt=In.current;if(Kt&&Kt.complete){let Go=Kt.naturalWidth||Kt.width||0,ga=Kt.naturalHeight||Kt.height||0;if(Go>0&&ga>0){let El=Go/ga,fp=Math.min(El,bae);me(fp)}}},[it,qe]),(0,Dn.useEffect)(()=>{if(!Ne.current||H)return;if(!To){(0,id.setTooltip)(Ne.current,"");return}let Kt=FC({file:e,displayName:Ze,extensionSuffix:xn,settings:{dateFormat:_.dateFormat,timeFormat:_.timeFormat,showTooltipPath:_.showTooltipPath,showTooltipWordCount:_.showTooltipWordCount},getFileTimestamps:re,sortOption:w,unfinishedTaskTooltipText:Wt,wordCount:De});(0,id.setTooltip)(Ne.current,Kt,{placement:Np()})},[H,e,e.stat.ctime,e.stat.mtime,To,_.dateFormat,_.timeFormat,_.showTooltipPath,_.showTooltipWordCount,Ze,xn,re,w,gt,e.name,Wt,De]);let Hi=()=>{$(async()=>{await q.activateView(),await q.revealFileInActualFolder(e,{showHiddenFileNotice:!0})})},Lh=bP(S??null),_m=W.isFilePinned(e.path,Lh),Uy=Kt=>{Kt.stopPropagation(),Kt.preventDefault(),$(()=>Vr({app:M,commandQueue:X,file:e,context:"tab"}))},IO=Kt=>{Kt.stopPropagation(),Kt.preventDefault(),$(async()=>{e.parent&&await W.togglePin(e.path,Lh)})},uT=Kt=>{Kt.stopPropagation(),Kt.preventDefault(),$(async()=>D(e,h))},pT=Kt=>{Kt.stopPropagation(),Kt.preventDefault(),Hi()},mT=Kt=>{Kt.stopPropagation(),Kt.preventDefault(),j&&QS({app:M,plugin:q,tagOperations:j,files:[e]})},rN=Kt=>{Kt.button===1&&(Kt.preventDefault(),Kt.stopPropagation(),$(()=>Vr({app:M,commandQueue:X,file:e,context:"tab"})))},gu=[];i&&Sn&&gu.push({key:"reveal",element:(0,Yt.jsx)("div",{ref:xe,className:"nn-quick-action-item",onClick:pT,title:d.contextMenu.file.revealInFolder})}),i&&Gn&&gu.push({key:"add-tag",element:(0,Yt.jsx)("div",{ref:Be,className:"nn-quick-action-item",onClick:mT,title:d.contextMenu.file.addTag})}),i&&mn&&gu.push({key:"shortcut",element:(0,Yt.jsx)("div",{ref:dt,className:"nn-quick-action-item",onClick:uT,title:Zn?d.shortcuts.remove:d.shortcuts.add})}),i&&an&&gu.push({key:"pin",element:(0,Yt.jsx)("div",{ref:St,className:"nn-quick-action-item",onClick:IO,title:_m?e.extension==="md"?d.contextMenu.file.unpinNote:d.contextMenu.file.unpinFile:e.extension==="md"?d.contextMenu.file.pinNote:d.contextMenu.file.pinFile})}),i&&Dt&&gu.push({key:"new-tab",element:(0,Yt.jsx)("div",{ref:ln,className:"nn-quick-action-item",onClick:Uy,title:d.contextMenu.file.openInNewTab})}),(0,Dn.useEffect)(()=>{let Kt=vn.current;if(!Kt||(Kt.innerHTML="",!mp))return;let Go=no;if(!Go)return;Fn().renderIcon(Kt,Go,E)},[no,Fr,mp,le,E]),(0,Dn.useEffect)(()=>{H||!i||(xe.current&&Sn&&(0,id.setIcon)(xe.current,"lucide-folder-search"),Be.current&&Gn&&(0,id.setIcon)(Be.current,"lucide-tag"),dt.current&&mn&&(0,id.setIcon)(dt.current,Zn?"lucide-star-off":"lucide-star"),St.current&&an&&(0,id.setIcon)(St.current,_m?"lucide-pin-off":"lucide-pin"),ln.current&&Dt&&(0,id.setIcon)(ln.current,"lucide-file-plus"))},[H,Dt,an,Sn,Gn,mn,i,Zn,_m]);let xO=(0,Dn.useCallback)(Kt=>{v(e,s,Kt)},[e,s,v]);return(0,Yt.jsxs)("div",{ref:Ne,className:js,"data-path":e.path,"data-drag-path":e.path,"data-drag-type":"file","data-draggable":!H&&!N?"true":void 0,"data-drag-icon":gd,"data-drag-fallback-icon":md,"data-drag-icon-color":uo,onClick:xO,onMouseDown:rN,draggable:!H&&!N,role:"listitem","aria-describedby":Yn?eo:void 0,style:bd,children:[(0,Yt.jsxs)("div",{className:"nn-file-content",children:[!H&&ir&&i&&(0,Yt.jsx)("div",{className:`nn-quick-actions-panel ${le?"nn-compact-mode":""}`,"data-title-rows":C.titleRows,"data-has-tags":zm?"true":"false",children:gu.map((Kt,Go)=>(0,Yt.jsxs)(Dn.default.Fragment,{children:[Go>0&&(0,Yt.jsx)("div",{className:"nn-quick-action-separator"}),Kt.element]},Kt.key))}),(0,Yt.jsxs)("div",{className:"nn-file-inner-content",children:[Cr?(0,Yt.jsx)("div",{className:"nn-file-icon-slot",children:mp?(0,Yt.jsx)("span",{ref:vn,className:ta,"data-has-color":Il?"true":"false",style:Dm,title:!H&&!_.showTooltips&&Ye?Wt??void 0:void 0}):null}):null,le?(0,Yt.jsxs)("div",{className:"nn-compact-file-text-content",children:[(0,Yt.jsxs)("div",{className:"nn-compact-file-header",children:[fd,wo?(0,Yt.jsx)("div",{className:"nn-compact-extension-badge","aria-hidden":"true",children:(0,Yt.jsx)("div",{className:"nn-file-icon-rectangle",children:(0,Yt.jsx)("span",{className:"nn-file-icon-rectangle-text",children:pp})})}):null]}),Gs]}):(0,Yt.jsxs)(Yt.Fragment,{children:[(0,Yt.jsxs)("div",{className:"nn-file-text-content",children:[fd,ke&&(0,Yt.jsxs)("div",{className:"nn-file-second-line nn-file-second-line--pinned",children:[Bt(!1),vd&&(0,Yt.jsx)("div",{className:"nn-file-preview",style:{"--preview-rows":pu},children:uu})]}),!u&&vd&&(0,Yt.jsx)("div",{className:"nn-file-preview",style:{"--preview-rows":pu},children:uu}),Gs,!u&&ge&&(0,Yt.jsxs)("div",{className:"nn-file-second-line",children:[Bt(di),di&&(0,Yt.jsx)("div",{className:"nn-file-date",children:Oh}),xl()]})]}),hp&&(0,Yt.jsx)("div",{className:sr,style:Mo,children:it?(0,Yt.jsx)("img",{src:it,alt:d.common.featureImageAlt,className:"nn-file-thumbnail-img",ref:In,draggable:!1,onDragStart:Kt=>Kt.preventDefault(),onLoad:ci,onError:()=>{fe(!0)}},yn??it):lc?(0,Yt.jsx)("div",{className:"nn-file-extension-badge nn-file-extension-badge--drawing","aria-hidden":"true",children:(0,Yt.jsx)(qt,{iconId:wn.iconId??"brush",className:"nn-file-extension-icon","aria-hidden":!0})}):mu?(0,Yt.jsx)("div",{className:"nn-file-extension-badge",children:(0,Yt.jsx)("span",{className:"nn-file-extension-text",children:e.extension})}):null})]})]})]}),Yn?(0,Yt.jsx)("span",{id:eo,className:"nn-visually-hidden",children:Yn}):null]})})});function Tae(t){return Math.max(0,Math.trunc(t))}function nxe(t,e,n){let r=Ed(Tae(e)),o=gk(t,n);return o!==null?`${r} / ${Ed(o)}`:r}function rxe(t,e){if(e<=0)return null;let n=Math.round(Tae(t)/e*100);return Number.isFinite(n)?n:0}function kae(t,e,n){let r=gk(t,n),o=r!==null?rxe(e,r):null,a=o===null?null:Math.min(100,Math.max(0,o));return{progressPercent:o,progressWidth:a}}function Pae(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 xC({header:t,wordCount:e,targetWordCount:n}){let r=Lp(t),o=nxe(t,e,n),a=kae(t,e,n),i=Pae(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,lp.jsxs)("div",{className:s.join(" "),style:i,children:[t.iconId?(0,lp.jsx)(qt,{iconId:t.iconId,className:"nn-manual-sort-group-header-custom-icon","aria-hidden":!0}):null,(0,lp.jsx)("span",{className:"nn-manual-sort-group-header-title",children:t.title}),r?(0,lp.jsxs)("span",{className:"nn-manual-sort-group-header-count",children:["(",o,")"]}):null,a.progressPercent!==null?(0,lp.jsxs)("span",{className:"nn-manual-sort-group-header-percent",children:[a.progressPercent,"%"]}):null]})}function AD({header:t,wordCount:e,targetWordCount:n}){let r=kae(t,e,n);if(r.progressWidth===null)return null;let o=Pae(t,r);return(0,lp.jsx)("div",{className:"nn-manual-sort-group-header-progress-row",style:o,"aria-hidden":!0,children:(0,lp.jsx)("div",{className:"nn-manual-sort-group-header-progress",children:(0,lp.jsx)("div",{className:"nn-manual-sort-group-header-progress-fill"})})})}var lp,vK=U(()=>{hi();sg();rd();lp=he($e())});function DD(t,e){if(!(e<0||e>=t.length))return t[e]}function oxe(t){let e=new Array(t.length).fill(null),n=null;return t.forEach((r,o)=>{if(r.type===tn.HEADER&&r.headerKind==="date"&&typeof r.data=="string"){n=r.data;return}r.type===tn.FILE&&(e[o]=n)}),e}function axe(t,e){for(let n=e+1;n({collapsed:Je(l.interfaceIcons,"nav-tree-expand"),expanded:Je(l.interfaceIcons,"nav-tree-collapse")}),[l.interfaceIcons]),le=(0,ua.useMemo)(()=>Je(l.interfaceIcons,"list-pinned"),[l.interfaceIcons]),ae=(0,ua.useMemo)(()=>el({manualSortGroupHeaderProperty:l.manualSortGroupHeaderProperty,manualSortPropertyKey:l.manualSortPropertyKey}),[l.manualSortGroupHeaderProperty,l.manualSortPropertyKey]),ve=(0,ua.useMemo)(()=>{let ze=new Map,Ie=De=>{if(!De||ze.has(De))return;let Me=_.vault.getFolderByPath(De);if(!Me)return;let nt=l.enableFolderNotes&&l.enableFolderNoteLinks?Rn(Me,{enableFolderNotes:l.enableFolderNotes,folderNoteNamePattern:l.folderNoteNamePattern}):null;ze.set(De,{folder:Me,folderNote:nt})};return t.forEach(De=>{De.type===tn.HEADER&&(Ie(De.headerFolderPath),De.headerFolderSegments?.forEach(Me=>{Ie(Me.path)}))}),ze},[_.vault,t,l.enableFolderNoteLinks,l.enableFolderNotes,l.folderNoteNamePattern]),{headerModels:de,headerModelByIndex:Pe}=(0,ua.useMemo)(()=>{let ze=[],Ie=new Map,De=!1;return t.forEach((Me,nt)=>{if(Me.type===tn.FILE){De=!0;return}if(Me.type!==tn.HEADER||typeof Me.data!="string")return;let Ge=Me.headerFolderPath??null,Tt=Me.key===Qy,gt=Me.collapseKey??null,wn=Tt?!c:Me.isCollapsed===!0,it=Me.headerKind==="manual-sort-custom"?Me.manualSortHeader??null:null,yn=it?.title??Me.data,rt=Me.headerKind==="folder"?Ge??"/":null,me=Me.headerKind==="folder"&&l.showFolderGroupPaths?(Me.headerFolderSegments??[]).map(dt=>({label:dt.label,path:dt.path,target:ve.get(dt.path)??null})):[],se=null,fe=null,Ne=l.showFolderIcons,xe=l.showFolderIcons||!l.colorIconOnly;if(rt!==null&&(Ne||xe)){let dt=Y.getFolderDisplayData(rt,{includeDisplayName:!1,includeColor:xe,includeBackgroundColor:!1,includeIcon:Ne,includeInheritedColors:xe});se=Ne?dt.icon??Je(l.interfaceIcons,rt==="/"?"nav-folder-root":wn?"nav-folder-closed":"nav-folder-open"):null,xe&&(fe=wy({model:q,folderPath:rt,color:dt.color,backgroundColor:void 0}).color??null)}let Be={index:nt,label:Me.data,baseLabel:yn,isFirstHeader:ze.length===0&&!De,isPinnedHeader:Tt,collapseKey:gt,isCollapsed:wn,isCollapsible:Tt||gt!==null,folderGroupHeaderTarget:Ge!==null?ve.get(Ge)??null:null,folderGroupHeaderPath:Me.headerKind==="folder"?Ge??"/":null,folderGroupHeaderSegments:me,groupFilePaths:Me.groupFilePaths??[],itemCount:l.showGroupHeaderItemCounts?Me.groupFilePaths?.length??0:null,totalItemCount:l.showGroupHeaderItemCounts?Me.groupTotalItemCount??null:null,manualSortHeaderFilePath:Me.headerKind==="manual-sort-custom"?Me.manualSortHeaderFilePath??null:null,manualSortHeader:it,manualSortHeaderWordCount:Me.manualSortHeaderWordCount??0,manualSortHeaderTargetWordCount:Me.manualSortHeaderTargetWordCount??null,folderIconId:se,folderColor:fe,applyFolderColorToLabel:fe!==null&&!l.colorIconOnly};ze.push(Be),Ie.set(nt,Be)}),{headerModels:ze,headerModelByIndex:Ie}},[q,ve,t,Y,c,l.colorIconOnly,l.showFolderGroupPaths,l.showGroupHeaderItemCounts,l.interfaceIcons,l.showFolderIcons]),Fe=(0,ua.useMemo)(()=>oxe(t),[t]),te=(0,ua.useCallback)((ze,Ie)=>{ze.stopPropagation();let De=Ie.folderNote,Me={source:"manual",suppressAutoSelect:!!De};if(H(Ie.folder.path,Me),!De)return;let nt=Iu(ze,l.folderNoteOpenLocation,l.multiSelectModifier);Ai(Z,De),!(nt==="right-sidebar"&&l.showNearestFolderNoteInSidebar&&!(m===K.FOLDER&&g===Ie.folder.path))&&$(()=>vi({app:_,commandQueue:W,folder:Ie.folder,folderNote:De,context:nt,openInRightSidebar:Ge=>J.openFolderNoteInRightSidebar(Ge)}))},[_,W,H,J,Z,g,m,l.folderNoteOpenLocation,l.multiSelectModifier,l.showNearestFolderNoteInSidebar]),ye=(0,ua.useCallback)((ze,Ie)=>{let De=Ie.folderNote;ze.button!==1||!De||(ze.preventDefault(),ze.stopPropagation(),H(Ie.folder.path,{source:"manual",suppressAutoSelect:!0}),Ai(Z,De),$(()=>vi({app:_,commandQueue:W,folder:Ie.folder,folderNote:De,context:"tab"})))},[_,W,H,Z]),ce=(0,ua.useCallback)((ze,Ie)=>{let De=Ie.groupFilePaths.map(Tt=>_.vault.getFileByPath(Tt)).filter(Tt=>Tt instanceof Pl.TFile),Me=Sm(De),nt=new Pl.Menu,Ge=!1;if(Me.length>=2&&(Ge=hD({menu:nt,app:_,commandQueue:W,fileSystemOps:re,files:Me,outputFolder:ixe(_,Ie,Me),defaultOutputName:Ie.baseLabel||d.modals.mergeNotes.outputNamePlaceholder,title:d.contextMenu.file.mergeNotesInGroup})),ae&&Ie.manualSortHeaderFilePath){let Tt=_.vault.getFileByPath(Ie.manualSortHeaderFilePath);if(Tt instanceof Pl.TFile&&Tt.extension==="md"){Ge&&nt.addSeparator();let gt=Sw({menu:nt,app:_,file:Tt,propertyKey:ae,metadataService:Y});Ge=Ge||gt}}Ge&&(ze.preventDefault(),ze.stopPropagation(),nt.showAtMouseEvent(ze.nativeEvent))},[_,W,re,ae,Y]),pe=(0,ua.useCallback)(ze=>{T(Cae(ze.target),{clientX:ze.clientX,clientY:ze.clientY})},[T]),ue=(0,ua.useCallback)(()=>{T(null,null)},[T]),Se=(0,ua.useCallback)(ze=>{if(ze?.type!==tn.FILE||!(ze.data instanceof Pl.TFile))return!1;let Ie=ze.data,De=l.showFileBackgroundUnfinishedTask?D.getDB().getFile(Ie.path)?.taskUnfinished:void 0;return sE({customBackgroundColor:Y.getFileBackgroundColor(Ie.path),taskUnfinished:De,showUnfinishedTaskBackground:l.showFileBackgroundUnfinishedTask,unfinishedTaskBackgroundColor:l.unfinishedTaskBackgroundColor,getSolidBackground:j})},[D,j,Y,l.showFileBackgroundUnfinishedTask,l.unfinishedTaskBackgroundColor]),ee=(0,ua.useCallback)(ze=>v(ze)||b&&y===ze.path,[v,b,y]),ie=(0,ua.useMemo)(()=>({onFileClick:F,selectionType:m,sortOption:f,searchHighlightTerms:h,onModifySearchWithTag:k,onModifySearchWithProperty:P,localDayReference:E,fileIconSize:C,appearanceSettings:L,includeDescendantNotes:z,hiddenTagVisibility:G,fileNameIconNeedles:Q,visiblePropertyKeys:R,visibleNavigationPropertyKeys:O,fileItemStorage:D,onToggleNoteShortcut:B,folderDecorationModel:q,fileItemPillDecorationModel:X,fileItemPillOrderModel:V,getSolidBackground:j}),[F,m,f,h,k,P,E,C,L,z,G,Q,R,O,D,B,q,X,V,j]),Ce=(0,ua.useMemo)(()=>({onCommit:A,onCancel:N,onRestoreFocus:M}),[A,N,M]),we=e.getVirtualItems(),Le=e.scrollOffset??0,We=l.stickyGroupHeaders,Nt=We&&(s===0||Le>=s)?Math.max(0,Le+.5):null,Pt=Nt!==null&&t.length>0?e.getVirtualItemForOffset(Nt):void 0,Zt=We?sxe(de,Pt?.index??null):null;return(0,cr.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:pe,onMouseLeave:ue,children:[Zt?(0,cr.jsx)("div",{className:"nn-list-sticky-header",children:(0,cr.jsx)(Fae,{header:Zt,collapseChevronIcons:ne,pinnedSectionIcon:le,onPinnedGroupHeaderToggle:u,onListGroupHeaderToggle:p,onFolderGroupHeaderClick:te,onFolderGroupHeaderMouseDown:ye,onGroupHeaderContextMenu:ce})}):null,(0,cr.jsx)("div",{className:"nn-list-pane-content",children:a?(0,cr.jsx)("div",{className:"nn-empty-state",children:(0,cr.jsx)("div",{className:"nn-empty-message",children:d.listPane.emptyStateNoSelection})}):i?(0,cr.jsx)("div",{className:"nn-empty-state",children:(0,cr.jsx)("div",{className:"nn-empty-message",children:d.listPane.emptyStateNoNotes})}):t.length>0?(0,cr.jsx)("div",{className:"nn-virtual-container",style:{height:`${e.getTotalSize()}px`},children:we.map(ze=>{let Ie=DD(t,ze.index);if(!Ie)return null;let De=DD(t,ze.index+1),Me=DD(t,ze.index-1),nt=EC(Ie),Ge=nt&&ee(Ie.data),Tt=EC(Me)&&ee(Me.data),gt=EC(De)&&ee(De.data),wn=Se(Ie),it=nt&&Se(Me),yn=nt&&Se(De),rt=wn&&it,me=nt&&yn,se=nt&&(Ge||wn),fe=se&&EC(Me)&&(Tt||it),Ne=se&&EC(De)&&(gt||yn),xe=nt&&(ze.index===t.length-1||De&&(De.type===tn.HEADER||De.type===tn.HEADER_SPACER||De.type===tn.TOP_SPACER||De.type===tn.BOTTOM_SPACER)),Be=nt&&Tt,dt=nt&>,St=Ie.type===tn.FILE?Fe[ze.index]??null:null,ln=Ie.type===tn.FILE&&Ie.data instanceof Pl.TFile?x.get(Ie.data.path):void 0,vn=Ie.type===tn.FILE&&Ie.data instanceof Pl.TFile&&Ie.data.path===I,In=Pe.get(ze.index)??null,eo=In?axe(t,ze.index):null,Dt=lxe(In)||dxe(In),an=Ie.type===tn.FILE&&(Ge&&!dt||!Ge&>),Sn=eo!==null&&ee(eo),_r=an||Sn;return(0,cr.jsx)(cxe,{index:ze.index,top:Math.max(0,ze.start),rowHeight:ze.size,item:Ie,headerModel:In,topSpacerHeight:s,isSelected:Ge,hasSelectedAbove:Be,hasSelectedBelow:dt,isLastFile:!!xe,hideSeparator:_r,shouldHideHeaderSeparatorForGroup:Dt,hasFilledBackground:se,hasPreviousFilledBackground:!!fe,hasNextFilledBackground:!!Ne,hasCustomBackground:wn,hasPreviousCustomBackground:rt,hasNextCustomBackground:me,showQuickActionsPanel:nt&&!vn&&!w&&S===Ie.data.path,isInlineRenaming:vn,groupHeaderLabel:St,shortcutKey:ln,fileItemPaneProps:ie,inlineRenameHandlers:Ce,collapseChevronIcons:ne,pinnedSectionIcon:le,onPinnedGroupHeaderToggle:u,onListGroupHeaderToggle:p,onFolderGroupHeaderClick:te,onFolderGroupHeaderMouseDown:ye,onGroupHeaderContextMenu:ce},ze.key)})}):null})]})}var ua,Pl,cr,Fae,cxe,xae=U(()=>{ua=he(Ve()),Pl=require("obsidian");Ur();fn();Oe();Ue();st();Hu();Md();yK();rd();lr();_f();hi();PD();gD();Q1();ZS();vK();cr=he($e());Fae=ua.default.memo(function({header:e,collapseChevronIcons:n,pinnedSectionIcon:r,onPinnedGroupHeaderToggle:o,onListGroupHeaderToggle:a,onFolderGroupHeaderClick:i,onFolderGroupHeaderMouseDown:s,onGroupHeaderContextMenu:l}){let c=e.folderGroupHeaderTarget,u=e.manualSortHeader,p=e.folderGroupHeaderSegments.length>0,m=!!c&&!e.isPinnedHeader&&!p,g=u!==null&&yf(u,e.manualSortHeaderTargetWordCount),f=e.folderColor??void 0,h=f?{color:f}:void 0,b=e.applyFolderColorToLabel&&f?{color:f}:void 0,y=(0,ua.useCallback)(P=>{if(P.stopPropagation(),e.isPinnedHeader){o();return}e.collapseKey&&a(e.collapseKey)},[e.collapseKey,e.isPinnedHeader,a,o]),v=["nn-list-group-header"];e.isCollapsible&&v.push("nn-list-group-header--collapsible"),e.isPinnedHeader&&v.push("nn-pinned-section-header"),u&&v.push("nn-list-group-header--manual-sort");let S=P=>l(P,e),w=`nn-list-group-header-text ${m?"nn-list-group-header-text--folder-note":""} ${e.applyFolderColorToLabel?"nn-list-group-header-text--custom-color":""}`,T=`${w} nn-list-group-header-path`,F=()=>p?(0,cr.jsx)("span",{className:T,style:b,children:e.folderGroupHeaderSegments.map((P,E)=>{let C=P.target,L=`nn-list-group-header-folder-segment ${C?"nn-list-group-header-text--folder-note":""}`;return(0,cr.jsxs)(ua.default.Fragment,{children:[E>0?(0,cr.jsx)("span",{className:"nn-list-group-header-path-separator","aria-hidden":"true",children:"/"}):null,(0,cr.jsx)("span",{className:L,onClick:C?z=>{z.stopPropagation(),i(z,C)}:void 0,onMouseDown:C?z=>s(z,C):void 0,children:P.label})]},P.path)})}):(0,cr.jsx)("span",{className:w,style:b,onClick:c?P=>{P.stopPropagation(),i(P,c)}:void 0,onMouseDown:c?P=>s(P,c):void 0,children:e.label}),k=(0,cr.jsxs)("div",{className:v.join(" "),onClick:e.isCollapsible?y:void 0,onContextMenu:g?void 0:S,children:[u?(0,cr.jsx)(xC,{header:u,wordCount:e.manualSortHeaderWordCount,targetWordCount:e.manualSortHeaderTargetWordCount}):(0,cr.jsxs)(cr.Fragment,{children:[e.isPinnedHeader&&r?(0,cr.jsx)(qt,{iconId:r,className:"nn-list-group-header-icon nn-pinned-section-icon","aria-hidden":!0}):null,!e.isPinnedHeader&&e.folderIconId?(0,cr.jsx)(qt,{iconId:e.folderIconId,className:"nn-list-group-header-icon nn-list-group-header-folder-icon","aria-hidden":!0,"data-has-color":f?"true":"false",style:h}):null,F()]}),e.itemCount!==null?(0,cr.jsxs)("span",{className:"nn-list-group-header-item-count",children:["(",e.itemCount,e.totalItemCount!==null?`/${e.totalItemCount}`:"",")"]}):null,e.isCollapsible?(0,cr.jsx)("button",{type:"button",className:"nn-list-group-header-collapse-button","aria-label":e.isCollapsed?d.listPane.expandGroup:d.listPane.collapseGroup,"aria-expanded":!e.isCollapsed,onClick:y,children:(0,cr.jsx)(qt,{iconId:e.isCollapsed?n.collapsed:n.expanded,className:"nn-list-group-header-icon","aria-hidden":!0})}):null]});return g?(0,cr.jsxs)("div",{className:"nn-manual-sort-group-header-shell",onContextMenu:S,children:[k,(0,cr.jsx)(AD,{header:u,wordCount:e.manualSortHeaderWordCount,targetWordCount:e.manualSortHeaderTargetWordCount})]}):k}),cxe=ua.default.memo(function({index:e,top:n,rowHeight:r,item:o,headerModel:a,topSpacerHeight:i,isSelected:s,hasSelectedAbove:l,hasSelectedBelow:c,isLastFile:u,hideSeparator:p,shouldHideHeaderSeparatorForGroup:m,hasFilledBackground:g,hasPreviousFilledBackground:f,hasNextFilledBackground:h,hasCustomBackground:b,hasPreviousCustomBackground:y,hasNextCustomBackground:v,showQuickActionsPanel:S,isInlineRenaming:w,groupHeaderLabel:T,shortcutKey:F,fileItemPaneProps:k,inlineRenameHandlers:P,collapseChevronIcons:E,pinnedSectionIcon:C,onPinnedGroupHeaderToggle:L,onListGroupHeaderToggle:z,onFolderGroupHeaderClick:G,onFolderGroupHeaderMouseDown:Q,onGroupHeaderContextMenu:R}){let O={top:n,"--item-height":`${r}px`},D=["nn-virtual-item"];return o.type===tn.FILE&&D.push("nn-virtual-file-item"),a&&D.push("nn-virtual-list-group-header"),m&&D.push("nn-hide-list-group-header-separator"),u&&D.push("nn-last-file"),p&&D.push("nn-hide-separator-selection"),g&&D.push("nn-virtual-file-item-has-filled-background"),f&&D.push("nn-virtual-file-item-has-filled-background-previous"),h&&D.push("nn-virtual-file-item-has-filled-background-next"),b&&D.push("nn-virtual-file-item-has-custom-background"),y&&D.push("nn-virtual-file-item-has-custom-background-previous"),v&&D.push("nn-virtual-file-item-has-custom-background-next"),(0,cr.jsx)("div",{className:D.join(" "),style:O,"data-index":e,children:a?(0,cr.jsx)(Fae,{header:a,collapseChevronIcons:E,pinnedSectionIcon:C,onPinnedGroupHeaderToggle:L,onListGroupHeaderToggle:z,onFolderGroupHeaderClick:G,onFolderGroupHeaderMouseDown:Q,onGroupHeaderContextMenu:R}):o.type===tn.HEADER_SPACER?(0,cr.jsx)("div",{className:"nn-list-group-header-spacer"}):o.type===tn.TOP_SPACER?(0,cr.jsx)("div",{className:"nn-list-top-spacer",style:{height:`${i}px`}}):o.type===tn.BOTTOM_SPACER?(0,cr.jsx)("div",{className:"nn-list-bottom-spacer"}):o.type===tn.FILE&&o.data instanceof Pl.TFile?(0,cr.jsx)(MD,{file:o.data,paneProps:k,isSelected:s,hasSelectedAbove:l,hasSelectedBelow:c,showQuickActionsPanel:S,fileIndex:o.fileIndex,groupHeaderLabel:T,parentFolder:o.parentFolder,isPinned:o.isPinned,matchedAliases:o.matchedAliases,matchedProperties:o.matchedProperties,searchMeta:o.searchMeta,isHidden:!!o.isHidden,shortcutKey:F,inlineRename:w?P:void 0},o.key):null})})});function Rae(){for(var t=arguments.length,e=new Array(t),n=0;nr=>{e.forEach(o=>o(r))},e)}function Fy(t){let e=Object.prototype.toString.call(t);return e==="[object Window]"||e==="[object global]"}function OD(t){return"nodeType"in t}function Vs(t){var e,n;return t?Fy(t)?t:OD(t)&&(e=(n=t.ownerDocument)==null?void 0:n.defaultView)!=null?e:window:window}function LD(t){let{Document:e}=Vs(t);return t instanceof e}function Ow(t){return Fy(t)?!1:t instanceof Vs(t).HTMLElement}function SK(t){return t instanceof Vs(t).SVGElement}function Cy(t){return t?Fy(t)?t.document:OD(t)?LD(t)?t:Ow(t)||SK(t)?t.ownerDocument:document:document:document}function zD(t){let e=(0,ka.useRef)(t);return tc(()=>{e.current=t}),(0,ka.useCallback)(function(){for(var n=arguments.length,r=new Array(n),o=0;o{t.current=setInterval(r,o)},[]),n=(0,ka.useCallback)(()=>{t.current!==null&&(clearInterval(t.current),t.current=null)},[]);return[e,n]}function Lw(t,e){e===void 0&&(e=[t]);let n=(0,ka.useRef)(t);return tc(()=>{n.current!==t&&(n.current=t)},e),n}function zw(t,e){let n=(0,ka.useRef)();return(0,ka.useMemo)(()=>{let r=t(n.current);return n.current=r,r},[...e])}function MC(t){let e=zD(t),n=(0,ka.useRef)(null),r=(0,ka.useCallback)(o=>{o!==n.current&&e?.(o,n.current),n.current=o},[]);return[n,r]}function BD(t){let e=(0,ka.useRef)();return(0,ka.useEffect)(()=>{e.current=t},[t]),e.current}function Ny(t,e){return(0,ka.useMemo)(()=>{if(e)return e;let n=bK[t]==null?0:bK[t]+1;return bK[t]=n,t+"-"+n},[t,e])}function Aae(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 uxe(t){return"clientX"in t&&"clientY"in t}function AC(t){if(!t)return!1;let{KeyboardEvent:e}=Vs(t.target);return e&&t instanceof e}function pxe(t){if(!t)return!1;let{TouchEvent:e}=Vs(t.target);return e&&t instanceof e}function _D(t){if(pxe(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 uxe(t)?{x:t.clientX,y:t.clientY}:null}function Dae(t){return t.matches(Eae)?t:t.querySelector(Eae)}var ka,RC,tc,bK,Iy,Bw,ec,Eae,_w=U(()=>{ka=he(Ve());RC=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";tc=RC?ka.useLayoutEffect:ka.useEffect;bK={};Iy=Aae(1),Bw=Aae(-1);ec=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[ec.Translate.toString(t),ec.Scale.toString(t)].join(" ")}},Transition:{toString(t){let{property:e,duration:n,easing:r}=t;return e+" "+n+"ms "+r}}}),Eae="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]"});function Oae(t){let{id:e,value:n}=t;return xy.default.createElement("div",{id:e,style:mxe},n)}function Lae(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 xy.default.createElement("div",{id:e,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function zae(){let[t,e]=(0,xy.useState)("");return{announce:(0,xy.useCallback)(r=>{r!=null&&e(r)},[]),announcement:t}}var xy,mxe,Bae=U(()=>{xy=he(Ve()),mxe={display:"none"}});function gxe(t){let e=(0,Qe.useContext)(Xae);(0,Qe.useEffect)(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of ");return e(t)},[t,e])}function hxe(){let[t]=(0,Qe.useState)(()=>new Set),e=(0,Qe.useCallback)(r=>(t.add(r),()=>t.delete(r)),[t]);return[(0,Qe.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 vxe(t){let{announcements:e=yxe,container:n,hiddenTextDescribedById:r,screenReaderInstructions:o=fxe}=t,{announce:a,announcement:i}=zae(),s=Ny("DndLiveRegion"),[l,c]=(0,Qe.useState)(!1);if((0,Qe.useEffect)(()=>{c(!0)},[]),gxe((0,Qe.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=Qe.default.createElement(Qe.default.Fragment,null,Qe.default.createElement(Oae,{id:r,value:o.draggable}),Qe.default.createElement(Lae,{id:s,announcement:i}));return n?(0,Ey.createPortal)(u,n):u}function VD(){}function Nh(t,e){return(0,Qe.useMemo)(()=>({sensor:t,options:e??{}}),[t,e])}function Vw(){for(var t=arguments.length,e=new Array(t),n=0;n[...e].filter(r=>r!=null),[...e])}function bxe(t,e){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))}function Sxe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return n-r}function wxe(t,e){let{data:{value:n}}=t,{data:{value:r}}=e;return r-n}function Qae(t,e){if(!t||t.length===0)return null;let[n]=t;return e?n[e]:n}function _ae(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 Txe(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 Nxe(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 Ixe(t,e,n){let r=Nxe(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 Oy(t,e){e===void 0&&(e=xxe);let n=t.getBoundingClientRect();if(e.ignoreTransform){let{transform:c,transformOrigin:u}=Vs(t).getComputedStyle(t);c&&(n=Ixe(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 Hae(t){return Oy(t,{ignoreTransform:!0})}function Exe(t){let e=t.innerWidth,n=t.innerHeight;return{top:0,left:0,right:e,bottom:n,width:e,height:n}}function Rxe(t,e){return e===void 0&&(e=Vs(t).getComputedStyle(t)),e.position==="fixed"}function Mxe(t,e){e===void 0&&(e=Vs(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 WD(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(!Ow(o)||SK(o)||n.includes(o))return n;let a=Vs(t).getComputedStyle(o);return o!==t&&Mxe(o,a)&&n.push(o),Rxe(o,a)?n:r(o.parentNode)}return t?r(t):n}function Jae(t){let[e]=WD(t,1);return e??null}function wK(t){return!RC||!t?null:Fy(t)?t:OD(t)?LD(t)||t===Cy(t).scrollingElement?window:Ow(t)?t:null:null}function eie(t){return Fy(t)?t.scrollX:t.scrollLeft}function tie(t){return Fy(t)?t.scrollY:t.scrollTop}function PK(t){return{x:eie(t),y:tie(t)}}function nie(t){return!RC||!t?!1:t===document.scrollingElement}function rie(t){let e={x:0,y:0},n=nie(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 Dxe(t,e,n,r,o){let{top:a,left:i,right:s,bottom:l}=n;r===void 0&&(r=10),o===void 0&&(o=Axe);let{isTop:c,isBottom:u,isLeft:p,isRight:m}=rie(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 Oxe(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 oie(t){return t.reduce((e,n)=>Iy(e,PK(n)),Jc)}function Lxe(t){return t.reduce((e,n)=>e+eie(n),0)}function zxe(t){return t.reduce((e,n)=>e+tie(n),0)}function Bxe(t,e){if(e===void 0&&(e=Oy),!t)return;let{top:n,left:r,bottom:o,right:a}=e(t);Jae(t)&&(o<=0||a<=0||n>=window.innerHeight||r>=window.innerWidth)&&t.scrollIntoView({block:"center",inline:"center"})}function Hxe(t){let{EventTarget:e}=Vs(t);return t instanceof e?t:Cy(t)}function TK(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 Vae(t){t.preventDefault()}function Vxe(t){t.stopPropagation()}function Kae(t){return!!(t&&"distance"in t)}function Uae(t){return!!(t&&"delay"in t)}function Gxe(t){let{acceleration:e,activator:n=DC.Pointer,canScroll:r,draggingRect:o,enabled:a,interval:i=5,order:s=UD.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:p,threshold:m}=t,g=qxe({delta:p,disabled:!a}),[f,h]=Mae(),b=(0,Qe.useRef)({x:0,y:0}),y=(0,Qe.useRef)({x:0,y:0}),v=(0,Qe.useMemo)(()=>{switch(n){case DC.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case DC.DraggableRect:return o}},[n,o,l]),S=(0,Qe.useRef)(null),w=(0,Qe.useCallback)(()=>{let F=S.current;if(!F)return;let k=b.current.x*y.current.x,P=b.current.y*y.current.y;F.scrollBy(k,P)},[]),T=(0,Qe.useMemo)(()=>s===UD.TreeOrder?[...c].reverse():c,[s,c]);(0,Qe.useEffect)(()=>{if(!a||!c.length||!v){h();return}for(let F of T){if(r?.(F)===!1)continue;let k=c.indexOf(F),P=u[k];if(!P)continue;let{direction:E,speed:C}=Dxe(F,P,v,e,m);for(let L of["x","y"])g[L][E[L]]||(C[L]=0,E[L]=0);if(C.x>0||C.y>0){h(),S.current=F,f(w,i),b.current=C,y.current=E;return}}b.current={x:0,y:0},y.current={x:0,y:0},h()},[e,w,r,h,a,i,JSON.stringify(v),JSON.stringify(g),f,c,T,u,JSON.stringify(m)])}function qxe(t){let{delta:e,disabled:n}=t,r=BD(e);return zw(o=>{if(n||!r||!o)return jxe;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 Yxe(t,e){let n=e!=null?t.get(e):void 0,r=n?n.node.current:null;return zw(o=>{var a;return e==null?null:(a=r??o)!=null?a:null},[r,e])}function $xe(t,e){return(0,Qe.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 Xxe(t,e){let{dragging:n,dependencies:r,config:o}=e,[a,i]=(0,Qe.useState)(null),{frequency:s,measure:l,strategy:c}=o,u=(0,Qe.useRef)(t),p=b(),m=Lw(p),g=(0,Qe.useCallback)(function(y){y===void 0&&(y=[]),!m.current&&i(v=>v===null?y:v.concat(y.filter(S=>!v.includes(S))))},[m]),f=(0,Qe.useRef)(null),h=zw(y=>{if(p&&!n)return Wae;if(!y||y===Wae||u.current!==t||a!=null){let v=new Map;for(let S of t){if(!S)continue;if(a&&a.length>0&&!a.includes(S.id)&&S.rect.current){v.set(S.id,S.rect.current);continue}let w=S.node.current,T=w?new OC(l(w),w):null;S.rect.current=T,T&&v.set(S.id,T)}return v}return y},[t,a,n,p,l]);return(0,Qe.useEffect)(()=>{u.current=t},[t]),(0,Qe.useEffect)(()=>{p||g()},[n,p]),(0,Qe.useEffect)(()=>{a&&a.length>0&&i(null)},[JSON.stringify(a)]),(0,Qe.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 zC.Always:return!1;case zC.BeforeDragging:return n;default:return!n}}}function iie(t,e){return zw(n=>t?n||(typeof e=="function"?e(t):t):null,[e,t])}function Qxe(t,e){return iie(t,e)}function Zxe(t){let{callback:e,disabled:n}=t,r=zD(e),o=(0,Qe.useMemo)(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;let{MutationObserver:a}=window;return new a(r)},[r,n]);return(0,Qe.useEffect)(()=>()=>o?.disconnect(),[o]),o}function GD(t){let{callback:e,disabled:n}=t,r=zD(e),o=(0,Qe.useMemo)(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;let{ResizeObserver:a}=window;return new a(r)},[n]);return(0,Qe.useEffect)(()=>()=>o?.disconnect(),[o]),o}function Jxe(t){return new OC(Oy(t),t)}function Gae(t,e,n){e===void 0&&(e=Jxe);let[r,o]=(0,Qe.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=Zxe({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=GD({callback:a});return tc(()=>{a(),t?(s?.observe(t),i?.observe(document.body,{childList:!0,subtree:!0})):(s?.disconnect(),i?.disconnect())},[t]),r}function eEe(t){let e=iie(t);return Zae(t,e)}function tEe(t){let e=(0,Qe.useRef)(t),n=zw(r=>t?r&&r!==jae&&t&&e.current&&t.parentNode===e.current.parentNode?r:WD(t):jae,[t]);return(0,Qe.useEffect)(()=>{e.current=t},[t]),n}function nEe(t){let[e,n]=(0,Qe.useState)(null),r=(0,Qe.useRef)(t),o=(0,Qe.useCallback)(a=>{let i=wK(a.target);i&&n(s=>s?(s.set(i,PK(i)),new Map(s)):null)},[]);return(0,Qe.useEffect)(()=>{let a=r.current;if(t!==a){i(a);let s=t.map(l=>{let c=wK(l);return c?(c.addEventListener("scroll",o,{passive:!0}),[c,PK(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=wK(l);c?.removeEventListener("scroll",o)})}},[o,t]),(0,Qe.useMemo)(()=>t.length?e?Array.from(e.values()).reduce((a,i)=>Iy(a,i),Jc):oie(t):Jc,[t,e])}function qae(t,e){e===void 0&&(e=[]);let n=(0,Qe.useRef)(null);return(0,Qe.useEffect)(()=>{n.current=null},e),(0,Qe.useEffect)(()=>{let r=t!==Jc;r&&!n.current&&(n.current=t),!r&&n.current&&(n.current=null)},[t]),n.current?Bw(t,n.current):Jc}function rEe(t){(0,Qe.useEffect)(()=>{if(!RC)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 oEe(t,e){return(0,Qe.useMemo)(()=>t.reduce((n,r)=>{let{eventName:o,handler:a}=r;return n[o]=i=>{a(i,e)},n},{}),[t,e])}function sie(t){return(0,Qe.useMemo)(()=>t?Exe(t):null,[t])}function aEe(t,e){e===void 0&&(e=Oy);let[n]=t,r=sie(n?Vs(n):null),[o,a]=(0,Qe.useState)(Yae);function i(){a(()=>t.length?t.map(l=>nie(l)?r:new OC(e(l),l)):Yae)}let s=GD({callback:i});return tc(()=>{s?.disconnect(),i(),t.forEach(l=>s?.observe(l))},[t]),o}function iEe(t){if(!t)return null;if(t.children.length>1)return t;let e=t.children[0];return Ow(e)?e:t}function sEe(t){let{measure:e}=t,[n,r]=(0,Qe.useState)(null),o=(0,Qe.useCallback)(c=>{for(let{target:u}of c)if(Ow(u)){r(p=>{let m=e(u);return p?{...p,width:m.width,height:m.height}:m});break}},[e]),a=GD({callback:o}),i=(0,Qe.useCallback)(c=>{let u=iEe(c);a?.disconnect(),u&&a?.observe(u),r(u?e(u):null)},[e,a]),[s,l]=MC(i);return(0,Qe.useMemo)(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}function pEe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new My}}}function mEe(t,e){switch(e.type){case ri.DragStart:return{...t,draggable:{...t.draggable,initialCoordinates:e.initialCoordinates,active:e.active}};case ri.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 ri.DragEnd:case ri.DragCancel:return{...t,draggable:{...t.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ri.RegisterDroppable:{let{element:n}=e,{id:r}=n,o=new My(t.droppable.containers);return o.set(r,n),{...t,droppable:{...t.droppable,containers:o}}}case ri.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 My(t.droppable.containers);return i.set(n,{...a,disabled:o}),{...t,droppable:{...t.droppable,containers:i}}}case ri.UnregisterDroppable:{let{id:n,key:r}=e,o=t.droppable.containers.get(n);if(!o||r!==o.key)return t;let a=new My(t.droppable.containers);return a.delete(n),{...t,droppable:{...t.droppable,containers:a}}}default:return t}}function gEe(t){let{disabled:e}=t,{active:n,activatorEvent:r,draggableNodes:o}=(0,Qe.useContext)(jD),a=BD(r),i=BD(n?.id);return(0,Qe.useEffect)(()=>{if(!e&&!r&&a&&i!=null){if(!AC(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=Dae(u);if(p){p.focus();break}}})}},[r,e,o,i,a]),null}function hEe(t,e){let{transform:n,...r}=e;return t!=null&&t.length?t.reduce((o,a)=>a({transform:o,...r}),n):n}function fEe(t){return(0,Qe.useMemo)(()=>({draggable:{...HD.draggable,...t?.draggable},droppable:{...HD.droppable,...t?.droppable},dragOverlay:{...HD.dragOverlay,...t?.dragOverlay}}),[t?.draggable,t?.droppable,t?.dragOverlay])}function yEe(t){let{activeNode:e,measure:n,initialRect:r,config:o=!0}=t,a=(0,Qe.useRef)(!1),{x:i,y:s}=typeof o=="boolean"?{x:o,y:o}:o;tc(()=>{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=Zae(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=Jae(c);m&&m.scrollBy({top:p.y,left:p.x})}},[e,i,s,r,n])}function cie(t){let{id:e,data:n,disabled:r=!1,attributes:o}=t,a=Ny(bEe),{activators:i,activatorEvent:s,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:p,over:m}=(0,Qe.useContext)(jD),{role:g=$ae,roleDescription:f="draggable",tabIndex:h=0}=o??{},b=l?.id===e,y=(0,Qe.useContext)(b?die:vEe),[v,S]=MC(),[w,T]=MC(),F=oEe(i,e),k=Lw(n);tc(()=>(p.set(e,{id:e,key:a,node:v,activatorNode:w,data:k}),()=>{let E=p.get(e);E&&E.key===a&&p.delete(e)}),[p,e]);let P=(0,Qe.useMemo)(()=>({role:g,tabIndex:h,"aria-disabled":r,"aria-pressed":b&&g===$ae?!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:P,isDragging:b,listeners:r?void 0:F,node:v,over:m,setNodeRef:S,setActivatorNodeRef:T,transform:y}}function uie(){return(0,Qe.useContext)(lie)}function pie(t){let{data:e,disabled:n=!1,id:r,resizeObserverConfig:o}=t,a=Ny(SEe),{active:i,dispatch:s,over:l,measureDroppableContainers:c}=(0,Qe.useContext)(jD),u=(0,Qe.useRef)({disabled:n}),p=(0,Qe.useRef)(!1),m=(0,Qe.useRef)(null),g=(0,Qe.useRef)(null),{disabled:f,updateMeasurementsFor:h,timeout:b}={...wEe,...o},y=Lw(h??r),v=(0,Qe.useCallback)(()=>{if(!p.current){p.current=!0;return}g.current!=null&&clearTimeout(g.current),g.current=setTimeout(()=>{c(Array.isArray(y.current)?y.current:[y.current]),g.current=null},b)},[b]),S=GD({callback:v,disabled:f||!i}),w=(0,Qe.useCallback)((P,E)=>{S&&(E&&(S.unobserve(E),p.current=!1),P&&S.observe(P))},[S]),[T,F]=MC(w),k=Lw(e);return(0,Qe.useEffect)(()=>{!S||!T.current||(S.disconnect(),p.current=!1,S.observe(T.current))},[T,S]),(0,Qe.useEffect)(()=>(s({type:ri.RegisterDroppable,element:{id:r,key:a,disabled:n,node:T,rect:m,data:k}}),()=>s({type:ri.UnregisterDroppable,key:a,id:r})),[r]),(0,Qe.useEffect)(()=>{n!==u.current.disabled&&(s({type:ri.SetDroppableDisabled,id:r,key:a,disabled:n}),u.current.disabled=n)},[r,a,n,s]),{active:i,rect:m,isOver:l?.id===r,node:T,over:l,setNodeRef:F}}var Qe,Ey,Xae,fxe,yxe,ri,Jc,BC,kxe,Cxe,xxe,Ci,Axe,_xe,OC,Ry,nc,Ir,aie,Kxe,KD,LC,Uxe,Hw,Wxe,FK,Ay,kK,Dy,DC,UD,jxe,zC,CK,Wae,jae,Yae,lEe,dEe,HD,My,cEe,uEe,jD,lie,die,Ch,Kw,vEe,$ae,bEe,SEe,wEe,Ly=U(()=>{Qe=he(Ve()),Ey=he(FF());_w();Bae();Xae=(0,Qe.createContext)(null);fxe={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.
`},yxe={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"})(ri||(ri={}));Jc=Object.freeze({x:0,y:0});BC=t=>{let{collisionRect:e,droppableRects:n,droppableContainers:r}=t,o=_ae(e,e.left,e.top),a=[];for(let i of r){let{id:s}=i,l=n.get(s);if(l){let c=bxe(_ae(l),o);a.push({id:s,data:{droppableContainer:i,value:c}})}}return a.sort(Sxe)};kxe=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=Txe(s,e);l>0&&o.push({id:i,data:{droppableContainer:a,value:l}})}}return o.sort(wxe)};Cxe=Fxe(1);xxe={ignoreTransform:!1};(function(t){t[t.Forward=1]="Forward",t[t.Backward=-1]="Backward"})(Ci||(Ci={}));Axe={x:.2,y:.2};_xe=[["x",["left","right"],Lxe],["y",["top","bottom"],zxe]],OC=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=WD(n),o=oie(r);this.rect={...e},this.width=e.width,this.height=e.height;for(let[a,i,s]of _xe)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})}},Ry=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"})(nc||(nc={}));(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"})(Ir||(Ir={}));aie={start:[Ir.Space,Ir.Enter],cancel:[Ir.Esc],end:[Ir.Space,Ir.Enter,Ir.Tab]},Kxe=(t,e)=>{let{currentCoordinates:n}=e;switch(t.code){case Ir.Right:return{...n,x:n.x+25};case Ir.Left:return{...n,x:n.x-25};case Ir.Down:return{...n,y:n.y+25};case Ir.Up:return{...n,y:n.y-25}}},KD=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 Ry(Cy(n)),this.windowListeners=new Ry(Vs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(nc.Resize,this.handleCancel),this.windowListeners.add(nc.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(nc.Keydown,this.handleKeyDown))}handleStart(){let{activeNode:e,onStart:n}=this.props,r=e.node.current;r&&Bxe(r),n(Jc)}handleKeyDown(e){if(AC(e)){let{active:n,context:r,options:o}=this.props,{keyboardCodes:a=aie,coordinateGetter:i=Kxe,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}:Jc;this.referenceCoordinates||(this.referenceCoordinates=u);let p=i(e,{active:n,context:r.current,currentCoordinates:u});if(p){let m=Bw(p,u),g={x:0,y:0},{scrollableAncestors:f}=r.current;for(let h of f){let b=e.code,{isTop:y,isRight:v,isLeft:S,isBottom:w,maxScroll:T,minScroll:F}=rie(h),k=Oxe(h),P={x:Math.min(b===Ir.Right?k.right-k.width/2:k.right,Math.max(b===Ir.Right?k.left:k.left+k.width/2,p.x)),y:Math.min(b===Ir.Down?k.bottom-k.height/2:k.bottom,Math.max(b===Ir.Down?k.top:k.top+k.height/2,p.y))},E=b===Ir.Right&&!v||b===Ir.Left&&!S,C=b===Ir.Down&&!w||b===Ir.Up&&!y;if(E&&P.x!==p.x){let L=h.scrollLeft+m.x,z=b===Ir.Right&&L<=T.x||b===Ir.Left&&L>=F.x;if(z&&!m.y){h.scrollTo({left:L,behavior:s});return}z?g.x=h.scrollLeft-L:g.x=b===Ir.Right?h.scrollLeft-T.x:h.scrollLeft-F.x,g.x&&h.scrollBy({left:-g.x,behavior:s});break}else if(C&&P.y!==p.y){let L=h.scrollTop+m.y,z=b===Ir.Down&&L<=T.y||b===Ir.Up&&L>=F.y;if(z&&!m.x){h.scrollTo({top:L,behavior:s});return}z?g.y=h.scrollTop-L:g.y=b===Ir.Down?h.scrollTop-T.y:h.scrollTop-F.y,g.y&&h.scrollBy({top:-g.y,behavior:s});break}}this.handleMove(e,Iy(Bw(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()}};KD.activators=[{eventName:"onKeyDown",handler:(t,e,n)=>{let{keyboardCodes:r=aie,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}}];LC=class{constructor(e,n,r){var o;r===void 0&&(r=Hxe(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=Cy(i),this.documentListeners=new Ry(this.document),this.listeners=new Ry(r),this.windowListeners=new Ry(Vs(i)),this.initialCoordinates=(o=_D(a))!=null?o:Jc,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(nc.Resize,this.handleCancel),this.windowListeners.add(nc.DragStart,Vae),this.windowListeners.add(nc.VisibilityChange,this.handleCancel),this.windowListeners.add(nc.ContextMenu,Vae),this.documentListeners.add(nc.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Uae(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Kae(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(nc.Click,Vxe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(nc.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=_D(e))!=null?n:Jc,c=Bw(o,l);if(!r&&s){if(Kae(s)){if(s.tolerance!=null&&TK(c,s.tolerance))return this.handleCancel();if(TK(c,s.distance))return this.handleStart()}if(Uae(s)&&TK(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===Ir.Esc&&this.handleCancel()}removeTextSelection(){var e;(e=this.document.getSelection())==null||e.removeAllRanges()}},Uxe={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}},Hw=class extends LC{constructor(e){let{event:n}=e,r=Cy(n.target);super(e,Uxe,r)}};Hw.activators=[{eventName:"onPointerDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];Wxe={move:{name:"mousemove"},end:{name:"mouseup"}};(function(t){t[t.RightClick=2]="RightClick"})(FK||(FK={}));Ay=class extends LC{constructor(e){super(e,Wxe,Cy(e.event.target))}};Ay.activators=[{eventName:"onMouseDown",handler:(t,e)=>{let{nativeEvent:n}=t,{onActivation:r}=e;return n.button===FK.RightClick?!1:(r?.({event:n}),!0)}}];kK={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}},Dy=class extends LC{constructor(e){super(e,kK)}static setup(){return window.addEventListener(kK.move.name,e,{capture:!1,passive:!1}),function(){window.removeEventListener(kK.move.name,e)};function e(){}}};Dy.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"})(DC||(DC={}));(function(t){t[t.TreeOrder=0]="TreeOrder",t[t.ReversedTreeOrder=1]="ReversedTreeOrder"})(UD||(UD={}));jxe={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"})(zC||(zC={}));(function(t){t.Optimized="optimized"})(CK||(CK={}));Wae=new Map;jae=[];Yae=[];lEe=[{sensor:Hw,options:{}},{sensor:KD,options:{}}],dEe={current:{}},HD={draggable:{measure:Hae},droppable:{measure:Hae,strategy:zC.WhileDragging,frequency:CK.Optimized},dragOverlay:{measure:Oy}},My=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}},cEe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new My,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:VD},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:HD,measureDroppableContainers:VD,windowRect:null,measuringScheduled:!1},uEe={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:VD,draggableNodes:new Map,over:null,measureDroppableContainers:VD},jD=(0,Qe.createContext)(uEe),lie=(0,Qe.createContext)(cEe);die=(0,Qe.createContext)({...Jc,scaleX:1,scaleY:1});(function(t){t[t.Uninitialized=0]="Uninitialized",t[t.Initializing=1]="Initializing",t[t.Initialized=2]="Initialized"})(Ch||(Ch={}));Kw=(0,Qe.memo)(function(e){var n,r,o,a;let{id:i,accessibility:s,autoScroll:l=!0,children:c,sensors:u=lEe,collisionDetection:p=kxe,measuring:m,modifiers:g,...f}=e,h=(0,Qe.useReducer)(mEe,void 0,pEe),[b,y]=h,[v,S]=hxe(),[w,T]=(0,Qe.useState)(Ch.Uninitialized),F=w===Ch.Initialized,{draggable:{active:k,nodes:P,translate:E},droppable:{containers:C}}=b,L=k!=null?P.get(k):null,z=(0,Qe.useRef)({initial:null,translated:null}),G=(0,Qe.useMemo)(()=>{var Ge;return k!=null?{id:k,data:(Ge=L?.data)!=null?Ge:dEe,rect:z}:null},[k,L]),Q=(0,Qe.useRef)(null),[R,O]=(0,Qe.useState)(null),[D,x]=(0,Qe.useState)(null),B=Lw(f,Object.values(f)),I=Ny("DndDescribedBy",i),A=(0,Qe.useMemo)(()=>C.getEnabled(),[C]),N=fEe(m),{droppableRects:M,measureDroppableContainers:H,measuringScheduled:q}=Xxe(A,{dragging:F,dependencies:[E.x,E.y],config:N.droppable}),X=Yxe(P,k),V=(0,Qe.useMemo)(()=>D?_D(D):null,[D]),j=nt(),_=Qxe(X,N.draggable.measure);yEe({activeNode:k!=null?P.get(k):null,config:j.layoutShiftCompensation,initialRect:_,measure:N.draggable.measure});let W=Gae(X,N.draggable.measure,_),J=Gae(X?X.parentElement:null),Z=(0,Qe.useRef)({activatorEvent:null,active:null,activeNode:X,collisionRect:null,collisions:null,droppableRects:M,draggableNodes:P,draggingNode:null,draggingNodeRect:null,droppableContainers:C,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),re=C.getNodeFor((n=Z.current.over)==null?void 0:n.id),Y=sEe({measure:N.dragOverlay.measure}),ne=(r=Y.nodeRef.current)!=null?r:X,le=F?(o=Y.rect)!=null?o:W:null,ae=!!(Y.nodeRef.current&&Y.rect),ve=eEe(ae?null:W),de=sie(ne?Vs(ne):null),Pe=tEe(F?re??X:null),Fe=aEe(Pe),te=hEe(g,{transform:{x:E.x-ve.x,y:E.y-ve.y,scaleX:1,scaleY:1},activatorEvent:D,active:G,activeNodeRect:W,containerNodeRect:J,draggingNodeRect:le,over:Z.current.over,overlayNodeRect:Y.rect,scrollableAncestors:Pe,scrollableAncestorRects:Fe,windowRect:de}),ye=V?Iy(V,E):null,ce=nEe(Pe),pe=qae(ce),ue=qae(ce,[W]),Se=Iy(te,pe),ee=le?Cxe(le,te):null,ie=G&&ee?p({active:G,collisionRect:ee,droppableRects:M,droppableContainers:A,pointerCoordinates:ye}):null,Ce=Qae(ie,"id"),[we,Le]=(0,Qe.useState)(null),We=ae?te:Iy(te,ue),Nt=Pxe(We,(a=we?.rect)!=null?a:null,W),Pt=(0,Qe.useRef)(null),Zt=(0,Qe.useCallback)((Ge,Tt)=>{let{sensor:gt,options:wn}=Tt;if(Q.current==null)return;let it=P.get(Q.current);if(!it)return;let yn=Ge.nativeEvent,rt=new gt({active:Q.current,activeNode:it,event:yn,options:wn,context:Z,onAbort(se){if(!P.get(se))return;let{onDragAbort:Ne}=B.current,xe={id:se};Ne?.(xe),v({type:"onDragAbort",event:xe})},onPending(se,fe,Ne,xe){if(!P.get(se))return;let{onDragPending:dt}=B.current,St={id:se,constraint:fe,initialCoordinates:Ne,offset:xe};dt?.(St),v({type:"onDragPending",event:St})},onStart(se){let fe=Q.current;if(fe==null)return;let Ne=P.get(fe);if(!Ne)return;let{onDragStart:xe}=B.current,Be={activatorEvent:yn,active:{id:fe,data:Ne.data,rect:z}};(0,Ey.unstable_batchedUpdates)(()=>{xe?.(Be),T(Ch.Initializing),y({type:ri.DragStart,initialCoordinates:se,active:fe}),v({type:"onDragStart",event:Be}),O(Pt.current),x(yn)})},onMove(se){y({type:ri.DragMove,coordinates:se})},onEnd:me(ri.DragEnd),onCancel:me(ri.DragCancel)});Pt.current=rt;function me(se){return async function(){let{active:Ne,collisions:xe,over:Be,scrollAdjustedTranslate:dt}=Z.current,St=null;if(Ne&&dt){let{cancelDrop:ln}=B.current;St={activatorEvent:yn,active:Ne,collisions:xe,delta:dt,over:Be},se===ri.DragEnd&&typeof ln=="function"&&await Promise.resolve(ln(St))&&(se=ri.DragCancel)}Q.current=null,(0,Ey.unstable_batchedUpdates)(()=>{y({type:se}),T(Ch.Uninitialized),Le(null),O(null),x(null),Pt.current=null;let ln=se===ri.DragEnd?"onDragEnd":"onDragCancel";if(St){let vn=B.current[ln];vn?.(St),v({type:ln,event:St})}})}}},[P]),ze=(0,Qe.useCallback)((Ge,Tt)=>(gt,wn)=>{let it=gt.nativeEvent,yn=P.get(wn);if(Q.current!==null||!yn||it.dndKit||it.defaultPrevented)return;let rt={active:yn};Ge(gt,Tt.options,rt)===!0&&(it.dndKit={capturedBy:Tt.sensor},Q.current=wn,Zt(gt,Tt))},[P,Zt]),Ie=$xe(u,ze);rEe(u),tc(()=>{W&&w===Ch.Initializing&&T(Ch.Initialized)},[W,w]),(0,Qe.useEffect)(()=>{let{onDragMove:Ge}=B.current,{active:Tt,activatorEvent:gt,collisions:wn,over:it}=Z.current;if(!Tt||!gt)return;let yn={active:Tt,activatorEvent:gt,collisions:wn,delta:{x:Se.x,y:Se.y},over:it};(0,Ey.unstable_batchedUpdates)(()=>{Ge?.(yn),v({type:"onDragMove",event:yn})})},[Se.x,Se.y]),(0,Qe.useEffect)(()=>{let{active:Ge,activatorEvent:Tt,collisions:gt,droppableContainers:wn,scrollAdjustedTranslate:it}=Z.current;if(!Ge||Q.current==null||!Tt||!it)return;let{onDragOver:yn}=B.current,rt=wn.get(Ce),me=rt&&rt.rect.current?{id:rt.id,rect:rt.rect.current,data:rt.data,disabled:rt.disabled}:null,se={active:Ge,activatorEvent:Tt,collisions:gt,delta:{x:it.x,y:it.y},over:me};(0,Ey.unstable_batchedUpdates)(()=>{Le(me),yn?.(se),v({type:"onDragOver",event:se})})},[Ce]),tc(()=>{Z.current={activatorEvent:D,active:G,activeNode:X,collisionRect:ee,collisions:ie,droppableRects:M,draggableNodes:P,draggingNode:ne,draggingNodeRect:le,droppableContainers:C,over:we,scrollableAncestors:Pe,scrollAdjustedTranslate:Se},z.current={initial:le,translated:ee}},[G,X,ie,ee,P,ne,le,M,C,we,Pe,Se]),Gxe({...j,delta:E,draggingRect:ee,pointerCoordinates:ye,scrollableAncestors:Pe,scrollableAncestorRects:Fe});let De=(0,Qe.useMemo)(()=>({active:G,activeNode:X,activeNodeRect:W,activatorEvent:D,collisions:ie,containerNodeRect:J,dragOverlay:Y,draggableNodes:P,droppableContainers:C,droppableRects:M,over:we,measureDroppableContainers:H,scrollableAncestors:Pe,scrollableAncestorRects:Fe,measuringConfiguration:N,measuringScheduled:q,windowRect:de}),[G,X,W,D,ie,J,Y,P,C,M,we,H,Pe,Fe,N,q,de]),Me=(0,Qe.useMemo)(()=>({activatorEvent:D,activators:Ie,active:G,activeNodeRect:W,ariaDescribedById:{draggable:I},dispatch:y,draggableNodes:P,over:we,measureDroppableContainers:H}),[D,Ie,G,W,y,I,P,we,H]);return Qe.default.createElement(Xae.Provider,{value:S},Qe.default.createElement(jD.Provider,{value:Me},Qe.default.createElement(lie.Provider,{value:De},Qe.default.createElement(die.Provider,{value:Nt},c)),Qe.default.createElement(gEe,{disabled:s?.restoreFocus===!1})),Qe.default.createElement(vxe,{...s,hiddenTextDescribedById:I}));function nt(){let Ge=R?.autoScrollEnabled===!1,Tt=typeof l=="object"?l.enabled===!1:l===!1,gt=F&&!Ge&&!Tt;return typeof l=="object"?{...l,enabled:gt}:{enabled:gt}}}),vEe=(0,Qe.createContext)(null),$ae="button",bEe="Draggable";SEe="Droppable",wEe={timeout:25}});function Nm(t,e,n){let r=t.slice();return r.splice(n<0?r.length+n:n,0,r.splice(e,1)[0]),r}function TEe(t,e){return t.reduce((n,r,o)=>{let a=e.get(r);return a&&(n[o]=a),n},Array(t.length))}function qD(t){return t!==null&&t>=0}function kEe(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,y=(0,Pa.useRef)(g),v=!kEe(g,y.current),S=b!==-1&&h===-1||v,w=PEe(a);tc(()=>{v&&f&&u(g)},[v,g,f,u]),(0,Pa.useEffect)(()=>{y.current=g},[g]);let T=(0,Pa.useMemo)(()=>({activeIndex:h,containerId:p,disabled:w,disableTransforms:S,items:g,overIndex:b,useDragOverlay:m,sortedRects:TEe(g,l),strategy:o}),[h,p,w.draggable,w.droppable,S,g,b,l,m,o]);return Pa.default.createElement(hie.Provider,{value:T},e)}function REe(t){let{disabled:e,index:n,node:r,rect:o}=t,[a,i]=(0,Pa.useState)(null),s=(0,Pa.useRef)(n);return tc(()=>{if(!e&&n!==s.current&&r.current){let l=o.current;if(l){let c=Oy(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,Pa.useEffect)(()=>{a&&i(null)},[a]),a}function Gw(t){let{animateLayoutChanges:e=NEe,attributes:n,disabled:r,data:o,getNewIndex:a=CEe,id:i,strategy:s,resizeObserverConfig:l,transition:c=IEe}=t,{items:u,containerId:p,activeIndex:m,disabled:g,disableTransforms:f,sortedRects:h,overIndex:b,useDragOverlay:y,strategy:v}=(0,Pa.useContext)(hie),S=MEe(r,g),w=u.indexOf(i),T=(0,Pa.useMemo)(()=>({sortable:{containerId:p,index:w,items:u},...o}),[p,o,w,u]),F=(0,Pa.useMemo)(()=>u.slice(u.indexOf(i)),[u,i]),{rect:k,node:P,isOver:E,setNodeRef:C}=pie({id:i,data:T,disabled:S.droppable,resizeObserverConfig:{updateMeasurementsFor:F,...l}}),{active:L,activatorEvent:z,activeNodeRect:G,attributes:Q,setNodeRef:R,listeners:O,isDragging:D,over:x,setActivatorNodeRef:B,transform:I}=cie({id:i,data:T,attributes:{...EEe,...n},disabled:S.draggable}),A=Rae(C,R),N=!!L,M=N&&!f&&qD(m)&&qD(b),H=!y&&D,q=H&&M?I:null,V=M?q??(s??v)({rects:h,activeNodeRect:G,activeIndex:m,overIndex:b,index:w}):null,j=qD(m)&&qD(b)?a({id:i,items:u,activeIndex:m,overIndex:b}):w,_=L?.id,W=(0,Pa.useRef)({activeId:_,items:u,newIndex:j,containerId:p}),J=u!==W.current.items,Z=e({active:L,containerId:p,isDragging:D,isSorting:N,id:i,index:w,items:u,newIndex:W.current.newIndex,previousItems:W.current.items,previousContainerId:W.current.containerId,transition:c,wasDragging:W.current.activeId!=null}),re=REe({disabled:!Z,index:w,node:P,rect:k});return(0,Pa.useEffect)(()=>{N&&W.current.newIndex!==j&&(W.current.newIndex=j),p!==W.current.containerId&&(W.current.containerId=p),u!==W.current.items&&(W.current.items=u)},[N,j,p,u]),(0,Pa.useEffect)(()=>{if(_===W.current.activeId)return;if(_!=null&&W.current.activeId==null){W.current.activeId=_;return}let ne=setTimeout(()=>{W.current.activeId=_},50);return()=>clearTimeout(ne)},[_]),{active:L,activeIndex:m,attributes:Q,data:T,rect:k,index:w,newIndex:j,items:u,isOver:E,isSorting:N,isDragging:D,listeners:O,node:P,overIndex:b,over:x,setNodeRef:A,setActivatorNodeRef:B,setDroppableNodeRef:C,setDraggableNodeRef:R,transform:re??V,transition:Y()};function Y(){if(re||J&&W.current.newIndex===w)return xEe;if(!(H&&!AC(z)||!c)&&(N||Z))return ec.Transition.toString({...c,property:fie})}}function MEe(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 Pa,mie,YD,Uw,gie,hie,CEe,NEe,IEe,fie,xEe,EEe,ygt,jw=U(()=>{Pa=he(Ve());Ly();_w();mie=t=>{let{rects:e,activeIndex:n,overIndex:r,index:o}=t,a=Nm(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}},YD={scaleX:1,scaleY:1},Uw=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,...YD}:o=i?{x:0,y:s.height+l,...YD}:{x:0,y:0,...YD}};gie="Sortable",hie=Pa.default.createContext({activeIndex:-1,containerId:gie,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mie,disabled:{draggable:!1,droppable:!1}});CEe=t=>{let{id:e,items:n,activeIndex:r,overIndex:o}=t;return Nm(n,r,o).indexOf(e)},NEe=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},IEe={duration:200,easing:"ease"},fie="transform",xEe=ec.Transition.toString({property:fie,duration:0,easing:"linear"}),EEe={roleDescription:"sortable"};ygt=[Ir.Down,Ir.Right,Ir.Up,Ir.Left]});function bie({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}=vt(),g=yt(),f=hr(),h=ar(),b=rp(),y=Ti(),{handleShiftArrowSelection:v,selectAll:S}=nw(),w=(0,oi.useRef)(null),T=(0,oi.useRef)(null),F=(0,oi.useCallback)(R=>{let O=t.current;if(!O)return;let D=null;for(let I of O.querySelectorAll(".nn-file"))if(I.dataset.path===R){D=I;break}if(!D)return;let x=O.getBoundingClientRect(),B=D.getBoundingClientRect();B.top>=x.top&&B.bottom<=x.bottom||O.scrollTo({top:O.scrollTop+B.top-x.top-Math.max((O.clientHeight-B.height)/2,0),behavior:"auto"})},[t]),k=(0,oi.useCallback)(R=>{T.current=R,F(R)},[F]);(0,oi.useEffect)(()=>{if(!o)return;if(T.current===o){T.current=null;return}T.current=null;let R=window.requestAnimationFrame(()=>{F(o)});return()=>{window.cancelAnimationFrame(R)}},[F,o]),(0,oi.useEffect)(()=>{let R=w.current;if(!R)return;w.current=null;let O=window.requestAnimationFrame(()=>{F(R)});return()=>{window.cancelAnimationFrame(O)}},[e,F]);let P=(0,oi.useMemo)(()=>o?e.findIndex(R=>R.path===o):-1,[e,o]),E=(0,oi.useCallback)((R,O)=>{let D=e[R];D&&(i(D,{debounceOpen:O?.debounceOpen}),k(D.path))},[e,i,k]),C=(0,oi.useCallback)(R=>{let O=e[R];if(!O||!f.selectedFile)return;let D=e.findIndex(A=>A.path===f.selectedFile?.path);if(D===-1){h({type:"SET_SELECTED_FILE",file:O});return}let x=Gb(e,Math.min(D,R),Math.max(D,R)),{selectedFiles:B,changed:I}=jb(f.selectedFiles,x);h({type:"APPLY_FILE_SELECTION",selectedFiles:B,selectedFile:O,lastMovementDirection:I?null:f.lastMovementDirection}),g.enterToOpenFiles||b(O),k(O.path)},[e,b,k,h,f.selectedFile,f.selectedFiles,f.lastMovementDirection,g.enterToOpenFiles]),L=(0,oi.useCallback)(R=>{if(a)return!0;let O=o,D=TI(e,O,r,R);if(!D)return!0;let x=dg(n,O??"",r),B=x.size>0?x:O?new Set([O]):new Set;return u({nextFiles:D.files,movedPaths:B,onApplied:()=>{w.current=D.scrollPath}}),!0},[e,a,n,u,o,r]),z=(0,oi.useCallback)(R=>{if(vie(R))return;let O=R.nativeEvent;if(Cp(O))return;let D=g.keyboardShortcuts,x=P,B=e.length>0;if(g.enterToOpenFiles&&Av(O)){let I=jc(p,f);if(!I)return;R.preventDefault();let A=Dv(O,g);if(A==="rename"){$(()=>y.renameFile(I));return}if(A){$(()=>Vr({app:p,commandQueue:m,file:I,context:A,active:!1}));return}b(I);return}if(cn(O,D,xt.LIST_MANUAL_SORT_DOWN)&&L("down")){R.preventDefault();return}if(cn(O,D,xt.LIST_MANUAL_SORT_UP)&&L("up")){R.preventDefault();return}if(cn(O,D,xt.LIST_EXTEND_SELECTION_DOWN)){if(R.preventDefault(),Kn()&&x!==-1){let I=v("down",x,e,{openFile:O.key==="ArrowDown"&&l?l:void 0});if(I===-1&&O.key==="ArrowDown"&&s?.(),I>=0){let A=e[I];A&&k(A.path)}}return}if(cn(O,D,xt.LIST_EXTEND_SELECTION_UP)){if(R.preventDefault(),Kn()&&x!==-1){let I=v("up",x,e,{openFile:O.key==="ArrowUp"&&l?l:void 0});if(I===-1&&O.key==="ArrowUp"&&s?.(),I>=0){let A=e[I];A&&k(A.path)}}return}if(cn(O,D,xt.LIST_SELECT_ALL)){R.preventDefault(),Kn()&&S(e);return}if(cn(O,D,xt.LIST_RANGE_TO_START)){R.preventDefault(),Kn()&&B&&C(0);return}if(cn(O,D,xt.LIST_RANGE_TO_END)){R.preventDefault(),Kn()&&B&&C(e.length-1);return}if(cn(O,D,xt.PANE_MOVE_DOWN)){if(R.preventDefault(),!B)return;let I=x===-1?0:$D(x+1,e);if(I===x){O.key==="ArrowDown"&&s?.();return}E(I,{debounceOpen:O.key==="ArrowDown"});return}if(cn(O,D,xt.PANE_MOVE_UP)){if(R.preventDefault(),!B)return;let I=x===-1?0:$D(x-1,e);if(I===x){O.key==="ArrowUp"&&s?.();return}E(I,{debounceOpen:O.key==="ArrowUp"});return}if(cn(O,D,xt.PANE_PAGE_DOWN)){if(R.preventDefault(),!B)return;let I=yie(t.current),A=x===-1?0:$D(x+I,e);if(A===x){O.key==="PageDown"&&s?.();return}E(A,{debounceOpen:O.key==="PageDown"});return}if(cn(O,D,xt.PANE_PAGE_UP)){if(R.preventDefault(),!B)return;let I=yie(t.current),A=x===-1?0:$D(x-I,e);if(A===x){O.key==="PageUp"&&s?.();return}E(A,{debounceOpen:O.key==="PageUp"});return}if(cn(O,D,xt.PANE_HOME)){if(R.preventDefault(),!B||x===0)return;E(0);return}if(cn(O,D,xt.PANE_END)){if(R.preventDefault(),!B||x===e.length-1)return;E(e.length-1)}},[e,p,m,L,v,y,s,l,b,t,k,E,C,S,P,f,g]),G=(0,oi.useCallback)(R=>{if(vie(R)||!c)return;let O=R.nativeEvent;Cp(O)||O.ctrlKey||O.metaKey||O.altKey||O.key!=="ArrowUp"&&O.key!=="ArrowDown"&&O.key!=="PageUp"&&O.key!=="PageDown"||c()},[c]),Q=(0,oi.useCallback)(()=>{let R=t.current;R&&Gi(R)},[t]);return(0,oi.useLayoutEffect)(()=>{Q();let R=window.requestAnimationFrame(Q);return()=>{window.cancelAnimationFrame(R)}},[Q]),{handleKeyDown:z,handleKeyUp:G}}var oi,$D,yie,vie,Sie=U(()=>{oi=he(Ve());Ur();fn();on();st();Ts();Md();Uh();hi();_u();$r();bi();tw();GA();$D=(t,e)=>e.length===0?-1:Math.max(0,Math.min(t,e.length-1)),yie=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)},vie=t=>{let e=t.target;return!(e instanceof HTMLElement)||e===t.currentTarget?!1:e.isContentEditable||e.closest("button, input, textarea, select")!==null}});var qw,XD,wie,Tie,kie,_C=U(()=>{Ly();qw=({transform:t})=>({...t,x:0}),XD=t=>{let e=t.active?.data?.current?.type;if(!e)return BC(t);let n=t.droppableContainers.filter(r=>r.data.current?.type===e);return BC({...t,droppableContainers:n})},wie={distance:6},Tie={distance:6},kie={distance:6}});function Fie({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 Pie(){}async function OEe(){}function Cie({entry:t,canReorder:e,isMobile:n,paneProps:r,shortcutKey:o,isSelected:a,hasSelectedAbove:i,hasSelectedBelow:s,dragHandle:l}){return(0,Bn.jsxs)(Bn.Fragment,{children:[(0,Bn.jsx)("div",{className:"nn-manual-sort-file",children:(0,Bn.jsx)(MD,{file:t.file,paneProps:r,isSelected:a,hasSelectedAbove:i,hasSelectedBelow:s,showQuickActionsPanel:!1,fileIndex:t.info.fileIndex,parentFolder:t.info.parentFolder,isPinned:!1,isHidden:t.info.isHidden,shortcutKey:o,manualSortDisabled:!e})}),n&&e?l:null]})}function LEe(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:y}=t,{attributes:v,listeners:S,setNodeRef:w,setActivatorNodeRef:T,transform:F,transition:k,isSorting:P}=Gw({id:e.sortableId,disabled:!r,data:{type:"manual-sort-file"}}),E={transform:F?ec.Translate.toString(F):void 0,transition:k},C=r&&!o,L=r&&o,z=f?yf(f,b):!1,G=(0,Bn.jsx)("span",{ref:T,className:"nn-drag-handle",role:"button",tabIndex:-1,...L?v:void 0,...L?S:void 0,children:(0,Bn.jsx)(Hs,{name:"lucide-grip-horizontal"})});return(0,Bn.jsxs)("div",{ref:w,className:`nn-manual-sort-sortable-item${P?" nn-manual-sort-sortable-item-sorting":""}`,style:E,children:[f?z?(0,Bn.jsxs)("div",{className:`nn-manual-sort-group-header-shell nn-manual-sort-custom-header${y?"":" nn-manual-sort-section-header"}`,"data-manual-sort-header-file-path":g,children:[(0,Bn.jsx)("div",{className:"nn-list-group-header nn-list-group-header--manual-sort",children:(0,Bn.jsx)(xC,{header:f,wordCount:h??0,targetWordCount:b})}),(0,Bn.jsx)(AD,{header:f,wordCount:h??0,targetWordCount:b})]}):(0,Bn.jsx)("div",{className:`nn-list-group-header nn-list-group-header--manual-sort nn-manual-sort-custom-header${y?"":" nn-manual-sort-section-header"}`,"data-manual-sort-header-file-path":g,children:(0,Bn.jsx)(xC,{header:f,wordCount:h??0,targetWordCount:b})}):null,(0,Bn.jsx)("div",{className:Fie({canReorder:r,isDragBlockMember:a,isSorting:P,isLastEntry:n,hideSeparator:i,hasCustomBackground:s,hasPreviousCustomBackground:l,hasNextCustomBackground:c,hasFilledBackground:u,hasPreviousFilledBackground:p,hasNextFilledBackground:m}),...C?v:void 0,...C?S:void 0,children:(0,Bn.jsx)(Cie,{...t,dragHandle:G})})]})}function zEe(t){let{isLastEntry:e,isDragBlockMember:n,hideSeparator:r,hasCustomBackground:o,hasPreviousCustomBackground:a,hasNextCustomBackground:i,hasFilledBackground:s,hasPreviousFilledBackground:l,hasNextFilledBackground:c}=t;return(0,Bn.jsx)("div",{className:Fie({canReorder:!1,isDragBlockMember:n,isLastEntry:e,hideSeparator:r,hasCustomBackground:o,hasPreviousCustomBackground:a,hasNextCustomBackground:i,hasFilledBackground:s,hasPreviousFilledBackground:l,hasNextFilledBackground:c}),children:(0,Bn.jsx)(Cie,{...t,canReorder:!1})})}function NK(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=cg(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 BEe({rankedRows:t,unsortedRows:e,nonMarkdownRows:n,sortableIds:r,canReorder:o,rowContext:a,noteShortcutKeysByPath:i,selectedFiles:s,activeDragPaths:l}){let{fileItemStorage:c,getSolidBackground:u}=a.paneProps,p=yt(),m=Zo(),g=new Map,f=b=>{if(!b)return!1;let y=g.get(b.file.path);if(y!==void 0)return y;let v=p.showFileBackgroundUnfinishedTask?c.getDB().getFile(b.file.path)?.taskUnfinished:void 0,S=sE({customBackgroundColor:m.getFileBackgroundColor(b.file.path),taskUnfinished:v,showUnfinishedTaskBackground:p.showFileBackgroundUnfinishedTask,unfinishedTaskBackgroundColor:p.unfinishedTaskBackgroundColor,getSolidBackground:u});return g.set(b.file.path,S),S},h=(b,y=!1)=>b.map((v,S)=>{let w=v.entry,T=b[S-1],F=b[S+1],k=T?.segmentKey===v.segmentKey?T.entry:void 0,P=F?.segmentKey===v.segmentKey?F.entry:void 0,E=!P,C=s.has(w.file.path),L=P?s.has(P.file.path):!1,z=k?s.has(k.file.path):!1,G=f(w),Q=f(k),R=f(P),O=G&&Q,D=R,x=C||G,B=x&&!!(k&&(z||Q)),I=x&&!!(P&&(L||R)),A={...a,entry:w,isLastEntry:E,canReorder:o&&w.file.extension==="md",isSelected:C,hasSelectedAbove:!!(k&&s.has(k.file.path)),hasSelectedBelow:!!(P&&s.has(P.file.path)),isDragBlockMember:l.has(w.file.path),hideSeparator:C&&!L||!C&&L,hasCustomBackground:G,hasPreviousCustomBackground:O,hasNextCustomBackground:D,hasFilledBackground:x,hasPreviousFilledBackground:B,hasNextFilledBackground:I,headerFilePath:v.headerFilePath,header:v.header,headerWordCount:v.headerWordCount,headerTargetWordCount:v.headerTargetWordCount,suppressHeaderTopSpacing:!!(v.header&&y&&S===0),shortcutKey:i.get(w.file.path)};return w.file.extension!=="md"?(0,Bn.jsx)(zEe,{...A},v.key):(0,Bn.jsx)(LEe,{...A},v.key)});return(0,Bn.jsxs)(Ww,{items:r,strategy:Uw,children:[h(t,!0),e.length>0?(0,Bn.jsxs)(Bn.Fragment,{children:[(0,Bn.jsx)("div",{className:"nn-list-group-header nn-manual-sort-section-header",children:(0,Bn.jsx)("span",{className:"nn-list-group-header-text",children:d.listPane.unsortedSection})}),h(e)]}):null,h(n)]})}function _Ee(t){let e=new Map;return t.forEach(n=>{n.type!==tn.FILE||!(n.data instanceof HC.TFile)||e.set(n.data.path,{fileIndex:n.fileIndex,parentFolder:n.parentFolder,isHidden:n.isHidden})}),e}function Nie({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:y,visibleListPropertyKeys:v,visibleNavigationPropertyKeys:S,fileItemStorage:w,noteShortcutKeysByPath:T,folderDecorationModel:F,fileItemPillDecorationModel:k,fileItemPillOrderModel:P,getSolidBackground:E,selectedFiles:C,selectedFilePath:L,onFileClick:z,onKeyboardSelect:G,onScheduleKeyboardOpen:Q,onScheduleKeyboardOpenForFile:R,onCommitKeyboardOpen:O,onDone:D,onReorder:x}){let{app:B,isMobile:I}=vt(),A=Zo(),N=(0,Ar.useRef)(null),[M,H]=(0,Ar.useState)(()=>new Set),q=(0,Ar.useMemo)(()=>_Ee(e),[e]),X=(0,Ar.useMemo)(()=>Rd(t),[t]),V=X.markdown,j=X.nonMarkdown,_=(0,Ar.useMemo)(()=>new Map(t.map((ze,Ie)=>[ze.path,Ie])),[t]),W=(0,Ar.useMemo)(()=>V.filter(ze=>i.has(ze.path)),[V,i]),J=(0,Ar.useMemo)(()=>V.filter(ze=>!i.has(ze.path)),[V,i]),Z=j.length,re=t.length===0,Y=(0,Ar.useCallback)(ze=>ze.map(Ie=>{let De=q.get(Ie.path)??{};return{file:Ie,sortableId:Ie.path,info:{...De,fileIndex:_.get(Ie.path)??De.fileIndex,parentFolder:De.parentFolder??s,isHidden:De.isHidden??n.get(Ie.path)}}}),[q,n,_,s]),ne=(0,Ar.useMemo)(()=>Y(W),[Y,W]),le=(0,Ar.useMemo)(()=>Y(J),[Y,J]),ae=(0,Ar.useMemo)(()=>Y(j),[Y,j]),ve=(0,Ar.useCallback)(ze=>NI(w.getDB().getFile(ze.path)?.wordCount),[w]),de=(0,Ar.useCallback)(ze=>ck(w.getDB().getFile(ze.path)?.properties,a)??wI(B,ze,a),[B,w,a]),Pe=(0,Ar.useMemo)(()=>NK(B,ne,o,"ranked",ve,de),[B,ve,de,o,ne]),Fe=(0,Ar.useMemo)(()=>NK(B,le,o,"unsorted",ve,de),[B,ve,de,o,le]),te=(0,Ar.useMemo)(()=>NK(B,ae,null,"non-markdown",ve,de),[B,ve,de,ae]),ye=(0,Ar.useMemo)(()=>[...ne,...le,...ae],[ae,ne,le]),ce=(0,Ar.useMemo)(()=>new Map(ye.map(ze=>[ze.sortableId,ze])),[ye]),pe=(0,Ar.useMemo)(()=>V.map(ze=>ze.path),[V]),ue=(0,Ar.useMemo)(()=>({onFileClick:z,selectionType:u,sortOption:p,onModifySearchWithTag:Pie,onModifySearchWithProperty:Pie,localDayReference:m,fileIconSize:g,appearanceSettings:f,includeDescendantNotes:h,hiddenTagVisibility:b,fileNameIconNeedles:y,visiblePropertyKeys:v,visibleNavigationPropertyKeys:S,fileItemStorage:w,onToggleNoteShortcut:OEe,folderDecorationModel:F,fileItemPillDecorationModel:k,fileItemPillOrderModel:P,getSolidBackground:E,disableNativeDrag:!0}),[z,u,p,m,g,f,h,b,y,v,S,w,F,k,P,E]),Se=(0,Ar.useMemo)(()=>({isMobile:I,paneProps:ue}),[I,ue]),ee=(0,Ar.useCallback)(ze=>{let Ie=dg(V,ze,C);return Ie.size>1?Ie:new Set},[V,C]),ie=(0,Ar.useCallback)((ze,Ie)=>Bj(t,ze,Ie,C),[t,C]),Ce=Vw(Nh(Ay,{activationConstraint:AEe}),Nh(Dy,{activationConstraint:DEe})),{handleKeyDown:we,handleKeyUp:Le}=bie({scrollContainerRef:N,files:t,markdownFiles:V,selectedFiles:C,selectedFilePath:L,isSaving:l,onKeyboardSelect:G,onScheduleKeyboardOpen:Q,onScheduleKeyboardOpenForFile:R,onCommitKeyboardOpen:O,onReorder:x}),We=(0,Ar.useCallback)(ze=>{if(H(new Set),l)return;let Ie=ze.active.id,De=ze.over?.id;if(!De||Ie===De)return;let Me=ce.get(Ie),nt=ce.get(De);if(!Me||!nt||Me.file.extension!=="md"||nt.file.extension!=="md")return;let Ge=ie(Me.file.path,nt.file.path);if(!Ge)return;let Tt=dg(V,Me.file.path,C);x({nextFiles:Ge,movedPaths:Tt.size>1?Tt:new Set([Me.file.path])})},[l,V,ie,x,C,ce]),Nt=(0,Ar.useCallback)(ze=>{if(l)return;let Ie=ze.active.id;H(ee(Ie))},[ee,l]),Pt=(0,Ar.useCallback)(()=>{H(new Set)},[]),Zt=(0,Ar.useCallback)(ze=>{if(!o)return;let Ie=ze.target;if(!(Ie instanceof Element))return;let De,Me=Ie.closest(".nn-manual-sort-custom-header");if(Me instanceof HTMLElement&&(De=Me.dataset.manualSortHeaderFilePath),!De){let Tt=Ie.closest(".nn-file");if(!(Tt instanceof HTMLElement))return;De=Tt.dataset.path}let nt=De?B.vault.getFileByPath(De):null;if(!(nt instanceof HC.TFile)||nt.extension!=="md")return;ze.preventDefault(),ze.stopPropagation();let Ge=new HC.Menu;Sw({menu:Ge,app:B,file:nt,propertyKey:o,metadataService:A}),Ge.showAtMouseEvent(ze.nativeEvent)},[B,o,A]);return(0,Bn.jsx)("div",{ref:N,className:"nn-list-pane-scroller nn-manual-sort-scroller",role:"list",tabIndex:-1,onKeyDown:we,onKeyUp:Le,onContextMenu:Zt,children:(0,Bn.jsxs)("div",{className:"nn-manual-sort-panel",children:[(0,Bn.jsxs)("div",{className:"nn-manual-sort-header",children:[(0,Bn.jsxs)("div",{className:"nn-manual-sort-header-text",children:[(0,Bn.jsx)("span",{className:"nn-manual-sort-title",children:d.listPane.manualSortTitle.replace("{property}",r)}),(0,Bn.jsx)("span",{className:"nn-manual-sort-hint",children:d.listPane.manualSortHint.replace("{property}",r)}),Z>0?(0,Bn.jsx)("span",{className:"nn-manual-sort-hint",children:d.listPane.manualSortNonMarkdownHint}):null]}),(0,Bn.jsx)("button",{type:"button",className:"nn-support-button nn-manual-sort-done",onClick:D,disabled:c,children:d.listPane.manualSortDone})]}),re?(0,Bn.jsx)("div",{className:"nn-empty-state",children:(0,Bn.jsx)("div",{className:"nn-empty-message",children:d.listPane.emptyStateNoNotes})}):(0,Bn.jsx)(Kw,{sensors:Ce,collisionDetection:XD,modifiers:[qw],onDragStart:Nt,onDragCancel:Pt,onDragEnd:We,children:(0,Bn.jsx)("div",{className:"nn-manual-sort-list","aria-busy":l?"true":void 0,children:ye.length>0?(0,Bn.jsx)(BEe,{rankedRows:Pe,unsortedRows:Fe,nonMarkdownRows:te,sortableIds:pe,canReorder:!l,rowContext:Se,noteShortcutKeysByPath:T,selectedFiles:C,activeDragPaths:M}):null})})]})})}var Ar,HC,Bn,AEe,DEe,Iie=U(()=>{Ar=he(Ve());Ly();jw();_w();HC=require("obsidian");fn();on();Oe();Ue();Sie();_C();hi();_f();gD();sg();Fh();yK();vK();Bn=he($e()),AEe={distance:2},DEe={distance:4}});function VEe(t){return activeDocument?.body?(Yw||(Yw=new MutationObserver(()=>{QD.forEach(e=>e())}),Yw.observe(activeDocument.body,HEe)),QD.add(t),()=>{QD.delete(t),QD.size===0&&Yw&&(Yw.disconnect(),Yw=null)}):()=>{}}function KEe(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 ZD(t,e){let{app:n,rootContainerRef:r,solidBackgroundRevision:o,variables:a}=e,[i,s]=(0,Ih.useState)(null),[l,c]=(0,Ih.useState)(0),u=(0,Ih.useMemo)(()=>a.slice(),[a]),p=(0,Ih.useMemo)(()=>m4(i,()=>t.current),[t,o,i,l]);return(0,Ih.useEffect)(()=>{let m=t.current;if(!m)return;let g=!1,f=()=>{if(g)return;let T=t.current;if(!T)return;let F=window.getComputedStyle(T),k=Ng(F.backgroundColor,{container:T}),P=!1;s(C=>p4(C,k)?C:(P=!0,k));let E=!1;for(let C of u){let L=F.getPropertyValue(C.source),z=F0(k,L,{container:T}),G=T.style.getPropertyValue(C.target);z?G!==z&&(T.style.setProperty(C.target,z),E=!0):G&&(T.style.removeProperty(C.target),E=!0)}(P||E)&&c(C=>C+1)},h=window.requestAnimationFrame(f);f();let b=null,y=null,v=()=>{if(b)return;let T=r.current;if(!T){y=window.requestAnimationFrame(v);return}let F=KEe(T,f);b=F.observer,y=F.rafId};v();let S=VEe(f),w=null;return n?.workspace&&(w=n.workspace.on("css-change",f)),()=>{g=!0,cancelAnimationFrame(h),y!==null&&cancelAnimationFrame(y),b&&b.disconnect(),S(),w&&n?.workspace?.offref(w),m&&s4(m)}},[n,t,r,u]),{getSolidBackground:p}}var Ih,HEe,QD,Yw,IK=U(()=>{Ih=he(Ve());_f();HEe={attributes:!0,attributeFilter:["class","style","data-theme"]},QD=new Set,Yw=null});var xie,Eie,xK=U(()=>{xie=[{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"}],Eie=[{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 Rie(t){return Rd(t).markdown.map(e=>e.path)}function EK(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=mk(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 WEe({onHeaderClick:t,isSearchActive:e,onSearchToggle:n,onManualSortStart:r,getManualSortNewFileContext:o,canToggleGroupExpansion:a,shouldCollapseGroups:i,onToggleGroupExpansion:s,actionsDisabled:l,shouldShowDesktopTitleArea:c,children:u}){let{desktopTitle:p,breadcrumbSegments:m,iconName:g,showIcon:f}=are();return(0,Fa.jsxs)(Fa.Fragment,{children:[(0,Fa.jsx)(qre,{onHeaderClick:t,isSearchActive:e,onSearchToggle:n,onManualSortStart:r,getManualSortNewFileContext:o,canToggleGroupExpansion:a,shouldCollapseGroups:i,onToggleGroupExpansion:s,actionsDisabled:l,desktopTitle:p,breadcrumbSegments:m,iconName:g,showIcon:f}),u,c?(0,Fa.jsx)(_oe,{desktopTitle:p}):null]})}var et,dp,Fa,UEe,Mie,Aie=U(()=>{et=he(Ve()),dp=require("obsidian");Ur();fn();on();wa();Tl();cs();ph();Ste();One();R1();nre();ire();dre();ure();gre();vC();Ue();Ln();Yre();Xre();kC();Boe();Hoe();xae();Iie();yC();gr();IK();xK();uw();$r();Hr();sn();Id();st();bi();vA();hi();bn();Dp();Oe();$a();hc();Ts();Fa=he($e()),UEe=new Set;Mie=et.default.memo((0,et.forwardRef)(function(e,n){let{app:r,isMobile:o,plugin:a,fileSystemOps:i,tagTreeService:s,propertyTreeService:l}=vt(),{onNavigateToFolder:c,onRevealTag:u,onRevealProperty:p,folderDecorationModel:m,fileItemPillDecorationModel:g,fileItemPillOrderModel:f}=e,h=hr(),b=ar(),y=yt(),v=Sl(),{fileNameIconNeedles:S}=hA(),w=la(),T=Wa(),F=jt(),k=F.includeDescendantNotes,P=F.showHiddenItems,E=F.showCalendar,C=lre(),{getFileDisplayName:L,getDB:z,getFileTimestamps:G,hasPreview:Q,regenerateFeatureImageForFile:R}=_o(),{noteShortcutKeysByPath:O,addNoteShortcut:D,removeShortcut:x}=Xd(),B=Qr(),I=!B.singlePane&&B.effectiveDualPaneOrientation==="vertical",A=y.calendarPlacement,N=y.calendarEnabled&&A==="left-sidebar"&&E&&I,M=(0,et.useRef)(null),H=(0,et.useRef)(null),q=dp.Platform.isAndroidApp,{getSolidBackground:X}=ZD(M,{app:r,rootContainerRef:e.rootContainerRef,variables:xie}),[V,j]=(0,et.useState)(()=>y.calendarWeeksToShow),[_,W]=(0,et.useState)(!1),[J,Z]=(0,et.useState)(null),[re,Y]=(0,et.useState)(null),[ne,le]=(0,et.useState)(null),[ae,ve]=(0,et.useState)(null),[de,Pe]=(0,et.useState)(!1),Fe=(0,et.useRef)(null),te=(0,et.useRef)(0),ye=(0,et.useRef)(0),ce=(0,et.useRef)(0),pe=(0,et.useRef)(!1),ue=(0,et.useRef)(null),Se=(0,et.useRef)(!1),ee=(0,et.useRef)(D),ie=(0,et.useRef)(x),Ce=y.listPaneTitle??"header",we=Xa(),Le=!we&&Ce==="list",We=dw(o),Nt=Le?0:We.topSpacer,Pt=(0,et.useMemo)(()=>{if(!y.showFileIcons)return{"--nn-file-icon-slot-width":"0px","--nn-file-icon-slot-width-mobile":"0px","--nn-file-icon-slot-gap":"0px"}},[y.showFileIcons]),Zt=(0,et.useMemo)(()=>({...Pt??{},"--nn-calendar-week-count":V}),[V,Pt]);(0,et.useEffect)(()=>{y.calendarWeeksToShow!==6&&j(y.calendarWeeksToShow)},[y.calendarWeeksToShow]);let ze=we&&dp.Platform.isIosApp&&y.useFloatingToolbars,Ie=(0,et.useMemo)(()=>ze?pN:0,[ze]),De=(0,et.useRef)(null),{isSearchActive:Me,searchProvider:nt,searchQuery:Ge,debouncedSearchQuery:Tt,debouncedSearchTokens:gt,searchHighlightTerms:wn,shouldFocusSearch:it,activeSearchShortcut:yn,isSavingSearchShortcut:rt,suppressSearchTopScrollRef:me,setSearchQuery:se,handleSearchToggle:fe,closeSearch:Ne,focusSearchComplete:xe,handleSaveSearchShortcut:Be,handleRemoveSearchShortcut:dt,modifySearchWithTag:St,modifySearchWithProperty:ln,modifySearchWithDateToken:vn,toggleSearch:In,executeSearchShortcut:eo}=cre({rootContainerRef:e.rootContainerRef,onSearchTokensChange:e.onSearchTokensChange,onNavigateToFolder:c,onRevealTag:u,onRevealProperty:p,ensureSelectionForCurrentFilterRef:De}),{selectionType:Dt,selectedFolder:an,selectedTag:Sn,selectedProperty:_r,selectedFile:Gn}=h,mn=Dt===K.FOLDER?an?.path??null:null,ir=de&&Me&&Dt===K.FOLDER&&mn==="/",Zn=k||ir,Fr=rg(y,Dt,an,Sn,_r),co=Fr.option,Cr=Fr.propertyKey.trim(),Ye=ji(co)==="property"&&qi(y,Cr),bt=el(y),Wt=(0,et.useMemo)(()=>Dt===K.FOLDER&&an?`${Dt}:${an.path}`:Dt===K.TAG&&Sn?`${Dt}:${Sn}`:Dt===K.PROPERTY&&_r?`${Dt}:${_r}`:"none",[an,_r,Sn,Dt]),Ze=ne!==null;(0,et.useLayoutEffect)(()=>{let ot=Se.current;if(Se.current=Ze,!ot||Ze)return;let ut=e.rootContainerRef.current;ut&&Gi(ut)},[Ze,e.rootContainerRef]);let Vt=GE({selectionType:Dt,selectedFolder:an,selectedTag:Sn,selectedProperty:_r}),gn=PJ()[Vt]!==!0,ur=et.default.useCallback(()=>{a.togglePinnedGroupCollapsed(Vt)},[Vt,a]),jn=Ze?UEe:w.collapsedListGroups,Ia=(0,et.useMemo)(()=>{let ot=Array.from(jn);return ot.sort(),`${gn?"expanded":"collapsed"}:${ot.join("")}`},[jn,gn]),ft=et.default.useCallback(ot=>{T({type:"TOGGLE_LIST_GROUP_COLLAPSED",collapseKey:ot})},[T]);(0,et.useEffect)(()=>{de&&(Me&&Dt===K.FOLDER&&mn==="/"||Pe(!1))},[de,Me,mn,Dt]),(0,et.useEffect)(()=>{!ne||ne.selectionKey===Wt||le(null)},[Wt,ne]),(0,et.useEffect)(()=>{ae&&(Ze||Me||!Ye||!Cr||ae.selectionKey!==Wt||ae.propertyKey!==Cr)&&(pe.current=!1,ue.current=null,ve(null))},[Cr,Ze,Ye,Me,Wt,ae]);let Tn=!Ze&&!Me&&Ye&&Cr.length>0,Jn=Tn&&ae?.selectionKey===Wt&&ae.propertyKey===Cr?ae:null,qn=Jn?.order??null,ii=og({groupBy:C.groupBy,sortOption:co,selectionType:Dt,isManualSortActive:Ye,isManualSortEditActive:Ze}),er=(0,et.useMemo)(()=>ii===C.groupBy?C:{...C,groupBy:ii},[C,ii]),Ii=et.default.useCallback((ot,ut,Gt,tr)=>{if(Gt.length===0){tr(!1);return}$(async()=>{let $n=!1;try{let Ao=await hk(r,ot,ut,Gt);Ao.failed>0&&($n=!0,oe(d.dragDrop.errors.failedToSetProperty.replace("{error}",ff(Ao)),{variant:"warning"}))}catch(Ao){$n=!0,oe(d.dragDrop.errors.failedToSetProperty.replace("{error}",qr(Ao,d.common.unknownError)),{variant:"warning"})}finally{tr($n)}})},[r]),hs=et.default.useCallback((ot,ut,Gt,tr,$n,Ao)=>{Ii(ot,ut,Gt,Po=>{le(ha=>!ha||ha.propertyKey!==ut||ha.selectionKey!==tr||ha.sessionId!==$n||ha.saveId!==Ao?ha:{...ha,order:Po?null:ha.order,pendingAssignments:Po?[]:ha.pendingAssignments,isSaving:!1})})},[Ii]),rc=et.default.useCallback((ot,ut,Gt,tr,$n)=>{Ii(ot,ut,Gt,Ao=>{ce.current===$n&&(pe.current=!1),ve(Po=>!Po||Po.propertyKey!==ut||Po.selectionKey!==tr||Po.saveId!==$n?Po:Ao?null:{...Po,isSaving:!1})})},[Ii]),si=et.default.useCallback((ot,ut)=>{new Pn(r,d.modals.manualSortConfirm.compactTitle,d.modals.manualSortConfirm.compactMessage(ot),ut,d.modals.manualSortConfirm.compactConfirmButton,{confirmButtonClass:"mod-cta"}).open()},[r]),iu=et.default.useCallback(ot=>{let ut=te.current+1;te.current=ut;let Gt=Wt;Pe(!1),Ne(),le({propertyKey:ot,order:null,pendingAssignments:[],isSaving:!1,selectionKey:Gt,sessionId:ut,saveId:0})},[Ne,Wt]),su=!B.singlePane||B.currentSinglePaneView==="files",{listItems:xa,orderedFiles:Wo,orderedFileIndexMap:pp,filePathToIndex:to,files:xi,hiddenFileState:Am,localDayKey:pd}=Dne({selectionType:Dt,selectedFolder:an,selectedTag:Sn,selectedProperty:_r,settings:y,activeProfile:v,groupBy:er.groupBy,showFileTags:er.showTags,showFileDate:er.showDate,pinnedGroupExpanded:gn,collapsedListGroups:jn,searchProvider:nt,searchQuery:!Ze&&Me?Tt:void 0,searchTokens:!Ze&&Me?gt:void 0,visibility:{includeDescendantNotes:Zn,showHiddenItems:P},propertySortOrderOverride:qn}),lu=(0,et.useMemo)(()=>AV({selectionType:Dt,selectedFolderPath:mn,selectedTag:Sn,selectedProperty:_r,groupingMode:er.groupBy}),[er.groupBy,mn,_r,Sn,Dt]),no=(0,et.useMemo)(()=>Ine(xa,gn,jn,lu),[jn,lu,xa,gn]),Ea=et.default.useCallback(()=>{if(Ze||!no.canToggle)return!1;let ot=no.shouldCollapse;T({type:"SET_LIST_GROUPS_COLLAPSED",collapseKeys:no.collapseKeys,collapsed:ot});let ut=!gn;return no.hasPinnedGroup&&ut!==ot&&a.togglePinnedGroupCollapsed(Vt),!0},[T,Ze,no,Vt,gn,a]),du=xa[0]?.type===tn.TOP_SPACER&&xa[1]?.type===tn.HEADER,md=y.stickyGroupHeaders&&du?0:Nt,gd=(0,et.useMemo)(()=>Gr.parseLocalDayKey(pd),[pd]);(0,et.useEffect)(()=>{if(!ae||ae.isSaving)return;let ot=new Set(ae.order),Gt=xi.filter($n=>ot.has($n.path)).filter($n=>$n.extension==="md").map($n=>$n.path);if(!(Gt.length===ae.order.length&&Gt.every(($n,Ao)=>$n===ae.order[Ao]))){ve($n=>$n&&$n.saveId===ae.saveId?null:$n);return}qj(r,ae.assignmentFiles,ae.propertyKey,ae.pendingAssignments)&&ve($n=>$n&&$n.saveId===ae.saveId&&!$n.isSaving?null:$n)},[r,xi,ae]);let mp=(0,et.useMemo)(()=>Dt!=="folder"||!an?null:an.path,[Dt,an]),{visibleListPropertyKeys:Il,visibleNavigationPropertyKeys:Dm}=(0,et.useMemo)(()=>({visibleListPropertyKeys:$v(v.propertyKeys,"list"),visibleNavigationPropertyKeys:$v(v.propertyKeys,"navigation")}),[v.propertyKeys]),ta=(0,et.useMemo)(()=>({getFileDisplayName:L,getDB:z,getFileTimestamps:G,hasPreview:Q,regenerateFeatureImageForFile:R}),[L,z,G,Q,R]),uo=(0,et.useMemo)(()=>Yr(v.hiddenTags,P),[v.hiddenTags,P]),wo=et.default.useCallback(ot=>{let ut=Nae(ot,H.current);Z(Gt=>Gt===ut?Gt:ut)},[]),Ws=et.default.useCallback(ot=>{if(typeof window>"u"||typeof window.requestAnimationFrame!="function"){wo(ot);return}Fe.current!==null&&window.cancelAnimationFrame(Fe.current),Fe.current=window.requestAnimationFrame(()=>{Fe.current=null,wo(ot)})},[wo]),Om=et.default.useCallback((ot,ut)=>{if(ot){W(Gt=>Gt||!0),Z(Gt=>Gt===null?Gt:null);return}wo(ut),W(!1)},[wo]),fs=et.default.useCallback((ot,ut)=>{if(W(!1),!ot){Fe.current!==null&&(window.cancelAnimationFrame(Fe.current),Fe.current=null),Z(Gt=>Gt===null?Gt:null);return}wo(ut),Ws(ut)},[wo,Ws]),li=(0,et.useMemo)(()=>{if(Il.size===0)return"";let ot=Array.from(Il);return ot.sort(),ot.join("")},[Il]);(0,et.useEffect)(()=>{if(Ze||!h.isRevealOperation||h.revealSource!=="manual"||!Gn||to.has(Gn.path))return;let ot=Nne(xa,Gn.path,gn);if(ot){if(ot.type==="pinned"){a.togglePinnedGroupCollapsed(Vt);return}T({type:"EXPAND_LIST_GROUP",collapseKey:ot.collapseKey})}},[T,to,Ze,xa,Vt,gn,a,Gn,h.isRevealOperation,h.revealSource]);let{rowVirtualizer:cu,scrollContainerRef:ma,scrollContainerRefCallback:Lm,handleScrollToTop:Ei,scrollToIndexSafely:ys}=tre({enabled:!Ze,listItems:xa,filePathToIndex:to,selectedFile:Gn,selectedFolder:an,selectedTag:Sn,selectedProperty:_r,settings:y,folderSettings:er,isVisible:su,selectionState:h,selectionDispatch:b,searchQuery:!Ze&&Me?Tt:void 0,suppressSearchTopScrollRef:me,topSpacerHeight:md,includeDescendantNotes:Zn,groupCollapseStateSignature:Ia,visiblePropertyKeys:Il,visiblePropertyKeySignature:li,hiddenTagVisibility:uo,scrollMargin:0,scrollPaddingEnd:Ie,onVirtualizerScrollingChange:Om,onScrollContainerVisibilityChange:fs}),hd=et.default.useCallback(()=>{let ot=()=>{let ut=ma.current??e.rootContainerRef.current;ut&&Gi(ut)};if(typeof window.requestAnimationFrame=="function"){window.requestAnimationFrame(ot);return}window.setTimeout(ot,0)},[e.rootContainerRef,ma]),oc=et.default.useCallback(ot=>{let ut=to.get(ot.path);return ut===void 0?!1:(Y(ot.path),ys(ut,"auto"),!0)},[to,ys]),ac=(0,et.useRef)(N),fd=(0,et.useRef)(V);(0,et.useEffect)(()=>{let ot=ac.current,ut=fd.current,Gt=N&&!ot,tr=N&&V!==ut;if(ac.current=N,fd.current=V,!Gt&&!tr||!Gn)return;let $n=to.get(Gn.path);if($n===void 0)return;let Ao=()=>ys($n,"auto");if(typeof requestAnimationFrame<"u"){window.requestAnimationFrame(()=>{window.requestAnimationFrame(Ao)});return}window.setTimeout(Ao,0)},[V,to,ys,Gn,N]);let Oh=et.default.useCallback((ot,ut)=>{H.current=ut,Z(Gt=>Gt===ot?Gt:ot)},[]);(0,et.useEffect)(()=>{if(o)return;let ot=Gt=>{H.current={clientX:Gt.clientX,clientY:Gt.clientY}},ut=Gt=>{Gt.relatedTarget||(H.current=null)};return window.addEventListener("mousemove",ot,{passive:!0}),window.addEventListener("mouseout",ut),()=>{window.removeEventListener("mousemove",ot),window.removeEventListener("mouseout",ut)}},[o]),(0,et.useEffect)(()=>()=>{Fe.current!==null&&(window.cancelAnimationFrame(Fe.current),Fe.current=null)},[]),(0,et.useLayoutEffect)(()=>{_||wo(ma.current)},[_,xa,ma,wo]),(0,et.useEffect)(()=>{ee.current=D,ie.current=x},[D,x]),wh(ma,{type:pC,item:an??null,options:{orderedFiles:Wo,onStartInlineRename:oc}});let ic=C.mode==="compact",{selectFileFromList:sc,selectAdjacentFile:gp,ensureSelectionForCurrentFilter:uu,handleFileItemClick:pu,lastSelectedFilePath:hp,isFileSelected:lc,scheduleKeyboardSelectionOpen:mu,scheduleKeyboardSelectionOpenForFile:yd,commitPendingKeyboardSelectionOpen:zm}=mre({rootContainerRef:e.rootContainerRef,orderedFiles:Wo,filePathToIndex:to,scrollToIndexSafely:ys});De.current=uu;let Bm=et.default.useCallback(async(ot,ut)=>{if(ut){await ie.current(ut);return}await ee.current(ot.path)},[]),Gs=et.default.useCallback((ot,ut,Gt)=>{if(!ut)return[...ot];let tr=[...ot],$n=new Map;return sk(tr,"property-asc",Po=>G(Po).created,Po=>G(Po).modified,L,Po=>{if($n.has(Po.path))return $n.get(Po.path)??null;let ha=Gt.get(Po.path),Hm=ha===void 0?Hj(r,Po,ut):ha.toString();return $n.set(Po.path,Hm),Hm},y.propertySortSecondary),tr},[r,L,G,y.propertySortSecondary]),vd=et.default.useCallback(ot=>{if(!ot||Dt!==K.FOLDER||!an||!k)return{files:xi,isBroadened:!1};let ut=an.parent instanceof dp.TFolder?an.parent:null;if(!ut||ut.path===an.path)return{files:xi,isBroadened:!1};for(;ut.parent instanceof dp.TFolder&&ut.parent.path!==ut.path;)ut=ut.parent;let Gt=ba({selectionType:K.FOLDER,selectedFolder:ut},y,{includeDescendantNotes:!0,showHiddenItems:P},r,s,l,{orderResults:!1}),tr=new Set(xi.map(Ao=>Ao.path));return Gt.some(Ao=>!tr.has(Ao.path))?{files:Gt,isBroadened:!0}:{files:xi,isBroadened:!1}},[r,xi,k,l,an,Dt,y,P,s]),di=ne?.propertyKey??"",_i=(0,et.useMemo)(()=>vd(di),[vd,di]),xl=_i.files,je=_i.isBroadened,Bt=(0,et.useMemo)(()=>EK(r,xl,di,ne?.pendingAssignments??[]),[r,xl,di,ne?.pendingAssignments]),ge=(0,et.useMemo)(()=>di?Gs(xl,di,Bt):xl,[xl,di,Bt,Gs]),ke=(0,et.useMemo)(()=>je?BL(an,xl,ge):void 0,[je,xl,ge,an]),Re=(0,et.useMemo)(()=>di?Gs(xi,di,Bt):xi,[xi,di,Bt,Gs]),qe=(0,et.useMemo)(()=>{let ot=ne?.order;return ot?pk(Re,ot):Re},[ne?.order,Re]),Rt=(0,et.useMemo)(()=>Tn?EK(r,Wo,Cr,Jn?.pendingAssignments??[]):new Map,[Jn?.pendingAssignments,r,Tn,Cr,Wo]),sr=et.default.useCallback(()=>{if(!Tn)return{files:Wo,isBroadened:!1,rankByPath:Rt};let ot=vd(Cr);if(!ot.isBroadened)return{files:Wo,isBroadened:!1,rankByPath:Rt};let ut=EK(r,ot.files,Cr,Jn?.pendingAssignments??[]),Gt=Gs(ot.files,Cr,ut);return{files:Gt,isBroadened:!0,rankByPath:ut,insertionIndex:BL(an,ot.files,Gt)}},[Jn?.pendingAssignments,r,Tn,Cr,vd,Wo,Rt,an,Gs]),Dr=!!ne?.isSaving,Mo=et.default.useCallback(()=>{!ne||Dr||le(null)},[Dr,ne]),ci=et.default.useCallback(({nextFiles:ot,movedPaths:ut,onApplied:Gt})=>{if(!ne?.propertyKey)return;let{propertyKey:tr,selectionKey:$n,sessionId:Ao}=ne,Po=je?kI(ge,qe,ot):ot,ha=Pv(Po,ut,Bt),Hm=()=>{let gT=ye.current+1;ye.current=gT;let hT=Rie(ot);Gt?.(),le(Wy=>Wy&&Wy.sessionId===Ao?{...Wy,order:hT,pendingAssignments:ha.assignments,isSaving:ha.assignments.length>0,saveId:gT}:Wy),hs(ha.files,tr,ha.assignments,$n,Ao,gT)};if(ha.requiresCompaction){si(ha.assignments.length,Hm);return}Hm()},[si,je,qe,ge,Bt,ne,hs]),To=et.default.useCallback((ot,ut,Gt)=>{pu(ot,ut,Gt,qe)},[pu,qe]),ko=et.default.useCallback((ot,ut)=>{sc(ot,{markKeyboardNavigation:!0,suppressOpen:y.enterToOpenFiles,debounceOpen:ut?.debounceOpen})},[sc,y.enterToOpenFiles]),js=et.default.useCallback(ot=>{if(!ot)return[];let ut=xa.find(tr=>tr.type===tn.FILE&&tr.data instanceof dp.TFile&&tr.data.path===ot);if(!ut||!(ut.data instanceof dp.TFile))return[];let Gt=!!ut.isPinned;return xa.flatMap(tr=>tr.type!==tn.FILE||!(tr.data instanceof dp.TFile)?[]:!!tr.isPinned!==Gt?[]:[tr.data])},[xa]),bd=et.default.useCallback(ot=>{if(!Tn)return!1;if(pe.current)return!0;let ut=Gn?.path??null,Gt=js(ut),tr=TI(Gt,ut,h.selectedFiles,ot);if(!tr)return!0;let $n=new Set(Gt.map(yp=>yp.path)),Ao=0,Po=Wo.map(yp=>{if(!$n.has(yp.path))return yp;let ece=tr.files[Ao];return Ao+=1,ece??yp}),{markdown:ha}=Rd(Gt),Hm=dg(ha,ut??"",h.selectedFiles),gT=Hm.size>1?Hm:new Set(ut?[ut]:[]),hT=sr(),Wy=hT.isBroadened?kI(hT.files,Wo,Po):Po,zh=Pv(Wy,gT,hT.rankByPath),sU=()=>{let yp=ce.current+1;ce.current=yp,pe.current=!0,ue.current=tr.scrollPath,ve({propertyKey:Cr,order:Rie(Po),pendingAssignments:zh.assignments,assignmentFiles:zh.files,isSaving:zh.assignments.length>0,selectionKey:Wt,saveId:yp}),rc(zh.files,Cr,zh.assignments,Wt,yp)};return zh.requiresCompaction?(si(zh.assignments.length,sU),!0):(sU(),!0)},[Tn,si,Cr,sr,js,Wt,Wo,rc,Gn,h.selectedFiles]),Yn=et.default.useCallback(()=>{let ot=Gn?.path??null,ut=y.manualSortNewNotePlacement,Gt=Dt===K.FOLDER&&an?{targetType:"folder",targetKey:an.path}:Dt===K.TAG&&Sn?{targetType:"tag",targetKey:Sn}:Dt===K.PROPERTY&&_r?{targetType:"property",targetKey:_r}:null;if(!Gt)return null;if(ne?.propertyKey)return{...Gt,propertyKey:ne.propertyKey,files:qe,planningFiles:je?ge:void 0,planningInsertionIndex:ke,selectedFilePath:ot,rankByPath:Bt,placement:ut};if(!Tn||!Cr)return null;let tr=sr();return{...Gt,propertyKey:Cr,files:Wo,planningFiles:tr.isBroadened?tr.files:void 0,planningInsertionIndex:tr.insertionIndex,selectedFilePath:ot,rankByPath:tr.rankByPath,placement:ut}},[Tn,Cr,sr,je,qe,ke,ge,Bt,ne?.propertyKey,Wo,an,Gn,_r,Sn,Dt,y.manualSortNewNotePlacement]),Hi=et.default.useCallback(()=>{Pe(!1),fe()},[fe]),Lh=et.default.useCallback(()=>{Pe(!1),Ne()},[Ne]),_m=et.default.useCallback(()=>{Pe(!1),In()},[In]),Uy=et.default.useCallback(()=>{Pe(!0),In()},[In]),IO=et.default.useCallback(()=>{Pe(!1)},[]),uT=et.default.useCallback((ot,ut,Gt)=>{Pe(!1),St(ot,ut,Gt)},[St]),pT=et.default.useCallback((ot,ut,Gt,tr)=>{Pe(!1),ln(ot,ut,Gt,tr)},[ln]),mT=et.default.useCallback((ot,ut)=>{Pe(!1),vn(ot,ut)},[vn]),rN=et.default.useCallback(async ot=>{Pe(!1),await eo(ot)},[eo]),gu=(0,et.useMemo)(()=>(0,Fa.jsx)($re,{isSearchActive:Me,onSearchToggle:Hi,onManualSortStart:iu,getManualSortNewFileContext:Yn,canToggleGroupExpansion:no.canToggle,shouldCollapseGroups:no.shouldCollapse,onToggleGroupExpansion:Ea,useFloatingLayout:ze}),[Yn,iu,Hi,Me,no.canToggle,no.shouldCollapse,ze,Ea]);(0,et.useEffect)(()=>i.setManualSortNewFileContextProvider(Yn),[i,Yn]),(0,et.useEffect)(()=>{let ot=ue.current;if(!ot)return;let ut=to.get(ot);ut!==void 0&&(ue.current=null,ys(ut,"auto"))},[to,ae?.order,ys]),(0,et.useEffect)(()=>{!re||to.has(re)||Y(null)},[to,re]);let xO=et.default.useCallback(()=>Gn?oc(Gn):!1,[oc,Gn]),Kt=et.default.useCallback(async(ot,ut)=>{let Gt=await i.renameFileDisplayName(ot,ut);return Gt&&Y(null),Gt},[i]),Go=et.default.useCallback(()=>{Y(null)},[]);(0,et.useImperativeHandle)(n,()=>({getIndexOfPath:ot=>to.get(ot)??-1,virtualizer:cu,scrollContainerRef:ma.current,getOrderedFiles:()=>Wo,selectFile:sc,selectAdjacentFile:gp,modifySearchWithTag:uT,modifySearchWithProperty:pT,modifySearchWithDateToken:mT,toggleSearch:_m,searchWithDescendants:Uy,executeSearchShortcut:rN,getManualSortNewFileContext:Yn,toggleGroupExpansion:Ea}),[to,Wo,cu,ma,_m,Uy,rN,sc,gp,uT,pT,mT,Yn,Ea]),bte({enabled:!Ze,items:xa,virtualizer:cu,containerRef:e.rootContainerRef,pathToIndex:to,orderedFiles:Wo,orderedFileIndexMap:pp,scrollToIndexSafely:ys,onSelectFile:(ot,ut)=>sc(ot,{markKeyboardNavigation:!0,suppressOpen:y.enterToOpenFiles||ut?.suppressOpen,debounceOpen:ut?.debounceOpen}),onScheduleKeyboardOpen:mu,onScheduleKeyboardOpenForFile:yd,onCommitKeyboardOpen:zm,onReorderPropertySort:bd,onStartRename:xO});let ga=!an&&!Sn&&!_r,El=xi.length===0,fp=we&&!q,EO=fp&&ze,iU=fp&&!ze;return(0,Fa.jsxs)("div",{ref:M,className:`nn-list-pane ${Me?"nn-search-active":""}`,style:Zt,"data-calendar":N?"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)(WEe,{onHeaderClick:Ei,isSearchActive:Me,onSearchToggle:Hi,onManualSortStart:iu,getManualSortNewFileContext:Yn,canToggleGroupExpansion:no.canToggle,shouldCollapseGroups:no.shouldCollapse,onToggleGroupExpansion:Ea,actionsDisabled:Ze,shouldShowDesktopTitleArea:Le,children:[we&&q&&!ne?gu:null,(0,Fa.jsx)("div",{className:`nn-search-bar-container ${Me?"nn-search-bar-visible":""}`,children:Me&&(0,Fa.jsx)(zoe,{searchQuery:Ge,onSearchQueryChange:se,shouldFocus:it,onFocusComplete:xe,onEmptySearchExit:IO,isWholeVaultSearch:ir,onClose:Lh,onFocusFiles:()=>{uu({openInEditor:!1})},containerRef:e.rootContainerRef,onSaveShortcut:yn?void 0:Be,onRemoveShortcut:yn?dt:void 0,isShortcutSaved:!!yn,isShortcutDisabled:rt,searchProvider:nt})})]})}),(0,Fa.jsxs)("div",{className:"nn-list-pane-panel",children:[ne?(0,Fa.jsx)(Nie,{files:qe,listItems:xa,hiddenFileState:Am,propertyKey:ne.propertyKey,manualSortGroupHeaderPropertyKey:bt,wordCountTargetProperty:y.wordCountTargetProperty,rankByPath:Bt,selectedFolderPath:an?.path??null,isSaving:ne.isSaving,isDoneDisabled:Dr,selectionType:Dt,sortOption:co,localDayReference:gd,fileIconSize:We.fileIconSize,appearanceSettings:er,includeDescendantNotes:Zn,hiddenTagVisibility:uo,fileNameIconNeedles:S,visibleListPropertyKeys:Il,visibleNavigationPropertyKeys:Dm,fileItemStorage:ta,noteShortcutKeysByPath:O,folderDecorationModel:m,fileItemPillDecorationModel:g,fileItemPillOrderModel:f,getSolidBackground:X,selectedFiles:h.selectedFiles,selectedFilePath:Gn?.path??null,onFileClick:To,onKeyboardSelect:ko,onScheduleKeyboardOpen:mu,onScheduleKeyboardOpenForFile:yd,onCommitKeyboardOpen:zm,onDone:Mo,onReorder:ci}):(0,Fa.jsx)(Iae,{listItems:xa,rowVirtualizer:cu,scrollContainerRefCallback:Lm,activeFolderDropPath:mp,isCompactMode:ic,isEmptySelection:ga,hasNoFiles:El,topSpacerHeight:md,settings:y,pinnedGroupExpanded:gn,onPinnedGroupHeaderToggle:ur,onListGroupHeaderToggle:ft,selectionType:Dt,selectedFolderPath:mn,sortOption:co,searchHighlightTerms:wn,isFolderNavigation:h.isFolderNavigation,lastSelectedFilePath:hp,isFileSelected:lc,hoveredFilePath:J,suppressRowHover:_,onHoveredFilePathChange:Oh,onFileClick:pu,onModifySearchWithTag:uT,onModifySearchWithProperty:pT,localDayReference:gd,fileIconSize:We.fileIconSize,appearanceSettings:er,includeDescendantNotes:Zn,hiddenTagVisibility:uo,fileNameIconNeedles:S,visibleListPropertyKeys:Il,visibleNavigationPropertyKeys:Dm,fileItemStorage:ta,noteShortcutKeysByPath:O,onToggleNoteShortcut:Bm,inlineRenameFilePath:re,onFileRenameCommit:Kt,onFileRenameCancel:Go,onFileRenameRestoreFocus:hd,onNavigateToFolder:c,folderDecorationModel:m,fileItemPillDecorationModel:g,fileItemPillOrderModel:f,getSolidBackground:X}),EO&&!ne?(0,Fa.jsx)("div",{className:"nn-pane-bottom-toolbar",children:gu}):null]}),N?(0,Fa.jsx)("div",{className:"nn-navigation-calendar-overlay",children:(0,Fa.jsx)(Cm,{onWeekCountChange:j,onAddDateFilter:mT})}):null,iU&&!ne?(0,Fa.jsx)("div",{className:"nn-pane-bottom-toolbar",children:gu}):null]})}))});function RK(t){return t.type===be.VIRTUAL_FOLDER&&typeof t.tagCollectionId=="string"&&t.tagCollectionId.length>0}function MK(t){return t.type===be.VIRTUAL_FOLDER&&typeof t.propertyCollectionId=="string"&&t.propertyCollectionId.length>0}function GEe(t){return t.key==="Tab"&&t.shiftKey&&!t.ctrlKey&&!t.metaKey&&!t.altKey}function Die({items:t,virtualizer:e,containerRef:n,pathToIndex:r,onStartRename:o}){let{app:a,commandQueue:i,plugin:s}=vt(),l=Ti(),c=yt(),u=jt(),p=u.includeDescendantNotes,m=u.showHiddenItems,g=hr(),f=ar(),h=la(),b=Wa(),y=Qr(),v=So(),S=(0,KC.useCallback)((k,P)=>{if(!k)return-1;if(P){let z=kl(r,P,k);if(z!==void 0)return z}let E=kl(r,K.FOLDER,k);if(E!==void 0)return E;let C=kl(r,K.TAG,k);if(C!==void 0)return C;let L=kl(r,K.PROPERTY,k);return L!==void 0?L:-1},[r]),w=(0,KC.useCallback)(()=>g.selectionType===K.FOLDER&&g.selectedFolder?.path?S(g.selectedFolder.path,K.FOLDER):g.selectionType===K.TAG&&g.selectedTag?S(g.selectedTag,K.TAG):g.selectionType===K.PROPERTY&&g.selectedProperty?S(g.selectedProperty,K.PROPERTY):-1,[g,S]),T=(0,KC.useCallback)(k=>{if(k.type===be.FOLDER){if(!(k.data instanceof JD.TFolder))return;let P=k.data;if(f({type:"SET_SELECTED_FOLDER",folder:P}),c.autoExpandNavItems&&P.children.some(E=>E instanceof JD.TFolder)&&!da(P.path,h.expandedFolders,c.showRootFolder)){let E=gh(k,{showHiddenItems:m,showRootFolder:c.showRootFolder});E&&Zd(E,h,b,"expand",{collapseOtherBranches:c.collapseOtherBranchesOnExpand})}return}else if(k.type===be.TAG||k.type===be.UNTAGGED){let P=k.data;if(f({type:"SET_SELECTED_TAG",tag:P.path}),c.autoExpandNavItems&&P.children.size>0&&!h.expandedTags.has(P.path)){let E=gh(k,{showHiddenItems:m,showRootFolder:c.showRootFolder});E&&Zd(E,h,b,"expand",{collapseOtherBranches:c.collapseOtherBranchesOnExpand})}}else if(k.type===be.PROPERTY_KEY||k.type===be.PROPERTY_VALUE){let P=k.data;if(f({type:"SET_SELECTED_PROPERTY",nodeId:P.id}),c.autoExpandNavItems&&P.children.size>0&&!h.expandedProperties.has(P.id)){let E=gh(k,{showHiddenItems:m,showRootFolder:c.showRootFolder});E&&Zd(E,h,b,"expand",{collapseOtherBranches:c.collapseOtherBranchesOnExpand})}}else if(MK(k))f({type:"SET_SELECTED_PROPERTY",nodeId:_e});else if(RK(k)){let P=k.tagCollectionId;f({type:"SET_SELECTED_TAG",tag:P})}},[f,c,h,b,m]),F=(0,KC.useCallback)((k,P)=>{let E=w(),C=c.keyboardShortcuts,L=P.isRTL(),z=-1,G=!1;if(GEe(k)){k.preventDefault();return}if(cn(k,C,xt.PANE_RENAME)&&o?.()){k.preventDefault();return}let Q=()=>P.findNextIndex(-1),R=O=>{if(t.length===0)return-1;for(let D=Math.min(O,t.length-1);D>=0;D--){let x=P.getItemAt(D);if(x&&VC(x))return D}return-1};if(Av(k)&&c.enableFolderNoteLinks&&g.selectionType===K.FOLDER&&g.selectedFolder){let O=g.selectedFolder,D=Rn(O,c);if(D){k.preventDefault();let x=Dv(k,c);if(x==="rename"){o?.();return}let B=x??UI(c.folderNoteOpenLocation);Ai(f,D),$(()=>vi({app:a,commandQueue:i,folder:O,folderNote:D,context:B,active:!1,openInRightSidebar:I=>s.openFolderNoteInRightSidebar(I)}));return}}if(cn(k,C,xt.PANE_MOVE_DOWN)){if(k.preventDefault(),z=P.findNextIndex(E),z===E&&E>=0)return}else if(cn(k,C,xt.PANE_MOVE_UP)){if(k.preventDefault(),E===-1)z=P.findNextIndex(-1);else if(z=P.findPreviousIndex(E),z===E&&E>=0)return}else if(cn(k,C,xt.PANE_PAGE_DOWN)){if(k.preventDefault(),E!==-1){let O=P.getPageSize(),D=Math.min(E+O,t.length-1),x=P.findNextIndex(D-1);if(x===E&&E!==t.length-1)for(let B=t.length-1;B>=0;B--){let I=P.getItemAt(B);if(I&&VC(I)){x=B;break}}z=x}}else if(cn(k,C,xt.PANE_PAGE_UP)){k.preventDefault();let O=Q();if(E===-1)z=O,O>=0&&(G=!0);else{let D=P.getPageSize(),x=Math.max(0,E-D),B=R(x);B>=0?(z=B,O>=0&&B===O&&(G=!0)):(z=O,O>=0&&(G=!0))}}else if(cn(k,C,xt.NAV_EXPAND_OR_FOCUS_LIST,{isRTL:L,directional:"horizontal"})){if(k.preventDefault(),E>=0){let O=P.getItemAt(E);if(!O)return;let D=gh(O,{showHiddenItems:m,showRootFolder:c.showRootFolder}),x=D?Zd(D,h,b,"expand",{collapseOtherBranches:c.collapseOtherBranchesOnExpand}):!1,B=!x;x&&y.singlePane&&c.autoExpandNavItems?v({type:"ACTIVATE_PANE",target:"navigation"}):B&&(y.singlePane||f({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!0}),v({type:"ACTIVATE_PANE",target:"files"}))}}else if(cn(k,C,xt.NAV_COLLAPSE_OR_PARENT,{isRTL:L,directional:"horizontal"})){if(k.preventDefault(),E>=0){let O=P.getItemAt(E);if(!O)return;let D=gh(O,{showHiddenItems:m,showRootFolder:c.showRootFolder}),x=()=>D?Zd(D,h,b,"collapse"):!1,B=()=>{if(!c.showAllTagsFolder)return;let I=S(Lt,K.TAG);if(I>=0){let A=P.getItemAt(I);A&&(T(A),P.scrollToIndex(I))}};if(O.type===be.FOLDER){if(!(O.data instanceof JD.TFolder))return;let I=O.data;if(!x()&&I.parent&&(!c.showRootFolder||I.path!=="/")){let A=I.parent.path,N=S(A,K.FOLDER);if(N>=0){let M=P.getItemAt(N);M&&(T(M),P.scrollToIndex(N))}}}else if(O.type===be.TAG){let I=O.data;if(!x()){let A=I.path.lastIndexOf("/");if(A>0){let N=I.path.substring(0,A),M=S(N,K.TAG);if(M>=0){let H=P.getItemAt(M);H&&(T(H),P.scrollToIndex(M))}}else B()}}else if(O.type===be.UNTAGGED)B();else if(O.type===be.PROPERTY_KEY||O.type===be.PROPERTY_VALUE){let I=O.data;if(!x())if(I.kind==="value"){let A=or(I.key),N=S(A,K.PROPERTY);if(N>=0){let M=P.getItemAt(N);M&&(T(M),P.scrollToIndex(N))}}else{let A=S(_e,K.PROPERTY);if(A>=0){let N=P.getItemAt(A);N&&(T(N),P.scrollToIndex(A))}}}else(RK(O)||MK(O))&&x()}}else if(cn(k,C,xt.NAV_FOCUS_LIST))k.preventDefault(),y.singlePane||f({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!0}),v({type:"ACTIVATE_PANE",target:"files"});else if(cn(k,C,xt.DELETE_SELECTED))g.selectionType===K.FOLDER&&g.selectedFolder&&(k.preventDefault(),$(()=>Jee({app:a,fileSystemOps:l,settings:c,visibility:{includeDescendantNotes:p,showHiddenItems:m},selectionState:g,selectionDispatch:f})));else if(cn(k,C,xt.PANE_HOME))k.preventDefault(),z=Q(),z>=0&&(G=!0);else if(cn(k,C,xt.PANE_END)){k.preventDefault();for(let O=t.length-1;O>=0;O--){let D=P.getItemAt(O);if(D&&VC(D)){z=O;break}}}if(z>=0&&z{KC=he(Ve()),JD=require("obsidian");Tl();Ur();fn();on();gr();wa();Ue();MA();l1();Uh();st();hh();Hu();Md();un();qc();VC=t=>t.type===be.FOLDER||t.type===be.TAG||t.type===be.UNTAGGED||t.type===be.PROPERTY_KEY||t.type===be.PROPERTY_VALUE||(RK(t)||MK(t))&&!!t.isSelectable});function zie({plugin:t,children:e}){let[n,r]=(0,eu.useState)(()=>t.getRecentNotes()),[o,a]=(0,eu.useState)(()=>t.getRecentIcons());(0,eu.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=eu.default.useMemo(()=>({recentNotes:n,recentIcons:o}),[n,o]);return(0,_ie.jsx)(Lie.Provider,{value:i,children:e})}function Bie(){let t=(0,eu.useContext)(Lie);if(t===null)throw new Error("useRecentData must be used within a RecentDataProvider");return t}var eu,_ie,Lie,AK=U(()=>{eu=he(Ve()),_ie=he($e()),Lie=(0,eu.createContext)(null)});function UC(t,e){let n=e.cache?.get(t.path);if(n)return n;let r=0,o=0,a=e.excludedFileMatcher??oo(e.excludedFiles);for(let s of t.children)if(s instanceof eO.TFile){if(e.folderNoteSettings.enableFolderNotes&&e.hideFolderNoteInList&&al(s,t,e.folderNoteSettings))continue;let l=e.hiddenFileTagVisibility,c=!1;l&&l.hasHiddenRules&&s.extension==="md"&&Br({app:e.app,file:s,db:e.db}).some(p=>!l.isTagVisible(p))&&(c=!0),bs(s,e.fileVisibility,e.app)&&!(e.fileNameMatcher&&e.fileNameMatcher.matches(s))&&!oa(s,a,e.app)&&!c&&(r+=1)}else if(s instanceof eO.TFolder){if(!e.includeDescendants||!e.showHiddenFolders&&wc(s.name,e.excludedFolders,s.path)||e.descendantExcludedFolders.length>0&&Tc(s.name,e.descendantExcludedFolders,s.path))continue;let l=UC(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 eO,DK=U(()=>{eO=require("obsidian");Lr();wr();Ja();Cn()});function Vie(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,descendantExcludedFolders:g,hiddenFileTags:f,showHiddenItems:h,folderCountFileNameMatcher:b,fileVisibility:y,folderChangeVersion:v,vaultChangeVersion:S,metadataVisibilityVersion:w,tagDataVersion:T}=t,F=(0,Bi.useRef)(new Map),k=(0,Bi.useRef)(new Map),P=(0,Bi.useRef)(new Map),E=(0,Bi.useRef)(null),C=!h&&f.length>0?T:0,L=p.length>0?w:0,z=(0,Bi.useMemo)(()=>{if(!n||!r.showTags||!r.showNoteCount)return null;let B=new Map,I=i?s:0;return B.set(Lt,{current:I,descendants:0,total:I}),r.showUntagged&&B.set(wt,{current:l,descendants:0,total:l}),a.forEach(A=>{if(A.type!==be.TAG)return;let N=A.data;if(A.noteCount){B.set(N.path,A.noteCount);return}B.set(N.path,qI(N,i))}),B},[i,n,a,r.showNoteCount,r.showTags,r.showUntagged,l,s]),G=(0,Bi.useMemo)(()=>!r.showTags||!r.showNoteCount?new Map:z??F.current,[z,r.showNoteCount,r.showTags]);(0,Bi.useEffect)(()=>{if(!r.showTags||!r.showNoteCount){F.current=new Map;return}z&&(F.current=z)},[z,r.showNoteCount,r.showTags]);let Q=(0,Bi.useMemo)(()=>{if(!n||!o||!r.showNoteCount)return null;let B=new Map;u&&B.set(_e,u);let I=new Map;return a.forEach(A=>{(A.type===be.PROPERTY_KEY||A.type===be.PROPERTY_VALUE)&&I.set(A.data.id,A.data)}),I.size===0||I.forEach(A=>{if(A.kind==="key"){let X=Au(A);if(!i){B.set(A.id,{current:X,descendants:0,total:X});return}let V=A.notesWithValue.size,j=Math.max(V-X,0);B.set(A.id,{current:X,descendants:j,total:V});return}let N=A.notesWithValue.size;if(!i||!A.valuePath){B.set(A.id,{current:N,descendants:0,total:N});return}let M=c.get(A.key);if(!M){B.set(A.id,{current:N,descendants:0,total:N});return}let H=hg(M,A.valuePath),q=Math.max(H-N,0);B.set(A.id,{current:N,descendants:q,total:H})}),B},[i,n,a,o,u,c,r.showNoteCount]),R=(0,Bi.useMemo)(()=>!o||!r.showNoteCount?new Map:Q??k.current,[Q,o,r.showNoteCount]);(0,Bi.useEffect)(()=>{if(!o||!r.showNoteCount){k.current=new Map;return}Q&&(k.current=Q)},[Q,o,r.showNoteCount]);let O=(0,Bi.useMemo)(()=>(r.enableFolderNotes,r.folderNoteNamePattern,r.hideFolderNoteInList,{}),[g,p,y,v,b,L,C,f,m,i,r.enableFolderNotes,r.folderNoteNamePattern,r.hideFolderNoteInList,h,S]),D=(0,Bi.useMemo)(()=>{if(!n||!r.showNoteCount)return null;let B=E.current,I=B!==null&&B.key===O?B.counts:new Map;E.current={key:O,counts:I};let A=p,N=oo(A),M=m,H=h?null:Yr(f,!1),q=H&&H.hasHiddenRules?mr():null,X=zo({enableFolderNotes:r.enableFolderNotes,folderNoteNamePattern:r.folderNoteNamePattern}),_={app:e,db:q,fileVisibility:y,excludedFiles:A,excludedFileMatcher:N,excludedFolders:M,descendantExcludedFolders:g,fileNameMatcher:b,hiddenFileTagVisibility:H,includeDescendants:i,showHiddenFolders:h,hideFolderNoteInList:r.hideFolderNoteInList,folderNoteSettings:X,cache:I};return a.forEach(W=>{W.type===be.FOLDER&&W.data instanceof Hie.TFolder&&UC(W.data,_)}),new Map(I)},[e,p,g,y,O,b,f,m,i,n,a,r.enableFolderNotes,r.folderNoteNamePattern,r.hideFolderNoteInList,r.showNoteCount,h]),x=(0,Bi.useMemo)(()=>r.showNoteCount?D??P.current:new Map,[D,r.showNoteCount]);return(0,Bi.useEffect)(()=>{if(!r.showNoteCount){E.current=null,P.current=new Map;return}D&&(P.current=D)},[D,r.showNoteCount]),{tagCounts:G,propertyCounts:R,folderCounts:x}}var Bi,Hie,Kie=U(()=>{Bi=he(Ve()),Hie=require("obsidian");Ue();Qa();wr();Hr();Vn();Ja();DK();un()});function Wie(t){return typeof t!="string"?null:Uie.has(t)?t:null}function $w(t){let e=new Set,n=[];return t.forEach(r=>{Uie.has(r)&&(e.has(r)||(e.add(r),n.push(r)))}),dN.forEach(r=>{e.has(r)||(e.add(r),n.push(r))}),n}function OK(t){if(!Array.isArray(t))return[...dN];let e=t.map(Wie).filter(n=>!!n);return $w(e)}function Gie(t,e){let n=[],r=new Set;return t.forEach(o=>{let a=Wie(o);a&&(r.has(a)||(r.add(a),n.push(a)))}),e.forEach(o=>{r.has(o)||(r.add(o),n.push(o))}),$w(n)}var Uie,tO=U(()=>{Ue();Uie=new Set(dN)});function jie(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=P=>{let E=p.get(P);if(E)return E;let C=i.getFolderDisplayData(P);return p.set(P,C),C},g={showFilenameMatchIcons:n.showFilenameMatchIcons,fileNameIconMap:n.fileNameIconMap,showCategoryIcons:!0,fileTypeIconMap:n.fileTypeIconMap,fileTypeIconPreset:n.fileTypeIconPreset,externalIconProviders:n.externalIconProviders},f="file",h=P=>{if(n.showFilenameMatchIcons)return a(P)},b=r.mode,y=b!=="none",v=n.showAllTagsFolder?1:0,S=n.showAllPropertiesFolder?1:0,w=c.tag,T=c.property,F=c.shortcut,k=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:y,tag:{isEnabled:!!w,scope:r.tags.scope,rootLevel:v,colors:u.tag},property:{isEnabled:!!T,scope:r.properties.scope,rootLevel:S,colors:u.property},shortcut:{isEnabled:!!F,colors:u.shortcut},recent:{isEnabled:!!k,colors:u.recent}}}}function qie(t){let{ctx:e,folderPath:n,color:r,backgroundColor:o}=t;return wy({model:e.folderDecorationModel,folderPath:n,color:r,backgroundColor:o})}function Yie(t){let{ctx:e,rainbowColor:n,color:r,backgroundColor:o}=t;return!e.rainbow.isEnabled||!n?{color:r,backgroundColor:o}:Rb({mode:e.rainbow.mode,rainbowColor:n,color:r,backgroundColor:o})}function WC(t){let{ctx:e,shouldApply:n,rainbowColor:r,colors:o}=t;if(!n||!r)return o;let a=Yie({ctx:e,rainbowColor:r,color:o.color,backgroundColor:o.backgroundColor});return{color:a.color,backgroundColor:a.backgroundColor}}function GC(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 jEe(t,e,n){return GC({ctx:t,enabled:!0,virtualFolderId:qa,color:e,backgroundColor:n})}function qEe(t,e,n){return GC({ctx:t,enabled:!0,virtualFolderId:Ya,color:e,backgroundColor:n})}function $ie(t,e,n){if(!t.rainbow.isEnabled||!n)return e;let r=e.color??void 0,o=e.backgroundColor??void 0,a=Yie({ctx:t,rainbowColor:n,color:r,backgroundColor:o});return a.color===r&&a.backgroundColor===o?e:{...e,...a}}function nO(t,e,n){let r=!bs(e,xr.SUPPORTED,t.app);return VS(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 YEe(t,e){if(t.rainbow.shortcut.isEnabled)return t.rainbow.shortcut.colors.colorsByKey.get(e)}function $Ee(t,e){if(t.rainbow.recent.isEnabled)return t.rainbow.recent.colors.colorsByKey.get(e)}function Xw(t){let{ctx:e,itemKey:n,color:r,backgroundColor:o,allowRainbow:a=!0}=t,i=r,s=o,l=jEe(e,i,s);return l&&(i=l.color,s=l.backgroundColor),a?WC({ctx:e,shouldApply:!0,rainbowColor:YEe(e,n),colors:{color:i,backgroundColor:s}}):{color:i,backgroundColor:s}}function Xie(t){let{ctx:e,itemKey:n,color:r,backgroundColor:o}=t,a=r,i=o,s=qEe(e,a,i);return s&&(a=s.color,i=s.backgroundColor),WC({ctx:e,shouldApply:!0,rainbowColor:$Ee(e,n),colors:{color:a,backgroundColor:i}})}var LK=U(()=>{Ue();Lr();zF();Ig();PD()});function XEe(t,e){if(e===_e)return Je(t.settings.interfaceIcons,"nav-properties");let n=Nn(e);return t.metadataService.getPropertyIcon(e)||(n?.valuePath?Je(t.settings.interfaceIcons,"nav-property-value"):Je(t.settings.interfaceIcons,"nav-property"))}function QEe(t,e){let n=e.folder?.path,r=n?t.getFolderDisplayData(n):void 0,o=n==="/"?"vault":"lucide-folder",a=Xw({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 ZEe(t,e){let n=t.metadataService.getTagColorData(e.tagPath),r=Xw({ctx:t,itemKey:e.key,color:n.color,backgroundColor:void 0});return{...e,icon:t.metadataService.getTagIcon(e.tagPath)||Je(t.settings.interfaceIcons,"nav-tag"),color:r.color,backgroundColor:r.backgroundColor}}function JEe(t,e){let n=e.propertyNodeId,r=t.metadataService.getPropertyColorData(n),o=Xw({ctx:t,itemKey:e.key,color:r.color,backgroundColor:void 0});return{...e,icon:XEe(t,n),color:o.color,backgroundColor:o.backgroundColor}}function eRe(t,e){let n=e.note;if(!n)return e;let r=t.metadataService.getFileColor(n.path),o=t.metadataService.getFileIcon(n.path),a=nO(t,n,o),i=Xw({ctx:t,itemKey:e.key,color:r,backgroundColor:void 0});return{...e,icon:a??void 0,color:i.color,backgroundColor:i.backgroundColor}}function tRe(t,e){let n=Xw({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 Qie(t,e){switch(e.type){case be.SHORTCUT_FOLDER:return QEe(t,e);case be.SHORTCUT_TAG:return ZEe(t,e);case be.SHORTCUT_PROPERTY:return JEe(t,e);case be.SHORTCUT_NOTE:return eRe(t,e);case be.SHORTCUT_SEARCH:return tRe(t,e);default:return null}}var Zie=U(()=>{Ue();un();lr();LK()});function nRe(t,e){let n=t.getFolderDisplayData(e.data.path),r={color:n.color,backgroundColor:n.backgroundColor};return r=qie({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 rRe(t,e){let n=e.data,r=t.metadataService.getTagColorData(n.path),o={color:r.color,backgroundColor:r.background},a=GC({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=WC({ctx:t,shouldApply:u,rainbowColor:c,colors:o})}return{...e,color:o.color,backgroundColor:o.backgroundColor,icon:t.metadataService.getTagIcon(n.path)}}function oRe(t,e){let n=e.data,r=n.id,o=t.metadataService.getPropertyColorData(r),a=t.metadataService.getPropertyIcon(r)||(n.kind==="value"?Je(t.settings.interfaceIcons,"nav-property-value"):void 0),i={color:o.color,backgroundColor:o.background},s=GC({ctx:t,enabled:t.settings.showAllPropertiesFolder&&t.settings.inheritPropertyColors,virtualFolderId:_e,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=WC({ctx:t,shouldApply:g,rainbowColor:p,colors:i})}return{...e,color:i.color,backgroundColor:i.backgroundColor,icon:a}}function aRe(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===_e?i=t.rainbow.property.colors.rootColor:e.data.id===qa?i=t.rainbow.shortcut.colors.rootColor:e.data.id===Ya&&(i=t.rainbow.recent.colors.rootColor),$ie(t,a,i)}function iRe(t,e){let n=e.note,r=t.metadataService.getFileIcon(n.path),o=t.metadataService.getFileColor(n.path),a=Xie({ctx:t,itemKey:e.key,color:o,backgroundColor:e.backgroundColor}),i=nO(t,n,r);return{...e,icon:i??void 0,color:a.color,backgroundColor:a.backgroundColor}}function sRe(t,e){switch(e.type){case be.FOLDER:return nRe(t,e);case be.TAG:case be.UNTAGGED:return rRe(t,e);case be.PROPERTY_KEY:case be.PROPERTY_VALUE:return oRe(t,e);case be.VIRTUAL_FOLDER:return aRe(t,e);case be.RECENT_NOTE:return iRe(t,e);case be.SHORTCUT_FOLDER:case be.SHORTCUT_TAG:case be.SHORTCUT_PROPERTY:case be.SHORTCUT_NOTE:case be.SHORTCUT_SEARCH:return Qie(t,e)??e;default:return e}}function Jie(t){let{app:e,settings:n,navRainbow:r,fileNameIconNeedles:o,getFileDisplayName:a,metadataService:i,parsedExcludedFolders:s,folderDecorationModel:l,navRainbowPalettes:c,navRainbowColors:u}=t,p=jie({app:e,settings:n,navRainbow:r,fileNameIconNeedles:o,getFileDisplayName:a,metadataService:i,parsedExcludedFolders:s,folderDecorationModel:l,navRainbowPalettes:c,navRainbowColors:u});return m=>sRe(p,m)}var ese=U(()=>{Ue();lr();LK();Zie()});function nse(t,e,n){if(e<=0)return t;let r=[],o=0,a=0,i=l=>l.type!==be.VIRTUAL_FOLDER?!1:l.data.id===_n?n.tagRootLevel>0:l.data.id===_e?n.propertyRootLevel>0:!1,s=l=>l.type===be.TOP_SPACER||l.type===be.BOTTOM_SPACER||l.type===be.VIRTUAL_FOLDER?!0:l.type===be.LIST_SPACER?!lRe(l.key):!1;for(let l of t){if(s(l)){o=i(l)?1:0,r.push(l);continue}if(dRe(l,n)){o>0&&r.push({type:be.ROOT_SPACER,key:`root-spacer-${a++}`,spacing:e}),o+=1,r.push(l);continue}r.push(l)}return r}var tse,lRe,dRe,rse=U(()=>{Ue();cP();tse=new Set([be.TOP_SPACER,be.LIST_SPACER,be.BOTTOM_SPACER,be.ROOT_SPACER]),lRe=t=>{let e=Hf(t);return e?.type==="folder"||e?.type==="tag"||e?.type==="property"},dRe=(t,e)=>{if(t.type===be.FOLDER){if(e.showRootFolder&&t.data.path==="/")return!0;let n=e.showRootFolder?1:0;return t.level===n}return t.type===be.TAG||t.type===be.UNTAGGED?t.level===e.tagRootLevel:t.type===be.PROPERTY_KEY?t.level===e.propertyRootLevel:!1}});function ase({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:y,metadataDecorationVersion:v}){let S=(0,Eo.useMemo)(()=>$w(s),[s]),{navRainbow:w,navRainbowPalettes:T}=i,{items:F,sectionSpacerMap:k,firstSectionId:P}=(0,Eo.useMemo)(()=>{let _=[],W=new Map,J=null;_.push({type:be.TOP_SPACER,key:"top-spacer"});let Z=e.showShortcuts&&h.length>0&&!c,re=e.showRecentNotes&&b.length>0&&!u,Y=m.length>0,ne=e.showTags&&g.length>0,le=p&&f.length>0,ae=[];S.forEach(de=>{switch(de){case Ot.SHORTCUTS:Z&&ae.push({id:de,items:h});break;case Ot.RECENT:re&&ae.push({id:de,items:b});break;case Ot.FOLDERS:Y&&ae.push({id:de,items:m});break;case Ot.TAGS:ne&&ae.push({id:de,items:g});break;case Ot.PROPERTIES:le&&ae.push({id:de,items:f});break;default:break}});let ve=ae.filter(de=>de.items.length>0);return ve.length>0&&(J=ve[0].id,W.set(ve[0].id,"top-spacer")),ve.forEach((de,Pe)=>{if(_.push(...de.items),Pen.getNavigationSeparatorsVersion());(0,Eo.useEffect)(()=>n.subscribeToNavigationSeparatorChanges(_=>{C(_)}),[n]);let L=(0,Eo.useMemo)(()=>({version:E,record:e.navigationSeparators||{}}),[E,e.navigationSeparators]),z=(0,Eo.useMemo)(()=>{let _=L.record,W=new Set,J=new Set,Z=new Set,re=new Set,Y=!1;Object.entries(_||{}).forEach(([le,ae])=>{if(!ae)return;let ve=Hf(le);if(ve){if(ve.type==="section"){if(ve.id===Ot.TAGS&&!e.showAllTagsFolder||ve.id===Ot.PROPERTIES&&!p)return;re.add(ve.id);return}if(ve.type==="folder"){ve.path==="/"?Y=e.showRootFolder||l:W.add(ve.path);return}if(ve.type==="tag"){J.add(ve.path);return}if(ve.type==="property"){let de=en(ve.nodeId);de&&Z.add(de)}}});let ne=W.size>0||J.size>0||Z.size>0||re.size>0||Y;return{folderSeparators:W,tagSeparators:J,propertySeparators:Z,sectionSeparatorIds:re,useSectionSpacerForRootFolder:Y,hasAnySeparators:ne}},[L,p,e.showAllTagsFolder,e.showRootFolder,l]),G=(0,Eo.useMemo)(()=>{let{folderSeparators:_,tagSeparators:W,propertySeparators:J,sectionSeparatorIds:Z,useSectionSpacerForRootFolder:re,hasAnySeparators:Y}=z;if(!Y)return F;let ne=new Set,le=new Set(Z);if(c&&(le.delete(Ot.SHORTCUTS),P&&le.delete(P)),le.forEach(Pe=>{let Fe=k.get(Pe);Fe&&ne.add(Fe)}),re&&(!c||P!==Ot.FOLDERS)){let Pe=k.get(Ot.FOLDERS);Pe&&ne.add(Pe)}if(ne.size===0&&_.size===0&&W.size===0&&J.size===0)return F;let ve=Pe=>({type:be.LIST_SPACER,key:Pe,hasSeparator:!0}),de=[];return F.forEach(Pe=>{if(Pe.type===be.TOP_SPACER||Pe.type===be.LIST_SPACER){ne.has(Pe.key)?de.push({...Pe,hasSeparator:!0}):de.push(Pe);return}let Fe=Pe.type===be.FOLDER&&Pe.isExcluded&&!l;Pe.type===be.FOLDER?!Fe&&_.has(Pe.data.path)&&de.push(ve(Lb(Pe.data.path))):(Pe.type===be.TAG||Pe.type===be.UNTAGGED)&&W.has(Pe.data.path)?de.push(ve(dP(Pe.data.path))):(Pe.type===be.PROPERTY_KEY||Pe.type===be.PROPERTY_VALUE)&&J.has(Pe.data.id)&&de.push(ve(zb(Pe.data.id))),de.push(Pe)}),de},[P,F,z,c,k,l]),Q=(0,Eo.useMemo)(()=>{let _=T.tag;return _?dE({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:W=>{}}},[w.tags.scope,T.tag,e.inheritTagColors,e.showAllTagsFolder,g]),R=(0,Eo.useMemo)(()=>{let _=T.property;return _?cE({items:f,palette:_,scope:w.properties.scope,showAllPropertiesFolder:e.showAllPropertiesFolder}):{colorsByNodeId:new Map,rootColor:void 0,rootColorsByKey:new Map}},[w.properties.scope,T.property,f,e.showAllPropertiesFolder]),O=(0,Eo.useMemo)(()=>{let _=T.shortcut;return _?F4({items:h,palette:_}):{colorsByKey:new Map,rootColor:void 0}},[T.shortcut,h]),D=(0,Eo.useMemo)(()=>{let _=T.recent;return _?C4({items:b,palette:_}):{colorsByKey:new Map,rootColor:void 0}},[T.recent,b]),x=(0,Eo.useMemo)(()=>({tag:Q,property:R,shortcut:O,recent:D}),[R,D,O,Q]),B=(0,Eo.useMemo)(()=>Jie({app:t,settings:e,navRainbow:w,fileNameIconNeedles:r,getFileDisplayName:o,metadataService:n,parsedExcludedFolders:y,folderDecorationModel:a,navRainbowPalettes:T,navRainbowColors:x}),[t,r,o,v,n,a,w,x,T,y,e]),I=(0,Eo.useMemo)(()=>G.map(B),[B,G]),A=(0,Eo.useMemo)(()=>I.filter(ose),[I]),N=(0,Eo.useMemo)(()=>c?h.map(B):[],[B,c,h]),M=(0,Eo.useMemo)(()=>u?A.length>0?A:b.map(B):[],[B,A,b,u]),H=(0,Eo.useMemo)(()=>{let _=I.filter(W=>!(c&&cRe(W)||u&&ose(W)));return l?_:_.filter(W=>!(W.type===be.FOLDER&&W.isExcluded))},[I,c,u,l]),q=(0,Eo.useMemo)(()=>{if(!c)return null;let _=null;for(let W of H)if(!tse.has(W.type)){_=W;break}return _&&_.type===be.FOLDER?_.data.path:null},[H,c]),X=(0,Eo.useMemo)(()=>{if(!c||!q)return H;let{folderSeparators:_}=z;if(!_.has(q))return H;let J=Lb(q),Z=-1;for(let Y=0;Y{let _=e.showAllTagsFolder?1:0,W=e.showAllPropertiesFolder?1:0;return nse(X,e.rootLevelSpacing,{showRootFolder:e.showRootFolder||l,tagRootLevel:_,propertyRootLevel:W})},[X,e.rootLevelSpacing,e.showAllPropertiesFolder,e.showAllTagsFolder,e.showRootFolder,l]),j=(0,Eo.useMemo)(()=>Qee(V),[V]);return{items:V,itemsWithMetadata:I,firstSectionId:P,firstInlineFolderPath:q,shortcutItemsWithMetadata:N,pinnedRecentNotesItems:M,pathToIndex:j}}var Eo,cRe,ose,ise=U(()=>{Eo=he(Ve());Ue();hh();Ig();tO();cP();un();ese();rse();cRe=t=>t.type===be.VIRTUAL_FOLDER?t.data.id===qa:t.type===be.SHORTCUT_FOLDER||t.type===be.SHORTCUT_NOTE||t.type===be.SHORTCUT_SEARCH||t.type===be.SHORTCUT_TAG||t.type===be.SHORTCUT_PROPERTY||t.type===be.SHORTCUT_HEADER,ose=t=>t.type===be.VIRTUAL_FOLDER?t.data.id===Ya:t.type===be.RECENT_NOTE});function sse({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:y,tagDataVersion:v,tagTreeForOrdering:S}=n,w=(0,zK.useMemo)(()=>{if(!e.showShortcuts)return[];let k=0,P=k+1,E=new Map,C=new Map,L=Yr(p,!1),z=L.hasHiddenRules,G=z?Ft():null,Q=[{type:be.VIRTUAL_FOLDER,key:qa,level:k,data:{id:qa,name:d.navigationPane.shortcutsHeader,icon:Je(e.interfaceIcons,"nav-shortcuts")},hasChildren:r.length>0}];if(!a)return Q;let R=D=>{if(E.has(D))return E.get(D)??!1;let x=t.vault.getAbstractFileByPath(D);return!(x instanceof BK.TFile)||x.extension!=="md"||u.hasCriteria&&oa(x,u,t)||c.length>0&&Ak(x,c)||z&&Br({app:t,file:x,db:G}).some(B=>!L.isTagVisible(B))||m.length>0&&x.parent!==null&&fi(x.parent,m)?(E.set(D,!1),!1):(E.set(D,!0),!0)},O=D=>{if(C.has(D))return C.get(D)??!1;if(cl(D))return C.set(D,!0),!0;let x=$i(S,D);if(!x)return C.set(D,!1),!1;let B=[x],I=new Set;for(;B.length>0;){let A=B.pop();if(A&&!I.has(A)&&(I.add(A),!(g&&!cl(A.path)&&Fs(A.path,A.name,f)))){for(let N of A.notesWithTag)if(R(N))return C.set(D,!0),!0;for(let N of A.children.values())B.push(N)}}return C.set(D,!1),!1};return r.forEach(D=>{let{key:x,shortcut:B,folder:I,note:A,search:N,tagPath:M,propertyNodeId:H}=D;if(ia(B)){if(!I){Q.push({type:be.SHORTCUT_FOLDER,key:x,level:P,shortcut:B,folder:null,isMissing:!0,missingLabel:B.path});return}let q=m.length>0&&fi(I,m);Q.push({type:be.SHORTCUT_FOLDER,key:x,level:P,shortcut:B,folder:I,isExcluded:q});return}if(Do(B)){if(!A){Q.push({type:be.SHORTCUT_NOTE,key:x,level:P,shortcut:B,note:null,isMissing:!0,missingLabel:B.path});return}let q=A.extension==="md"&&u.hasCriteria&&oa(A,u,t)||A.extension==="md"&&z&&Br({app:t,file:A,db:G}).some(X=>!L.isTagVisible(X))||c.length>0&&Ak(A,c)||m.length>0&&A.parent!==null&&fi(A.parent,m);Q.push({type:be.SHORTCUT_NOTE,key:x,level:P,shortcut:B,note:A,isExcluded:q});return}if(Qi(B)){Q.push({type:be.SHORTCUT_SEARCH,key:x,level:P,shortcut:B,searchShortcut:N??B});return}if(Oo(B)){let q=M??B.tagPath;if(!q)return;let X=xu(q,S);if(!X)return;let V=$i(S,X),j=V?.displayPath??q,_=!V,W=!O(X);cl(X)&&(j=Rc(X).getLabel(),_=!1),Q.push({type:be.SHORTCUT_TAG,key:x,level:P,shortcut:B,tagPath:X,displayName:j,isMissing:_,isExcluded:W,missingLabel:_?q:void 0});return}if(ya(B)){let q=H??B.nodeId,X=Gv(H,B.nodeId);if(X===_e){let W=!l;Q.push({type:be.SHORTCUT_PROPERTY,key:x,level:P,shortcut:B,propertyNodeId:_e,displayName:d.navigationPane.properties,isMissing:W,missingLabel:W?d.navigationPane.properties:void 0});return}let V=X?Nn(X):null;if(!X||!V){Q.push({type:be.SHORTCUT_PROPERTY,key:x,level:P,shortcut:B,propertyNodeId:q,displayName:q,isMissing:!0,missingLabel:q});return}let j=ux({nodeId:X,propertyTree:b});if(!j){let W=b.get(V.key);if(!W){let re=V.valuePath?.trim(),Y=re&&re.length>0?re:V.key;Q.push({type:be.SHORTCUT_PROPERTY,key:x,level:P,shortcut:B,propertyNodeId:X,displayName:Y,isMissing:!0,missingLabel:Y});return}let J=V.valuePath?.trim(),Z=J&&J.length>0?J:W.name;Q.push({type:be.SHORTCUT_PROPERTY,key:x,level:P,shortcut:B,propertyNodeId:X,displayName:Z,isMissing:!0,missingLabel:Z});return}let _=j.node;Q.push({type:be.SHORTCUT_PROPERTY,key:x,level:P,shortcut:B,propertyNodeId:_.id,displayName:_.name})}}),Q},[t,c,u,p,m,g,f,r,h,b,l,e.interfaceIcons,e.showShortcuts,a,v,S]),T=(0,zK.useMemo)(()=>{if(!e.showRecentNotes)return[];let k=0,P=k+1,E=Math.max(1,e.recentNotesCount??1),C=o.slice(0,E),L=R=>{let O=t.vault.getAbstractFileByPath(R);return O instanceof BK.TFile?y(O)?null:O:null},z=d.navigationPane.recentFilesHeader;if(!i){let R=!1;for(let O of C)if(L(O)){R=!0;break}return[{type:be.VIRTUAL_FOLDER,key:Ya,level:k,data:{id:Ya,name:z,icon:Je(e.interfaceIcons,"nav-recent-files")},hasChildren:R}]}let G=[];C.forEach(R=>{let O=L(R);O&&G.push({type:be.RECENT_NOTE,key:`recent-${R}`,level:P,note:O})});let Q=[{type:be.VIRTUAL_FOLDER,key:Ya,level:k,data:{id:Ya,name:z,icon:Je(e.interfaceIcons,"nav-recent-files")},hasChildren:G.length>0}];return G.length===0||Q.push(...G),Q},[t,h,o,i,y,e.interfaceIcons,e.recentNotesCount,e.showRecentNotes,v]),F=s&&e.pinRecentNotesWithShortcuts&&e.showRecentNotes;return{shortcutItems:w,recentNotesItems:T,shouldPinRecentNotes:F}}var zK,BK,lse=U(()=>{zK=he(Ve()),BK=require("obsidian");Oe();Ue();Ha();wr();Vn();Og();Hr();Qa();Cn();un();lr()});function dse({settings:t,isVisible:e,sourceState:n,treeSections:r,folderDecorationModel:o,navRainbowState:a,shortcutsExpanded:i,recentNotesExpanded:s,pinShortcuts:l,sectionOrder:c}){let{app:u}=vt(),{fileNameIconNeedles:p}=hA(),{recentNotes:m}=Bie(),g=Zo(),{getFileDisplayName:f}=_o(),{hydratedShortcuts:h}=Xd(),b=jt(),y=b.includeDescendantNotes,v=b.showHiddenItems,{effectiveFrontmatterExclusions:S,hiddenFolders:w,descendantExcludedFolders:T,hiddenFileTags:F,fileVisibility:k,navigationBannerPath:P,folderCountFileNameMatcher:E,rootLevelFolders:C,missingRootFolderPaths:L,untaggedCount:z,visibleTaggedCount:G,rootTagOrderMap:Q,missingRootTagPaths:R,rootPropertyOrderMap:O,missingRootPropertyKeys:D,metadataDecorationVersion:x,metadataVisibilityVersion:B,tagDataVersion:I,fileChangeVersion:A,folderChangeVersion:N}=n,{folderItems:M,tagItems:H,rootOrderingTagTree:q,resolvedRootTagKeys:X,tagsVirtualFolderHasChildren:V,renderPropertyTree:j,rootOrderingPropertyTree:_,propertyItems:W,propertiesSectionActive:J,resolvedRootPropertyKeys:Z,propertyCollectionCount:re}=r,Y=w,{shortcutItems:ne,recentNotesItems:le,shouldPinRecentNotes:ae}=sse({app:u,settings:t,sourceState:n,hydratedShortcuts:h,recentNotes:m,shortcutsExpanded:i,recentNotesExpanded:s,pinShortcuts:l,propertiesSectionActive:J}),{items:ve,itemsWithMetadata:de,firstSectionId:Pe,firstInlineFolderPath:Fe,shortcutItemsWithMetadata:te,pinnedRecentNotesItems:ye,pathToIndex:ce}=ase({app:u,settings:t,metadataService:g,fileNameIconNeedles:p,getFileDisplayName:f,folderDecorationModel:o,navRainbowState:a,sectionOrder:c,showHiddenItems:v,pinShortcuts:l,shouldPinRecentNotes:ae,propertiesSectionActive:J,folderItems:M,tagItems:H,propertyItems:W,shortcutItems:ne,recentNotesItems:le,parsedExcludedFolders:Y,metadataDecorationVersion:x}),{tagCounts:pe,propertyCounts:ue,folderCounts:Se}=Vie({app:u,isVisible:e,settings:t,propertiesSectionActive:J,itemsWithMetadata:de,includeDescendantNotes:y,visibleTaggedCount:G,untaggedCount:z,renderPropertyTree:j,propertyCollectionCount:re,effectiveFrontmatterExclusions:S,hiddenFolders:w,descendantExcludedFolders:T,hiddenFileTags:F,showHiddenItems:v,folderCountFileNameMatcher:E,fileVisibility:k,folderChangeVersion:N,vaultChangeVersion:A,metadataVisibilityVersion:B,tagDataVersion:I});return{items:ve,firstSectionId:Pe,firstInlineFolderPath:Fe,shortcutItems:te,pinnedRecentNotesItems:ye,shouldPinRecentNotes:ae,tagsVirtualFolderHasChildren:V,propertiesSectionActive:J,pathToIndex:ce,tagCounts:pe,propertyCounts:ue,folderCounts:Se,rootLevelFolders:C,missingRootFolderPaths:L,resolvedRootTagKeys:X,rootOrderingTagTree:q,rootTagOrderMap:Q,missingRootTagPaths:R,resolvedRootPropertyKeys:Z,rootOrderingPropertyTree:_,rootPropertyOrderMap:O,missingRootPropertyKeys:D,vaultChangeVersion:A,navigationBannerPath:P}}var cse=U(()=>{fn();AK();cs();ph();gr();on();Kie();ise();lse()});function uRe(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 pRe(t){return t.map(e=>e.type===be.ROOT_SPACER?`${e.type}:${e.spacing}`:e.type).join("")}function use({items:t,pathToIndex:e,isVisible:n,activeShortcutKey:r,scrollMargin:o,scrollPaddingEnd:a}){let{isMobile:i}=vt(),s=nd(),l=oee(),c=Qr(),u=yt(),m=jt().showHiddenItems,g=(0,Wn.useRef)(null),[f,h]=(0,Wn.useState)(null),[b,y]=(0,Wn.useState)(!1),v=(0,Wn.useCallback)(W=>{g.current=W,h(W),W||y(!1)},[]);(0,Wn.useEffect)(()=>{let W=f;if(!W){y(!1);return}let J=()=>{let re=W.getBoundingClientRect(),Y=re.width>0&&re.height>0;y(ne=>ne===Y?ne:Y)};if(J(),typeof ResizeObserver>"u"){let re=()=>J();return window.addEventListener("resize",re),()=>{window.removeEventListener("resize",re)}}let Z=new ResizeObserver(re=>{let Y=re[0];if(!Y)return;let{width:ne,height:le}=Y.contentRect,ae=ne>0&&le>0;y(ve=>ve===ae?ve:ae)});return Z.observe(W),()=>Z.disconnect()},[f]);let S=n&&b,w=(0,Wn.useCallback)((W,J)=>{if(!W)return;if(J)return kl(e,J,W);let Z=kl(e,K.FOLDER,W);if(Z!==void 0)return Z;let re=kl(e,K.TAG,W);return re!==void 0?re:kl(e,K.PROPERTY,W)},[e]),T=(0,Wn.useRef)(null),[F,k]=(0,Wn.useState)(0),P=(0,Wn.useRef)(0),E=(0,Wn.useRef)(null),C=(0,Wn.useRef)(null),L=(0,Wn.useRef)(!1),z=(0,Wn.useRef)(null),G=(0,Wn.useRef)(null),Q=(0,Wn.useRef)(""),R=(0,Wn.useRef)(m),O=(0,Wn.useRef)(e.size),D=(0,Wn.useRef)(""),x=Number.isFinite(o)&&o>0?o:0,B=Number.isFinite(a)&&a>0?a:0,I=(0,Wn.useCallback)(W=>{let J=t[W];return J?Yc(J):W},[t]),A=(0,Wn.useCallback)(W=>{let J=g.current;if(!J||B<=0)return;let Z=J.querySelector(`[data-index="${W}"]`);if(!(Z instanceof HTMLElement))return;let re=J.getBoundingClientRect(),Y=Z.getBoundingClientRect(),ne=re.bottom-B;Y.bottom>ne&&(J.scrollTop+=Math.round(Y.bottom-ne))},[B]),N=tD({count:t.length,getItemKey:I,getScrollElement:()=>g.current,scrollMargin:x,scrollPaddingEnd:B,estimateSize:W=>{let J=t[W],Z=i?u.navItemHeight+Rl.mobileHeightIncrement:u.navItemHeight;switch(J.type){case be.TOP_SPACER:return Rl.topSpacer;case be.BOTTOM_SPACER:return Rl.bottomSpacer;case be.LIST_SPACER:return Rl.listSpacer;case be.ROOT_SPACER:return J.spacing;case be.FOLDER:case be.VIRTUAL_FOLDER:return Z;case be.TAG:case be.UNTAGGED:return Z;default:return Z}},overscan:cN}),M=(0,Wn.useMemo)(()=>pRe(t),[t]);(0,Wn.useEffect)(()=>{let W=E.current,J=W===null||!uRe(W,e),Z=D.current!==M;if(J){let re=P.current;P.current=re+1,O.current=e.size,E.current=e,D.current=M,N.measure();return}Z&&(D.current=M,N.measure()),(O.current!==e.size||E.current!==e)&&(O.current=e.size,E.current=e)},[M,e,e.size,N]);let H=(0,Wn.useCallback)((W,J)=>{N.scrollToIndex(W,{align:J});let Z=0,re=()=>{Z+=1,A(W),Z<3&&window.requestAnimationFrame(re)};window.requestAnimationFrame(re)},[A,N]),q=(0,Wn.useCallback)(()=>{i&&g.current&&g.current.scrollTo({top:0,behavior:"smooth"})},[i]),X=(0,Wn.useCallback)((W,J)=>{let Z=bm(J.itemType,W);T.current={path:Z,align:J.align,intent:"external",minIndexVersion:P.current,itemType:J.itemType},k(re=>re+1)},[]),V=s.selectionType===K.TAG?K.TAG:s.selectionType===K.PROPERTY?K.PROPERTY:s.selectionType===K.FOLDER?K.FOLDER:null,j=s.selectionType===K.FOLDER&&s.selectedFolder?bm(K.FOLDER,s.selectedFolder.path):s.selectionType===K.TAG&&s.selectedTag?bm(K.TAG,s.selectedTag):s.selectionType===K.PROPERTY&&s.selectedProperty?s.selectedProperty:null;(0,Wn.useEffect)(()=>{if(!j||!N||!S)return;if(l.isRevealOperation){C.current=j,L.current=S,z.current=c.focusedPane;return}let W=V??K.FOLDER,J=u.skipAutoScroll&&l.revealSource==="shortcut",Z=C.current!==j,re=!L.current&&S,Y=z.current!=="navigation"&&c.focusedPane==="navigation";if(C.current=j,L.current=S,z.current=c.focusedPane,J||!Z&&!re&&!Y||r)return;if(R.current!==m){T.current={path:j,align:"auto",intent:"visibilityToggle",minIndexVersion:P.current+1,itemType:W},k(le=>le+1);return}let ne=w(j,W);ne!==void 0&&ne>=0&&H(ne,nD("selection"))},[j,N,S,l.isRevealOperation,c.focusedPane,m,V,l.revealSource,w,r,u.skipAutoScroll,H]),(0,Wn.useEffect)(()=>{if(!j||!V||!N||!S)return;if(l.isRevealOperation){G.current=j;return}if(V!==K.TAG&&V!==K.PROPERTY)return;if(r){G.current=j;return}if(u.skipAutoScroll&&l.revealSource==="shortcut"){G.current=j;return}let J=G.current!==j;if(G.current=j,!J)return;if(R.current!==m){T.current={path:j,align:"auto",intent:"visibilityToggle",minIndexVersion:P.current+1,itemType:V},k(re=>re+1);return}let Z=w(j,V);Z!==void 0&&Z>=0&&H(Z,nD("selection"))},[e,V,j,N,S,l.isRevealOperation,m,w,r,l.revealSource,u.skipAutoScroll,H]),(0,Wn.useEffect)(()=>{if(!N||!T.current||!S)return;let{path:W,align:J,intent:Z,minIndexVersion:re,itemType:Y}=T.current;if(R.current!==m&&Z!=="visibilityToggle")return;let ne=re??P.current;if(P.current{let Pe=w(de,Y);Pe!==void 0&&Pe!==ve&&(T.current={path:de,align:"auto",intent:"visibilityToggle",minIndexVersion:P.current+1,itemType:Y},k(Fe=>Fe+1))})}}},[N,S,F,m,w,H]),(0,Wn.useEffect)(()=>{if(!i)return;let W=()=>{if(r||!j)return;let J=V??K.FOLDER;if(N&&S){let Z=w(j,J);if(Z!==void 0&&Z>=0){H(Z,"auto");return}}T.current={path:j,align:"auto",intent:"mobile-visibility",minIndexVersion:P.current,itemType:J},k(Z=>Z+1)};return window.addEventListener("notebook-navigator-visible",W),()=>window.removeEventListener("notebook-navigator-visible",W)},[i,j,N,V,w,r,S,H]),(0,Wn.useEffect)(()=>{N&&N.measure()},[u.navItemHeight,u.rootLevelSpacing,N]),(0,Wn.useEffect)(()=>{let W=`${u.navItemHeight}-${u.rootLevelSpacing}`,J=Q.current&&Q.current!==W;if(r){Q.current=W;return}if(J&&j&&S&&N){let Z=w(j,V??K.FOLDER);Z!==void 0&&Z>=0&&window.requestAnimationFrame(()=>{H(Z,"auto")})}Q.current=W},[u.navItemHeight,u.rootLevelSpacing,j,S,N,w,V,r,H]);let _=(0,Wn.useRef)(null);return(0,Wn.useEffect)(()=>{if(!S)return;let W=_.current,J={top:x,bottom:B};if(_.current=J,!W||W.top===J.top&&W.bottom===J.bottom||r||!j)return;let Z=V??K.FOLDER,re=w(j,Z);re===void 0||re<0||window.requestAnimationFrame(()=>{H(re,"auto")})},[r,x,B,S,w,H,j,V]),(0,Wn.useEffect)(()=>{R.current!==m&&(j&&(V===K.TAG||V===K.PROPERTY)&&S&&N&&(T.current={path:j,align:"auto",intent:"visibilityToggle",minIndexVersion:P.current+1,itemType:V??K.FOLDER},k(W=>W+1)),R.current=m)},[V,m,j,S,N]),{rowVirtualizer:N,scrollContainerRef:g,scrollContainerRefCallback:v,handleScrollToTop:q,requestScroll:X,pendingScrollVersion:F}}var Wn,pse=U(()=>{Wn=he(Ve());z1();fn();Ur();wa();on();gr();Ue();_1();hh()});function mse(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:y,tagsSectionExpanded:v,propertiesSectionExpanded:S,propertiesSectionActive:w,handleToggleFoldersSection:T,handleToggleTagsSection:F,handleTogglePropertiesSection:k,activeProfile:P}=t,{showRootFolder:E,rootFolderOrder:C,rootTagOrder:L,rootPropertyOrder:z,showUntagged:G,tagSortOrder:Q,propertySortOrder:R,showShortcuts:O,showRecentNotes:D,showTags:x,customVaultName:B}=r,{hiddenFolders:I,hiddenTags:A}=P,N=(0,vr.useMemo)(()=>mg(A),[A]),M=(0,vr.useMemo)(()=>N.pathPatterns.length>0||N.prefixes.length>0||N.startsWithNames.length>0||N.endsWithNames.length>0,[N]),H=(0,vr.useMemo)(()=>{let me=[];if(E){let Be=e.vault.getRoot();me.push({key:Be.path,folder:Be,isVault:!0})}let se=new Map;l.forEach(Be=>{se.set(Be.path,Be)});let fe=new Set(c),Ne=C.length>0?C:l.map(Be=>Be.path),xe=new Set;return Ne.forEach(Be=>{if(xe.has(Be))return;xe.add(Be);let dt=se.get(Be);dt?me.push({key:Be,folder:dt}):fe.has(Be)&&me.push({key:Be,folder:null,isMissing:!0})}),l.forEach(Be=>{xe.has(Be.path)||me.push({key:Be.path,folder:Be})}),me},[e.vault,c,C,l,E]),q=(0,vr.useMemo)(()=>Q==="frequency-asc"||Q==="frequency-desc"?d.navigationPane.resetRootToFrequency:d.navigationPane.resetRootToAlpha,[Q]),X=(0,vr.useMemo)(()=>R==="frequency-asc"||R==="frequency-desc"?d.navigationPane.resetRootToFrequency:d.navigationPane.resetRootToAlpha,[R]),V=(0,vr.useMemo)(()=>{let me=[],se=new Map;p.forEach((xe,Be)=>{se.set(Be,xe)});let fe=new Set,Ne=xe=>{fe.has(xe.key)||(fe.add(xe.key),me.push(xe))};return se.size>0&&Ne({key:mRe,tag:null,isVirtualRoot:!0}),u.forEach(xe=>{if(xe===wt){G&&Ne({key:wt,tag:null,isUntagged:!0});return}let Be=se.get(xe);Be&&Ne({key:Be.path,tag:Be})}),L.forEach(xe=>{xe!==wt&&(fe.has(xe)||se.has(xe)||Ne({key:xe,tag:null,isMissing:!0}))}),m.forEach(xe=>{xe!==wt&&(fe.has(xe)||Ne({key:xe,tag:null,isMissing:!0}))}),me},[m,u,p,L,G]),j=(0,vr.useMemo)(()=>{let me=[],se=new Map;f.forEach((xe,Be)=>{se.set(Be,xe)});let fe=new Set,Ne=xe=>{fe.has(xe.key)||(fe.add(xe.key),me.push(xe))};return g.forEach(xe=>{let Be=se.get(xe);Be&&Ne({key:Be.key,node:Be})}),z.forEach(xe=>{fe.has(xe)||se.has(xe)||Ne({key:xe,node:null,isMissing:!0})}),h.forEach(xe=>{fe.has(xe)||Ne({key:xe,node:null,isMissing:!0})}),me},[h,g,f,z]),_=(0,vr.useMemo)(()=>H.filter(me=>{if(me.isVault)return!1;if(!o){let se=me.folder?me.folder.name:Pu(me.key);if(I.length>0&&wc(se,I,me.key))return!1}return!0}),[I,H,o]),W=(0,vr.useMemo)(()=>V.filter(me=>!(me.isVirtualRoot||!o&&M&&me.tag&&Fs(me.tag.path,me.tag.name,N))),[M,N,V,o]),J=(0,vr.useMemo)(()=>j.slice(),[j]),Z=(0,vr.useMemo)(()=>$w(i),[i]),re=(0,vr.useMemo)(()=>o?Z:Z.filter(me=>me===Ot.SHORTCUTS?O:me===Ot.RECENT?D:me===Ot.FOLDERS?_.length>0:me===Ot.TAGS?x&&W.length>0:me===Ot.PROPERTIES?w:!0),[_.length,W.length,w,Z,o,D,O,x]),Y=re.length>1,ne=(0,vr.useCallback)(async me=>{let se=Gie(me,Z);ao(se,Z)||(s(se),Te.set(lt.navigationSectionOrderKey,se))},[Z,s]),le=_.length>1,ae=W.length>1,ve=J.length>1,de=Y||le||ae||ve,Pe=_.length>0,Fe=W.length>0,te=J.length>0,ye=(0,vr.useMemo)(()=>{let me=new Map,se=new Map,fe=new Map,Ne=new Map,xe=new Map,Be=new Map,dt=new Map;return n.forEach(St=>{if(St.type===be.FOLDER){let ln=St.data.path;me.set(ln,St.icon),se.set(ln,St.color),fe.set(ln,St.displayName);return}if(St.type===be.TAG){let ln=St.data.path;Ne.set(ln,St.icon),xe.set(ln,St.color);return}if(St.type===be.PROPERTY_KEY){let ln=St.data.key;Be.set(ln,St.icon),dt.set(ln,St.color)}}),{rootFolderIconMap:me,rootFolderColorMap:se,rootFolderDisplayNameMap:fe,rootTagIconMap:Ne,rootTagColorMap:xe,rootPropertyIconMap:Be,rootPropertyColorMap:dt}},[n]),{rootFolderIconMap:ce,rootFolderColorMap:pe,rootFolderDisplayNameMap:ue,rootTagIconMap:Se,rootTagColorMap:ee,rootPropertyIconMap:ie,rootPropertyColorMap:Ce}=ye,we=(0,vr.useMemo)(()=>H.find(me=>me.isVault),[H]),Le=(0,vr.useCallback)(async me=>{let se=me.slice();ao(se,C)||await a(fe=>{fe.rootFolderOrder=se})},[C,a]),We=(0,vr.useCallback)(async me=>{let se=me.slice();ao(se,L)||await a(fe=>{fe.rootTagOrder=se})},[L,a]),Nt=(0,vr.useCallback)(async me=>{let se=me.slice();ao(se,z)||await a(fe=>{fe.rootPropertyOrder=se})},[z,a]),Pt=(0,vr.useCallback)(async me=>{await Le(me)},[Le]),Zt=(0,vr.useCallback)(async me=>{await We(me)},[We]),ze=(0,vr.useCallback)(async me=>{await Nt(me)},[Nt]),Ie=(0,vr.useCallback)(async me=>{me&&await a(se=>{if(!Array.isArray(se.rootFolderOrder)){se.rootFolderOrder=[];return}se.rootFolderOrder.includes(me)&&(se.rootFolderOrder=se.rootFolderOrder.filter(fe=>fe!==me))})},[a]),De=(0,vr.useCallback)(async me=>{me&&await a(se=>{if(!Array.isArray(se.rootTagOrder)){se.rootTagOrder=[];return}se.rootTagOrder.includes(me)&&(se.rootTagOrder=se.rootTagOrder.filter(fe=>fe!==me))})},[a]),Me=(0,vr.useCallback)(async me=>{me&&await a(se=>{if(!Array.isArray(se.rootPropertyOrder)){se.rootPropertyOrder=[];return}se.rootPropertyOrder.includes(me)&&(se.rootPropertyOrder=se.rootPropertyOrder.filter(fe=>fe!==me))})},[a]),nt=(0,vr.useCallback)((me,se)=>{let fe=()=>{$(()=>se(me))};return(0,gse.jsx)("span",{role:"button",tabIndex:0,className:"nn-root-reorder-remove",onClick:Ne=>{Ne.preventDefault(),Ne.stopPropagation(),fe()},onKeyDown:Ne=>{(Ne.key==="Enter"||Ne.key===" ")&&(Ne.preventDefault(),Ne.stopPropagation(),fe())},children:gRe})},[]),Ge=(0,vr.useMemo)(()=>_.map(me=>{let se=me.isMissing===!0,fe=me.folder?me.folder.name:Pu(me.key),Ne=I.length>0&&wc(fe,I,me.key),xe=me.folder===null?Pu(me.key):ue.get(me.key)||ns({app:e,metadataService:b,settings:{customVaultName:B},folderPath:me.key,fallbackName:me.folder.name}),Be=ce.get(me.key)??(se?void 0:b.getFolderIcon(me.key)),dt=pe.get(me.key)??(se?void 0:b.getFolderColor(me.key)),St=Je(r.interfaceIcons,"nav-folder-closed");se?St="lucide-folder-off":Be&&(St=Be);let ln=se?nt(me.key,Ie):void 0;return{key:me.key,props:{icon:St,color:dt,label:xe,level:1,dragHandlers:void 0,isDragSource:!1,isMissing:se,itemType:"folder",className:o&&Ne?"nn-excluded":void 0,trailingAccessory:ln}}}),[e,_,ce,pe,ue,b,r.interfaceIcons,B,nt,Ie,I,o]),Tt=(0,vr.useMemo)(()=>W.map(me=>{let se=me.isUntagged===!0,fe=me.isMissing===!0,Ne=!se&&M&&me.tag&&Fs(me.tag.path,me.tag.name,N),xe,Be;if(se)xe=b.getTagIcon(me.key)??Je(r.interfaceIcons,"nav-tag"),Be=d.tagList.untaggedLabel;else{let vn=Se.get(me.key),In=b.getTagIcon(me.key);xe=vn??In??(fe?"lucide-tag-off":Je(r.interfaceIcons,"nav-tag")),Be=me.tag?`#${me.tag.displayPath}`:`#${me.key}`}let dt=se?void 0:b.getTagColor(me.key),St=ee.get(me.key)??dt,ln=fe?nt(me.key,De):void 0;return{key:me.key,props:{icon:xe,color:St,label:Be,level:1,dragHandlers:void 0,isDragSource:!1,isMissing:fe,itemType:"tag",className:o&&Ne?"nn-excluded":void 0,trailingAccessory:ln}}}),[W,Se,ee,b,r.interfaceIcons,nt,De,M,N,o]),gt=(0,vr.useMemo)(()=>J.map(me=>{let se=me.isMissing===!0,fe=me.node?.id??or(me.key),Ne=ie.get(me.key),xe=Ce.get(me.key),Be=b.getPropertyIcon(fe),dt=b.getPropertyColor(fe),St=Ne??Be??Je(r.interfaceIcons,"nav-property"),ln=xe??dt,vn=me.node?me.node.name:me.key,In=se?nt(me.key,Me):void 0;return{key:me.key,props:{icon:St,color:ln,label:vn,level:1,dragHandlers:void 0,isDragSource:!1,isMissing:se,itemType:"property",trailingAccessory:In}}}),[J,ie,Ce,b,r.interfaceIcons,nt,Me]),wn=(0,vr.useMemo)(()=>re.map(me=>{let se=me===Ot.SHORTCUTS&&!O||me===Ot.RECENT&&!D||me===Ot.FOLDERS&&H.length===0||me===Ot.TAGS&&!x||me===Ot.PROPERTIES&&!w,fe="lucide-circle",Ne="",xe,Be,dt;if(me===Ot.SHORTCUTS)fe=Je(r.interfaceIcons,"nav-shortcuts"),Ne=d.navigationPane.shortcutsHeader;else if(me===Ot.RECENT)fe=Je(r.interfaceIcons,"nav-recent-files"),Ne=d.navigationPane.recentFilesHeader;else if(me===Ot.FOLDERS){if(we){let St=ce.get(we.key);dt=pe.get(we.key),St?fe=St:fe=y?"open-vault":"vault",Ne=ns({app:e,metadataService:b,settings:{customVaultName:B},folderPath:we.key,fallbackName:we.folder?.name??e.vault.getRoot().name})}else fe=vs,Ne=d.navigationPane.folders;xe=y?"lucide-chevron-down":"lucide-chevron-right",Be=T}else me===Ot.TAGS?(fe=Je(r.interfaceIcons,"nav-tags"),Ne=d.navigationPane.tags,xe=v?"lucide-chevron-down":"lucide-chevron-right",Be=F):me===Ot.PROPERTIES&&(fe=Je(r.interfaceIcons,"nav-properties"),Ne=d.navigationPane.properties,xe=S?"lucide-chevron-down":"lucide-chevron-right",Be=k);return{key:me,sectionId:me,props:{icon:fe,label:Ne,level:0,dragHandlers:void 0,isDragSource:!1,color:dt,onClick:Be,chevronIcon:xe,itemType:"section",className:se?"nn-excluded":void 0}}}),[re,O,D,x,w,H.length,we,ce,pe,B,e,b,r.interfaceIcons,y,v,T,F,S,k]),it=(0,vr.useCallback)(async()=>{await a(me=>{me.rootFolderOrder=[]})},[a]),yn=(0,vr.useCallback)(async()=>{await a(me=>{me.rootTagOrder=[]})},[a]),rt=(0,vr.useCallback)(async()=>{await a(me=>{me.rootPropertyOrder=[]})},[a]);return{reorderableRootFolders:_,reorderableRootTags:W,reorderableRootProperties:J,sectionReorderItems:wn,folderReorderItems:Ge,tagReorderItems:Tt,propertyReorderItems:gt,canReorderSections:Y,canReorderRootFolders:le,canReorderRootTags:ae,canReorderRootProperties:ve,canReorderRootItems:de,showRootFolderSection:Pe,showRootTagSection:Fe,showRootPropertySection:te,resetRootTagOrderLabel:q,resetRootPropertyOrderLabel:X,vaultRootDescriptor:we,handleResetRootFolderOrder:it,handleResetRootTagOrder:yn,handleResetRootPropertyOrder:rt,reorderSectionOrder:ne,reorderRootFolderOrder:Pt,reorderRootTagOrder:Zt,reorderRootPropertyOrder:ze}}var vr,gse,mRe,gRe,hse=U(()=>{vr=he(Ve());Ue();Oe();jr();ll();st();tO();ra();wr();Hr();Vm();lr();em();un();gse=he($e()),mRe="__nn-tags-root__",gRe=d.common.remove});function fse(t,e){let n=e?.enabled??!0,[r,o]=(0,rO.useState)(0);return(0,rO.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 rO,yse=U(()=>{rO=he(Ve())});function vse({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:y,tagTree:v,hydratedShortcuts:S}){let w=(0,Fl.useCallback)(D=>{!a.singlePane||D!=="right-sidebar"||i({type:"ACTIVATE_PANE",target:"files"})},[i,a.singlePane]),T=(0,Fl.useCallback)(()=>{let D=()=>u(null);if(typeof requestAnimationFrame<"u"){window.requestAnimationFrame(()=>{window.requestAnimationFrame(D)});return}window.setTimeout(D,0)},[u]),F=(0,Fl.useCallback)(D=>{let x=()=>t.workspace.getLeaf(!1),B=async I=>{I&&await I.openFile(D,{active:!1})};if(e){$(()=>e.executeOpenActiveFile(D,B,{active:!1,getLeaf:x}));return}$(()=>B(x()))},[t.workspace,e]),k=(0,Fl.useCallback)((D,x)=>{u(x),m(D.path,{skipScroll:o.skipAutoScroll,source:"shortcut"}),T();let B=r.current;B&&!a.singlePane&&B.focus()},[m,r,T,u,o.skipAutoScroll,a.singlePane]),P=(0,Fl.useCallback)((D,x,B)=>{if(u(x),!o.enableFolderNotes||!o.enableFolderNoteLinks){k(D,x);return}let I=Rn(D,o);if(!I){k(D,x);return}let A=s===K.FOLDER&&l?.path===D.path;c({type:"SET_SELECTED_FOLDER",folder:D,autoSelectedFile:null});let N=Iu(B,o.folderNoteOpenLocation,o.multiSelectModifier);if(w(N),Ai(c,I),N==="right-sidebar"&&o.showNearestFolderNoteInSidebar&&!A){T();return}$(()=>vi({app:t,commandQueue:e,folder:D,folderNote:I,context:N,openInRightSidebar:y})),T()},[t,e,w,k,y,T,l,c,u,s,o]),E=(0,Fl.useCallback)((D,x)=>{if(x.button!==1||!o.enableFolderNotes||!o.enableFolderNoteLinks)return;let B=Rn(D,o);B&&(x.preventDefault(),x.stopPropagation(),c({type:"SET_SELECTED_FOLDER",folder:D,autoSelectedFile:null}),Ai(c,B),$(()=>vi({app:t,commandQueue:e,folder:D,folderNote:B,context:"tab"})))},[t,e,c,o]),C=(0,Fl.useCallback)((D,x,B)=>{if(B&&$L(B,o.multiSelectModifier)){$(()=>Vr({app:t,commandQueue:e,file:D,context:"tab"}));return}u(x),s===K.TAG&&b?b(D):h(D),F(D),n&&t.workspace.leftSplit&&t.workspace.leftSplit.collapse();let I=a.singlePane?a.currentSinglePaneView:"files";i({type:"ACTIVATE_PANE",target:I}),T()},[t,e,n,h,b,F,T,s,u,o.multiSelectModifier,i,a.currentSinglePaneView,a.singlePane]),L=(0,Fl.useCallback)((D,x)=>{D.button===1&&(D.preventDefault(),D.stopPropagation(),$(()=>Vr({app:t,commandQueue:e,file:x,context:"tab"})))},[t,e]),z=(0,Fl.useCallback)((D,x)=>{if(x&&$L(x,o.multiSelectModifier)){$(()=>Vr({app:t,commandQueue:e,file:D,context:"tab"}));return}s===K.TAG&&b?b(D):h(D),F(D),n&&t.workspace.leftSplit&&t.workspace.leftSplit.collapse();let B=a.singlePane?a.currentSinglePaneView:"files";i({type:"ACTIVATE_PANE",target:B})},[t,e,n,h,b,F,s,o.multiSelectModifier,i,a.currentSinglePaneView,a.singlePane]),G=(0,Fl.useCallback)((D,x)=>{u(D),p&&$(()=>p(D,x)),T()},[p,T,u]),Q=(0,Fl.useCallback)((D,x)=>{u(x);let B=xu(D,v);if(!B){T();return}if(g(B,{skipScroll:o.skipAutoScroll,source:"shortcut"}),!a.singlePane){i({type:"ACTIVATE_PANE",target:"navigation"});let I=r.current;I&&I.focus()}c({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!0}),T()},[g,r,T,c,u,o.skipAutoScroll,v,i,a.singlePane]),R=(0,Fl.useCallback)((D,x)=>{if(u(x),!f(D,{skipScroll:o.skipAutoScroll,source:"shortcut"}))return T(),!1;if(!a.singlePane){i({type:"ACTIVATE_PANE",target:"navigation"});let I=r.current;I&&I.focus()}return c({type:"SET_KEYBOARD_NAVIGATION",isKeyboardNavigation:!0}),T(),!0},[f,r,T,c,u,o.skipAutoScroll,i,a.singlePane]),O=(0,Fl.useCallback)(async D=>{if(!Number.isInteger(D)||D<1)return!1;let x=S[D-1];if(!x||x.isMissing)return!1;let{key:B,shortcut:I,folder:A,note:N,search:M,tagPath:H,propertyNodeId:q}=x;if(ia(I)&&A)return k(A,B),!0;if(Do(I)&&N)return C(N,B),!0;if(Qi(I))return G(B,M??I),!0;if(Oo(I)){let X=H??I.tagPath;return X?(Q(X,B),!0):!1}if(ya(I)){let X=Gv(q,I.nodeId);return X?R(X,B):!1}return!1},[k,C,R,G,Q,S]);return{handleShortcutFolderActivate:k,handleShortcutFolderNoteClick:P,handleShortcutFolderNoteMouseDown:E,handleShortcutNoteActivate:C,handleShortcutNoteMouseDown:L,handleRecentNoteActivate:z,handleShortcutSearchActivate:G,handleShortcutTagActivate:Q,handleShortcutPropertyActivate:R,openShortcutByNumber:O}}var Fl,bse=U(()=>{Fl=he(Ve());Ha();un();Cn();st();_u();Hu();Md();Ue()});function Sse({app:t,settings:e,includeDescendantNotes:n,showHiddenItems:r,fileVisibility:o,noteCountDB:a,hiddenFolders:i,descendantExcludedFolders:s,effectiveFrontmatterExclusions:l,effectiveFrontmatterExclusionMatcher:c,folderCountFileNameMatcher:u,hiddenFileTagVisibility:p,getFolderCounts:m,getTagCounts:g,getPropertyCounts:f,tagTree:h,propertyTree:b,propertyTreeService:y,onToggleShortcutsPin:v,isShortcutsPinned:S,onConfigurePropertyKeys:w}){let T=e.pinRecentNotesWithShortcuts&&e.showRecentNotes,F=T?d.navigationPane.pinShortcutsAndRecentFiles:d.navigationPane.pinShortcuts,k=T?d.navigationPane.unpinShortcutsAndRecentFiles:d.navigationPane.unpinShortcuts,P=S?k:F,E=(0,xh.useMemo)(()=>({actionLabel:P,icon:S?"lucide-pin-off":"lucide-pin",onClick:v}),[S,v,P]),C=(0,xh.useMemo)(()=>({actionLabel:d.contextMenu.property.addKey,icon:"lucide-settings-2",onClick:w,labelMode:"note-count"}),[w]),L=(0,xh.useCallback)(R=>{if(!e.showNoteCount)return Qw;let O=m().get(R.path);if(O)return O;let D=zo({enableFolderNotes:e.enableFolderNotes,folderNoteNamePattern:e.folderNoteNamePattern});return UC(R,{app:t,db:a,fileVisibility:o,excludedFiles:l,excludedFileMatcher:c,excludedFolders:i,descendantExcludedFolders:s,fileNameMatcher:u,hiddenFileTagVisibility:p,includeDescendants:n,showHiddenFolders:r,hideFolderNoteInList:e.hideFolderNoteInList,folderNoteSettings:D})},[t,c,l,s,o,u,m,p,i,n,a,e,r]),z=(0,xh.useCallback)(R=>{let O=xu(R,h);if(!O||!e.showNoteCount)return Qw;let D=g().get(O);if(D)return D;let x=$i(h,O);return x?qI(x,n):Qw},[g,n,e.showNoteCount,h]),G=(0,xh.useCallback)(R=>{if(!e.showNoteCount)return Qw;let O=f().get(R);if(O)return O;if(R===_e)return Qw;let x=ux({nodeId:R,propertyTreeService:y,propertyTree:b})?.node??null;if(!x)return Qw;if(x.kind==="key"){let M=Au(x);if(!n)return{current:M,descendants:0,total:M};let H=x.notesWithValue.size,q=Math.max(H-M,0);return{current:M,descendants:q,total:H}}let B=x.notesWithValue.size;if(!n||!x.valuePath)return{current:B,descendants:0,total:B};let I=y?.getKeyNode(x.key)??b.get(x.key)??null;if(!I)return{current:B,descendants:0,total:B};let A=hg(I,x.valuePath),N=Math.max(A-B,0);return{current:B,descendants:N,total:A}},[f,n,b,y,e.showNoteCount]),Q=(0,xh.useCallback)(R=>{let O=Pu(R);if(!O)return"";let D=O.lastIndexOf(".");if(D<=0)return O;let x=O.substring(0,D);return O.substring(D+1).toLowerCase()==="md"?x:O},[]);return{pinToggleLabel:P,shortcutHeaderTrailingAction:E,propertiesHeaderTrailingAction:C,getFolderShortcutCount:L,getTagShortcutCount:z,getPropertyShortcutCount:G,getMissingNoteLabel:Q}}var xh,Qw,wse=U(()=>{xh=he(Ve());Oe();Ja();DK();Qa();Ue();un();ra();Cn();Qw={current:0,descendants:0,total:0}});function Tse(t){return t?.type===K.FILE&&t.filePaths.length>0?t.filePaths:t?.type===K.FOLDER?[t.folderPath]:null}function kse(t){return t?.type!==K.TAG?null:t.canonicalPath??t.displayPath}function Pse(t){return t?.type!==K.PROPERTY?null:t.nodeId}function Fse({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,ai.useMemo)(()=>i.map(N=>N.key),[i]),b=Vw(Nh(Hw,{activationConstraint:wie})),y=f&&h.length>1&&!n&&!r,[v,S]=(0,ai.useState)(null),w=y&&!!v,T=e&&f,F=(0,ai.useMemo)(()=>{if(T)return{visible:!0,only:!0}},[T]),k=US(),P=(0,ai.useMemo)(()=>{let N=new Map;return i.forEach((M,H)=>{N.set(M.key,H)}),N},[i]),E=(0,ai.useCallback)(N=>{S(String(N.active.id))},[]),C=(0,ai.useCallback)(N=>{let M=String(N.active.id),H=N.over?String(N.over.id):void 0;if(S(null),!H||M===H)return;let q=h.indexOf(M),X=h.indexOf(H);if(q===-1||X===-1)return;let V=Nm(h,q,X);$(async()=>{await c(V)})},[c,h]),L=(0,ai.useCallback)(()=>{S(null)},[]),z=(0,ai.useCallback)((N,M)=>{let H=P.get(M);if(H===void 0)return i.length;let q=N.currentTarget;if(!(q instanceof HTMLElement))return H;let X=q.getBoundingClientRect();return N.clientY-X.top{let{dataTransfer:M}=N;if(!M||!o||!a)return!1;let H=Array.from(M.types??[]);if(H.includes(Yv))return!1;let q=k.getSession(),X=WS(H)||!!Tse(q),V=H.includes(Bh)||!!kse(q),j=H.includes(fT)||!!Pse(q);return!X&&!V&&!j?!1:(N.preventDefault(),M.dropEffect="copy",!0)},[k,o,a]),R=(0,ai.useCallback)(N=>{let M=t.vault.getAbstractFileByPath(N);return M instanceof Zw.TFile?"file":M instanceof Zw.TFolder?"folder":null},[t.vault]),O=(0,ai.useCallback)((N,M)=>{let{dataTransfer:H}=N;if(!H||!o||!a||Array.from(H.types??[]).includes(Yv))return!1;let X=k.getSession(),V=H.getData(Bh),j=V?bee(V):kse(X);if(j){N.preventDefault(),N.stopPropagation();let ve=z(N,M);return $(async()=>{await u(j,{index:Math.max(0,ve)})}),k.clearSession(),!0}let _=H.getData(fT),W=_?See(_):Pse(X);if(W){N.preventDefault(),N.stopPropagation();let ve=z(N,M);return $(async()=>{await p(W,{index:Math.max(0,ve)})}),k.clearSession(),!0}let J=PA(H,{getPathType:R,vaultName:t.vault.getName()})??Tse(X);if(!J||J.length===0)return!1;let Z=new Set,re=J.filter(ve=>Z.has(ve)?!1:(Z.add(ve),!0));if(re.length===0)return!1;let Y=[],ne=0,le=0;if(re.forEach(ve=>{let de=t.vault.getAbstractFileByPath(ve);if(de instanceof Zw.TFolder){if(de.path==="/")return;if(s(de.path)){ne+=1;return}Y.push({type:zn.FOLDER,path:de.path})}else if(de instanceof Zw.TFile){if(l(de.path)){le+=1;return}Y.push({type:zn.NOTE,path:de.path})}}),ne>0&&oe(d.shortcuts.folderExists,{variant:"warning"}),le>0&&oe(d.shortcuts.noteExists,{variant:"warning"}),Y.length===0)return!1;N.preventDefault(),N.stopPropagation();let ae=z(N,M);return $(async()=>{await m(Y,{index:Math.max(0,ae)})}),k.clearSession(),!0},[p,m,u,t.vault,z,R,s,l,k,a,o]),D=o&&a&&i.length===0,x=(0,ai.useCallback)(N=>{D&&Q(N)},[D,Q]),B=(0,ai.useCallback)(N=>{D&&O(N,G)},[D,O]),I=(0,ai.useRef)({handleShortcutDragOver:Q,handleShortcutDrop:O});I.current={handleShortcutDragOver:Q,handleShortcutDrop:O};let A=(0,ai.useCallback)(N=>({onDragOver:M=>{I.current.handleShortcutDragOver(M)},onDrop:M=>{I.current.handleShortcutDrop(M,N)}}),[]);return{activeShortcutId:v,shouldUseShortcutDnd:y,allowEmptyShortcutDrop:D,shortcutDragHandleConfig:F,shortcutIds:h,shortcutSensors:b,handleShortcutDragStart:E,handleShortcutDragEnd:C,handleShortcutDragCancel:L,isShortcutSorting:w,handleShortcutRootDragOver:x,handleShortcutRootDrop:B,buildShortcutExternalHandlers:A}}var ai,Zw,Cse=U(()=>{ai=he(Ve()),Zw=require("obsidian");Ly();jw();bn();FA();st();GF();po();_C();Ha();Oe();Ue()});function Nse({settings:t,menuServices:e,selectionStateRef:n,expansionState:r,selectionDispatch:o,expansionDispatch:a,uiDispatch:i,removeShortcut:s,renameShortcut:l,setIsShortcutContextMenuOpen:c}){let u=(0,_K.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 HK.Menu;if(h.onHide(()=>{c(!1)}),c(!0),g.type==="search"){sp({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(v=>{v.setTitle(d.shortcuts.remove).setIcon(Qn(t.interfaceIcons,"nav-shortcuts","lucide-star-off")).onClick(()=>{$(()=>s(g.key))})}),h.showAtMouseEvent(m.nativeEvent);return}if(g.type==="missing"){h.addItem(v=>{v.setTitle(d.shortcuts.remove).setIcon(Qn(t.interfaceIcons,"nav-shortcuts","lucide-star-off")).onClick(()=>{$(()=>s(g.key))})}),h.showAtMouseEvent(m.nativeEvent);return}let b={selectionState:n.current,expandedFolders:r.expandedFolders,expandedTags:r.expandedTags,expandedProperties:r.expandedProperties},y={selectionDispatch:o,expansionDispatch:a,uiDispatch:i};g.type==="folder"?gC({folder:g.folder,menu:h,services:e,settings:t,state:b,dispatchers:y,options:{disableNavigationSeparatorActions:!0}}):g.type==="note"?(ww({file:g.file,menu:h,services:e,settings:t,state:b,dispatchers:y}),g.file.extension!=="md"&&(h.addSeparator(),h.addItem(v=>{v.setTitle(d.shortcuts.remove).setIcon(Qn(t.interfaceIcons,"nav-shortcuts","lucide-star-off")).onClick(()=>{$(()=>s(g.key))})}))):g.type==="tag"?hC({tagPath:g.tagPath,menu:h,services:e,settings:t,state:b,dispatchers:y,options:{disableNavigationSeparatorActions:!0}}):g.type==="property"&&fC({propertyNodeId:g.propertyNodeId,menu:h,services:e,settings:t,state:b,dispatchers:y,options:{disableNavigationSeparatorActions:!0}}),h.showAtMouseEvent(m.nativeEvent)},[a,r.expandedFolders,r.expandedProperties,r.expandedTags,e,s,l,o,n,c,t,i]),p=(0,_K.useCallback)((m,g)=>{m.preventDefault(),m.stopPropagation();let f=new HK.Menu,h={selectionState:n.current,expandedFolders:r.expandedFolders,expandedTags:r.expandedTags,expandedProperties:r.expandedProperties};ww({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 _K,HK,Ise=U(()=>{_K=he(Ve()),HK=require("obsidian");Oe();st();lr();yC();gw()});function Ese({app:t,settings:e,hydratedShortcuts:n,shortcutMap:r,selectionState:o,selectionStateRef:a,subscribeSelectionState:i}){let s=e.shortcutBadgeDisplay,l=s==="count",c=(0,Ks.useMemo)(()=>{if(s!=="index")return new Map;let w=new Map;return n.slice(0,9).forEach((T,F)=>{w.set(T.key,String(F+1))}),w},[s,n]),[u,p]=(0,Ks.useState)(null),m=(0,Ks.useCallback)(()=>{p(null)},[]),[g,f]=(0,Ks.useState)(!1),[h,b]=(0,Ks.useState)(()=>Te.get(lt.shortcutsExpandedKey)!=="0"),[y,v]=(0,Ks.useState)(()=>{let w=Te.get(lt.recentNotesExpandedKey);return w==="1"}),[,S]=(0,Ks.useReducer)(w=>w+1,0);return(0,Ks.useEffect)(()=>{if(!e.useFrontmatterMetadata)return;let w=t.metadataCache,T=new Set(n.map(C=>C.note?.path).filter(C=>!!C));if(T.size===0)return;let F=()=>{S()},k=C=>{T.has(C.path)&&S()},P=w.on("resolved",F),E=w.on("changed",C=>{C instanceof xse.TFile&&k(C)});return()=>{w.offref(P),w.offref(E)}},[t.metadataCache,n,e.useFrontmatterMetadata]),(0,Ks.useEffect)(()=>{if(!u)return;let w=r.get(u);if(!w){p(null);return}if(w.type===zn.FOLDER){let T=o.selectedFolder?.path;(!T||T!==w.path)&&p(null);return}if(w.type===zn.NOTE){let T=a.current.selectedFile?.path;(!T||T!==w.path)&&p(null);return}if(w.type===zn.TAG){let T=o.selectedTag;(!T||T!==w.tagPath)&&p(null);return}if(w.type===zn.PROPERTY){let T=o.selectedProperty,F=Gv(null,w.nodeId);(!T||!F||T!==F)&&p(null)}},[u,o.selectedFolder,o.selectedProperty,o.selectedTag,a,r]),(0,Ks.useEffect)(()=>{if(!u)return;let w=r.get(u);if(!(!w||w.type!==zn.NOTE))return i(T=>{let F=T.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:y,setRecentNotesExpanded:v,shortcutNumberBadgesByKey:c,shouldShowShortcutCounts:l}}var Ks,xse,Rse=U(()=>{Ks=he(Ve()),xse=require("obsidian");Ue();jr();Ha();un()});function Mse({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}=vt(),y=vl(),v=Ti(),S=Zo(),w=HS(),T=pA(),F=la(),k=Wa(),P=nd(),E=aee(),C=iee(),L=ar(),z=yt(),G=Sl(),Q=jt(),R=Qr(),O=So(),{fileData:D}=_o(),x=Xd(),{shortcuts:B,shortcutMap:I,tagShortcutKeysByPath:A,propertyShortcutKeysByNodeId:N,hydratedShortcuts:M,reorderShortcuts:H,addTagShortcut:q,addPropertyShortcut:X,addShortcutsBatch:V,clearShortcuts:j,removeShortcut:_,renameShortcut:W,hasFolderShortcut:J,hasNoteShortcut:Z}=x,re=Q.includeDescendantNotes,Y=Q.showHiddenItems,{hiddenFolders:ne,descendantExcludedFolders:le,hiddenFileNames:ae,hiddenFileTags:ve,fileVisibility:de}=G,Pe=Bg(z,Y),Fe=(0,Im.useMemo)(()=>oo(Pe),[Pe]),te=(0,Im.useMemo)(()=>Sc(ae,Y),[ae,Y]),ye=(0,Im.useMemo)(()=>Y?null:Yr(ve,!1),[ve,Y]),ce=(0,Im.useMemo)(()=>Y||!ye||!ye.hasHiddenRules?null:mr(),[ye,Y]),pe=(0,Im.useMemo)(()=>({app:m,plugin:f,isMobile:g,fileSystemOps:v,metadataService:S,tagOperations:w,propertyOperations:T,tagTreeService:h,propertyTreeService:b,commandQueue:y,shortcuts:x,visibility:{includeDescendantNotes:re,showHiddenItems:Y}}),[m,y,v,re,g,S,f,T,b,x,Y,w,h]),ue=Ese({app:m,settings:z,hydratedShortcuts:M,shortcutMap:I,selectionState:P,selectionStateRef:E,subscribeSelectionState:C.subscribe}),Se=Fse({app:m,isMobile:g,isRootReorderMode:e,isShortcutContextMenuOpen:ue.isShortcutContextMenuOpen,shortcutsExpanded:ue.shortcutsExpanded,showShortcuts:z.showShortcuts,hydratedShortcuts:M,hasFolderShortcut:J,hasNoteShortcut:Z,reorderShortcuts:H,addTagShortcut:q,addPropertyShortcut:X,addShortcutsBatch:V}),ee=(0,Im.useCallback)(()=>{O({type:"SET_PIN_SHORTCUTS",value:!R.pinShortcuts})},[O,R.pinShortcuts]),ie=vse({app:m,commandQueue:y,isMobile:g,rootContainerRef:t,settings:z,uiState:R,uiDispatch:O,selectionType:P.selectionType,selectedFolder:P.selectedFolder,selectionDispatch:L,setActiveShortcut:ue.setActiveShortcut,onExecuteSearchShortcut:n,onNavigateToFolder:r,onRevealTag:o,onRevealProperty:a,onRevealFile:i,onRevealShortcutFile:s,openFolderNoteInRightSidebar:Le=>f.openFolderNoteInRightSidebar(Le),tagTree:D.tagTree,hydratedShortcuts:M}),Ce=Sse({app:m,settings:z,includeDescendantNotes:re,showHiddenItems:Y,fileVisibility:de,noteCountDB:ce,hiddenFolders:ne,descendantExcludedFolders:le,effectiveFrontmatterExclusions:Pe,effectiveFrontmatterExclusionMatcher:Fe,folderCountFileNameMatcher:te,hiddenFileTagVisibility:ye,getFolderCounts:l,getTagCounts:c,getPropertyCounts:u,tagTree:D.tagTree,propertyTree:D.propertyTree,propertyTreeService:b,onToggleShortcutsPin:ee,isShortcutsPinned:R.pinShortcuts,onConfigurePropertyKeys:p}),we=Nse({settings:z,menuServices:pe,selectionStateRef:E,expansionState:F,selectionDispatch:L,expansionDispatch:k,uiDispatch:O,removeShortcut:_,renameShortcut:W,setIsShortcutContextMenuOpen:ue.setIsShortcutContextMenuOpen});return(0,Im.useMemo)(()=>({shortcutsExpanded:ue.shortcutsExpanded,setShortcutsExpanded:ue.setShortcutsExpanded,recentNotesExpanded:ue.recentNotesExpanded,setRecentNotesExpanded:ue.setRecentNotesExpanded,activeShortcutKey:ue.activeShortcutKey,clearActiveShortcut:ue.clearActiveShortcut,pinToggleLabel:Ce.pinToggleLabel,handleShortcutSplitToggle:ee,isShortcutSorting:Se.isShortcutSorting,shortcutIds:Se.shortcutIds,shortcutSensors:Se.shortcutSensors,handleShortcutDragStart:Se.handleShortcutDragStart,handleShortcutDragEnd:Se.handleShortcutDragEnd,handleShortcutDragCancel:Se.handleShortcutDragCancel,shortcutsCount:B.length,tagShortcutKeysByPath:A,propertyShortcutKeysByNodeId:N,clearShortcuts:j,addTagShortcut:q,addPropertyShortcut:X,openShortcutByNumber:ie.openShortcutByNumber,activeShortcutId:Se.activeShortcutId,shouldUseShortcutDnd:Se.shouldUseShortcutDnd,allowEmptyShortcutDrop:Se.allowEmptyShortcutDrop,shortcutDragHandleConfig:Se.shortcutDragHandleConfig,shortcutHeaderTrailingAction:Ce.shortcutHeaderTrailingAction,propertiesHeaderTrailingAction:Ce.propertiesHeaderTrailingAction,shortcutNumberBadgesByKey:ue.shortcutNumberBadgesByKey,shouldShowShortcutCounts:ue.shouldShowShortcutCounts,removeShortcut:_,handleShortcutFolderActivate:ie.handleShortcutFolderActivate,handleShortcutFolderNoteClick:ie.handleShortcutFolderNoteClick,handleShortcutFolderNoteMouseDown:ie.handleShortcutFolderNoteMouseDown,handleShortcutNoteActivate:ie.handleShortcutNoteActivate,handleShortcutNoteMouseDown:ie.handleShortcutNoteMouseDown,handleRecentNoteActivate:ie.handleRecentNoteActivate,handleShortcutSearchActivate:ie.handleShortcutSearchActivate,handleShortcutTagActivate:ie.handleShortcutTagActivate,handleShortcutPropertyActivate:ie.handleShortcutPropertyActivate,handleShortcutContextMenu:we.handleShortcutContextMenu,handleRecentFileContextMenu:we.handleRecentFileContextMenu,handleShortcutRootDragOver:Se.handleShortcutRootDragOver,handleShortcutRootDrop:Se.handleShortcutRootDrop,buildShortcutExternalHandlers:Se.buildShortcutExternalHandlers,getFolderShortcutCount:Ce.getFolderShortcutCount,getTagShortcutCount:Ce.getTagShortcutCount,getPropertyShortcutCount:Ce.getPropertyShortcutCount,getMissingNoteLabel:Ce.getMissingNoteLabel}),[X,q,j,ee,N,_,ie.handleRecentNoteActivate,ie.handleShortcutFolderActivate,ie.handleShortcutFolderNoteClick,ie.handleShortcutFolderNoteMouseDown,ie.handleShortcutNoteActivate,ie.handleShortcutNoteMouseDown,ie.handleShortcutPropertyActivate,ie.handleShortcutSearchActivate,ie.handleShortcutTagActivate,ie.openShortcutByNumber,Ce.getFolderShortcutCount,Ce.getMissingNoteLabel,Ce.getPropertyShortcutCount,Ce.getTagShortcutCount,Ce.pinToggleLabel,Ce.propertiesHeaderTrailingAction,Ce.shortcutHeaderTrailingAction,Se.activeShortcutId,Se.allowEmptyShortcutDrop,Se.buildShortcutExternalHandlers,Se.handleShortcutDragCancel,Se.handleShortcutDragEnd,Se.handleShortcutDragStart,Se.handleShortcutRootDragOver,Se.handleShortcutRootDrop,Se.isShortcutSorting,Se.shortcutDragHandleConfig,Se.shortcutIds,Se.shortcutSensors,Se.shouldUseShortcutDnd,we.handleRecentFileContextMenu,we.handleShortcutContextMenu,ue.activeShortcutKey,ue.clearActiveShortcut,ue.recentNotesExpanded,ue.setRecentNotesExpanded,ue.setShortcutsExpanded,ue.shortcutNumberBadgesByKey,ue.shortcutsExpanded,ue.shouldShowShortcutCounts,B.length,A])}var Im,Ase=U(()=>{Im=he(Ve());fn();Tl();Ur();on();ph();cs();wa();gr();wr();Qb();Hr();Vn();bse();wse();Cse();Ise();Rse()});function oO(t,e){let n=(0,VK.useRef)(t);n.current=t;let r=(0,VK.useRef)(null);if(r.current===null){let o={};for(let a of e)o[a]=(...i)=>n.current[a](...i);r.current=o}return r.current}var VK,KK=U(()=>{VK=he(Ve())});function Dse({app:t,commandQueue:e,settings:n,uiState:r,expansionState:o,expansionDispatch:a,selectionState:i,selectionDispatch:s,uiDispatch:l,propertyTreeService:c,tagTree:u,propertyTree:p,tagsVirtualFolderHasChildren:m,setShortcutsExpanded:g,setRecentNotesExpanded:f,clearActiveShortcut:h,openFolderNoteInRightSidebar:b,onModifySearchWithTag:y,onModifySearchWithProperty:v}){let S=(0,Ho.useCallback)(V=>{!r.singlePane||V!=="right-sidebar"||l({type:"ACTIVATE_PANE",target:"files"})},[l,r.singlePane]),w=(0,Ho.useCallback)(V=>{if(!ym(V,n.showRootFolder)){if(n.collapseOtherBranchesOnExpand){let j=t.vault.getFolderByPath(V);if(j){Zd({type:"folder",id:V,hasChildren:j.children.some(_=>_ instanceof jC.TFolder),ancestorIds:tp(j,{includeRootFolder:n.showRootFolder})},o,a,"toggle",{collapseOtherBranches:!0});return}}a({type:"TOGGLE_FOLDER_EXPANDED",folderPath:V})}},[t.vault,a,o,n.collapseOtherBranchesOnExpand,n.showRootFolder]),T=(0,Ho.useCallback)((V,j)=>{j?.fromShortcut||h();let _=V.children.some(Y=>Y instanceof jC.TFolder),W=da(V.path,o.expandedFolders,n.showRootFolder),J=i.selectionType===K.FOLDER&&i.selectedFolder?.path===V.path,Z=n.autoExpandNavItems&&!r.singlePane&&_&&W&&J,re=r.singlePane&&n.autoExpandNavItems&&_&&!W;if(s({type:"SET_SELECTED_FOLDER",folder:V}),Z){w(V.path),l({type:"ACTIVATE_PANE",target:"navigation"});return}if(n.autoExpandNavItems&&_&&!W&&w(V.path),r.singlePane){l(re?{type:"ACTIVATE_PANE",target:"navigation"}:{type:"ACTIVATE_PANE",target:"files"});return}l({type:"ACTIVATE_PANE",target:"navigation"})},[h,o.expandedFolders,w,s,i.selectedFolder,i.selectionType,n,l,r.singlePane]),F=(0,Ho.useCallback)((V,j)=>{if(!n.enableFolderNotes||!n.enableFolderNoteLinks){T(V);return}let _=Rn(V,n);if(!_){T(V);return}let W=i.selectionType===K.FOLDER&&i.selectedFolder?.path===V.path;s({type:"SET_SELECTED_FOLDER",folder:V,autoSelectedFile:null});let J=V.children.some(Y=>Y instanceof jC.TFolder),Z=da(V.path,o.expandedFolders,n.showRootFolder);n.autoExpandNavItems&&J&&!Z&&w(V.path);let re=j?Iu(j,n.folderNoteOpenLocation,n.multiSelectModifier):UI(n.folderNoteOpenLocation);S(re),Ai(s,_),!(re==="right-sidebar"&&n.showNearestFolderNoteInSidebar&&!W)&&$(()=>vi({app:t,commandQueue:e,folder:V,folderNote:_,context:re,openInRightSidebar:b}))},[t,e,o.expandedFolders,S,T,w,b,s,i.selectedFolder,i.selectionType,n]),k=(0,Ho.useCallback)((V,j)=>{if(j.button!==1||!n.enableFolderNotes||!n.enableFolderNoteLinks)return;let _=Rn(V,n);_&&(j.preventDefault(),j.stopPropagation(),s({type:"SET_SELECTED_FOLDER",folder:V,autoSelectedFile:null}),Ai(s,_),$(()=>vi({app:t,commandQueue:e,folder:V,folderNote:_,context:"tab"})))},[t,e,s,n]),P=(0,Ho.useCallback)(V=>{if(n.collapseOtherBranchesOnExpand){let j=$i(u,V);if(j){Zd({type:"tag",id:j.path,hasChildren:j.children.size>0,ancestorIds:qF(j.path)},o,a,"toggle",{collapseOtherBranches:!0});return}}a({type:"TOGGLE_TAG_EXPANDED",tagPath:V})},[a,o,n.collapseOtherBranchesOnExpand,u]),E=(0,Ho.useCallback)(V=>{if(n.collapseOtherBranchesOnExpand){let j=c?.findNode(V)??Array.from(p.values()).find(W=>W.id===V||W.children.has(V))??null,_=j?.id===V?j:j?.children.get(V);if(_){Zd({type:"property",id:_.id,hasChildren:_.children.size>0,ancestorIds:VV(_.id)},o,a,"toggle",{collapseOtherBranches:!0});return}}a({type:"TOGGLE_PROPERTY_EXPANDED",propertyNodeId:V})},[a,o,p,c,n.collapseOtherBranchesOnExpand]),C=(0,Ho.useCallback)(V=>{if(V===qa){g(j=>{let _=!j;return Te.set(lt.shortcutsExpandedKey,_?"1":"0"),_});return}if(V===Ya){f(j=>{let _=!j;return Te.set(lt.recentNotesExpandedKey,_?"1":"0"),_});return}a({type:"TOGGLE_VIRTUAL_FOLDER_EXPANDED",folderId:V})},[a,f,g]),L=(0,Ho.useCallback)(V=>{let j=[],_=W=>{W.children.forEach(J=>{J instanceof jC.TFolder&&(j.push(J.path),_(J))})};return _(V),j},[]),z=(0,Ho.useCallback)(()=>{let V=[],j=new Set,_=W=>{j.has(W)||(j.add(W),V.push(W.path),W.children.forEach(J=>_(J)))};return u.forEach(W=>_(W)),V},[u]),G=(0,Ho.useCallback)(V=>{let j=[],_=$i(u,V);if(!_)return j;let W=J=>{J.children.forEach(Z=>{j.push(Z.path),W(Z)})};return W(_),j},[u]),Q=(0,Ho.useCallback)(()=>{let V=[],j=new Set,_=W=>{j.has(W)||(j.add(W),V.push(W.id),W.children.forEach(J=>_(J)))};return p.forEach(W=>_(W)),V},[p]),R=(0,Ho.useCallback)(V=>{if((c?.findNode(V.id)??null)===V)return Array.from(c?.collectDescendantNodeIds(V.id)??[]);let _=[],W=J=>{J.children.forEach(Z=>{_.push(Z.id),W(Z)})};return W(V),_},[c]),O=(0,Ho.useCallback)(V=>{if(r.singlePane){l(V?{type:"ACTIVATE_PANE",target:"navigation"}:{type:"ACTIVATE_PANE",target:"files"});return}l({type:"ACTIVATE_PANE",target:"navigation"})},[l,r.singlePane]),D=(0,Ho.useCallback)(V=>{let{hasChildren:j,isExpanded:_,isSelected:W,fromShortcut:J,onSelect:Z,onToggleExpand:re}=V;if(J||h(),Z(),n.autoExpandNavItems&&!r.singlePane&&j&&_&&W){re(),l({type:"ACTIVATE_PANE",target:"navigation"});return}let ne=r.singlePane&&n.autoExpandNavItems&&j&&!_;n.autoExpandNavItems&&j&&!_&&re(),O(ne)},[h,O,n.autoExpandNavItems,l,r.singlePane]),x=(0,Ho.useCallback)((V,j,_)=>{let W=$i(u,V),J=xu(V,u);if(!J)return;let Z=cl(J),re=Ov(j??null,n.multiSelectModifier);if(re&&!Z&&J!==wt){j&&(j.preventDefault(),j.stopPropagation()),y(J,re);return}let Y=n.showAllTagsFolder&&J===Lt,ne=Y?o.expandedVirtualFolders.has(_n):!!(W&&o.expandedTags.has(W.path)),le=i.selectionType===K.TAG&&i.selectedTag===J,ae=Y?m:!!(W&&W.children.size>0);D({hasChildren:ae,isExpanded:ne,isSelected:le,fromShortcut:_?.fromShortcut,onSelect:()=>{s({type:"SET_SELECTED_TAG",tag:J})},onToggleExpand:()=>{Y?a({type:"TOGGLE_VIRTUAL_FOLDER_EXPANDED",folderId:_n}):W&&P(W.path)}})},[D,a,o.expandedTags,o.expandedVirtualFolders,P,y,s,i.selectedTag,i.selectionType,n.multiSelectModifier,n.showAllTagsFolder,u,m]),B=(0,Ho.useCallback)((V,j)=>{x(V,j)},[x]),I=(0,Ho.useCallback)(V=>{let j=_e,_=i.selectionType===K.PROPERTY?i.selectedProperty:null;D({hasChildren:p.size>0,isExpanded:o.expandedVirtualFolders.has(j),isSelected:_===j,onSelect:()=>{s({type:"SET_SELECTED_PROPERTY",nodeId:j})},onToggleExpand:()=>{C(j)}})},[D,o.expandedVirtualFolders,C,p,s,i.selectedProperty,i.selectionType]),A=(0,Ho.useCallback)((V,j,_)=>{let W=Ov(j??null,n.multiSelectModifier);if(W){j&&(j.preventDefault(),j.stopPropagation());let Y=V.kind==="value"&&V.valuePath?V.valuePath:null;v(V.key,Y,W);return}let J=V.children.size>0,Z=o.expandedProperties.has(V.id),re=i.selectionType===K.PROPERTY?i.selectedProperty:null;D({hasChildren:J,isExpanded:Z,isSelected:re===V.id,fromShortcut:_?.fromShortcut,onSelect:()=>{s({type:"SET_SELECTED_PROPERTY",nodeId:V.id,source:_?.fromShortcut?"shortcut":void 0})},onToggleExpand:()=>{E(V.id)}})},[D,o.expandedProperties,E,v,s,i.selectedProperty,i.selectionType,n.multiSelectModifier]),N=(0,Ho.useCallback)(V=>{if(ym(V.path,n.showRootFolder))return;let j=o.expandedFolders.has(V.path);w(V.path);let _=L(V);_.length>0&&a({type:"TOGGLE_DESCENDANT_FOLDERS",descendantPaths:_,expand:!j})},[a,o.expandedFolders,L,w,n.showRootFolder]),M=(0,Ho.useCallback)(V=>{let j=o.expandedTags.has(V);P(V);let _=G(V);_.length>0&&a({type:"TOGGLE_DESCENDANT_TAGS",descendantPaths:_,expand:!j})},[a,o.expandedTags,G,P]),H=(0,Ho.useCallback)(V=>{let j=o.expandedProperties.has(V.id);E(V.id);let _=R(V);_.length>0&&a({type:"TOGGLE_DESCENDANT_PROPERTIES",descendantNodeIds:_,expand:!j})},[a,o.expandedProperties,R,E]),q=(0,Ho.useCallback)(V=>{let j=o.expandedVirtualFolders.has(V);if(C(V),V===_n){let _=z();_.length>0&&a({type:"TOGGLE_DESCENDANT_TAGS",descendantPaths:_,expand:!j});return}if(V===_e){let _=Q();_.length>0&&a({type:"TOGGLE_DESCENDANT_PROPERTIES",descendantNodeIds:_,expand:!j})}},[a,o.expandedVirtualFolders,Q,z,C]);return oO({handleFolderToggle:w,handleFolderClick:T,handleFolderNameClick:F,handleFolderNameMouseDown:k,handleFolderToggleAllSiblings:N,handleTagToggle:P,handleTagToggleAllSiblings:M,handlePropertyToggle:E,handlePropertyToggleAllSiblings:H,handleVirtualFolderToggle:C,handleVirtualFolderToggleAllSiblings:q,handleTagClick:x,handleTagCollectionClick:B,handlePropertyCollectionClick:I,handlePropertyClick:A},["handleFolderToggle","handleFolderClick","handleFolderNameClick","handleFolderNameMouseDown","handleFolderToggleAllSiblings","handleTagToggle","handleTagToggleAllSiblings","handlePropertyToggle","handlePropertyToggleAllSiblings","handleVirtualFolderToggle","handleVirtualFolderToggleAllSiblings","handleTagClick","handleTagCollectionClick","handlePropertyCollectionClick","handlePropertyClick"])}var Ho,jC,Ose=U(()=>{Ho=he(Ve()),jC=require("obsidian");jr();Ue();Hu();st();Md();Qa();Cn();Cn();Og();qc();KK()});function _se({searchNavFilters:t}){let e=(0,Vo.useMemo)(()=>{let T=t?.tags.include;return!T||T.length===0?Lse:T},[t]),n=(0,Vo.useMemo)(()=>{let T=t?.tags.exclude;return!T||T.length===0?Lse:T},[t]),r=t?.tags.requireTagged??!1,o=t?.tags.excludeTagged??!1,a=t?.tags.includeUntagged??!1,i=(0,Vo.useMemo)(()=>aO(e,zr),[e]),s=(0,Vo.useMemo)(()=>aO(n,zr),[n]),l=(0,Vo.useMemo)(()=>aO(t?.properties.include,UK),[t]),c=(0,Vo.useMemo)(()=>aO(t?.properties.exclude,UK),[t]),u=(0,Vo.useMemo)(()=>t?.tags.includeOperators??zse,[t]),p=(0,Vo.useMemo)(()=>t?.properties.includeOperators??zse,[t]),m=(0,Vo.useRef)(new Map),g=(0,Vo.useRef)(new Map),f=(0,Vo.useCallback)(T=>{let F=m.current.get(T);if(F!==void 0)return F;let k=zr(T);return Bse(m.current,T,k),k},[]),h=(0,Vo.useCallback)(T=>{let F=g.current.get(T);if(F!==void 0)return F;let k=UK(T);return Bse(g.current,T,k),k},[]);(0,Vo.useEffect)(()=>{m.current.clear()},[i,s]),(0,Vo.useEffect)(()=>{g.current.clear()},[l,c]);let b=(0,Vo.useCallback)(T=>{if(T===wt)return a?"include":o?"exclude":void 0;if(!i&&!s)return;let F=f(T);if(s?.has(F))return"exclude";if(i?.has(F))return"include"},[f,o,a,s,i]),y=(0,Vo.useCallback)(T=>{if(T===Lt){if(o)return"exclude";if(r)return"include"}},[o,r]),v=(0,Vo.useCallback)(T=>{if(T===_e||!l&&!c)return;let F=h(T);if(c?.has(F))return"exclude";if(l?.has(F))return"include"},[h,c,l]),S=(0,Vo.useCallback)(T=>{let F=f(T);return u[F]},[f,u]),w=(0,Vo.useCallback)(T=>{if(T===_e)return;let F=h(T);return p[F]},[h,p]);return(0,Vo.useMemo)(()=>({getTagSearchMatch:b,getPropertySearchMatch:v,getTagCollectionSearchMatch:y,getTagInclusionOperator:S,getPropertyInclusionOperator:w}),[w,v,y,S,b])}var Vo,Lse,hRe,zse,aO,Bse,UK,Hse=U(()=>{Vo=he(Ve());Ue();Et();un();Lse=[],hRe=2048,zse=Object.freeze({}),aO=(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},Bse=(t,e,n)=>{if(!t.has(e)&&t.size>=hRe)for(let r of t.keys()){t.delete(r);break}t.set(e,n)},UK=t=>{let e=Nn(t);if(!e)return zr(t);let n=zr(e.key);return e.valuePath?fa(n,zr(e.valuePath)):or(n)}});function fRe(t){let e=t.lastIndexOf("/");return e>=0?t.slice(e+1):t}function Kse(t,e){let n=e.trim(),r=t.lastIndexOf("/");return r>=0?`${t.slice(0,r)}/${n}`:n}function Use(t,e){if(t.type===be.FOLDER){if(!(t.data instanceof Vse.TFolder))return null;let n=t.data;return{type:"folder",id:n.path,initialValue:e(n)}}if(t.type===be.TAG){let n=t.data;return n.path===Lt||n.path===wt?null:{type:"tag",id:n.path,displayPath:n.displayPath,initialValue:fRe(n.displayPath)}}if(t.type===be.PROPERTY_KEY){let n=t.data;return n.kind!=="key"||n.notesWithValue.size===0?null:{type:"property",id:n.id,normalizedKey:n.key,initialValue:n.name}}return null}function Wse(t,e){return t.type===be.FOLDER?e.type==="folder"&&e.id===t.data.path?e:null:t.type===be.TAG||t.type===be.UNTAGGED?e.type==="tag"&&e.id===t.data.path?e:null:(t.type===be.PROPERTY_KEY||t.type===be.PROPERTY_VALUE)&&e.type==="property"&&e.id===t.data.id?e:null}var Vse,Gse=U(()=>{Vse=require("obsidian");Ue()});function qse({path:t,onHeightChange:e}){let{app:n}=vt(),r=(0,Jw.useRef)(null),o=(0,Jw.useMemo)(()=>{let a=n.vault.getAbstractFileByPath(t);if(a instanceof jse.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,Jw.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,WK.jsx)("div",{className:"nn-nav-banner","aria-hidden":"true",ref:r,children:(0,WK.jsx)("img",{className:"nn-nav-banner-image",src:o.resourcePath,alt:""})}):null}var Jw,jse,WK,Yse=U(()=>{Jw=he(Ve()),jse=require("obsidian");fn();WK=he($e())});function iO({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:y,dragHandleConfig:v,className:S,chevronIcon:w,role:T="treeitem",tabIndex:F,ariaDisabled:k,labelClassName:P,onLabelClick:E,onLabelMouseDown:C,trailingAccessory:L,showIcon:z=!0,tooltip:G,dragRef:Q,dragHandleRef:R,dragAttributes:O,dragListeners:D,dragStyle:x,isSorting:B,nativeDragData:I}){let A=yt(),N=(0,Ga.useRef)(null),M=(0,Ga.useRef)(null),H=(0,Ga.useRef)(null),q=ts(),X=!!e&&!A.colorIconOnly,V=(0,Ga.useMemo)(()=>X&&e?{color:e}:void 0,[X,e]),j=(0,Ga.useMemo)(()=>{let we=["nn-navitem","nn-drag-item"];return S&&we.push(S),s&&we.push("nn-shortcut-disabled"),l&&we.push("nn-excluded"),v?.visible&&we.push("nn-drag-item-has-handle"),n&&we.push("nn-has-custom-background"),we.join(" ")},[n,S,v?.visible,s,l]),_=(0,Ga.useMemo)(()=>{let we=["nn-navitem-name"];return P&&we.push(P),X&&e&&we.push("nn-has-custom-color"),we.join(" ")},[X,e,P]);(0,Ga.useEffect)(()=>{if(M.current){if(!w){M.current.empty();return}M.current.empty(),(0,zy.setIcon)(M.current,w)}},[w]),(0,Ga.useEffect)(()=>{if(!H.current)return;if(!z){H.current.textContent="";return}Fn().renderIcon(H.current,t)},[t,q,z]);let W=!!D,J=!!v?.visible,Z=v?.only===!0,re=v?.disabled===!0,ne=J&&!re&&W||v?.interactive===!0,ae=Z&&W,ve=typeof b=="number"?b>0:typeof b=="string"?b.length>0:!1,de=y!=null,Pe=!!(f&&(ve||de)),Fe=h??!!f,te=(0,Ga.useCallback)(we=>{E&&(we.stopPropagation(),E(we))},[E]),ye=(0,Ga.useCallback)(we=>{C&&(we.stopPropagation(),C(we))},[C]),ce=(0,Ga.useMemo)(()=>n?{"--level":o,"--nn-navitem-custom-bg-color":n}:{"--level":o},[n,o]),pe=(0,Ga.useMemo)(()=>x?{...ce,...x}:ce,[x,ce]),ue=(0,Ga.useMemo)(()=>{if(!O)return;let{role:we,tabIndex:Le,...We}=O;return We},[O]),Se=(0,Ga.useCallback)(we=>{N.current=we,Q&&Q(we)},[Q]);(0,Ga.useEffect)(()=>{let we=N.current;if(we){if(zy.Platform.isMobile||!A.showTooltips||!G){(0,zy.setTooltip)(we,"");return}(0,zy.setTooltip)(we,G,{placement:Np()})}},[A.showTooltips,G]);let ee=(0,Ga.useCallback)(we=>{R&&R(we)},[R]),ie=g||B,Ce=!!I?.path;return(0,Cl.jsx)("div",{ref:Se,className:j,role:T,tabIndex:F,"aria-disabled":k||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":I?.path,"data-drag-type":I?.type,"data-draggable":Ce?"true":void 0,"data-drag-icon":I?.icon,"data-drag-fallback-icon":I?.fallbackIcon,"data-drag-base-icon":I?.baseIcon,"data-drag-icon-color":I?.iconColor,"data-drag-allow-multi-file":I?.allowMultiFileDrag===!1?"false":void 0,"data-level":o,"aria-level":o+1,draggable:Ce||void 0,onClick:c,onMouseDown:u,onContextMenu:p,onDragOver:m?.onDragOver,onDragLeave:m?.onDragLeave,onDrop:m?.onDrop,style:pe,...ae?void 0:ue,...ae?void 0:D,children:(0,Cl.jsxs)("div",{className:"nn-navitem-content",children:[(0,Cl.jsx)("span",{ref:M,className:`nn-navitem-chevron${w?"":" nn-navitem-chevron--no-children"}`,"aria-hidden":"true"}),z?(0,Cl.jsx)("span",{ref:H,className:"nn-navitem-icon","aria-hidden":"true","data-has-color":e?"true":"false",style:e?{color:e}:void 0}):null,(0,Cl.jsxs)("span",{className:_,onClick:E?te:void 0,onMouseDown:C?ye:void 0,children:[(0,Cl.jsx)("span",{className:"nn-shortcut-label","data-has-color":X?"true":void 0,style:V,children:r}),i?(0,Cl.jsx)("span",{className:"nn-shortcut-description",children:i}):null]}),(0,Cl.jsx)("span",{className:`nn-navitem-spacer${Fe?" nn-navitem-spacer--leader":""}`}),Pe?y??(0,Cl.jsx)("span",{className:"nn-navitem-count",children:b}):null,L?(0,Cl.jsx)("div",{className:"nn-navitem-accessory",children:L}):null,J?(0,Cl.jsx)("span",{className:`nn-drag-handle${ne?"":" nn-drag-handle-disabled"}${ie?" nn-drag-handle-active":""}`,role:"button",tabIndex:-1,ref:ee,onClick:v?.events?.onClick,onContextMenu:v?.events?.onContextMenu,...ae?O:void 0,...ae?D:void 0,children:(0,Cl.jsx)(Hs,{name:v?.icon??"lucide-grip-horizontal"})}):null]})})}var Ga,zy,Cl,GK=U(()=>{Ga=he(Ve());on();ei();Fh();zy=require("obsidian");Ts();Cl=he($e())});function jK({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:y,isSorting:v}){let S=yt(),w=P=>{P.preventDefault(),P.stopPropagation(),a&&a(P)},T=p??(r?{visible:!0,icon:"lucide-grip-horizontal"}:void 0),F=(()=>{let P=["nn-root-reorder-item"];return c==="folder"?P.push("nn-folder"):c==="tag"?P.push("nn-tag"):c==="property"?P.push("nn-property"):c==="section"&&P.push("nn-section"),s&&P.push("nn-root-reorder-item--missing"),u&&P.push(u),P.join(" ")})(),k=(0,$se.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,Xse.jsx)(iO,{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:T,chevronIcon:i,trailingAccessory:m,showIcon:k,dragRef:g,dragHandleRef:f,dragAttributes:h,dragListeners:b,dragStyle:y,isSorting:v})}var $se,Xse,Qse=U(()=>{$se=he(Ve());GK();on();Xse=he($e())});function yRe({entry:t,canReorder:e,isMobile:n}){let{item:r,sortableId:o}=t,{attributes:a,listeners:i,setNodeRef:s,transform:l,transition:c,isSorting:u}=Gw({id:o,disabled:!e,data:{type:r.props.itemType}}),p=l?{transform:ec.Transform.toString(l),transition:c}:void 0,m=(0,Ca.useMemo)(()=>({visible:n&&e,icon:"lucide-grip-horizontal",interactive:n&&e,only:n}),[e,n]);return(0,On.jsx)(jK,{...r.props,dragRef:s,dragAttributes:a,dragListeners:i,dragStyle:p,isSorting:u,dragHandleConfig:m})}function eT({entries:t,canReorder:e,children:n,isMobile:r}){let o=(0,Ca.useMemo)(()=>t.map(a=>a.sortableId),[t]);return(0,On.jsxs)(On.Fragment,{children:[(0,On.jsx)(Ww,{items:o,strategy:Uw,children:t.map(a=>(0,On.jsx)(yRe,{entry:a,canReorder:e,isMobile:r},a.sortableId))}),n]})}function tT({label:t,onClick:e}){return(0,On.jsx)("div",{className:"nn-root-reorder-actions",children:(0,On.jsxs)("button",{type:"button",className:"nn-root-reorder-reset nn-support-button",onClick:e,children:[(0,On.jsx)("span",{className:"nn-root-reorder-reset-icon","aria-hidden":"true",children:"Aa"}),(0,On.jsx)("span",{children:t})]})})}function Jse({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:y,onResetRootPropertyOrder:v,onReorderSections:S,onReorderFolders:w,onReorderTags:T,onReorderProperties:F,canReorderSections:k,canReorderFolders:P,canReorderTags:E,canReorderProperties:C}){let L=(0,Ca.useCallback)(W=>{W.preventDefault(),W.stopPropagation(),$(async()=>{await b()})},[b]),z=(0,Ca.useCallback)(W=>{W.preventDefault(),W.stopPropagation(),$(async()=>{await y()})},[y]),G=(0,Ca.useCallback)(W=>{W.preventDefault(),W.stopPropagation(),$(async()=>{await v()})},[v]),Q=(0,Ca.useMemo)(()=>t.map(W=>({id:W.key,item:W})),[t]),R=(0,Ca.useMemo)(()=>e.map(W=>({sortableId:`folder:${W.key}`,item:W})),[e]),O=(0,Ca.useMemo)(()=>n.map(W=>({sortableId:`tag:${W.key}`,item:W})),[n]),D=(0,Ca.useMemo)(()=>r.map(W=>({sortableId:`property:${W.key}`,item:W})),[r]),x=(0,Ca.useMemo)(()=>{let W=new Map;return R.forEach(J=>{W.set(J.sortableId,{type:"folder",key:J.item.key})}),O.forEach(J=>{W.set(J.sortableId,{type:"tag",key:J.item.key})}),D.forEach(J=>{W.set(J.sortableId,{type:"property",key:J.item.key})}),W},[R,D,O]),B=(0,Ca.useMemo)(()=>Q.map(W=>W.id),[Q]),I=(0,Ca.useMemo)(()=>R.map(W=>W.item.key),[R]),A=(0,Ca.useMemo)(()=>O.map(W=>W.item.key),[O]),N=(0,Ca.useMemo)(()=>D.map(W=>W.item.key),[D]),M=(0,Ca.useMemo)(()=>new Map(B.map((W,J)=>[W,J])),[B]),H=Vw(Nh(Ay,{activationConstraint:Tie}),Nh(Dy,{activationConstraint:kie})),q=(0,Ca.useCallback)((W,J)=>{if(!k)return;let Z=B.indexOf(W),re=Z+J;if(Z===-1||re<0||re>=B.length)return;let Y=Nm(B,Z,re);$(async()=>{await S(Y)})},[k,S,B]),X=(0,Ca.useCallback)((W,J)=>Z=>{Z.preventDefault(),Z.stopPropagation(),q(W,J)},[q]),V=(0,Ca.useCallback)((W,J)=>{if(!C)return;let Z=N.indexOf(W),re=N.indexOf(J);if(Z===-1||re===-1||Z===re)return;let Y=Nm(N,Z,re);$(async()=>{await F(Y)})},[C,F,N]),j=Q.length>0||a&&R.length>0||i&&O.length>0||s&&D.length>0,_=(0,Ca.useCallback)(W=>{let J=W.active.id,Z=W.over?.id;if(!Z)return;let re=x.get(J),Y=x.get(Z);if(!(!re||!Y)&&re.type===Y.type){if(re.type==="folder"){if(!P)return;let ne=I.indexOf(re.key),le=I.indexOf(Y.key);if(ne===-1||le===-1||ne===le)return;let ae=Nm(I,ne,le);$(async()=>{await w(ae)});return}if(re.type==="tag"){if(!E)return;let ne=A.indexOf(re.key),le=A.indexOf(Y.key);if(ne===-1||le===-1||ne===le)return;let ae=Nm(A,ne,le);$(async()=>{await T(ae)});return}V(re.key,Y.key)}},[P,E,I,V,w,T,x,A]);return(0,On.jsxs)("div",{className:"nn-root-reorder-panel",children:[(0,On.jsxs)("div",{className:"nn-root-reorder-header",children:[(0,On.jsx)("span",{className:"nn-root-reorder-title",children:d.navigationPane.reorderRootFoldersTitle}),(0,On.jsx)("span",{className:"nn-root-reorder-hint",children:d.navigationPane.reorderRootFoldersHint})]}),(0,On.jsx)("div",{className:"nn-root-reorder-list",role:"presentation",children:j?(0,On.jsx)(Kw,{sensors:H,collisionDetection:XD,modifiers:[qw],onDragEnd:_,children:Q.length>0?Q.map(W=>{let J=W.item,Z=W.id,re=M.get(Z)??-1,Y=k&&re>0,ne=k&&re>=0&&re1?(0,On.jsxs)("div",{className:"nn-root-reorder-section-controls",children:[(0,On.jsx)("button",{type:"button",className:"nn-icon-button nn-root-reorder-section-button","aria-label":d.settings.items.vaultProfiles.moveUp,onClick:X(Z,-1),disabled:!Y,children:(0,On.jsx)(Hs,{name:"lucide-arrow-up"})}),(0,On.jsx)("button",{type:"button",className:"nn-icon-button nn-root-reorder-section-button","aria-label":d.settings.items.vaultProfiles.moveDown,onClick:X(Z,1),disabled:!ne,children:(0,On.jsx)(Hs,{name:"lucide-arrow-down"})})]}):void 0,ve=J.sectionId===Ot.FOLDERS&&l&&a,de=J.sectionId===Ot.TAGS&&c&&i,Pe=J.sectionId===Ot.PROPERTIES&&u&&s;return(0,On.jsxs)("div",{className:"nn-root-reorder-section",children:[(0,On.jsx)(jK,{...J.props,trailingAccessory:ae}),ve&&R.length>0?(0,On.jsx)(eT,{entries:R,canReorder:P,isMobile:o,children:p?(0,On.jsx)(tT,{label:Zse,onClick:L}):null}):null,de&&O.length>0?(0,On.jsx)(eT,{entries:O,canReorder:E,isMobile:o,children:m?(0,On.jsx)(tT,{label:f,onClick:z}):null}):null,Pe&&D.length>0?(0,On.jsx)(eT,{entries:D,canReorder:C,isMobile:o,children:g?(0,On.jsx)(tT,{label:h,onClick:G}):null}):null]},`section:${J.key}`)}):(0,On.jsxs)(On.Fragment,{children:[a&&R.length>0?(0,On.jsx)("div",{className:"nn-root-reorder-section",children:(0,On.jsx)(eT,{entries:R,canReorder:P,isMobile:o,children:p?(0,On.jsx)(tT,{label:Zse,onClick:L}):null})}):null,i&&O.length>0?(0,On.jsx)("div",{className:"nn-root-reorder-section",children:(0,On.jsx)(eT,{entries:O,canReorder:E,isMobile:o,children:m?(0,On.jsx)(tT,{label:f,onClick:z}):null})}):null,s&&D.length>0?(0,On.jsx)("div",{className:"nn-root-reorder-section",children:(0,On.jsx)(eT,{entries:D,canReorder:C,isMobile:o,children:g?(0,On.jsx)(tT,{label:h,onClick:G}):null})}):null]})}):null})]})}var Ca,On,Zse,ele=U(()=>{Ca=he(Ve());Ly();jw();_w();Qse();Oe();Ue();st();Fh();_C();On=he($e()),Zse=d.navigationPane.resetRootToAlpha});function tle({onTreeUpdateComplete:t,onToggleRootFolderReorder:e,rootReorderActive:n,rootReorderDisabled:r,useFloatingLayout:o=!1}){let a=yt(),i=jt(),{toggleShowCalendar:s}=$d(),l=i.showHiddenItems,c=i.showCalendar,u=hr(),p=a.toolbarVisibility.navigation,{shouldCollapseItems:m,handleExpandCollapseAll:g,handleNewFolder:f,handleToggleShowExcludedFolders:h}=YS(),b=p.expandCollapse,y=p.calendar&&a.calendarEnabled&&a.calendarPlacement!=="right-sidebar",v=p.hiddenItems,S=p.rootReorder,w=p.newFolder,T=[b,y,v,S].filter(Boolean).length,F=T+(w?1:0),k=T===1?"nn-mobile-toolbar-circle":"nn-mobile-toolbar-pill",P=T===1?"nn-mobile-toolbar-button nn-mobile-toolbar-button-circle":"nn-mobile-toolbar-button";if(F===0)return null;let E=[b?(0,Ni.jsx)("button",{className:P,"aria-label":m()?d.paneHeader.collapseAllFolders:d.paneHeader.expandAllFolders,onClick:()=>{g(),t&&window.requestAnimationFrame(()=>{t()})},tabIndex:-1,children:(0,Ni.jsx)(qt,{iconId:Je(a.interfaceIcons,m()?"nav-collapse-all":"nav-expand-all")})},"expand-collapse"):null,v?(0,Ni.jsx)("button",{className:`${P}${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,Ni.jsx)(qt,{iconId:Je(a.interfaceIcons,"nav-hidden-items")})},"hidden-items"):null,y?(0,Ni.jsx)("button",{className:`${P}${c?" nn-mobile-toolbar-button-active":""}`,"aria-label":c?d.paneHeader.hideCalendar:d.paneHeader.showCalendar,onClick:s,tabIndex:-1,children:(0,Ni.jsx)(qt,{iconId:Je(a.interfaceIcons,"nav-calendar")})},"calendar"):null,S?(0,Ni.jsx)("button",{className:`${P}${n?" nn-mobile-toolbar-button-active":""}`,"aria-label":n?d.paneHeader.finishRootFolderReorder:d.paneHeader.reorderRootFolders,onClick:e,disabled:r,tabIndex:-1,children:(0,Ni.jsx)(qt,{iconId:Je(a.interfaceIcons,"nav-root-reorder")})},"root-reorder"):null].filter(Boolean),C=w?(0,Ni.jsx)("button",{className:"nn-mobile-toolbar-button nn-mobile-toolbar-button-circle","aria-label":d.paneHeader.newFolder,onClick:()=>{$(()=>f())},disabled:!u.selectedFolder,tabIndex:-1,children:(0,Ni.jsx)(qt,{iconId:Je(a.interfaceIcons,"nav-new-folder")})},"new-folder"):null;return o?(0,Ni.jsxs)("div",{className:"nn-mobile-toolbar",children:[(0,Ni.jsx)("div",{className:"nn-mobile-toolbar-left",children:T>0?(0,Ni.jsx)("div",{className:k,children:E}):null}),w?(0,Ni.jsx)("div",{className:"nn-mobile-toolbar-right",children:(0,Ni.jsx)("div",{className:"nn-mobile-toolbar-circle",children:C})}):null]}):(0,Ni.jsxs)("div",{className:"nn-mobile-toolbar",children:[E,C]})}var Ni,nle=U(()=>{Ur();on();gr();Oe();rd();EA();st();lr();Ni=he($e())});function cp(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 nT(t,e){return e?t.shouldDisplay?{shouldDisplay:!0,label:`${e} ${t.label}`}:{shouldDisplay:!0,label:e}:t}var rT=U(()=>{});function lO({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,sO.useCallback)(p=>{p.preventDefault(),p.stopPropagation()},[]),c=(0,sO.useCallback)(p=>{p.preventDefault(),p.stopPropagation()},[]),u=(0,sO.useCallback)(p=>{p.preventDefault(),p.stopPropagation(),r()},[r]);return(0,By.jsxs)("span",{className:s,children:[a?(0,By.jsx)("span",{className:"nn-navitem-count nn-navitem-hover-action-count",children:t}):i?(0,By.jsx)("span",{className:"nn-navitem-count nn-navitem-hover-action-placeholder","aria-hidden":!0}):null,(0,By.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,By.jsx)(Hs,{name:n,"aria-hidden":!0})})]})}var sO,By,qK=U(()=>{sO=he(Ve());Fh();By=he($e())});var xm,YK,Eh,rle=U(()=>{xm=he(Ve());on();gr();GK();rT();Oe();qK();YK=he($e()),Eh=xm.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,isHiddenFromParents:f,isExcluded:h,onClick:b,onRemove:y,onMouseDown:v,onContextMenu:S,dragHandlers:w,isDragSource:T,dragHandleConfig:F,hasFolderNote:k,tooltip:P,onLabelClick:E,onLabelMouseDown:C,dragRef:L,dragHandleRef:z,dragAttributes:G,dragListeners:Q,dragStyle:R,isSorting:O,nativeDragData:D}){let x=yt(),I=jt().includeDescendantNotes,A=cp(p,I,I&&x.separateNoteCounts),N=f&&I&&A.shouldDisplay?{shouldDisplay:!0,label:`(${A.label})`}:A,M=u==="folder"||u==="tag"||u==="property",H=typeof m=="string"&&m.length>0,q=!!y,X=H||M&&N.shouldDisplay&&(!!g||x.showNoteCount),V=H?m:N.label,j=!!l&&!c,_=(0,xm.useMemo)(()=>{let ne=["nn-shortcut-item"];return c&&ne.push("nn-shortcut-item--missing"),q&&ne.push("nn-shortcut-item--removable"),o&&ne.push(o),ne.join(" ")},[o,q,c]),W=(0,xm.useMemo)(()=>{if(!(j||c))return E},[c,E,j]),J=(0,xm.useMemo)(()=>{if(!(j||c))return C},[c,C,j]),Z=(0,xm.useMemo)(()=>{if(!c)return r},[r,c]),re=(0,xm.useMemo)(()=>x.showSectionIcons,[x.showSectionIcons]),Y=(0,xm.useMemo)(()=>{if(y)return(0,YK.jsx)(lO,{label:X?V:void 0,reserveSpaceWhenHidden:X,actionLabel:d.shortcuts.remove,icon:"lucide-x",onClick:y})},[V,y,X]);return(0,YK.jsx)(iO,{icon:e,color:n,backgroundColor:Z,label:a,description:i,level:s,itemType:u,isDisabled:j,isExcluded:h,onClick:ne=>{if(j||c){ne.preventDefault();return}b(ne)},onMouseDown:ne=>{j||c||v?.(ne)},onContextMenu:S,dragHandlers:w,isDragSource:T,showCount:X||q,showCountLeader:H,count:V,countSlot:Y,className:_,tabIndex:-1,ariaDisabled:j||c,dragHandleConfig:F,labelClassName:k?"nn-has-folder-note":void 0,tooltip:P,onLabelClick:W,onLabelMouseDown:J,showIcon:re,dragRef:L,dragHandleRef:z,dragAttributes:G,dragListeners:Q,dragStyle:R,isSorting:O,nativeDragData:D})})});function qC({sortableId:t,canReorder:e,...n}){let{attributes:r,listeners:o,setNodeRef:a,setActivatorNodeRef:i,transform:s,transition:l,isSorting:c}=Gw({id:t,disabled:!e}),u=s?{transform:ec.Transform.toString(s),transition:l}:void 0;return(0,sd.jsx)(Eh,{...n,dragRef:a,dragHandleRef:i,dragAttributes:r,dragListeners:o,dragStyle:u,isSorting:c})}function ole({item:t,context:e,adjacentFilledClassName:n,isDragSource:r}){let{app:o,settings:a,showHiddenItems:i,getFileDisplayName:s,getSolidBackground:l,shortcuts:c,shortcutUiState:u}=e,p=!e.isMobile&&a.showTooltips;switch(t.type){case be.SHORTCUT_FOLDER:{let m=t.folder,g=!!t.isMissing,f=!!m&&!g;if(!f&&!g)return null;let h=ia(t.shortcut)?t.shortcut.path:"",y=h==="/"?t.displayName||a.customVaultName||o.vault.getName():f&&m?t.displayName||m.name:Pu(h),v=f&&m&&u.shouldShowShortcutCounts?c.getFolderShortcutCount(m):void 0,S=!!(f&&m&&e.descendantExcludedFolders.length>0&&Tc(m.name,e.descendantExcludedFolders,m.path)),w=f&&m&&a.enableFolderNotes&&a.enableFolderNoteLinks?Rn(m,a):null,T=ia(t.shortcut)?t.shortcut.alias:void 0,F=T&&T.length>0?T:y,k=f&&m?{type:"folder",key:t.key,folder:m}:{type:"missing",key:t.key,kind:"folder"},P=g?void 0:l(t.backgroundColor),E=f&&m&&p?CD({app:o,folder:m,displayName:F,fileVisibility:e.fileVisibility,hiddenFolders:e.hiddenFolders,settings:a,showHiddenItems:i}):void 0,C={icon:g?"lucide-alert-triangle":t.isExcluded&&!i?"lucide-eye-off":t.icon??"lucide-folder",color:g?void 0:t.color,backgroundColor:P,adjacentFilledClassName:n,label:F,description:void 0,level:t.level,type:"folder",countInfo:g?void 0:v,badge:u.shortcutNumberBadgesByKey.get(t.key),tooltip:E,forceShowCount:u.shouldShowShortcutCounts,isHiddenFromParents:S,isExcluded:g?void 0:t.isExcluded,isDisabled:g,isMissing:g,onClick:()=>{m&&c.handleShortcutFolderActivate(m,t.key)},onRemove:()=>{$(()=>c.removeShortcut(t.key))},onContextMenu:L=>c.handleShortcutContextMenu(L,k),dragHandlers:c.buildShortcutExternalHandlers(t.key),dragHandleConfig:u.shortcutDragHandleConfig,hasFolderNote:!g&&!!w,onLabelClick:m&&w?L=>{c.handleShortcutFolderNoteClick(m,t.key,L)}:void 0,onLabelMouseDown:m&&w?L=>c.handleShortcutFolderNoteMouseDown(m,L):void 0};return u.shouldUseShortcutDnd?(0,sd.jsx)(qC,{sortableId:t.key,canReorder:u.shouldUseShortcutDnd,isDragSource:r,...C}):(0,sd.jsx)(Eh,{...C,isDragSource:r})}case be.SHORTCUT_NOTE:{let m=t.note,g=!!t.isMissing,f=!!m&&!g,h=Do(t.shortcut)?t.shortcut.path:"",b=f&&m?s(m):"",y=f&&m&&Xy(m)?jh(m):"",v=!m||!f?c.getMissingNoteLabel(h):y?`${b}${y}`:b,S=Do(t.shortcut)?t.shortcut.alias:void 0,w=S&&S.length>0?S:v,T=f&&m?{type:"note",key:t.key,file:m}:{type:"missing",key:t.key,kind:"note"},F=g?void 0:l(t.backgroundColor),k=f&&m&&p?FC({file:m,displayName:b,extensionSuffix:y,settings:a,getFileTimestamps:e.getFileTimestamps,wordCount:e.getFileWordCount(m)}):void 0,P={icon:g?"lucide-alert-triangle":t.isExcluded&&!i?"lucide-eye-off":t.icon??"lucide-file-text",color:g?void 0:t.color,backgroundColor:F,adjacentFilledClassName:n,label:w,description:void 0,level:t.level,type:"note",badge:u.shortcutNumberBadgesByKey.get(t.key),tooltip:k,forceShowCount:u.shouldShowShortcutCounts,isExcluded:g?void 0:t.isExcluded,isDisabled:g,isMissing:g,onClick:E=>{m&&c.handleShortcutNoteActivate(m,t.key,E)},onRemove:()=>{$(()=>c.removeShortcut(t.key))},onMouseDown:E=>{!m||!f||c.handleShortcutNoteMouseDown(E,m)},onContextMenu:E=>c.handleShortcutContextMenu(E,T),dragHandlers:c.buildShortcutExternalHandlers(t.key),dragHandleConfig:u.shortcutDragHandleConfig};return u.shouldUseShortcutDnd?(0,sd.jsx)(qC,{sortableId:t.key,canReorder:u.shouldUseShortcutDnd,isDragSource:r,...P}):(0,sd.jsx)(Eh,{...P,isDragSource:r})}case be.SHORTCUT_SEARCH:{let m=t.searchShortcut,g={icon:"lucide-search",color:t.color,backgroundColor:l(t.backgroundColor),adjacentFilledClassName:n,label:m.name,level:t.level,type:"search",badge:u.shortcutNumberBadgesByKey.get(t.key),forceShowCount:u.shouldShowShortcutCounts,onRemove:()=>{$(()=>c.removeShortcut(t.key))},onClick:()=>c.handleShortcutSearchActivate(t.key,m),onContextMenu:f=>c.handleShortcutContextMenu(f,{type:"search",key:t.key,searchShortcut:m}),dragHandlers:c.buildShortcutExternalHandlers(t.key),dragHandleConfig:u.shortcutDragHandleConfig};return u.shouldUseShortcutDnd?(0,sd.jsx)(qC,{sortableId:t.key,canReorder:u.shouldUseShortcutDnd,isDragSource:r,...g}):(0,sd.jsx)(Eh,{...g,isDragSource:r})}case be.SHORTCUT_TAG:{let m=!!t.isMissing,g=Oo(t.shortcut)?t.shortcut.tagPath:t.tagPath,f=!m&&u.shouldShowShortcutCounts?c.getTagShortcutCount(g):void 0,h=Oo(t.shortcut)?t.shortcut.alias:void 0,b=h&&h.length>0?h:t.displayName,y=m?{type:"missing",key:t.key,kind:"tag"}:{type:"tag",key:t.key,tagPath:g},v=m?void 0:l(t.backgroundColor),S={icon:m?"lucide-alert-triangle":t.isExcluded&&!i?"lucide-eye-off":t.icon??"lucide-tags",color:m?void 0:t.color,backgroundColor:v,adjacentFilledClassName:n,label:b,description:void 0,level:t.level,type:"tag",countInfo:f,badge:u.shortcutNumberBadgesByKey.get(t.key),forceShowCount:u.shouldShowShortcutCounts,isExcluded:m?void 0:t.isExcluded,isDisabled:m,isMissing:m,onClick:()=>{m||c.handleShortcutTagActivate(g,t.key)},onRemove:()=>{$(()=>c.removeShortcut(t.key))},onContextMenu:w=>c.handleShortcutContextMenu(w,y),dragHandlers:c.buildShortcutExternalHandlers(t.key),dragHandleConfig:u.shortcutDragHandleConfig};return u.shouldUseShortcutDnd?(0,sd.jsx)(qC,{sortableId:t.key,canReorder:u.shouldUseShortcutDnd,isDragSource:r,...S}):(0,sd.jsx)(Eh,{...S,isDragSource:r})}case be.SHORTCUT_PROPERTY:{let m=!!t.isMissing,g=t.propertyNodeId,f=!m&&u.shouldShowShortcutCounts?c.getPropertyShortcutCount(g):void 0,h=ya(t.shortcut)?t.shortcut.alias:void 0,b=h&&h.length>0?h:t.displayName,y=m?{type:"missing",key:t.key,kind:"property"}:{type:"property",key:t.key,propertyNodeId:g},v={icon:m?"lucide-alert-triangle":t.icon??Je(a.interfaceIcons,"nav-property"),color:m?void 0:t.color,backgroundColor:m?void 0:l(t.backgroundColor),adjacentFilledClassName:n,label:b,description:void 0,level:t.level,type:"property",countInfo:f,badge:u.shortcutNumberBadgesByKey.get(t.key),forceShowCount:u.shouldShowShortcutCounts,isDisabled:m,isMissing:m,onClick:()=>{m||c.handleShortcutPropertyActivate(g,t.key)},onRemove:()=>{$(()=>c.removeShortcut(t.key))},onContextMenu:S=>c.handleShortcutContextMenu(S,y),dragHandlers:c.buildShortcutExternalHandlers(t.key),dragHandleConfig:u.shortcutDragHandleConfig};return u.shouldUseShortcutDnd?(0,sd.jsx)(qC,{sortableId:t.key,canReorder:u.shouldUseShortcutDnd,isDragSource:r,...v}):(0,sd.jsx)(Eh,{...v,isDragSource:r})}case be.RECENT_NOTE:{let m=t.note,g=s(m),f=Xy(m)?jh(m):"",h=f?`${g}${f}`:g,b=p?FC({file:m,displayName:g,extensionSuffix:f,settings:a,getFileTimestamps:e.getFileTimestamps,wordCount:e.getFileWordCount(m)}):void 0;return(0,sd.jsx)(Eh,{icon:t.icon??"lucide-file-text",color:t.color,backgroundColor:l(t.backgroundColor),adjacentFilledClassName:n,label:h,tooltip:b,level:t.level,type:"note",onClick:y=>c.handleRecentNoteActivate(m,y),onMouseDown:y=>c.handleShortcutNoteMouseDown(y,m),onContextMenu:y=>c.handleRecentFileContextMenu(y,m),nativeDragData:e.isMobile?void 0:{path:m.path,type:K.FILE,icon:t.icon??"lucide-file-text",fallbackIcon:"file-text",baseIcon:"file",iconColor:t.color,allowMultiFileDrag:!1}})}default:return null}}var sd,ale=U(()=>{_w();jw();Ue();Ha();st();lr();Ja();Lr();wr();ra();ND();rle();sd=he($e())});function vRe(t){let e=ile.get(t);if(e)return e;let n={"--nn-indent-guide-level":t};return ile.set(t,n),n}var sle,YC,ile,Rh,$C=U(()=>{sle=he(Ve()),YC=he($e()),ile=new Map;Rh=sle.default.memo(function({levels:e}){return!e||e.length===0?null:(0,YC.jsx)(YC.Fragment,{children:e.map(n=>(0,YC.jsx)("span",{className:"nn-navitem-indent-guide",style:vRe(n),"aria-hidden":"true"},n))})})});var so,oT,tu,lle,dle=U(()=>{so=he(Ve()),oT=require("obsidian");fn();on();gr();vC();ei();Ts();Ja();wr();$C();rT();on();lr();Ue();ND();IC();Oe();tu=he($e()),lle=so.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:y,excludedFolders:v,descendantExcludedFolders:S,vaultChangeVersion:w,disableContextMenu:T,disableNavigationSeparatorActions:F,onStartInlineRename:k,inlineRename:P}){let{app:E,fileSystemOps:C,isMobile:L}=vt(),z=yt(),{fileVisibility:G}=Sl(),Q=jt(),R=Q.includeDescendantNotes,O=Q.showHiddenItems,D=(0,so.useRef)(null),x=so.default.useRef(null),B=so.default.useRef(null),I=so.default.useRef(null),A=ts(),N=y??{current:0,descendants:0,total:0},M=z.folderTreeSortOverrides,q=!!(M&&Object.prototype.hasOwnProperty.call(M,e.path))?M?.[e.path]:void 0,X=q==="alpha-desc"?"↓":q==="alpha-asc"?"↑":void 0,V=R&&z.separateNoteCounts,j=(0,so.useMemo)(()=>R&&S.length>0&&Tc(e.name,S,e.path),[S,e.name,e.path,R]),_=cp(N,R,V,"•"),W=j&&_.shouldDisplay,J=nT(W?{shouldDisplay:!0,label:`(${_.label})`}:_,X),Z=z.showNoteCount&&J.shouldDisplay,Y=gg(e,v,O),ne=f,le=!!ne&&!z.colorIconOnly,ae=z.enableFolderNotes&&z.enableFolderNoteLinks,ve=(0,so.useMemo)(()=>ae?Rn(e,z)!==null:!1,[e,z,ae,N.current,w]),de=e.path==="/",Pe=n||(de?z.customVaultName||E.vault.getName():e.name),Fe=z.showFolderIcons||de,te=(0,so.useMemo)(()=>{if(!(L||!z.showTooltips))return CD({app:E,folder:e,displayName:Pe,fileVisibility:G,hiddenFolders:v,settings:z,showHiddenItems:O})},[E,Pe,v,G,e,L,z,O,w]),ye=(0,so.useMemo)(()=>Rf({interfaceIcons:z.interfaceIcons,isRoot:de,hasChildren:Y,isExpanded:a}),[Y,a,de,z.interfaceIcons]),ce=g??ye,pe=h,ue=(0,so.useMemo)(()=>{let Ie=["nn-navitem","nn-folder"];return i&&Ie.push("nn-selected"),s&&Ie.push("nn-excluded"),pe&&Ie.push("nn-has-custom-background"),b&&Ie.push(b),Ie.join(" ")},[b,pe,i,s]),Se=(0,so.useMemo)(()=>{let Ie=["nn-navitem-name"];return ve&&Ie.push("nn-has-folder-note"),le&&Ie.push("nn-has-custom-color"),Ie.join(" ")},[le,ve]),ee=(0,so.useMemo)(()=>P?C.getFolderDisplayNameRenameInput(e):null,[C,e,P]),ie=(0,so.useCallback)(()=>{Y&&l()},[Y,l]),Ce=(0,so.useCallback)(Ie=>{Ie.stopPropagation(),Y&&(Ie.altKey&&m?m():l())},[Y,l,m]),we=(0,so.useCallback)(Ie=>{Ie.stopPropagation(),Ie.preventDefault()},[]),Le=(0,so.useCallback)(Ie=>{u&&(Ie.stopPropagation(),u(Ie))},[u]),We=(0,so.useCallback)(Ie=>{eK(),p&&(Ie.stopPropagation(),p(Ie))},[p]);(0,so.useEffect)(()=>{if(D.current&&!L){if(!z.showTooltips){(0,oT.setTooltip)(D.current,"");return}if(!te){(0,oT.setTooltip)(D.current,"");return}(0,oT.setTooltip)(D.current,te,{placement:Np()})}},[z.showTooltips,L,te]),(0,so.useEffect)(()=>{if(x.current){let Ie=Fn(),De=Je(z.interfaceIcons,a?"nav-tree-collapse":"nav-tree-expand");Ie.renderIcon(x.current,De)}},[A,a,z.interfaceIcons]),(0,so.useEffect)(()=>{B.current&&Fe&&Fn().renderIcon(B.current,Rf({interfaceIcons:z.interfaceIcons,customIcon:g,isRoot:de,hasChildren:Y,isExpanded:a}))},[Y,g,A,a,de,z.interfaceIcons,Fe]),(0,so.useEffect)(()=>{if(I.current){if(L||!z.showTooltips||!W||!Z){(0,oT.setTooltip)(I.current,"");return}(0,oT.setTooltip)(I.current,d.contextMenu.folder.hiddenFromParentsIndicator,{placement:Np()})}},[W,L,z.showTooltips,Z]);let Nt=(0,so.useMemo)(()=>F||k?{...F?{disableNavigationSeparatorActions:!0}:{},...k?{onStartInlineRename:k}:{}}:void 0,[F,k]),Pt=T?null:{type:K.FOLDER,item:e,options:Nt};wh(D,Pt);let Zt=!L&&!de,ze={"--level":r,...pe?{"--nn-navitem-custom-bg-color":pe}:{}};return(0,tu.jsx)("div",{ref:D,className:ue,"data-path":e.path,"data-drag-path":e.path,"data-drag-type":"folder","data-draggable":Zt?"true":void 0,"data-drag-icon":ce,"data-drag-fallback-icon":ye,"data-drag-icon-color":ne||void 0,draggable:Zt,"data-drop-zone":"folder","data-drop-path":e.path,"data-clickable":"folder","data-level":r,onClick:c,onDoubleClick:ie,style:ze,role:"treeitem","aria-expanded":Y?a:void 0,"aria-level":r+1,children:(0,tu.jsxs)("div",{className:"nn-navitem-content",children:[(0,tu.jsx)(Rh,{levels:o}),(0,tu.jsx)("div",{className:`nn-navitem-chevron ${Y?"nn-navitem-chevron--has-children":"nn-navitem-chevron--no-children"}`,ref:x,onClick:Ce,onDoubleClick:we,tabIndex:-1}),Fe&&(0,tu.jsx)("span",{className:"nn-navitem-icon",ref:B,style:ne?{color:ne}:void 0}),P&&ee?(0,tu.jsx)(Ph,{...P,...ee,className:"nn-navitem-inline-rename"}):(0,tu.jsx)("span",{className:Se,style:le?{color:ne}:void 0,onClick:Le,onMouseDown:We,children:Pe}),(0,tu.jsx)("span",{className:"nn-navitem-spacer nn-navitem-spacer--leader"}),Z&&(0,tu.jsx)("span",{ref:I,className:"nn-navitem-count",children:J.label})]})})})});var Ko,ld,cle,ule=U(()=>{Ko=he(Ve());on();gr();vC();ei();Ue();rT();Rw();lr();$C();Fh();IC();ld=he($e()),cle=Ko.default.memo((0,Ko.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:y,inlineRename:v},S){let w=yt(),F=jt().includeDescendantNotes,k=(0,Ko.useRef)(null),P=(0,Ko.useRef)(null),E=ts(),C=(0,Ko.useRef)(null),L=(0,Ko.useMemo)(()=>{if(c)return c;let Y=e.notesWithValue.size;return{current:Y,descendants:0,total:Y}},[c,e.notesWithValue.size]),z=w.propertyTreeSortOverrides,Q=e.kind==="key"&&!!(z&&Object.prototype.hasOwnProperty.call(z,e.id))?z?.[e.id]:void 0,R=Q==="alpha-desc"?"↓":Q==="alpha-asc"?"↑":void 0,O=F&&w.separateNoteCounts,D=nT(cp(L,F,O,"•"),R),x=D.label,B=u&&D.shouldDisplay,I=b==="OR"?"lucide-squares-unite":b==="AND"?"lucide-squares-intersect":null,A=h==="include"&&I!==null,N=(0,Ko.useMemo)(()=>e.children.size>0,[e.children.size]),M=!!p&&!w.colorIconOnly,H=(0,Ko.useMemo)(()=>e.kind==="value"?Je(w.interfaceIcons,"nav-property-value"):Je(w.interfaceIcons,"nav-property"),[e.kind,w.interfaceIcons]),q=f??H,X=e.kind==="value"?"equal":"align-left",V=(0,Ko.useMemo)(()=>{let Y=["nn-navitem","nn-property"];return a&&Y.push("nn-selected"),m&&Y.push("nn-has-custom-background"),h&&Y.push("nn-has-search-match"),g&&Y.push(g),Y.join(" ")},[g,m,a,h]),j=(0,Ko.useMemo)(()=>{let Y=["nn-navitem-name"];return M&&Y.push("nn-has-custom-color"),Y.join(" ")},[M]),_=(0,Ko.useMemo)(()=>Ew(["nn-navitem-content"],h),[h]),W=(0,Ko.useCallback)(Y=>{Y.preventDefault(),N&&i()},[N,i]),J=(0,Ko.useCallback)(Y=>{if(Y.stopPropagation(),!!N){if(Y.altKey&&l){l();return}i()}},[N,i,l]),Z=(0,Ko.useCallback)(Y=>{Y.stopPropagation(),Y.preventDefault()},[]);(0,Ko.useEffect)(()=>{if(k.current){if(!N){k.current.empty();return}k.current.empty(),Fn().renderIcon(k.current,Je(w.interfaceIcons,o?"nav-tree-collapse":"nav-tree-expand"))}},[N,E,o,w.interfaceIcons]),(0,Ko.useEffect)(()=>{if(!P.current||!w.showPropertyIcons)return;P.current.empty();let Y=f??(e.kind==="value"?Je(w.interfaceIcons,"nav-property-value"):Je(w.interfaceIcons,"nav-property"));Fn().renderIcon(P.current,Y)},[f,E,e.kind,w.interfaceIcons,w.showPropertyIcons]),(0,Ko.useImperativeHandle)(S,()=>C.current),wh(C,{type:K.PROPERTY,item:e.id});let re={"--level":n,...m?{"--nn-navitem-custom-bg-color":m}:{}};return(0,ld.jsx)("div",{ref:C,className:V,"data-property-node":e.id,"data-drag-path":e.id,"data-drag-type":"property","data-draggable":y?"true":void 0,"data-drag-icon":q,"data-drag-fallback-icon":H,"data-drag-base-icon":X,"data-drag-icon-color":p||void 0,draggable:y,"data-drop-zone":"property","data-drop-path":e.id,"data-allow-external-drop":"false","data-search-match":h??void 0,"data-level":n,style:re,role:"treeitem","aria-expanded":N?o:void 0,"aria-level":n+1,children:(0,ld.jsxs)("div",{className:_,onClick:s,onDoubleClick:W,children:[(0,ld.jsx)(Rh,{levels:r}),(0,ld.jsx)("div",{ref:k,className:`nn-navitem-chevron ${N?"nn-navitem-chevron--has-children":"nn-navitem-chevron--no-children"}`,onClick:J,onDoubleClick:Z,tabIndex:-1}),w.showPropertyIcons&&(0,ld.jsx)("span",{className:"nn-navitem-icon",ref:P,style:p?{color:p}:void 0}),v?(0,ld.jsx)(Ph,{...v,className:"nn-navitem-inline-rename"}):(0,ld.jsx)("span",{className:j,style:M?{color:p}:void 0,children:e.name}),(0,ld.jsx)("span",{className:"nn-navitem-spacer nn-navitem-spacer--leader"}),A?(0,ld.jsx)("span",{className:"nn-navitem-count nn-navitem-operator-indicator","data-operator":b,children:(0,ld.jsx)(Hs,{name:I,className:"nn-navitem-operator-icon","aria-hidden":!0})}):B?(0,ld.jsx)("span",{className:"nn-navitem-count",children:x}):null]})})}))});var ja,dd,ple,mle=U(()=>{ja=he(Ve());on();gr();vC();ei();Ue();rT();Rw();Qa();lr();$C();Fh();IC();dd=he($e()),ple=ja.default.memo((0,ja.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:y,isDraggable:v,inlineRename:S},w){let T=yt(),k=jt().includeDescendantNotes,P=ja.default.useRef(null),E=ja.default.useRef(null),C=ts(),L=ja.default.useRef(null),z=ja.default.useMemo(()=>{if(u)return u;let ae=e.notesWithTag.size;if(!k)return{current:ae,descendants:0,total:ae};let ve=Fk(e),de=Math.max(ve-ae,0);return{current:ae,descendants:de,total:ve}},[u,e,k]),G=T.tagTreeSortOverrides,R=!!(G&&Object.prototype.hasOwnProperty.call(G,e.path))?G?.[e.path]:void 0,O=R==="alpha-desc"?"↓":R==="alpha-asc"?"↑":void 0,D=k&&T.separateNoteCounts,x=nT(cp(z,k,D,"•"),O),B=x.label,I=p&&x.shouldDisplay,A=y==="OR"?"lucide-squares-unite":y==="AND"?"lucide-squares-intersect":null,N=b==="include"&&A!==null,M=(0,ja.useMemo)(()=>e.children.size>0,[e.children.size]),H=m,q=g,X=h,V=!!H&&!T.colorIconOnly,j=Je(T.interfaceIcons,"nav-tag"),_=X||j,W=(0,ja.useMemo)(()=>{let ae=["nn-navitem","nn-tag"];return a&&ae.push("nn-selected"),i&&ae.push("nn-excluded"),q&&ae.push("nn-has-custom-background"),b&&ae.push("nn-has-search-match"),f&&ae.push(f),ae.join(" ")},[f,a,i,q,b]),J=(0,ja.useMemo)(()=>{let ae=["nn-navitem-name"];return V&&ae.push("nn-has-custom-color"),ae.join(" ")},[V]),Z=(0,ja.useMemo)(()=>Ew(["nn-navitem-content"],b),[b]),re=(0,ja.useCallback)(ae=>{ae.preventDefault(),M&&s()},[M,s]),Y=(0,ja.useCallback)(ae=>{ae.stopPropagation(),M&&(ae.altKey&&c?c():s())},[M,s,c]),ne=(0,ja.useCallback)(ae=>{ae.stopPropagation(),ae.preventDefault()},[]);ja.default.useEffect(()=>{if(P.current){if(!M){P.current.empty();return}P.current.empty(),Fn().renderIcon(P.current,Je(T.interfaceIcons,o?"nav-tree-collapse":"nav-tree-expand"))}},[M,C,o,T.interfaceIcons]),ja.default.useEffect(()=>{E.current&&T.showTagIcons&&Fn().renderIcon(E.current,X||Je(T.interfaceIcons,"nav-tag"))},[X,T.showTagIcons,C,T.interfaceIcons]),ja.default.useImperativeHandle(w,()=>L.current),wh(L,{type:K.TAG,item:e.path});let le={"--level":n,...q?{"--nn-navitem-custom-bg-color":q}:{}};return(0,dd.jsx)("div",{ref:L,className:W,"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":v?"true":void 0,"data-drag-icon":_,"data-drag-fallback-icon":j,"data-drag-icon-color":H||void 0,"data-level":n,draggable:v,style:le,role:"treeitem","aria-expanded":M?o:void 0,"aria-level":n+1,children:(0,dd.jsxs)("div",{className:Z,onClick:l,onDoubleClick:re,children:[(0,dd.jsx)(Rh,{levels:r}),(0,dd.jsx)("div",{ref:P,className:`nn-navitem-chevron ${M?"nn-navitem-chevron--has-children":"nn-navitem-chevron--no-children"}`,onClick:Y,onDoubleClick:ne,tabIndex:-1}),T.showTagIcons&&(0,dd.jsx)("span",{className:"nn-navitem-icon",ref:E,style:H?{color:H}:void 0}),S?(0,dd.jsx)(Ph,{...S,className:"nn-navitem-inline-rename"}):(0,dd.jsx)("span",{className:J,style:V?{color:H}:void 0,children:e.name}),(0,dd.jsx)("span",{className:"nn-navitem-spacer nn-navitem-spacer--leader"}),N?(0,dd.jsx)("span",{className:"nn-navitem-count nn-navitem-operator-indicator","data-operator":y,children:(0,dd.jsx)(Hs,{name:A,className:"nn-navitem-operator-icon","aria-hidden":!0})}):I?(0,dd.jsx)("span",{className:"nn-navitem-count",children:B}):null]})})}))});var pa,nu,gle,hle=U(()=>{pa=he(Ve());on();ei();Ue();gr();rT();Rw();lr();$C();qK();nu=he($e()),gle=pa.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:y,onDragOver:v,onDrop:S,onDragLeave:w,dropConfig:T,onContextMenu:F}){let k=yt(),P=jt(),E=(0,pa.useRef)(null),C=(0,pa.useRef)(null),L=(0,pa.useRef)(null),z=ts(),G=P.includeDescendantNotes,Q=!!r&&!k.colorIconOnly,R=(0,pa.useMemo)(()=>{if(!f)return null;let _=G&&k.separateNoteCounts;return cp(f,G,_)},[f,G,k.separateNoteCounts]),O=(0,pa.useMemo)(()=>!m||!R||(e.id===_n||e.id===_e)&&!G?!1:R.shouldDisplay,[G,R,m,e.id]),D=b?.labelMode,x=(0,pa.useMemo)(()=>{if(D==="note-count"&&!(!O||!R))return R.label},[R,O,D]),B=(0,pa.useMemo)(()=>!O||!R?!1:D!=="note-count",[R,O,D]),I=D!=="note-count"||typeof x=="string",A=(0,pa.useMemo)(()=>{let _=["nn-navitem"];return e.id===qa&&_.push("nn-shortcut-header-item"),e.id===_e&&_.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]),N=(0,pa.useMemo)(()=>Ew(["nn-navitem-content"],h),[h]),M=(0,pa.useMemo)(()=>{let _=["nn-navitem-name"];return Q&&r&&_.push("nn-has-custom-color"),_.join(" ")},[Q,r]),H=(0,pa.useCallback)(()=>{l&&y()},[l,y]),q=(0,pa.useCallback)(_=>{if(_.stopPropagation(),!!l){if(_.altKey&&c){c();return}y()}},[l,y,c]),X=(0,pa.useCallback)(_=>{_.stopPropagation(),_.preventDefault()},[]),V=(0,pa.useCallback)(_=>{if(u){_.preventDefault(),_.stopPropagation(),u(_);return}y()},[u,y]);(0,pa.useEffect)(()=>{let _=C.current;if(_){if(!l){_.replaceChildren();return}Fn().renderIcon(_,Je(k.interfaceIcons,s?"nav-tree-collapse":"nav-tree-expand"))}},[l,z,s,k.interfaceIcons]),(0,pa.useEffect)(()=>{L.current&&e.icon&&Fn().renderIcon(L.current,e.icon)},[e.icon,z]);let j={"--level":n,...o?{"--nn-navitem-custom-bg-color":o}:{}};return(0,nu.jsx)("div",{ref:E,className:A,"data-search-match":h??void 0,"data-path":e.id,"data-drop-zone":T?.zone,"data-drop-path":T?.path,"data-tag":T?.tag,"data-allow-internal-drop":T?.allowInternalDrop===!1?"false":void 0,"data-allow-external-drop":T?.allowExternalDrop===!1?"false":void 0,"data-level":n,style:j,role:"treeitem","aria-expanded":l?s:void 0,"aria-selected":u?p:void 0,"aria-level":n+1,onDragOver:v,onDrop:S,onDragLeave:w,onContextMenu:F,children:(0,nu.jsxs)("div",{className:N,onClick:V,onDoubleClick:H,children:[(0,nu.jsx)(Rh,{levels:i}),(0,nu.jsx)("div",{className:`nn-navitem-chevron ${l?"nn-navitem-chevron--has-children":"nn-navitem-chevron--no-children"}`,ref:C,onClick:q,onDoubleClick:X,tabIndex:-1}),e.icon&&(0,nu.jsx)("span",{className:"nn-navitem-icon",ref:L,style:r?{color:r}:void 0}),(0,nu.jsx)("span",{className:M,style:Q?{color:r}:void 0,children:e.name}),(0,nu.jsx)("span",{className:`nn-navitem-spacer${g?" nn-navitem-spacer--leader":""}`}),B&&R&&(0,nu.jsx)("span",{className:"nn-navitem-count",children:R.label}),b&&(0,nu.jsx)(lO,{label:x,actionLabel:b.actionLabel,icon:b.icon,onClick:b.onClick,reserveSpaceWhenHidden:I})]})})})});function XC(t,e){switch(t.type){case be.VIRTUAL_FOLDER:return e.getTagCollectionSearchMatch(t.tagCollectionId??null);case be.TAG:case be.UNTAGGED:return e.getTagSearchMatch(t.data.path);case be.PROPERTY_KEY:case be.PROPERTY_VALUE:return e.getPropertySearchMatch(t.data.id);default:return}}function $K(t,e){switch(t.type){case be.FOLDER:return e.selectionType===K.FOLDER&&e.selectedFolder?.path===t.data.path;case be.VIRTUAL_FOLDER:{let n=t.tagCollectionId??null,r=t.propertyCollectionId??null;return n!==null&&e.selectionType===K.TAG&&e.selectedTag===n||r!==null&&e.selectionType===K.PROPERTY&&e.selectedProperty===r}case be.TAG:case be.UNTAGGED:return e.selectionType===K.TAG&&e.selectedTag===t.data.path;case be.PROPERTY_KEY:case be.PROPERTY_VALUE:return e.selectionType===K.PROPERTY&&e.selectedProperty===t.data.id;default:return!1}}function fle({item:t,selectionState:e,searchHighlights:n,getSolidBackground:r}){return(t.type===be.SHORTCUT_FOLDER||t.type===be.SHORTCUT_NOTE||t.type===be.SHORTCUT_TAG||t.type===be.SHORTCUT_PROPERTY)&&t.isMissing?!1:"backgroundColor"in t&&!!r(t.backgroundColor)||$K(t,e)||!!XC(t,n)}var XK=U(()=>{Ue()});function yle({item:t,context:e,adjacentFilledClassName:n,isSelected:r,isExpanded:o,renameTarget:a}){let{settings:i,isMobile:s,indentGuideLevelsByKey:l,firstSectionId:c,firstInlineFolderPath:u,shouldPinShortcuts:p,folderCounts:m,tagCounts:g,propertyCounts:f,vaultChangeVersion:h,descendantExcludedFolders:b,getSolidBackground:y,shortcuts:v,shortcutUiState:S,tree:w,searchHighlights:T,inlineRename:F,onSectionContextMenu:k}=e;switch(t.type){case be.FOLDER:{let P=t.data.path,E=m.get(P),C=l.get(Yc(t)),L=p&&u!==null&&P===u;return(0,Em.jsx)(lle,{folder:t.data,displayName:t.displayName,level:t.level,indentGuideLevels:C,isExpanded:o,isSelected:r,isExcluded:t.isExcluded,onToggle:()=>w.handleFolderToggle(t.data.path),onClick:()=>w.handleFolderClick(t.data),onNameClick:z=>w.handleFolderNameClick(t.data,z),onNameMouseDown:z=>w.handleFolderNameMouseDown(t.data,z),onToggleAllSiblings:()=>w.handleFolderToggleAllSiblings(t.data),icon:t.icon,color:t.color,backgroundColor:y(t.backgroundColor),adjacentFilledClassName:n,countInfo:E,excludedFolders:t.parsedExcludedFolders||[],descendantExcludedFolders:b,vaultChangeVersion:h,disableNavigationSeparatorActions:L,onStartInlineRename:F.startFolder,inlineRename:a?{initialValue:a.initialValue,ariaLabel:d.contextMenu.folder.renameFolder,onCommit:z=>F.commit(a,z),onCancel:F.cancel,onRestoreFocus:F.restoreFocus}:void 0})}case be.VIRTUAL_FOLDER:{let P=t.data,E=l.get(Yc(t)),C=P.id===qa,L=P.id===Ya,z=t.hasChildren??!1,G=t.tagCollectionId??null,Q=t.propertyCollectionId??null,R=!!G,O=!!Q,D=t.noteCount??(G?g.get(G):void 0),x=t.showFileCount??!1,B=XC(t,T),I=P.id===_n?{zone:"tag-root",path:"__nn-tag-root__",allowExternalDrop:!1}:void 0,A=C?Ot.SHORTCUTS:L?Ot.RECENT:P.id===_n?Ot.TAGS:P.id===_e?Ot.PROPERTIES:null,H=(!C||!p)&&!(p&&A!==null&&c!==null&&A===c),q=A!==null?_=>k(_,A,{allowSeparator:H}):void 0,X=P.id===_e,V=P.id===_n,j=C?S.shortcutHeaderTrailingAction:X?S.propertiesHeaderTrailingAction:void 0;return(0,Em.jsx)(gle,{virtualFolder:P,level:t.level,color:t.color,backgroundColor:y(t.backgroundColor),adjacentFilledClassName:n,indentGuideLevels:E,isExpanded:o,hasChildren:z,isSelected:r,showFileCount:x,showCountLeader:!C&&!L,countInfo:D,searchMatch:B,trailingAction:j,onSelect:R&&G?_=>w.handleTagCollectionClick(G,_):O?w.handlePropertyCollectionClick:void 0,onToggle:()=>w.handleVirtualFolderToggle(P.id),onToggleAllSiblings:V||X?()=>w.handleVirtualFolderToggleAllSiblings(P.id):void 0,onDragOver:C&&S.allowEmptyShortcutDrop?v.handleShortcutRootDragOver:void 0,onDrop:C&&S.allowEmptyShortcutDrop?v.handleShortcutRootDrop:void 0,dropConfig:I,onContextMenu:q})}case be.TAG:case be.UNTAGGED:{let P=t.data,E=l.get(Yc(t)),C=XC(t,T),L=C==="include"?T.getTagInclusionOperator(P.path):void 0;return(0,Em.jsx)(ple,{tagNode:P,level:t.level??0,indentGuideLevels:E,isExpanded:o,isSelected:r,isHidden:"isHidden"in t?t.isHidden:!1,onToggle:()=>w.handleTagToggle(P.path),onClick:z=>w.handleTagClick(P.path,z),color:t.color,backgroundColor:y(t.backgroundColor),adjacentFilledClassName:n,icon:t.icon,searchMatch:C,inclusionOperator:L,isDraggable:!s&&P.path!==wt&&P.path!==Lt,onToggleAllSiblings:()=>w.handleTagToggleAllSiblings(P.path),countInfo:t.noteCount??g.get(P.path),showFileCount:i.showNoteCount,inlineRename:a?{initialValue:a.initialValue,ariaLabel:d.modals.tagOperation.confirmRename,onCommit:z=>F.commit(a,z),onCancel:F.cancel,onRestoreFocus:F.restoreFocus}:void 0})}case be.PROPERTY_KEY:case be.PROPERTY_VALUE:{let P=t.data,E=l.get(Yc(t)),C=XC(t,T),L=C==="include"?T.getPropertyInclusionOperator(P.id):void 0;return(0,Em.jsx)(cle,{propertyNode:P,level:t.level??0,indentGuideLevels:E,isExpanded:o,isSelected:r,onToggle:()=>w.handlePropertyToggle(P.id),onClick:z=>w.handlePropertyClick(P,z),onToggleAllSiblings:()=>w.handlePropertyToggleAllSiblings(P),color:t.color,backgroundColor:y(t.backgroundColor),adjacentFilledClassName:n,icon:t.icon,searchMatch:C,inclusionOperator:L,isDraggable:!s,countInfo:f.get(P.id),showFileCount:i.showNoteCount,inlineRename:a?{initialValue:a.initialValue,ariaLabel:d.contextMenu.property.renameKey,onCommit:z=>F.commit(a,z),onCancel:F.cancel,onRestoreFocus:F.restoreFocus}:void 0})}case be.TOP_SPACER:{let P=t.hasSeparator?"nn-nav-top-spacer nn-nav-spacer--with-separator":"nn-nav-top-spacer";return(0,Em.jsx)("div",{className:P})}case be.BOTTOM_SPACER:return(0,Em.jsx)("div",{className:"nn-nav-bottom-spacer"});case be.LIST_SPACER:{let P=t.hasSeparator?"nn-nav-list-spacer nn-nav-spacer--with-separator":"nn-nav-list-spacer";return(0,Em.jsx)("div",{className:P})}case be.ROOT_SPACER:return(0,Em.jsx)("div",{className:"nn-nav-root-spacer",style:{height:`${t.spacing}px`},"aria-hidden":"true"});default:return null}}var Em,vle=U(()=>{Ue();dle();ule();mle();hle();XK();hh();Oe();Em=he($e())});function ble({item:t,context:e,adjacentFilledClassName:n,isSelected:r,isExpanded:o,renameTarget:a,isDragSource:i}){switch(t.type){case be.SHORTCUT_FOLDER:case be.SHORTCUT_NOTE:case be.SHORTCUT_SEARCH:case be.SHORTCUT_TAG:case be.SHORTCUT_PROPERTY:case be.RECENT_NOTE:return(0,QK.jsx)(ole,{item:t,context:e,adjacentFilledClassName:n,isSelected:r,isExpanded:o,renameTarget:a,isDragSource:i});default:return(0,QK.jsx)(yle,{item:t,context:e,adjacentFilledClassName:n,isSelected:r,isExpanded:o,renameTarget:a,isDragSource:i})}}var QK,Sle=U(()=>{Ue();ale();vle();QK=he($e())});function cO({plugin:t,vaultProfiles:e,activeProfileId:n}){let r=Ou(),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,dO.useCallback)(()=>{let m=new wle.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(()=>{$(()=>{t.setVaultProfile(g.id)})})})}),m},[t,r,s,e]),u=(0,dO.useCallback)(m=>{if(m.preventDefault(),m.stopPropagation(),!a)return;c().showAtMouseEvent(m.nativeEvent)},[c,a]),p=(0,dO.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 wle,dO,ZK=U(()=>{wle=require("obsidian"),dO=he(Ve());st();sn()});var Tle,lo,kle,Ple=U(()=>{Tle=he(Ve());Ur();fn();on();gr();wa();ZK();Oe();rd();EA();st();bn();$r();lr();lo=he($e()),kle=Tle.default.memo(function({onTreeUpdateComplete:e,onToggleRootFolderReorder:n,rootReorderActive:r,rootReorderDisabled:o,showVaultTitleInHeader:a}){let{plugin:i}=vt(),s=yt(),l=jt(),{toggleShowCalendar:c}=$d(),u=l.showHiddenItems,p=l.showCalendar,m=Qr(),g=hr(),{hasProfiles:f,hasMultipleProfiles:h,activeProfileName:b,handleTriggerClick:y,handleTriggerKeyDown:v}=cO({plugin:i,vaultProfiles:s.vaultProfiles??[],activeProfileId:s.vaultProfile}),{shouldCollapseItems:S,handleExpandCollapseAll:w,handleNewFolder:T,handleToggleShowExcludedFolders:F}=YS(),k=s.toolbarVisibility.navigation,P=Xa(),E=k.toggleDualPane,C=k.expandCollapse,L=k.calendar&&s.calendarEnabled&&s.calendarPlacement!=="right-sidebar",z=k.hiddenItems,G=k.rootReorder,Q=k.newFolder;if(!f)return null;let R=h&&(P||a),O=(0,lo.jsxs)(lo.Fragment,{children:[(0,lo.jsx)("span",{className:"nn-pane-header-text",children:b}),(0,lo.jsx)(qt,{className:"nn-pane-header-profile-chevron",iconId:Je(s.interfaceIcons,"nav-profile-chevron"),"aria-hidden":!0})]}),D=R?P?(0,lo.jsx)("div",{className:"nn-pane-header-title nn-pane-header-profile","aria-label":d.navigationPane.profileMenuAria,role:"button",tabIndex:0,onClick:y,onKeyDown:v,children:O}):(0,lo.jsx)("div",{className:"nn-pane-header-title nn-pane-header-profile",children:(0,lo.jsx)("div",{className:"nn-pane-header-profile","aria-label":d.navigationPane.profileMenuAria,role:"button",tabIndex:0,onClick:y,onKeyDown:v,children:O})}):null;if(P)return D?(0,lo.jsx)("div",{className:"nn-pane-header nn-pane-header-simple",children:D}):null;if(!(!!D||E||C||z||L||G||Q))return null;let B=i.useDualPane(),I=B&&m.singlePane;return(0,lo.jsx)("div",{className:"nn-pane-header",children:(0,lo.jsxs)("div",{className:"nn-header-actions nn-header-actions--space-between",children:[(0,lo.jsxs)("div",{className:"nn-header-actions nn-header-actions-profile",children:[E?(0,lo.jsx)("button",{className:"nn-icon-button","aria-label":B?d.paneHeader.showSinglePane:d.paneHeader.showDualPane,onClick:()=>{if(I){oe(d.paneHeader.dualPaneAutoFallbackNotice,{variant:"warning"});return}i.setDualPanePreference(!B)},tabIndex:-1,type:"button",children:(0,lo.jsx)(qt,{iconId:Je(s.interfaceIcons,B?"nav-show-single-pane":"nav-show-dual-pane")})}):null,D]}),(0,lo.jsxs)("div",{className:"nn-header-actions",children:[C?(0,lo.jsx)("button",{className:"nn-icon-button","aria-label":S()?d.paneHeader.collapseAllFolders:d.paneHeader.expandAllFolders,onClick:()=>{w(),e&&window.requestAnimationFrame(()=>{e()})},tabIndex:-1,children:(0,lo.jsx)(qt,{iconId:Je(s.interfaceIcons,S()?"nav-collapse-all":"nav-expand-all")})}):null,z?(0,lo.jsx)("button",{className:`nn-icon-button ${u?"nn-icon-button-active":""}`,"aria-label":u?d.paneHeader.hideExcludedItems:d.paneHeader.showExcludedItems,onClick:()=>{F(),e&&window.requestAnimationFrame(()=>{e()})},tabIndex:-1,children:(0,lo.jsx)(qt,{iconId:Je(s.interfaceIcons,"nav-hidden-items")})}):null,L?(0,lo.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,lo.jsx)(qt,{iconId:Je(s.interfaceIcons,"nav-calendar")})}):null,G?(0,lo.jsx)("button",{className:`nn-icon-button ${r?"nn-icon-button-active":""}`,"aria-label":r?d.paneHeader.finishRootFolderReorder:d.paneHeader.reorderRootFolders,onClick:n,disabled:o,tabIndex:-1,children:(0,lo.jsx)(qt,{iconId:Je(s.interfaceIcons,"nav-root-reorder")})}):null,Q?(0,lo.jsx)("button",{className:"nn-icon-button","aria-label":d.paneHeader.newFolder,onClick:()=>{$(()=>T())},disabled:!g.selectedFolder,tabIndex:-1,children:(0,lo.jsx)(qt,{iconId:Je(s.interfaceIcons,"nav-new-folder")})}):null]})]})})})});var Fle,aT,Cle,Nle=U(()=>{Fle=he(Ve());fn();on();ZK();Oe();$r();lr();rd();aT=he($e()),Cle=Fle.default.memo(function(){let{plugin:e}=vt(),n=yt(),{hasProfiles:r,hasMultipleProfiles:o,activeProfileName:a,handleTriggerClick:i,handleTriggerKeyDown:s}=cO({plugin:e,vaultProfiles:n.vaultProfiles??[],activeProfileId:n.vaultProfile});return Xa()||!r||!o?null:(0,aT.jsx)("div",{className:"nn-vault-title-area",children:(0,aT.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,aT.jsx)("span",{className:"nn-vault-title-text",children:a}),(0,aT.jsx)(qt,{className:"nn-vault-title-chevron",iconId:Je(n.interfaceIcons,"nav-profile-chevron"),"aria-hidden":!0})]})})})});function xle(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 Rle({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:y,pinnedShortcutsHasOverflow:v,pinnedShortcutsMaxHeight:S,allowEmptyShortcutDrop:w,onShortcutRootDragOver:T,onShortcutRootDrop:F,pinnedShortcutsScrollRefCallback:k,pinnedNavigationItems:P,renderNavigationItem:E,getRowHotState:C,isNavigationItemFilled:L,onPinnedShortcutsResizePointerDown:z,scrollContainerRefCallback:G,hasNavigationBannerConfigured:Q,navigationBannerRef:R,rootReorderContent:O,isRootReorderMode:D,items:x,rowVirtualizer:B,navigationScrollMargin:I,shouldRenderBottomToolbarInsidePanel:A,shouldRenderBottomToolbarOutsidePanel:N,calendarOverlay:M}){return(0,Uo.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,Uo.jsxs)("div",{className:"nn-navigation-pane-chrome",children:[(0,Uo.jsx)(kle,{onTreeUpdateComplete:i,onToggleRootFolderReorder:s,rootReorderActive:l,rootReorderDisabled:c,showVaultTitleInHeader:u}),p?(0,Uo.jsx)(Cle,{}):null,m?g:null,f?h:null,b?(0,Uo.jsxs)("div",{className:"nn-shortcut-pinned",ref:y,role:"presentation","data-scroll":v?"true":void 0,style:S!==null?{maxHeight:S}:void 0,onDragOver:w?T:void 0,onDrop:w?F:void 0,children:[(0,Uo.jsx)("div",{className:"nn-shortcut-pinned-scroll",ref:k,children:(0,Uo.jsx)("div",{className:"nn-shortcut-pinned-inner",children:P.map((H,q)=>{let X=C(H);return(0,Uo.jsx)(Ile,{item:H,adjacentFilledClassName:xle(H,q,P,L),isSelected:X.isSelected,isExpanded:X.isExpanded,renameTarget:X.renameTarget,isDragSource:X.isDragSource,renderNavigationItem:E},Yc(H))})})}),(0,Uo.jsx)("div",{className:"nn-shortcuts-resize-handle",role:"separator","aria-orientation":"horizontal","aria-label":"Resize pinned shortcuts",onPointerDown:z})]}):null]}),(0,Uo.jsxs)("div",{className:"nn-navigation-pane-panel",children:[(0,Uo.jsx)("div",{ref:G,className:"nn-navigation-pane-scroller","data-banner":Q?"true":void 0,"data-pane":"navigation",tabIndex:-1,children:(0,Uo.jsxs)("div",{className:"nn-navigation-pane-content",children:[!f&&h?(0,Uo.jsx)("div",{className:"nn-navigation-pane-banner",ref:R,children:h}):null,(0,Uo.jsx)("div",{role:D?"list":"tree",children:D?O:x.length>0&&(0,Uo.jsx)("div",{className:"nn-virtual-container",style:{height:`${B.getTotalSize()}px`},children:B.getVirtualItems().map(H=>{let q=H.index>=0&&H.index{Ele=he(Ve());hh();Ple();Nle();Uo=he($e()),Ile=Ele.default.memo(function({item:e,index:n,top:r,adjacentFilledClassName:o,isSelected:a,isExpanded:i,renameTarget:s,isDragSource:l,renderNavigationItem:c}){let u=c(e,o,{isSelected:a,isExpanded:i,renameTarget:s,isDragSource:l});return n===void 0||r===void 0?(0,Uo.jsx)(Uo.Fragment,{children:u}):(0,Uo.jsx)("div",{"data-index":n,className:"nn-virtual-nav-item",style:{transform:`translateY(${r}px)`},children:u})})});var Ct,QC,up,bRe,JK,Ale=U(()=>{Ct=he(Ve());Ly();jw();QC=require("obsidian");Tl();Ur();fn();on();gr();cs();wa();Oie();cse();pse();hse();yse();GV();IK();Ase();Ose();Hse();KK();Gse();Ue();Ue();kC();Yse();ele();nle();jr();bi();hh();Qa();qc();tO();$r();sn();bz();xK();yC();_C();Sle();Mle();XK();Ts();up=he($e()),bRe=new Map,JK=Ct.default.memo((0,Ct.forwardRef)(function(e,n){let{app:r,isMobile:o,plugin:a,fileSystemOps:i,propertyTreeService:s,tagOperations:l,propertyOperations:c}=vt(),u=vl(),p=Zo(),m=la(),g=Wa(),f=nd(),h=ar(),b=yt(),y=Sl(),v=bl(),S=jt(),w=Qr(),T=So(),{fileData:F,getFile:k,getFileDisplayName:P,getFileTimestamps:E,isStorageReady:C}=_o(),L=(0,Ct.useCallback)(je=>k(je.path)?.wordCount??null,[k]),{startPointerDrag:z}=xA(),{searchNavFilters:G,onExecuteSearchShortcut:Q,rootContainerRef:R,onNavigateToFolder:O,onRevealTag:D,onRevealProperty:x,onRevealFile:B,onRevealShortcutFile:I,onModifySearchWithTag:A,onModifySearchWithProperty:N,onModifySearchWithDateFilter:M,uiScale:H}=e,q=S.showHiddenItems,X=S.showCalendar,V=!w.singlePane&&w.effectiveDualPaneOrientation==="vertical",j=b.calendarEnabled&&b.calendarPlacement==="left-sidebar"&&X&&(!w.singlePane&&!V||w.singlePane&&b.calendarLeftPlacement==="navigation"&&w.currentSinglePaneView==="navigation"),[_,W]=(0,Ct.useState)(()=>b.calendarWeeksToShow);(0,Ct.useEffect)(()=>{b.calendarWeeksToShow!==6&&W(b.calendarWeeksToShow)},[b.calendarWeeksToShow]);let J=(0,Ct.useRef)(null),Z=(0,Ct.useRef)(null),re=(0,Ct.useRef)(null),[Y,ne]=(0,Ct.useState)(null),[le,ae]=(0,Ct.useState)(!1),ve=(0,Ct.useRef)(null),de=(0,Ct.useRef)(0),Pe=Number.isFinite(H)&&H>0?H:1,Fe=(0,Ct.useCallback)(je=>{ne(je)},[]),[te,ye]=(0,Ct.useState)(()=>{let je=Te.get(lt.pinnedShortcutsMaxHeightKey);return typeof je!="number"||!Number.isFinite(je)||je<=0?null:Math.max(dc.pinnedShortcutsMinHeight,Math.round(je))}),[ce,pe]=(0,Ct.useState)(!1),ue=(0,Ct.useCallback)(je=>{let Bt=je??Y;if(!Bt){ae(!1);return}let ge=Bt.scrollHeight-Bt.clientHeight>1;ae(ke=>ke===ge?ke:ge)},[Y]),Se=(0,Ct.useCallback)(je=>{de.current=je,ve.current===null&&(ve.current=window.requestAnimationFrame(()=>{ve.current=null,ye(de.current)}))},[]);(0,Ct.useEffect)(()=>()=>{ve.current!==null&&(cancelAnimationFrame(ve.current),ve.current=null)},[]),(0,Ct.useLayoutEffect)(()=>{let je=Y;if(!je){ae(!1);return}if(ue(je),typeof ResizeObserver>"u")return;let Bt=new ResizeObserver(()=>{ue(je)});return Bt.observe(je),()=>{Bt.disconnect()}},[Y,ue]);let ee=(0,Ct.useCallback)(je=>{if(je.pointerType==="mouse"&&je.button!==0)return;let Bt=re.current,ge=Y;if(!Bt||!ge)return;let ke=!o,Re=Math.round(je.currentTarget.getBoundingClientRect().height/Pe),qe=Math.round(ge.scrollHeight+Re),Rt=Math.min(dc.pinnedShortcutsMinHeight,qe),sr=Math.min(Math.round(Bt.getBoundingClientRect().height/Pe),qe),Dr=je.clientY,Mo=sr;je.preventDefault(),je.stopPropagation(),ke&&pe(!0);let ci=To=>Math.min(Math.max(To,Rt),qe);Se(Mo),z({event:je,onMove:To=>{let ko=(To.clientY-Dr)/Pe;Mo=ci(sr+ko),Se(Mo)},onEnd:()=>{ve.current!==null&&(cancelAnimationFrame(ve.current),ve.current=null);let To=Math.round(ge.scrollHeight+Re);Mo>=To-2?(ye(null),Te.remove(lt.pinnedShortcutsMaxHeightKey)):(Te.set(lt.pinnedShortcutsMaxHeightKey,Mo),ye(Mo)),ke&&pe(!1)}})},[o,Y,Pe,Se,z]),[ie,Ce]=(0,Ct.useState)(()=>{let je=Te.get(lt.navigationSectionOrderKey);return OK(je)}),[we,Le]=(0,Ct.useState)(!0),[We,Nt]=(0,Ct.useState)(!0),[Pt,Zt]=(0,Ct.useState)(!0),[ze,Ie]=(0,Ct.useState)(null),De=(0,Ct.useCallback)(()=>{Le(je=>!je)},[]),Me=(0,Ct.useCallback)(()=>{Nt(je=>!je)},[]),nt=(0,Ct.useCallback)(()=>{Zt(je=>!je)},[]),[Ge,Tt]=(0,Ct.useState)(!1),gt=(0,Ct.useCallback)(()=>{let je=nn(a.settings);new Qv(r,{initialKeys:je.propertyKeys,onSave:async ge=>{je.propertyKeys=ge,await a.saveSettingsAndUpdate()}}).open()},[r,a]),wn=(0,Ct.useRef)(new Map),it=(0,Ct.useRef)(new Map),yn=(0,Ct.useRef)(new Map),rt=Mse({rootContainerRef:R,isRootReorderMode:Ge,onExecuteSearchShortcut:Q,onNavigateToFolder:O,onRevealTag:D,onRevealProperty:x,onRevealFile:B,onRevealShortcutFile:I,getFolderCounts:()=>wn.current,getTagCounts:()=>it.current,getPropertyCounts:()=>yn.current,onConfigurePropertyKeys:gt}),me=(0,Ct.useRef)(rt);me.current=rt;let se=oO(rt,["removeShortcut","handleShortcutFolderActivate","handleShortcutFolderNoteClick","handleShortcutFolderNoteMouseDown","handleShortcutNoteActivate","handleShortcutNoteMouseDown","handleRecentNoteActivate","handleShortcutSearchActivate","handleShortcutTagActivate","handleShortcutPropertyActivate","handleShortcutContextMenu","handleRecentFileContextMenu","handleShortcutRootDragOver","handleShortcutRootDrop","buildShortcutExternalHandlers","getFolderShortcutCount","getTagShortcutCount","getPropertyShortcutCount","getMissingNoteLabel"]),fe=(0,Ct.useMemo)(()=>({shouldUseShortcutDnd:rt.shouldUseShortcutDnd,allowEmptyShortcutDrop:rt.allowEmptyShortcutDrop,shortcutDragHandleConfig:rt.shortcutDragHandleConfig,shortcutHeaderTrailingAction:rt.shortcutHeaderTrailingAction,propertiesHeaderTrailingAction:rt.propertiesHeaderTrailingAction,shortcutNumberBadgesByKey:rt.shortcutNumberBadgesByKey,shouldShowShortcutCounts:rt.shouldShowShortcutCounts}),[rt.shouldUseShortcutDnd,rt.allowEmptyShortcutDrop,rt.shortcutDragHandleConfig,rt.shortcutHeaderTrailingAction,rt.propertiesHeaderTrailingAction,rt.shortcutNumberBadgesByKey,rt.shouldShowShortcutCounts]),Ne=w.dualPane||w.currentSinglePaneView==="navigation",{items:xe,firstSectionId:Be,firstInlineFolderPath:dt,shortcutItems:St,pinnedRecentNotesItems:ln,shouldPinRecentNotes:vn,tagsVirtualFolderHasChildren:In,propertiesSectionActive:eo,pathToIndex:Dt,tagCounts:an,propertyCounts:Sn,folderCounts:_r,rootLevelFolders:Gn,missingRootFolderPaths:mn,resolvedRootTagKeys:ir,rootOrderingTagTree:Zn,missingRootTagPaths:Fr,resolvedRootPropertyKeys:co,rootOrderingPropertyTree:Cr,missingRootPropertyKeys:ud,vaultChangeVersion:Ye,navigationBannerPath:bt}=dse({settings:b,isVisible:Ne,sourceState:e.navigationSourceState,treeSections:e.navigationTreeSections,folderDecorationModel:e.folderDecorationModel,navRainbowState:e.navRainbowState,shortcutsExpanded:rt.shortcutsExpanded,recentNotesExpanded:rt.recentNotesExpanded,pinShortcuts:w.pinShortcuts&&b.showShortcuts,sectionOrder:ie});wn.current=_r,it.current=an,yn.current=Sn;let Wt=Dse({app:r,commandQueue:u,settings:b,uiState:w,expansionState:m,expansionDispatch:g,selectionState:f,selectionDispatch:h,uiDispatch:T,propertyTreeService:s,tagTree:e.navigationTreeSections.renderTagTree,propertyTree:e.navigationTreeSections.renderPropertyTree,tagsVirtualFolderHasChildren:In,setShortcutsExpanded:rt.setShortcutsExpanded,setRecentNotesExpanded:rt.setRecentNotesExpanded,clearActiveShortcut:rt.clearActiveShortcut,openFolderNoteInRightSidebar:je=>a.openFolderNoteInRightSidebar(je),onModifySearchWithTag:A,onModifySearchWithProperty:N}),Ze=_se({searchNavFilters:G});(0,Ct.useEffect)(()=>{if(!C)return;let je=m.expandedTags.size>0,Bt=m.expandedProperties.size>0;if(!je&&!Bt)return;let ge=je?new Set:null,ke=Bt?new Set:null;if(ge){let Re=new Set;F.tagTree.forEach(qe=>{Hl(qe,ge,Re)})}ke&&F.propertyTree.forEach(Re=>{ke.add(Re.id),Re.children.forEach(qe=>{ke.add(qe.id)})}),ge&&g({type:"CLEANUP_DELETED_TAGS",existingTags:ge}),ke&&g({type:"CLEANUP_DELETED_PROPERTIES",existingPropertyNodeIds:ke})},[g,m.expandedProperties.size,m.expandedTags.size,F.propertyTree,F.tagTree,C]);let Vt=(0,Ct.useMemo)(()=>b.showIndentGuides?Zee(xe,Yc):bRe,[xe,b.showIndentGuides]),xn=(0,Ct.useMemo)(()=>{let je=w.pinShortcuts&&b.showShortcuts?St:[],Bt=vn?ln:[],ge=OK(ie),ke=[];return ge.forEach(Re=>{Re===Ot.RECENT&&vn&&ke.push(...Bt),Re===Ot.SHORTCUTS&&w.pinShortcuts&&b.showShortcuts&&ke.push(...je)}),ke},[ln,ie,b.showShortcuts,St,vn,w.pinShortcuts]),ur=!!(bt&&!Ge)&&bt?(0,up.jsx)(qse,{path:bt}):null,jn=xn.length>0&&!Ge;(0,Ct.useLayoutEffect)(()=>{ue(Y)},[xn,Y,ue]);let ft=fse(Z,{enabled:!!ur&&!b.pinNavigationBanner}),Tn=!!bt,Jn=e.navRainbowState.navRainbow,{getSolidBackground:qn}=ZD(J,{app:r,rootContainerRef:R,variables:Eie,solidBackgroundRevision:Jn}),{reorderableRootFolders:ii,reorderableRootTags:er,reorderableRootProperties:Ii,sectionReorderItems:hs,folderReorderItems:rc,tagReorderItems:si,propertyReorderItems:iu,canReorderSections:su,canReorderRootFolders:xa,canReorderRootTags:Wo,canReorderRootProperties:pp,canReorderRootItems:to,showRootFolderSection:xi,showRootTagSection:Am,showRootPropertySection:pd,resetRootTagOrderLabel:lu,resetRootPropertyOrderLabel:no,handleResetRootFolderOrder:Ea,handleResetRootTagOrder:du,handleResetRootPropertyOrder:md,reorderSectionOrder:gd,reorderRootFolderOrder:mp,reorderRootTagOrder:Il,reorderRootPropertyOrder:Dm}=mse({app:r,items:xe,settings:b,showHiddenItems:q,updateSettings:v,sectionOrder:ie,setSectionOrder:Ce,rootLevelFolders:Gn,missingRootFolderPaths:mn,resolvedRootTagKeys:ir,rootOrderingTagTree:Zn,missingRootTagPaths:Fr,resolvedRootPropertyKeys:co,rootOrderingPropertyTree:Cr,missingRootPropertyKeys:ud,metadataService:p,foldersSectionExpanded:we,tagsSectionExpanded:We,propertiesSectionExpanded:Pt,propertiesSectionActive:eo,handleToggleFoldersSection:De,handleToggleTagsSection:Me,handleTogglePropertiesSection:nt,activeProfile:y});(0,Ct.useEffect)(()=>{Ge&&!to&&Tt(!1)},[to,Ge]);let ta=(0,Ct.useCallback)(()=>{to&&Tt(je=>!je)},[to]),uo=QC.Platform.isAndroidApp,wo=Xa(),Ws=wo&&QC.Platform.isIosApp&&b.useFloatingToolbars,Om=(0,Ct.useMemo)(()=>Ws?pN:0,[Ws]),{rowVirtualizer:fs,scrollContainerRef:li,scrollContainerRefCallback:cu,requestScroll:ma}=use({items:xe,pathToIndex:Dt,isVisible:Ne,activeShortcutKey:rt.activeShortcutKey,scrollMargin:ft,scrollPaddingEnd:Om}),Lm=(0,Ct.useCallback)(()=>{let je=()=>{let Bt=li.current??J.current??e.rootContainerRef.current;Bt&&Gi(Bt)};if(typeof window.requestAnimationFrame=="function"){window.requestAnimationFrame(je);return}window.setTimeout(je,0)},[e.rootContainerRef,li]);(0,Ct.useEffect)(()=>{Ge||fs.measure()},[Ge,ft,ii,Ii,er,fs,ie]),(0,Ct.useEffect)(()=>{if(!Ge)return;fs.scrollToOffset(0,{align:"start",behavior:"auto"});let je=li.current;je&&je.scrollTo({top:0,behavior:"auto"})},[Ge,fs,li]);let Ei=(0,Ct.useCallback)(()=>{let je=WE(f);if(!je)return;let Bt=f.selectionType===K.TAG?K.TAG:f.selectionType===K.PROPERTY?K.PROPERTY:K.FOLDER;ma(bm(Bt,je),{align:"auto",itemType:Bt})},[ma,f]),ys=(0,Ct.useRef)(j),hd=(0,Ct.useRef)(_),oc=(0,Ct.useRef)(b.showAllTagsFolder);(0,Ct.useEffect)(()=>{let je=ys.current,Bt=hd.current,ge=j&&!je,ke=j&&_!==Bt;if(ys.current=j,hd.current=_,!ge&&!ke)return;let Re=()=>Ei();if(typeof requestAnimationFrame<"u"){window.requestAnimationFrame(()=>{window.requestAnimationFrame(Re)});return}window.setTimeout(Re,0)},[_,Ei,j]),(0,Ct.useEffect)(()=>{b.showAllTagsFolder&&!oc.current&&b.showAllTagsFolder&&!m.expandedVirtualFolders.has(_n)&&g({type:"TOGGLE_VIRTUAL_FOLDER_EXPANDED",folderId:_n}),oc.current=b.showAllTagsFolder},[g,m.expandedVirtualFolders,b.showAllTagsFolder]);let ac=(0,Ct.useCallback)(()=>{if(Ge)return null;let je=(Bt,ge)=>{let ke=kl(Dt,Bt,ge);return ke===void 0?null:xe[ke]??null};return f.selectionType===K.FOLDER&&f.selectedFolder?.path?je(K.FOLDER,f.selectedFolder.path):f.selectionType===K.TAG&&f.selectedTag?je(K.TAG,f.selectedTag):f.selectionType===K.PROPERTY&&f.selectedProperty?je(K.PROPERTY,f.selectedProperty):null},[Ge,xe,Dt,f.selectedFolder,f.selectedProperty,f.selectedTag,f.selectionType]),fd=(0,Ct.useCallback)(je=>Use(je,Bt=>i.getFolderDisplayNameRenameInput(Bt).initialValue),[i]),Oh=(0,Ct.useCallback)(()=>{let je=ac();if(!je)return!1;let Bt=fd(je);return Bt?(Ie(Bt),!0):!1},[fd,ac]),ic=(0,Ct.useCallback)(je=>{if(Ge)return!1;let Bt=kl(Dt,K.FOLDER,je.path);if(Bt===void 0)return!1;let ge=xe[Bt];if(!ge||ge.type!==be.FOLDER)return!1;let ke=fd(ge);return ke?(Ie(ke),ma(je.path,{align:"auto",itemType:K.FOLDER}),!0):!1},[fd,Ge,xe,Dt,ma]),sc=(0,Ct.useCallback)(()=>{Ie(null)},[]),gp=(0,Ct.useCallback)(async(je,Bt)=>{let ge=Bt.trim();if(je.type==="folder"){let Re=je.id==="/"?r.vault.getRoot():r.vault.getFolderByPath(je.id);if(!(Re instanceof QC.TFolder))return Ie(null),!0;let qe=await i.renameFolderDisplayName(Re,Bt,b);return qe&&Ie(null),qe}if(je.type==="tag"){if(!l)return!1;if(ge===je.initialValue.trim())return Ie(null),!0;let Re=await l.renameTag(je.id,Kse(je.displayPath,ge));return Re&&Ie(null),Re}if(!c)return!1;if(ge===je.initialValue.trim())return Ie(null),!0;let ke=await c.renamePropertyKey(je.normalizedKey,Bt);return ke&&Ie(null),ke},[r.vault,i,c,b,l]);(0,Ct.useEffect)(()=>{Ge&&Ie(null)},[Ge]);let uu=(0,Ct.useCallback)(()=>{let je=ac();if(!je)return!1;let Bt=gh(je,{showHiddenItems:q,showRootFolder:b.showRootFolder});return Bt?Zd(Bt,m,g,"toggle",{collapseOtherBranches:b.collapseOtherBranchesOnExpand}):!1},[g,m,ac,b.collapseOtherBranchesOnExpand,b.showRootFolder,q]);(0,Ct.useImperativeHandle)(n,()=>({getIndexOfPath:(je,Bt)=>kl(Dt,je,Bt)??-1,virtualizer:fs,scrollContainerRef:li.current,requestScroll:ma,triggerSelectedItemCollapse:uu,openShortcutByNumber:rt.openShortcutByNumber}),[Dt,ma,fs,li,rt.openShortcutByNumber,uu]);let pu=Ge?[]:xe,hp=Ge?new Map:Dt;Die({items:pu,virtualizer:fs,containerRef:e.rootContainerRef,pathToIndex:hp,onStartRename:Oh});let lc=(0,Ct.useMemo)(()=>({...e.style??{},"--nn-calendar-week-count":_}),[_,e.style]),mu=(0,Ct.useMemo)(()=>(0,up.jsx)(tle,{onTreeUpdateComplete:Ei,onToggleRootFolderReorder:ta,rootReorderActive:Ge,rootReorderDisabled:!to,useFloatingLayout:Ws}),[to,ta,Ei,Ge,Ws]),yd=!wo&&(b.vaultProfiles??[]).length>1&&(b.vaultTitle??"navigation")==="header",zm=!wo&&(b.vaultProfiles??[]).length>1&&(b.vaultTitle??"navigation")==="navigation",Bm=(0,Ct.useCallback)((je,Bt,ge)=>{let ke=me.current;J1({app:r,event:je,sectionId:Bt,allowSeparator:ge?.allowSeparator,metadataService:p,settings:b,plugin:a,pinToggleLabel:ke.pinToggleLabel,isShortcutsPinned:w.pinShortcuts,onToggleShortcutsPin:ke.handleShortcutSplitToggle,onConfigurePropertyKeys:gt,shortcutActions:{shortcutsCount:ke.shortcutsCount,tagShortcutKeysByPath:ke.tagShortcutKeysByPath,propertyShortcutKeysByNodeId:ke.propertyShortcutKeysByNodeId,addTagShortcut:ke.addTagShortcut,addPropertyShortcut:ke.addPropertyShortcut,removeShortcut:ke.removeShortcut,clearShortcuts:ke.clearShortcuts}})},[r,gt,p,a,b,w.pinShortcuts]),Gs=(0,Ct.useMemo)(()=>({app:r,settings:b,isMobile:o,indentGuideLevelsByKey:Vt,firstSectionId:Be,firstInlineFolderPath:dt,shouldPinShortcuts:w.pinShortcuts&&b.showShortcuts,showHiddenItems:q,folderCounts:_r,tagCounts:an,propertyCounts:Sn,vaultChangeVersion:Ye,fileVisibility:y.fileVisibility,hiddenFolders:y.hiddenFolders,descendantExcludedFolders:y.descendantExcludedFolders,getFileDisplayName:P,getFileTimestamps:E,getFileWordCount:L,getSolidBackground:qn,shortcuts:se,shortcutUiState:fe,tree:Wt,searchHighlights:Ze,inlineRename:{startFolder:ic,commit:gp,cancel:sc,restoreFocus:Lm},onSectionContextMenu:Bm}),[r,dt,Be,_r,y.fileVisibility,y.hiddenFolders,y.descendantExcludedFolders,P,E,L,qn,Bm,sc,gp,ic,Vt,o,Sn,Ze,b,se,fe,q,an,Wt,w.pinShortcuts,Lm,Ye]),vd=(0,Ct.useCallback)(je=>{let Bt=!1,ge=!1;switch(je.type){case be.FOLDER:Bt=da(je.data.path,m.expandedFolders,b.showRootFolder);break;case be.VIRTUAL_FOLDER:{let Re=je.data.id;Bt=Re===qa?rt.shortcutsExpanded:Re===Ya?rt.recentNotesExpanded:m.expandedVirtualFolders.has(Re);break}case be.TAG:case be.UNTAGGED:Bt=m.expandedTags.has(je.data.path);break;case be.PROPERTY_KEY:case be.PROPERTY_VALUE:Bt=m.expandedProperties.has(je.data.id);break;case be.SHORTCUT_FOLDER:case be.SHORTCUT_NOTE:case be.SHORTCUT_SEARCH:case be.SHORTCUT_TAG:case be.SHORTCUT_PROPERTY:ge=rt.shouldUseShortcutDnd&&rt.activeShortcutId===je.key;break;default:break}let ke=ze?Wse(je,ze):null;return{isSelected:$K(je,f),isExpanded:Bt,renameTarget:ke,isDragSource:ge}},[m,ze,f,b.showRootFolder,rt.shortcutsExpanded,rt.recentNotesExpanded,rt.shouldUseShortcutDnd,rt.activeShortcutId]),di=(0,Ct.useCallback)(je=>fle({item:je,selectionState:f,searchHighlights:Ze,getSolidBackground:qn}),[qn,Ze,f]),_i=(0,Ct.useCallback)((je,Bt,ge)=>(0,up.jsx)(ble,{item:je,context:Gs,adjacentFilledClassName:Bt,isSelected:ge.isSelected,isExpanded:ge.isExpanded,renameTarget:ge.renameTarget,isDragSource:ge.isDragSource}),[Gs]),xl=(0,up.jsx)(Jse,{sectionItems:hs,folderItems:rc,tagItems:si,propertyItems:iu,showRootFolderSection:xi,showRootTagSection:Am,showRootPropertySection:pd,foldersSectionExpanded:we,tagsSectionExpanded:We,propertiesSectionExpanded:Pt,showRootFolderReset:b.rootFolderOrder.length>0,showRootTagReset:b.rootTagOrder.length>0,showRootPropertyReset:b.rootPropertyOrder.length>0,resetRootTagOrderLabel:lu,resetRootPropertyOrderLabel:no,onResetRootFolderOrder:Ea,onResetRootTagOrder:du,onResetRootPropertyOrder:md,onReorderSections:gd,onReorderFolders:mp,onReorderTags:Il,onReorderProperties:Dm,canReorderSections:su,canReorderFolders:xa,canReorderTags:Wo,canReorderProperties:pp,isMobile:o});return(0,up.jsx)(Kw,{sensors:rt.shouldUseShortcutDnd?rt.shortcutSensors:[],collisionDetection:rt.shouldUseShortcutDnd?BC:void 0,modifiers:rt.shouldUseShortcutDnd?[qw]:void 0,onDragStart:rt.shouldUseShortcutDnd?rt.handleShortcutDragStart:void 0,onDragEnd:rt.shouldUseShortcutDnd?rt.handleShortcutDragEnd:void 0,onDragCancel:rt.shouldUseShortcutDnd?rt.handleShortcutDragCancel:void 0,autoScroll:rt.shouldUseShortcutDnd?!1:void 0,children:(0,up.jsx)(Ww,{items:rt.shouldUseShortcutDnd?rt.shortcutIds:[],strategy:Uw,children:(0,up.jsx)(Rle,{navigationPaneRef:J,navigationPaneStyle:lc,shouldRenderCalendarOverlay:j,isShortcutSorting:rt.isShortcutSorting,isMobile:o,isPinnedShortcutsResizing:ce,onTreeUpdateComplete:Ei,onToggleRootReorder:ta,rootReorderActive:Ge,rootReorderDisabled:!to,showVaultTitleInHeader:yd,shouldShowVaultTitleInNavigationPane:zm,showAndroidToolbar:wo&&uo,navigationToolbar:mu,pinNavigationBanner:b.pinNavigationBanner,navigationBannerContent:ur,shouldRenderPinnedShortcuts:jn,pinnedShortcutsContainerRef:re,pinnedShortcutsHasOverflow:le,pinnedShortcutsMaxHeight:te,allowEmptyShortcutDrop:rt.allowEmptyShortcutDrop,onShortcutRootDragOver:rt.handleShortcutRootDragOver,onShortcutRootDrop:rt.handleShortcutRootDrop,pinnedShortcutsScrollRefCallback:Fe,pinnedNavigationItems:xn,renderNavigationItem:_i,getRowHotState:vd,isNavigationItemFilled:di,onPinnedShortcutsResizePointerDown:ee,scrollContainerRefCallback:cu,hasNavigationBannerConfigured:Tn,navigationBannerRef:Z,rootReorderContent:xl,isRootReorderMode:Ge,items:xe,rowVirtualizer:fs,navigationScrollMargin:ft,shouldRenderBottomToolbarInsidePanel:wo&&!uo&&Ws,shouldRenderBottomToolbarOutsidePanel:wo&&!uo&&!Ws,calendarOverlay:j?(0,up.jsx)("div",{className:"nn-navigation-calendar-overlay",children:(0,up.jsx)(Cm,{onWeekCountChange:W,onAddDateFilter:M})}):null})})})}))});var Dle=U(()=>{Ale()});var Ole=U(()=>{});function Lle({isActive:t,resetKey:e,onDismiss:n}){let[r,o]=(0,iT.useState)(!1),[a,i]=(0,iT.useState)(!1);return(0,iT.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,iT.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 iT,zle=U(()=>{iT=he(Ve());Ole()});function Ble({notice:t,onDismiss:e}){let[n,r]=(0,_y.useState)(null);(0,_y.useEffect)(()=>{t&&r(t)},[t]);let o=(0,_y.useCallback)(()=>{n&&(e(n.version),r(null))},[n,e]),a=(0,_y.useCallback)(()=>{window.open("obsidian://show-plugin?id=notebook-navigator"),o()},[o]),{isVisible:i,isFading:s}=Lle({isActive:n!==null,resetKey:n?.version??null,onDismiss:o});return!i||!n?null:(0,sT.jsx)("button",{type:"button",className:`nn-update-banner${s?" fade-out":""}`,onClick:a,"aria-label":d.common.updateBannerTitle,title:d.common.updateBannerInstruction,children:(0,sT.jsxs)("div",{className:"nn-update-banner__text",children:[(0,sT.jsx)("span",{className:"nn-update-banner__label",children:d.common.updateBannerTitle}),(0,sT.jsx)("span",{className:"nn-update-banner__instruction",children:d.common.updateBannerInstruction})]})})}var _y,sT,_le=U(()=>{_y=he(Ve());Oe();zle();sT=he($e())});function Hle(t){if(!t)return!1;let e=zl(t);return e===eU?!1:!e.includes("/")}function TRe(t,e){let n=new Map;e.forEach(s=>{n.set(zl(s.path),s)});let r=new Set,o=[],a=[];return t.forEach(s=>{let l=zl(s);!l||l===eU||r.has(l)||(r.add(l),o.push(l),n.has(l)||a.push(l))}),e.filter(s=>!r.has(zl(s.path))).sort((s,l)=>At(s.name,l.name)).map(s=>zl(s.path)).forEach(s=>{r.has(s)||(r.add(s),o.push(s))}),{normalizedOrder:o,missingPaths:a}}function kRe(t,e){return t.slice().sort((n,r)=>pK(n,r,e))}function Vle({settings:t,showHiddenItems:e,onFileChange:n,onFolderChange:r}){let{app:o}=vt(),a=bl(),[i,s]=(0,ru.useState)([]),[l,c]=(0,ru.useState)([]),[u,p]=(0,ru.useState)(new Map),[m,g]=(0,ru.useState)([]),f=(0,ru.useRef)({renames:new Map,removals:new Set,additions:new Set}),h=(0,ru.useRef)(t.rootFolderOrder);return(0,ru.useEffect)(()=>{h.current=t.rootFolderOrder.slice()},[t.rootFolderOrder]),(0,ru.useEffect)(()=>{let b=f.current,y=t.showRootFolder||e,v=()=>{let L=o.vault.getRoot(),z=L.children.filter(x=>x instanceof ou.TFolder),G=h.current.slice();if((b.renames.size>0||b.removals.size>0||b.additions.size>0)&&(b.renames.forEach((x,B)=>{let I=G.indexOf(B);I!==-1&&(G[I]=x)}),b.removals.size>0&&(G=G.filter(x=>!b.removals.has(x))),b.additions.forEach(x=>{G.includes(x)||G.push(x)}),b.renames.clear(),b.removals.clear(),b.additions.clear()),h.current.length===0){let x=t.folderSortOrder==="alpha-desc"?-1:1,B=z.slice().sort((I,A)=>At(I.name,A.name)*x);b.renames.clear(),b.removals.clear(),b.additions.clear(),c(B),s(y?[L]:B),p(new Map),g(I=>I.length===0?I:[]);return}let{normalizedOrder:Q,missingPaths:R}=TRe(G,z),O=Eg(Q),D=kRe(z,O);ao(Q,h.current)||(h.current=Q,$(async()=>{await a(x=>{x.rootFolderOrder=Q})})),g(x=>ao(x,R)?x:R),c(D),s(y?[L]:D),p(O)},S=C=>{n&&n(C)},w=()=>{r&&r()};v();let T=(0,ou.debounce)(v,_t.FILE_OPERATION_DELAY,!0),F=C=>{let L=zl(C.path);C.parent===o.vault.getRoot()&&L!==eU&&b.additions.add(L),T()},k=C=>{let L=zl(C.path);Hle(L)&&b.removals.add(L),T()},P=(C,L)=>{let z=zl(L),G=zl(C.path),Q=C.parent===o.vault.getRoot(),R=Hle(z);R&&Q?z!==G&&b.renames.set(z,G):R&&!Q?b.removals.add(z):!R&&Q&&b.additions.add(G),T()},E=[o.vault.on("create",C=>{C instanceof ou.TFolder&&(F(C),w()),C instanceof ou.TFile&&S({type:"create",path:C.path})}),o.vault.on("delete",C=>{C instanceof ou.TFolder&&(k(C),w()),C instanceof ou.TFile&&S({type:"delete",path:C.path})}),o.vault.on("rename",(C,L)=>{C instanceof ou.TFolder&&(P(C,L),w()),C instanceof ou.TFile&&S({type:"rename",path:C.path,oldPath:L})})];return()=>{E.forEach(C=>o.vault.offref(C)),T.cancel()}},[o,n,r,t.showRootFolder,t.rootFolderOrder,t.folderSortOrder,e,a]),{rootFolders:i,rootLevelFolders:l,rootFolderOrderMap:u,missingRootFolderPaths:m}}var ru,ou,eU,Kle=U(()=>{ru=he(Ve()),ou=require("obsidian");fn();on();Ln();ll();Dw();po();ra();st();eU="/"});function Ule({app:t,settings:e,activeProfile:n,metadataService:r,showHiddenItems:o,onFileChange:a}){let{hiddenFolders:i,hiddenFileProperties:s,hiddenFileNames:l,hiddenFileTags:c}=n,u=(0,br.useMemo)(()=>Sc(l,!1),[l]),p=(0,br.useMemo)(()=>oo(s),[s]),m=(0,br.useMemo)(()=>zo({enableFolderNotes:e.enableFolderNotes,folderNoteNamePattern:e.folderNoteNamePattern}),[e.enableFolderNotes,e.folderNoteNamePattern]),g=(0,br.useMemo)(()=>e.enableFolderNotes&&(p.hasCriteria||u!==null||c.length>0),[e.enableFolderNotes,p,c,u]),f=(0,br.useCallback)(J=>{if(!g)return!1;let Z=Qs(J);if(Z==="/")return!1;let re=J.split("/").pop();if(!re)return!1;let Y=re.lastIndexOf(".");if(Y<=0||Y===re.length-1)return!1;let ne=re.slice(0,Y),le=re.slice(Y+1).toLowerCase(),ae=Pu(Z),ve=cc(ae,m);return ne===ve&&FRe.has(le)?!0:le==="md"&&ne===`${ve}${Oa}`},[m,g]),[h,b]=(0,br.useState)(0),[y,v]=(0,br.useState)(0),[S,w]=(0,br.useState)(0),T=(0,br.useRef)(null),F=(0,br.useRef)(null),k=(0,br.useCallback)(()=>{T.current!==null&&(window.clearTimeout(T.current),T.current=null),F.current!==null&&(window.clearTimeout(F.current),F.current=null)},[]),P=(0,br.useCallback)(()=>{k(),v(J=>J+1)},[k]),E=(0,br.useCallback)(()=>{T.current!==null&&window.clearTimeout(T.current),T.current=window.setTimeout(P,_t.NAVIGATION_FILE_CHANGE_DEBOUNCE),F.current===null&&(F.current=window.setTimeout(P,_t.NAVIGATION_FILE_CHANGE_MAX_WAIT))},[P]);(0,br.useEffect)(()=>k,[k]);let C=(0,br.useCallback)(()=>{w(J=>J+1)},[]),L=(0,br.useCallback)(J=>{E(),a?.(J),(f(J.path)||J.oldPath!==void 0&&f(J.oldPath))&&b(Z=>Z+1)},[f,a,E]),{rootFolders:z,rootLevelFolders:G,rootFolderOrderMap:Q,missingRootFolderPaths:R}=Vle({settings:e,showHiddenItems:o,onFileChange:L,onFolderChange:C}),[O,D]=(0,br.useState)(()=>r.getFolderDisplayVersion()),[x,B]=(0,br.useState)(()=>r.getFolderDisplayNameVersion());(0,br.useEffect)(()=>{D(r.getFolderDisplayVersion());let J=(0,Hy.debounce)(re=>{D(re)},_t.FILE_OPERATION_DELAY,!0),Z=r.subscribeToFolderDisplayChanges(re=>{J(re)});return()=>{Z(),J.cancel()}},[r]),(0,br.useEffect)(()=>{B(r.getFolderDisplayNameVersion());let J=(0,Hy.debounce)(re=>{B(re)},_t.FILE_OPERATION_DELAY,!0),Z=r.subscribeToFolderDisplayNameChanges(re=>{J(re)});return()=>{Z(),J.cancel()}},[r]);let[I,A]=(0,br.useState)(0),[N,M]=(0,br.useState)(0),[H,q]=(0,br.useState)(0),[X,V]=(0,br.useState)(0);(0,br.useEffect)(()=>{let J=Ft(),Z=(0,Hy.debounce)(()=>{b(Y=>Y+1)},_t.FILE_OPERATION_DELAY,!0),re=J.onContentChange(Y=>{let ne=!1,le=!1,ae=!1,ve=!1,de=!1,Pe=new Map;for(let Fe of Y){let te=Fe.changes.tags!==void 0,ye=Fe.changes.properties!==void 0,ce=Fe.metadataHiddenChanged===!0;if(Fe.metadataDecorationChanged===!0&&(ne=!0),ce&&(le=!0),te&&(ae=!0),ye&&(ve=!0),!g||de||!(p.hasCriteria&&ce||c.length>0&&te))continue;let ue=Qs(Fe.path),Se=Pe.get(ue);if(Se===void 0){let ee=t.vault.getFolderByPath(ue);Se=ee?Rn(ee,m)?.path??null:null,Pe.set(ue,Se)}Se===Fe.path&&(de=!0)}ne&&A(Fe=>Fe+1),le&&M(Fe=>Fe+1),ae&&q(Fe=>Fe+1),ve&&V(Fe=>Fe+1),de&&Z()});return()=>{re(),Z.cancel()}},[t,m,p.hasCriteria,c.length,g]);let j=(0,br.useMemo)(()=>{let J=new Map,Z=(re,Y)=>(J.size>=PRe&&J.clear(),J.set(re,Y),Y);return re=>{let Y=J.get(re.path);if(Y!==void 0)return Y;if(!e.useFrontmatterMetadata)return Z(re.path,re.name);let ne=ns({app:t,metadataService:r,settings:{customVaultName:e.customVaultName},folderPath:re.path,fallbackName:re.name});return Z(re.path,ne)}},[t,e.customVaultName,e.useFrontmatterMetadata,r,x]),_=(0,br.useMemo)(()=>{if(!g)return;let J=Yr(c,!1),Z=J.hasHiddenRules,re=Z?mr():null,Y=new Map,ne=new Map,le=new Set,ae=de=>{let Pe=Y.get(de.path);if(Pe!==void 0)return Pe;let Fe=Rn(de,m);if(!Fe)return Y.set(de.path,!1),!1;let te=!1;return p.hasCriteria&&oa(Fe,p,t)&&(te=!0),!te&&u&&u.matches(Fe)&&(te=!0),!te&&Z&&Br({app:t,file:Fe,db:re}).some(ce=>!J.isTagVisible(ce))&&(te=!0),Y.set(de.path,te),te},ve=de=>{if(de.path==="/")return!1;let Pe=ne.get(de.path);if(Pe!==void 0)return Pe;if(le.has(de.path))return!1;le.add(de.path);let Fe=ae(de);return!Fe&&de.parent instanceof Hy.TFolder&&(Fe=ve(de.parent)),le.delete(de.path),ne.set(de.path,Fe),Fe};return de=>ve(de)},[t,h,m,u,p,c,g]),W=(0,br.useCallback)(J=>{if(J==="/")return!1;let Z=t.vault.getFolderByPath(J);return Z instanceof Hy.TFolder?i.length>0&&fi(Z,i)?!0:_?_(Z):!1:!1},[t,_,i]);return(0,br.useMemo)(()=>({hiddenFolders:i,rootFolders:z,rootLevelFolders:G,rootFolderOrderMap:Q,missingRootFolderPaths:R,fileChangeVersion:y,folderChangeVersion:S,folderDisplayVersion:O,metadataDecorationVersion:I,metadataVisibilityVersion:N,tagDataVersion:H,propertyDataVersion:X,getFolderSortName:j,folderExclusionByFolderNote:_,isFolderExcluded:W}),[_,S,O,y,j,i,W,I,N,R,X,z,Q,G,H])}var br,Hy,PRe,FRe,Wle=U(()=>{br=he(Ve()),Hy=require("obsidian");Vn();pb();po();wr();em();Tu();Ja();ws();ra();Cn();Hr();Kle();PRe=2e3,FRe=new Set(Object.values(Cc))});function Gle(t,e){let n=(0,lT.useRef)(null),r=(0,lT.useMemo)(()=>{let a=$q(t),i=n.current;return i&&fx(i,a)?i:(n.current=a,a)},[t]),o=(0,lT.useMemo)(()=>T4(r,e),[e,r]);return(0,lT.useMemo)(()=>({navRainbow:r,navRainbowPalettes:o}),[r,o])}var lT,jle=U(()=>{lT=he(Ve());Ig();sn()});function CRe({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,ZC.useMemo)(()=>s?$oe({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,ZC.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,ZC.useMemo)(()=>{let p=o.folder!==null?P4({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 qle(){let{app:t}=vt(),e=Zo(),n=yt(),r=Sl(),o=jt(),a=Ule({app:t,settings:n,activeProfile:r,metadataService:e,showHiddenItems:o.showHiddenItems}),i=vh(t)==="dark",s=Gle(n,i),l=CRe({settings:n,navRainbowState:s,source:a});return(0,ZC.useMemo)(()=>({folderNavigationSource:a,folderDecorationModel:l,navRainbowState:s}),[l,s,a])}var ZC,Yle=U(()=>{ZC=he(Ve());fn();on();gr();Wle();Ig();Dw();jle();uC()});function $le({sourceState:t,treeSections:e,includeDescendantNotes:n,navRainbowState:r}){let o=yt(),{navRainbow:a,navRainbowPalettes:i}=r,s=(0,uO.useMemo)(()=>{let c=i.tag;return c?Zoe({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,uO.useMemo)(()=>{let c=i.property;return c?Joe({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,uO.useMemo)(()=>({navRainbowMode:a.mode,tagRainbowColors:s,propertyRainbowColors:l,inheritPropertyColors:o.inheritPropertyColors}),[a.mode,l,o.inheritPropertyColors,s])}var uO,Xle=U(()=>{uO=he(Ve());on();mK()});function Qle(t){return(e,n)=>-t(e,n)}function Zle(t){let{order:e,compareAlphabetically:n,getFrequency:r}=t;if(e==="alpha-asc")return;if(e==="alpha-desc")return Qle(n);let o=(a,i)=>{let s=r(a)-r(i);return s!==0?s:n(a,i)};return e==="frequency-asc"?o:Qle(o)}function Jle(t,e){return Zle({order:t,compareAlphabetically:JC,getFrequency:e?r=>Fk(r):r=>r.notesWithTag.size})}function pO(t){let{order:e,compareAlphabetically:n,getFrequency:r}=t;return Zle({order:e,compareAlphabetically:n,getFrequency:r})??n}var JC,ede,tde,tU=U(()=>{Ln();Qa();JC=(t,e)=>{let n=At(t.name,e.name);return n!==0?n:t.path.localeCompare(e.path)};ede=(t,e)=>{let n=At(t.name,e.name);return n!==0?n:t.key.localeCompare(e.key)},tde=(t,e)=>{let n=At(t.name,e.name);return n!==0?n:(t.valuePath??"").localeCompare(e.valuePath??"")}});function NRe(t){let e=t.tagComparator??JC;return t.rootTagOrderMap.size===0?e:(n,r)=>Mw(n,r,t.rootTagOrderMap,e)}function nde(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(wt),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(wt)&&i.push(wt),{rootNodeMap:r,resolvedRootTagKeys:i,hasVisibleTags:n.length>0}}function IRe(t){return t.rootPropertyOrderMap.size===0?t.propertyKeyComparator:(e,n)=>xD(e,n,t.rootPropertyOrderMap,t.propertyKeyComparator)}function rde(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 ode({app:t,settings:e,expansionState:n,showHiddenItems:r,includeDescendantNotes:o,sourceState:a,selectionScope:i,tagTreeService:s,propertyTreeService:l}){let c=(0,ea.useMemo)(()=>{let V=!e.showRootFolder&&a.rootFolders.some(J=>J.path==="/"),j=V?new Set(n.expandedFolders).add("/"):n.expandedFolders,_=a.folderExclusionByFolderNote,W=V?J=>J.path==="/"?!0:_?.(J)??!1:_;return Yoe(a.rootFolders,j,a.hiddenFolders,0,new Set,{rootOrderMap:a.rootFolderOrderMap,defaultSortOrder:e.folderSortOrder,childSortOrderOverrides:e.folderTreeSortOverrides,getFolderSortName:a.getFolderSortName,isFolderExcluded:W})},[n.expandedFolders,e.folderSortOrder,e.folderTreeSortOverrides,e.showRootFolder,a.folderExclusionByFolderNote,a.getFolderSortName,a.hiddenFolders,a.rootFolderOrderMap,a.rootFolders]),u=(0,ea.useMemo)(()=>!e.showTags||!e.scopeTagsToCurrentContext?!1:i.selectionType===K.FOLDER?!!i.selectedFolder:i.selectionType===K.PROPERTY?!!i.selectedProperty:!1,[i.selectedFolder,i.selectedProperty,i.selectionType,e.scopeTagsToCurrentContext,e.showTags]),p=i.selectionType===K.PROPERTY?a.propertyDataVersion:0,m=i.selectionType===K.PROPERTY?a.propertyTree:null,g=(0,ea.useMemo)(()=>{if(a.fileChangeVersion,a.tagDataVersion,a.metadataVisibilityVersion,!u)return null;let V=mr();if(!V)return null;let _=ba(i,e,{includeDescendantNotes:o,showHiddenItems:r},t,s,l,{orderResults:!1}).filter(Y=>Y.extension==="md").map(Y=>Y.path),{tagTree:W,tagged:J,untagged:Z}=H2(V,_,a.hiddenTags,r,!1);return{visibleTagTree:r||!a.hiddenMatcherHasRules?W:YI(W,a.hiddenTagMatcher),visibleTaggedCount:J,untaggedCount:Z}},[t,o,u,l,i,e,r,a.fileChangeVersion,a.hiddenMatcherHasRules,a.hiddenTagMatcher,a.hiddenTags,a.metadataVisibilityVersion,a.tagDataVersion,p,m,s]),f=(0,ea.useMemo)(()=>e.showTags?g?.visibleTagTree??a.visibleTagTree:new Map,[g,e.showTags,a.visibleTagTree]),h=(0,ea.useMemo)(()=>NRe({rootTagOrderMap:a.rootTagOrderMap,tagComparator:a.tagComparator}),[a.rootTagOrderMap,a.tagComparator]),b=(0,ea.useMemo)(()=>e.showTags?nde({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]),y=(0,ea.useMemo)(()=>g?nde({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]),v=(0,ea.useMemo)(()=>b.rootNodeMap,[b.rootNodeMap]),S=(0,ea.useMemo)(()=>b.resolvedRootTagKeys,[b.resolvedRootTagKeys]),w=g!==null,F=g?.untaggedCount??a.untaggedCount,k=w?void 0:a.hiddenRootTagNodes,P=y.rootNodeMap,E=y.resolvedRootTagKeys,C=(0,ea.useMemo)(()=>{if(!e.showTags)return[];let V=e.showUntagged&&F>0;return E.filter(j=>k?.has(j)&&!r?!1:j===wt?V:P.has(j))},[k,P,F,E,e.showTags,e.showUntagged,r]),{tagItems:L,tagsVirtualFolderHasChildren:z}=(0,ea.useMemo)(()=>{if(!e.showTags)return{tagItems:[],tagsVirtualFolderHasChildren:!1};let V=[],j=!r,_=a.hiddenMatcherHasRules,W=g,J=f,Z=W?.visibleTaggedCount??a.visibleTaggedCount,re=W?.untaggedCount??a.untaggedCount,Y=W?new Map:a.hiddenRootTagNodes,ne=y.resolvedRootTagKeys,le=e.showUntagged&&re>0,ae=!j&&_?a.hiddenTagMatcher:void 0,{rootNodeMap:ve,hasVisibleTags:de}=y,Pe=o?{current:Z,descendants:0,total:Z}:{current:0,descendants:0,total:0},Fe=Se=>{if(!le)return;let ee={path:wt,displayPath:wt,name:Rc(ql.UNTAGGED).getLabel(),children:new Map,notesWithTag:new Set};V.push({type:be.UNTAGGED,data:ee,key:wt,level:Se,noteCount:{current:re,descendants:0,total:re}})},te=(Se,ee,ie,Ce)=>{let we={id:Se,name:ee,icon:ie};V.push({type:be.VIRTUAL_FOLDER,data:we,level:0,key:Se,isSelectable:!!(Ce?.tagCollectionId||Ce?.propertyCollectionId),tagCollectionId:Ce?.tagCollectionId,propertyCollectionId:Ce?.propertyCollectionId,hasChildren:Ce?.hasChildren,showFileCount:Ce?.showFileCount,noteCount:Ce?.noteCount})};if(J.size===0){if(e.showAllTagsFolder){let Se=_n;return te(Se,d.tagList.tags,Je(e.interfaceIcons,"nav-tags"),{tagCollectionId:Lt,hasChildren:le,showFileCount:e.showNoteCount,noteCount:Pe}),n.expandedVirtualFolders.has(Se)&&le&&Fe(1),{tagItems:V,tagsVirtualFolderHasChildren:le}}return le?(Fe(0),{tagItems:V,tagsVirtualFolderHasChildren:!0}):{tagItems:V,tagsVirtualFolderHasChildren:!1}}let ye=Z>0,ce=de||le||ye,pe=de||le,ue=(Se,ee)=>{let ie=Aw([Se],n.expandedTags,ee,{hiddenMatcher:ae,comparator:h,childSortOrderOverrides:e.tagTreeSortOverrides});V.push(...ie)};if(e.showAllTagsFolder){if(ce){let Se=_n;te(Se,d.tagList.tags,Je(e.interfaceIcons,"nav-tags"),{tagCollectionId:Lt,hasChildren:pe,showFileCount:e.showNoteCount,noteCount:Pe}),n.expandedVirtualFolders.has(Se)&&ne.forEach(ee=>{if(Y.has(ee)&&!r)return;if(ee===wt){Fe(1);return}let ie=ve.get(ee);ie&&ue(ie,1)})}}else ne.forEach(Se=>{if(Y.has(Se)&&!r)return;if(Se===wt){Fe(0);return}let ee=ve.get(Se);ee&&ue(ee,0)});return{tagItems:V,tagsVirtualFolderHasChildren:pe}},[h,n.expandedTags,n.expandedVirtualFolders,o,f,y,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,ea.useMemo)(()=>{if(!e.showProperties)return new Map;let V=new Map;return a.propertyTree.forEach((j,_)=>{a.visiblePropertyNavigationKeySet.has(j.key)&&V.set(_,j)}),V},[e.showProperties,a.propertyTree,a.visiblePropertyNavigationKeySet]),Q=(0,ea.useMemo)(()=>!e.showProperties||!e.scopePropertiesToCurrentContext?!1:i.selectionType===K.FOLDER?!!i.selectedFolder:i.selectionType===K.TAG?!!i.selectedTag:!1,[i.selectedFolder,i.selectedTag,i.selectionType,e.scopePropertiesToCurrentContext,e.showProperties]),R=i.selectionType===K.TAG||i.selectionType===K.FOLDER&&!r&&a.hiddenFileTags.length>0?a.tagDataVersion:0,O=i.selectionType===K.TAG?a.tagTree:null,D=(0,ea.useMemo)(()=>{if(a.fileChangeVersion,a.propertyDataVersion,a.metadataVisibilityVersion,!Q)return null;let V=mr();if(!V)return null;let _=ba(i,e,{includeDescendantNotes:o,showHiddenItems:r},t,s,l,{orderResults:!1}).filter(W=>W.extension==="md").map(W=>W.path);return a.visiblePropertyNavigationKeySet.size===0?{propertyTree:new Map}:{propertyTree:Iq(V,_,{includedPropertyKeys:a.visiblePropertyNavigationKeySet})}},[t,o,Q,l,i,e,r,a.fileChangeVersion,a.metadataVisibilityVersion,a.propertyDataVersion,a.visiblePropertyNavigationKeySet,R,O,s]),x=(0,ea.useMemo)(()=>e.showProperties?D?.propertyTree??G:new Map,[G,D,e.showProperties]),B=(0,ea.useMemo)(()=>IRe({propertyKeyComparator:a.propertyKeyComparator,rootPropertyOrderMap:a.rootPropertyOrderMap}),[a.propertyKeyComparator,a.rootPropertyOrderMap]),I=(0,ea.useMemo)(()=>e.showProperties?rde({propertyTree:G,comparator:B}):{rootNodeMap:new Map,resolvedRootPropertyKeys:[]},[B,G,e.showProperties]),A=(0,ea.useMemo)(()=>D?rde({propertyTree:x,comparator:B}):I,[B,I,x,D]),N=(0,ea.useMemo)(()=>I.rootNodeMap,[I.rootNodeMap]),M=(0,ea.useMemo)(()=>I.resolvedRootPropertyKeys,[I.resolvedRootPropertyKeys]),H=(0,ea.useMemo)(()=>{if(!e.showProperties)return{propertiesSectionActive:!1,keyNodes:[],collectionCount:void 0};let V=A.resolvedRootPropertyKeys.map(J=>A.rootNodeMap.get(J)??null).filter(J=>J!==null),j,_=e.showAllPropertiesFolder;if(e.showNoteCount&&(_||a.hasRootPropertyShortcut))if(!o||V.length===0)j={current:0,descendants:0,total:0};else{let J=new Set;V.forEach(re=>{re.notesWithValue.forEach(Y=>J.add(Y))});let Z=J.size;j={current:Z,descendants:0,total:Z}}return{propertiesSectionActive:!0,keyNodes:V,collectionCount:j}},[o,A,e.showAllPropertiesFolder,e.showNoteCount,e.showProperties,a.hasRootPropertyShortcut]),{propertyItems:q,propertiesSectionActive:X}=(0,ea.useMemo)(()=>{if(!H.propertiesSectionActive)return{propertyItems:[],propertiesSectionActive:!1};let V=_e,j=H.keyNodes,_=H.collectionCount,W=e.showAllPropertiesFolder,J=W?1:0,Z=J+1,re=[];if(W&&(re.push({type:be.VIRTUAL_FOLDER,data:{id:V,name:d.navigationPane.properties,icon:Je(e.interfaceIcons,"nav-properties")},level:0,key:V,isSelectable:!0,propertyCollectionId:_e,hasChildren:j.length>0,showFileCount:e.showNoteCount,noteCount:_}),!n.expandedVirtualFolders.has(V)))return{propertyItems:re,propertiesSectionActive:!0};let Y=(ne,le)=>{let ae=Array.from(le);if(ae.length<=1)return ae;let ve=e.propertyTreeSortOverrides,Pe=!!(ve&&Object.prototype.hasOwnProperty.call(ve,ne.id))?ve?.[ne.id]:void 0,Fe=pO({order:Pe??e.propertySortOrder,compareAlphabetically:tde,getFrequency:te=>o&&te.valuePath?hg(ne,te.valuePath):te.notesWithValue.size});return ae.sort(Fe)};return j.forEach(ne=>{re.push({type:be.PROPERTY_KEY,data:ne,level:J,key:ne.id}),n.expandedProperties.has(ne.id)&&ne.children.size>0&&Y(ne,ne.children.values()).forEach(le=>{re.push({type:be.PROPERTY_VALUE,data:le,level:Z,key:le.id})})}),{propertyItems:re,propertiesSectionActive:!0}},[n.expandedProperties,n.expandedVirtualFolders,o,H.collectionCount,H.keyNodes,H.propertiesSectionActive,e.interfaceIcons,e.propertySortOrder,e.propertyTreeSortOverrides,e.showAllPropertiesFolder,e.showNoteCount]);return{folderItems:c,tagItems:L,renderTagTree:f,renderedRootTagKeys:C,rootOrderingTagTree:v,resolvedRootTagKeys:S,tagsVirtualFolderHasChildren:z,renderPropertyTree:x,rootOrderingPropertyTree:N,propertyItems:q,propertiesSectionActive:X,resolvedRootPropertyKeys:M,propertyCollectionCount:H.collectionCount}}var ea,ade=U(()=>{ea=he(Ve());Oe();Ue();Vn();bi();Qa();un();Dw();lr();Og();tU()});function xRe(t,e){let n=At(t.name,e.name);return n!==0?n:t.key.localeCompare(e.key)}function ERe(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=Ee(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 ide({settings:t,propertyTree:e,comparator:n}){let r=bl(),o=(0,Mh.useMemo)(()=>n||xRe,[n]),a=(0,Mh.useMemo)(()=>!e||e.size===0?[]:Array.from(e.values()),[e]),i=Array.isArray(t.rootPropertyOrder)&&t.rootPropertyOrder.length>0,s=(0,Mh.useMemo)(()=>i?ERe(t.rootPropertyOrder,a,o):{normalizedOrder:[],missingKeys:[]},[o,i,a,t.rootPropertyOrder]);(0,Mh.useEffect)(()=>{i&&(ao(s.normalizedOrder,t.rootPropertyOrder)||$(async()=>{await r(u=>{u.rootPropertyOrder=s.normalizedOrder})}))},[i,s.normalizedOrder,t.rootPropertyOrder,r]);let l=(0,Mh.useMemo)(()=>i?Eg(s.normalizedOrder):new Map,[i,s.normalizedOrder]),c=(0,Mh.useMemo)(()=>i?s.missingKeys:[],[i,s.missingKeys]);return{rootPropertyOrderMap:l,missingRootPropertyKeys:c}}var Mh,sde=U(()=>{Mh=he(Ve());on();ll();st();Et();Ln()});function RRe(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=Mt(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 lde({settings:t,tagTree:e,comparator:n}){let r=bl(),o=(0,Ah.useMemo)(()=>n||((u,p)=>At(u.name,p.name)),[n]),a=(0,Ah.useMemo)(()=>!e||e.size===0?[]:Array.from(e.values()),[e]),i=Array.isArray(t.rootTagOrder)&&t.rootTagOrder.length>0,s=(0,Ah.useMemo)(()=>i?RRe(t.rootTagOrder,a,o):{normalizedOrder:[],missingPaths:[]},[o,i,a,t.rootTagOrder]);(0,Ah.useEffect)(()=>{i&&(ao(s.normalizedOrder,t.rootTagOrder)||$(async()=>{await r(u=>{u.rootTagOrder=s.normalizedOrder})}))},[i,s.normalizedOrder,t.rootTagOrder,r]);let l=(0,Ah.useMemo)(()=>i?Eg(s.normalizedOrder):new Map,[i,s.normalizedOrder]),c=(0,Ah.useMemo)(()=>i?s.missingPaths:[],[i,s.missingPaths]);return{rootTagOrderMap:l,missingRootTagPaths:c}}var Ah,dde=U(()=>{Ah=he(Ve());on();ll();Hr();Ln();st()});function cde({app:t,settings:e,activeProfile:n,folderNavigationSource:r,fileData:o,hydratedShortcuts:a,showHiddenItems:i,includeDescendantNotes:s}){let{hiddenFolders:l,descendantExcludedFolders:c,hiddenFileProperties:u,hiddenFileNames:p,hiddenTags:m,hiddenFileTags:g,fileVisibility:f,navigationBanner:h}=n,b=h,y=Bg(e,i),v=(0,Us.useMemo)(()=>Sc(p,i),[p,i]),S=(0,Us.useMemo)(()=>oo(u),[u]),{hiddenFolders:w,rootFolders:T,rootLevelFolders:F,rootFolderOrderMap:k,missingRootFolderPaths:P,fileChangeVersion:E,folderChangeVersion:C,metadataDecorationVersion:L,metadataVisibilityVersion:z,tagDataVersion:G,propertyDataVersion:Q,getFolderSortName:R,folderExclusionByFolderNote:O}=r,D=(0,Us.useMemo)(()=>o.tagTree??new Map,[o.tagTree]),x=(0,Us.useMemo)(()=>o.propertyTree??new Map,[o.propertyTree]),B=o.untagged,I=(0,Us.useMemo)(()=>Yr(m,i),[m,i]),A=I.matcher,N=I.hasHiddenRules,M=(0,Us.useMemo)(()=>!N||i?D:YI(D,A),[D,N,i,A]),H=o.tagged??0,q=(0,Us.useMemo)(()=>a.some(({shortcut:le,propertyNodeId:ae})=>ya(le)?ae===_e||le.nodeId===_e:!1),[a]),X=(0,Us.useMemo)(()=>Jle(e.tagSortOrder,s),[e.tagSortOrder,s]),V=(0,Us.useMemo)(()=>!e.showTags||i?new Map:o.hiddenRootTags??new Map,[o.hiddenRootTags,i,e.showTags]),j=(0,Us.useMemo)(()=>{if(V.size===0)return D;let le=new Map(D);return V.forEach((ae,ve)=>{le.has(ve)||le.set(ve,ae)}),le},[V,D]),{rootTagOrderMap:_,missingRootTagPaths:W}=lde({settings:e,tagTree:j,comparator:X??JC}),J=(0,Us.useMemo)(()=>pO({order:e.propertySortOrder,compareAlphabetically:ede,getFrequency:le=>s?le.notesWithValue.size:Au(le)}),[s,e.propertySortOrder]),{rootPropertyOrderMap:Z,missingRootPropertyKeys:re}=ide({settings:e,propertyTree:x,comparator:J}),Y=(0,Us.useMemo)(()=>$v(n.propertyKeys,"navigation"),[n.propertyKeys]),ne=(0,Us.useMemo)(()=>vB({hiddenFileProperties:u,hiddenFolders:l,hiddenFileNames:p,hiddenFileTags:g,hideDrawingPreviewImages:e.hideDrawingPreviewImages},t,i),[t,i,u,l,p,g,e.hideDrawingPreviewImages]);return(0,Us.useMemo)(()=>({effectiveFrontmatterExclusions:y,hiddenFolders:w,descendantExcludedFolders:c,hiddenTags:m,hiddenFileProperties:u,hiddenFileNames:p,hiddenFileTags:g,fileVisibility:f,navigationBannerPath:b,folderCountFileNameMatcher:v,hiddenFilePropertyMatcher:S,rootFolders:T,rootLevelFolders:F,rootFolderOrderMap:k,missingRootFolderPaths:P,tagTree:D,propertyTree:x,untaggedCount:B,visibleTaggedCount:H,hiddenTagMatcher:A,hiddenMatcherHasRules:N,visibleTagTree:M,hasRootPropertyShortcut:q,tagComparator:X,hiddenRootTagNodes:V,tagTreeForOrdering:j,rootTagOrderMap:_,missingRootTagPaths:W,propertyKeyComparator:J,rootPropertyOrderMap:Z,missingRootPropertyKeys:re,visiblePropertyNavigationKeySet:Y,metadataDecorationVersion:L,metadataVisibilityVersion:z,tagDataVersion:G,propertyDataVersion:Q,getFolderSortName:R,folderExclusionByFolderNote:O,recentNotesHiddenFileMatcher:ne,fileChangeVersion:E,folderChangeVersion:C}),[y,c,w,m,u,p,g,f,b,v,S,T,F,k,P,D,x,B,H,A,N,M,q,X,V,j,_,W,J,Z,re,Y,L,z,G,Q,R,O,ne,E,C])}var Us,ude=U(()=>{Us=he(Ve());Ue();Ha();Qb();wr();un();Hr();Qa();sn();sde();dde();tU()});var $t,mde,Rm,mO,pde,gde,hde=U(()=>{$t=he(Ve()),mde=require("obsidian");Tl();Ur();fn();on();wa();ph();gr();KV();Ree();Bee();Hee();Vee();EA();Gee();cs();Oe();st();qee();nB();$ee();XV();Ue();bi();hh();ll();MA();ZV();tb();t1();$r();BA();Cn();zu();un();n1();i1();ZS();s1();Aie();Dle();kC();_le();bn();$A();uw();Yle();Xle();vD();ade();ude();Rm=he($e()),mO=(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},gde=$t.default.memo((0,$t.forwardRef)(function(e,n){let{app:r,isMobile:o,fileSystemOps:a,plugin:i,tagTreeService:s,propertyTreeService:l,commandQueue:c,tagOperations:u}=vt(),p=yt(),m=Sl(),g=la(),f=jt(),h=Qr(),b=So(),y=(0,$t.useRef)(f);(0,$t.useEffect)(()=>{y.current=f},[f]);let v=h.effectiveDualPaneOrientation,S=p.desktopBackground??"separate",{scale:w,style:T,dataAttr:F}=KA({isMobile:o,desktopScale:p.desktopScale,mobileScale:p.mobileScale}),k=Pc("horizontal"),P=Pc("vertical"),E=v==="vertical"?P:k,C=hr(),L=ar(),z=C.selectionType===K.FOLDER?C.selectedFolder:null,G=Fw(r.vault,z,p.enableFolderNotes&&p.folderNoteOpenLocation==="right-sidebar"&&p.showNearestFolderNoteInSidebar,{includeAncestors:!0});(0,$t.useEffect)(()=>{$(()=>i.syncFolderNoteSidebarToFolder(z))},[i,G,z,p.enableFolderNotes,p.folderNoteNamePattern,p.folderNoteOpenLocation,p.showNearestFolderNoteInSidebar]);let{folderShortcutKeysByPath:Q,noteShortcutKeysByPath:R,tagShortcutKeysByPath:O,propertyShortcutKeysByNodeId:D,addFolderShortcut:x,addNoteShortcut:B,addTagShortcut:I,addPropertyShortcut:A,removeShortcut:N,hydratedShortcuts:M}=Xd(),H=(0,$t.useMemo)(()=>({selectionType:C.selectionType,selectedFolder:C.selectedFolder,selectedTag:C.selectedTag,selectedProperty:C.selectedProperty}),[C.selectedFolder,C.selectedProperty,C.selectedTag,C.selectionType]),{stopAllProcessing:q,rebuildCache:X,fileData:V}=_o(),{bannerNotice:j,markAsDisplayed:_}=jee(),W=(0,$t.useRef)(q);(0,$t.useEffect)(()=>{W.current=q},[q]);let J=(0,$t.useRef)(X);(0,$t.useEffect)(()=>{J.current=X},[X]);let Z=(0,$t.useRef)(null),[re,Y]=(0,$t.useState)(!1),[ne,le]=(0,$t.useState)(iw),[ae,ve]=(0,$t.useState)(!1),[de,Pe]=(0,$t.useState)(!1),Fe=(0,$t.useRef)(null),te=(0,$t.useRef)(null),ye=(0,$t.useRef)(h.dualPane),ce=(0,$t.useRef)({mouseBackForwardAction:p.mouseBackForwardAction,singlePane:h.singlePane,focusedPane:h.focusedPane,currentSinglePaneView:h.currentSinglePaneView,navigateSelectionHistory:()=>!1}),pe=(0,$t.useCallback)(Ye=>{le(bt=>bt.tags.excludeTagged===Ye.tags.excludeTagged&&bt.tags.includeUntagged===Ye.tags.includeUntagged&&bt.tags.requireTagged===Ye.tags.requireTagged&&mO(bt.tags.include,Ye.tags.include)&&mO(bt.tags.exclude,Ye.tags.exclude)&&pde(bt.tags.includeOperators,Ye.tags.includeOperators)&&mO(bt.properties.include,Ye.properties.include)&&mO(bt.properties.exclude,Ye.properties.exclude)&&pde(bt.properties.includeOperators,Ye.properties.includeOperators)?bt:{tags:{include:Ye.tags.include.slice(),exclude:Ye.tags.exclude.slice(),includeOperators:{...Ye.tags.includeOperators},excludeTagged:Ye.tags.excludeTagged,includeUntagged:Ye.tags.includeUntagged,requireTagged:Ye.tags.requireTagged},properties:{include:Ye.properties.include.slice(),exclude:Ye.properties.exclude.slice(),includeOperators:{...Ye.properties.includeOperators}}})},[]),ue=(0,$t.useCallback)(async(Ye,bt)=>{let Wt=te.current;Wt&&await Wt.executeSearchShortcut({searchShortcut:bt})},[]),Se=(0,$t.useCallback)(()=>({focusSearch:!1}),[]),ee=(0,$t.useCallback)((Ye,bt)=>{te.current?.modifySearchWithTag(Ye,bt,Se())},[Se]),ie=(0,$t.useCallback)((Ye,bt,Wt)=>{te.current?.modifySearchWithProperty(Ye,bt,Wt,Se())},[Se]),Ce=(0,$t.useCallback)(Ye=>{te.current?.modifySearchWithDateToken(Ye,Se())},[Se]),we=jV({orientation:"horizontal",initialSize:k.defaultSize,min:k.minSize,storageKey:k.storageKey,scale:w}),Le=jV({orientation:"vertical",initialSize:P.defaultSize,min:P.minSize,storageKey:P.storageKey,scale:w}),We=v==="vertical"?Le:we,Nt=We.paneSize,Pt=We.isResizing,Zt=We.resizeHandleProps,ze=(0,$t.useCallback)(Ye=>{Z.current=Ye},[]);(0,$t.useEffect)(()=>{b({type:"SET_PANE_WIDTH",width:we.paneSize})},[we.paneSize,b]),(0,$t.useLayoutEffect)(()=>{let Ye=Z.current;if(!Ye)return;let bt=Ze=>{Ze<=0||b({type:"SET_CONTAINER_WIDTH",width:Ze})};if(bt(Ye.offsetWidth),typeof ResizeObserver>"u"){let Ze=()=>bt(Ye.offsetWidth);return window.addEventListener("resize",Ze),()=>{window.removeEventListener("resize",Ze)}}let Wt=new ResizeObserver(Ze=>{let Vt=Ze[0];Vt&&bt(Vt.contentRect.width)});return Wt.observe(Ye),()=>Wt.disconnect()},[b]);let Ie=["nn-split-container"],De=(0,$t.useRef)(!1),Me=(0,$t.useRef)(p.startView==="navigation"?"navigation":"files");(0,$t.useLayoutEffect)(()=>{let Ye=ye.current;if(ye.current=h.dualPane,!vc())return;if(h.dualPane){De.current=!1;return}if(De.current)return;if(De.current=!0,Ye){Pe(!0);let Wt=window.requestAnimationFrame(()=>{Pe(!1)});return b({type:"ACTIVATE_PANE",target:"files"}),()=>{window.cancelAnimationFrame(Wt)}}let bt=Me.current;b({type:"ACTIVATE_PANE",target:bt})},[b,h.dualPane]),(0,$t.useEffect)(()=>{if(!h.singlePane){ve(!1);return}ve(!0);let Ye=window.setTimeout(()=>{ve(!1)},p.paneTransitionDuration+20);return()=>{window.clearTimeout(Ye)}},[p.paneTransitionDuration,h.currentSinglePaneView,h.singlePane]),Iee(Z);let nt=(0,$t.useCallback)(()=>{h.singlePane&&b({type:"ACTIVATE_PANE",target:"navigation"})},[b,h.singlePane]),Ge=(0,$t.useCallback)(()=>{h.singlePane&&h.currentSinglePaneView==="navigation"&&b({type:"ACTIVATE_PANE",target:"files"})},[b,h.singlePane,h.currentSinglePaneView]);Eee({containerRef:Z,isMobile:o,isSinglePane:h.singlePane,isFilesView:h.currentSinglePaneView==="files",onActivateNavigation:nt,onRestoreFiles:Ge}),Wee(Z,o),_ee({app:r,containerRef:Z,setIsNavigatorFocused:Y});let{handleExpandCollapseAll:Tt}=YS(),gt=(0,$t.useCallback)(Ye=>{let bt=c?.isOpeningVersionHistory()||!1,Wt=c?.isOpeningInNewContext()||!1;b({type:"ACTIVATE_PANE",target:Ye}),!bt&&!Wt&&Z.current?.focus()},[c,b]),wn=(0,$t.useCallback)(()=>{gt("navigation")},[gt]),it=(0,$t.useCallback)(()=>{gt("files")},[gt]),{revealFileInActualFolder:yn,revealFileInNearestFolder:rt,navigateToFolder:me,navigateToTag:se,navigateToProperty:fe,revealTag:Ne,revealProperty:xe}=zee({app:r,navigationPaneRef:Fe,focusNavigationPane:wn,focusFilesPane:it}),Be=(0,$t.useCallback)(Ye=>{if(Ye.type===K.FOLDER){let bt=r.vault.getFolderByPath(Ye.value);return bt?{type:K.FOLDER,value:bt.path}:null}if(Ye.type===K.TAG){if(!p.showTags)return null;let bt=at(Ye.value);if(!bt)return null;if(bt===Lt||bt===wt)return{type:K.TAG,value:bt};if(!s)return null;let Wt=s.resolveSelectionTagPath(bt);return Wt?{type:K.TAG,value:Wt}:null}if(Ye.type===K.PROPERTY){if(!p.showProperties)return null;let bt=Ye.value===_e?_e:en(Ye.value);if(!bt)return null;if(bt===_e)return{type:K.PROPERTY,value:_e};if(!l)return null;let Wt=l.resolveSelectionNodeId(bt);return Wt!==_e?{type:K.PROPERTY,value:Wt}:null}return null},[r.vault,l,p.showProperties,p.showTags,s]),dt=(0,$t.useCallback)(Ye=>{let{navigationHistory:bt}=C;if(bt.length===0)return null;let Wt=Math.min(Math.max(C.navigationHistoryIndex,0),bt.length-1),Ze=Ye==="back"?-1:1;for(let Vt=Wt+Ze;Vt>=0&&Vt{let bt=dt(Ye);if(!bt)return!1;if(bt.entry.type===K.FOLDER){let Wt=r.vault.getFolderByPath(bt.entry.value);return Wt?me(Wt,{historyIndex:bt.index,skipFocus:!0,source:"manual"}):!1}return bt.entry.type===K.TAG?se(bt.entry.value,{historyIndex:bt.index,skipFocus:!0,source:"manual"})!==null:fe(bt.entry.value,{historyIndex:bt.index,skipFocus:!0,source:"manual"})!==null},[r.vault,dt,me,fe,se]),ln=!h.singlePane||h.currentSinglePaneView==="navigation";(0,$t.useEffect)(()=>{ce.current={mouseBackForwardAction:p.mouseBackForwardAction,singlePane:h.singlePane,focusedPane:h.focusedPane,currentSinglePaneView:h.currentSinglePaneView,navigateSelectionHistory:St}},[St,p.mouseBackForwardAction,h.currentSinglePaneView,h.focusedPane,h.singlePane]),(0,$t.useEffect)(()=>{if(o)return;let Ye=Z.current;if(!Ye)return;let bt=Wt=>{if(Wt.button!==3&&Wt.button!==4)return;let{mouseBackForwardAction:Ze,singlePane:Vt,focusedPane:xn,currentSinglePaneView:gn,navigateSelectionHistory:ur}=ce.current,jn=Wt.button===3?"back":"forward";if(Ze==="none")return;if(Ze==="history"){Wt.preventDefault(),ur(jn);return}if(!Vt||(Wt.preventDefault(),xn==="search"))return;let Ia=jn==="back"?"navigation":"files";gn!==Ia&&b({type:"ACTIVATE_PANE",target:Ia})};return Ye.addEventListener("auxclick",bt),()=>{Ye.removeEventListener("auxclick",bt)}},[Z,o,b]);let vn=(0,$t.useCallback)(Ye=>{rt(Ye,{source:"shortcut"})},[rt]),In=(0,$t.useCallback)(()=>{let Ye=WE(C);if(!Ye)return;let bt=C.selectionType===K.TAG?K.TAG:C.selectionType===K.PROPERTY?K.PROPERTY:K.FOLDER,Wt=bm(bt,Ye);Fe.current?.requestScroll(Wt,{align:"auto",itemType:bt})},[C]),eo=(0,$t.useCallback)(()=>{let Ye=te.current;if(!Ye)return;let bt=jc(r,C);if(!bt)return;let Wt=Ye.getIndexOfPath(bt.path);Wt<0||Ye.virtualizer?.scrollToIndex(Wt,{align:"auto"})},[r,C]),Dt=(0,$t.useCallback)(()=>{let Ye=()=>{In(),eo()};if(typeof requestAnimationFrame<"u"){window.requestAnimationFrame(()=>{window.requestAnimationFrame(Ye)});return}window.setTimeout(Ye,0)},[eo,In]),an=(0,$t.useRef)(null),Sn=(0,$t.useCallback)(Ye=>{if(!h.singlePane)return;let bt=an.current;an.current=Ye,bt!==Ye&&Dt()},[Dt,h.singlePane]);(0,$t.useImperativeHandle)(n,()=>{let Ye=()=>{let Ze=Array.from(C.selectedFiles).map(Vt=>r.vault.getFileByPath(Vt)).filter(Vt=>!!Vt);return Ze.length===0&&C.selectedFile&&Ze.push(C.selectedFile),Ze},bt=()=>{let Ze=Ye(),Vt=te.current?.getOrderedFiles()??[];return qE(Ze,Vt)},Wt=Ze=>{let Vt=te.current;return Vt?Vt.selectAdjacentFile(Ze):!1};return{navigateToFile:(Ze,Vt)=>yn(Ze,Vt),revealFileInNearestFolder:(Ze,Vt)=>{rt(Ze,Vt)},focusVisiblePane:()=>{h.singlePane?gt(h.currentSinglePaneView):gt("files")},focusNavigationPane:wn,stopContentProcessing:()=>{try{W.current?.()}catch(Ze){console.error("Failed to stop content processing:",Ze)}},rebuildCache:async()=>{await J.current?.()},selectNextFile:async()=>Wt("next"),selectPreviousFile:async()=>Wt("previous"),navigateBack:async()=>St("back"),navigateForward:async()=>St("forward"),openShortcutByNumber:Ze=>{let Vt=Fe.current;return Vt?Vt.openShortcutByNumber(Ze):Promise.resolve(!1)},isDualPaneAutoFallbackActive:()=>i.useDualPane()&&vc()&&h.singlePane,deleteSelectedFiles:()=>{$(async()=>{!C.selectedFile&&C.selectedFiles.size===0||await RA({app:r,fileSystemOps:a,settings:p,visibility:{includeDescendantNotes:y.current.includeDescendantNotes,showHiddenItems:y.current.showHiddenItems},selectionState:C,selectionDispatch:L,tagTreeService:s,propertyTreeService:l,orderedFiles:te.current?.getOrderedFiles()??void 0})})},mergeSelectedFiles:async()=>{let Ze=bt(),Vt=Sm(Ze);if(Vt.length<2){oe(d.fileSystem.notifications.mergeNotesRequireMultipleMarkdown,{variant:"warning"});return}let xn=Vt[0],gn=xn.parent instanceof mde.TFolder?xn.parent:r.vault.getRoot();await VA({app:r,commandQueue:c,fileSystemOps:a,files:Vt,outputFolder:gn,defaultOutputName:d.modals.mergeNotes.outputNamePlaceholder})},createNoteInSelectedFolder:async(Ze=!1)=>{let Vt=te.current?.getManualSortNewFileContext()??null;if(C.selectedFolder){await a.createNewFile(C.selectedFolder,Ze,Vt);return}if(C.selectionType===K.TAG&&C.selectedTag&&C.selectedTag!==Lt&&C.selectedTag!==wt){let xn=C.selectedFile?.path??r.workspace.getActiveFile()?.path??"";await a.createNewFileForTag(C.selectedTag,xn,Ze,Vt);return}if(C.selectionType===K.PROPERTY&&C.selectedProperty&&C.selectedProperty!==_e){let xn=C.selectedFile?.path??r.workspace.getActiveFile()?.path??"";await a.createNewFileForProperty(C.selectedProperty,xn,Ze,Vt);return}oe(d.fileSystem.errors.noFolderSelected,{variant:"warning"})},createNoteFromTemplateInSelectedFolder:async()=>{if(!C.selectedFolder){oe(d.fileSystem.errors.noFolderSelected,{variant:"warning"});return}let Ze=rb(r);Ze&&await Ze(C.selectedFolder)},moveSelectedFiles:async()=>{let Ze=Ye();if(Ze.length===0){oe(d.fileSystem.errors.noFileSelected,{variant:"warning"});return}let Vt=J5(C,p,{includeDescendantNotes:y.current.includeDescendantNotes,showHiddenItems:y.current.showHiddenItems},r,s,l);await a.moveFilesWithModal(Ze,{selectedFile:C.selectedFile,dispatch:L,allFiles:Vt})},addShortcutForCurrentSelection:async()=>{let Ze=async(gn,ur)=>{if(gn){await N(gn);return}await ur()},Vt=Ye();if(Vt.length>0){let gn=Vt[0].path;await Ze(R.get(gn),()=>B(gn));return}if(C.selectedTag){let gn=C.selectedTag,ur=at(gn);await Ze(ur?O.get(ur):void 0,()=>I(gn));return}if(C.selectedProperty){let gn=C.selectedProperty,ur=gn===_e?_e:en(gn);await Ze(ur?D.get(ur):void 0,()=>A(gn));return}if(C.selectedFolder){let gn=C.selectedFolder.path;await Ze(Q.get(gn),()=>x(gn));return}let xn=r.workspace.getActiveFile();if(xn){await Ze(R.get(xn.path),()=>B(xn.path));return}oe(d.common.noSelection,{variant:"warning"})},navigateToFolder:me,navigateToTag:se,navigateToProperty:fe,addDateFilterToSearch:Ce,navigateToFolderWithModal:()=>{new Kf(r,Vt=>{me(Vt,{preserveNavigationFocus:ln})},d.modals.folderSuggest.navigatePlaceholder,d.modals.folderSuggest.instructions.select,void 0).open()},navigateToTagWithModal:()=>{new XS(r,i,Vt=>{se(Vt,{preserveNavigationFocus:ln})},d.modals.tagSuggest.navigatePlaceholder,d.modals.tagSuggest.instructions.select,!1).open()},navigateToPropertyWithModal:()=>{let Ze=l?Yee(l.getPropertyTree()):[];new ZF(r,Ze,xn=>{fe(xn,{preserveNavigationFocus:ln})},d.modals.propertySuggest.navigatePlaceholder,d.modals.propertySuggest.instructions.navigate).open()},addTagToSelectedFiles:async()=>{if(!u){oe(d.fileSystem.notifications.tagOperationsNotAvailable,{variant:"warning"});return}let Ze=Ye();if(Ze.length===0){oe(d.fileSystem.notifications.noFilesSelected,{variant:"warning"});return}QS({app:r,plugin:i,tagOperations:u,files:Ze})},setPropertyOnSelectedFiles:async()=>{let Ze=Ye();if(Ze.length===0){oe(d.fileSystem.notifications.noFilesSelected,{variant:"warning"});return}if(!Ze.every(ur=>ur.extension==="md")){oe(d.fileSystem.notifications.propertiesRequireMarkdown,{variant:"warning"});return}let xn=_A(p,l).map(ur=>({nodeId:ur.nodeId,label:ur.label,searchText:ur.label,noteCount:0}));if(xn.length===0){oe(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"});return}new ZF(r,xn,async ur=>{await a.applyPropertyNodeToFiles(ur,Ze)},d.modals.propertySuggest.placeholder,d.modals.propertySuggest.instructions.select).open()},removeTagFromSelectedFiles:async()=>{if(!u){oe(d.fileSystem.notifications.tagOperationsNotAvailable,{variant:"warning"});return}let Ze=Ye();if(Ze.length===0){oe(d.fileSystem.notifications.noFilesSelected,{variant:"warning"});return}await LA({app:r,tagOperations:u,files:Ze})},removeAllTagsFromSelectedFiles:async()=>{if(!u){oe(d.fileSystem.notifications.tagOperationsNotAvailable,{variant:"warning"});return}let Ze=Ye();if(Ze.length===0){oe(d.fileSystem.notifications.noFilesSelected,{variant:"warning"});return}zA({app:r,tagOperations:u,files:Ze})},toggleSearch:()=>{te.current?.toggleSearch()},searchWithDescendants:()=>{te.current?.searchWithDescendants()},triggerCollapse:()=>{Tt(),window.requestAnimationFrame(()=>{In()})},triggerListGroupCollapse:()=>te.current?.toggleGroupExpansion()??!1,triggerSelectedItemCollapse:()=>{let Ze=Fe.current?.triggerSelectedItemCollapse()??!1;return Ze&&window.requestAnimationFrame(()=>{In()}),Ze}}},[yn,rt,C,a,c,L,me,se,fe,St,h.singlePane,h.currentSinglePaneView,ln,r,p,i,s,l,gt,wn,u,Tt,In,Fe,Q,R,O,x,B,I,D,A,N,Ce]),o?Ie.push("nn-mobile"):(Ie.push("nn-desktop"),Ie.push(...KI(S))),h.singlePane?(Ie.push("nn-single-pane"),Ie.push(h.currentSinglePaneView==="navigation"?"show-navigation":"show-files")):(Ie.push("nn-dual-pane"),Ie.push(`nn-orientation-${v}`)),h.singlePane&&de&&Ie.push("nn-suppress-pane-transitions"),h.singlePane&&ae&&Ie.push("nn-pane-transitioning"),Pt&&Ie.push("nn-resizing"),(0,$t.useEffect)(()=>{if(Z.current){let Ye=p.navItemHeight,bt=Rl.defaultItemHeight,Wt=Rl.defaultFontSize,Ze=p.navItemHeightScaleText,Vt=Z.current.closest(".notebook-navigator"),xn=tte(Vt),gn=Wt;Ze&&(Ye<=bt-6?gn=Wt-2:Ye<=bt-4&&(gn=Wt-1));let ur=Ye+Rl.mobileHeightIncrement,jn=gn+Rl.mobileFontSizeIncrement,Ia=gn/xn,ft=jn/xn;Z.current.style.setProperty("--nn-setting-nav-item-height",`${Ye}px`),Z.current.style.setProperty("--nn-setting-nav-item-height-mobile",`${ur}px`),Z.current.style.setProperty("--nn-setting-nav-font-size",`${Ia}px`),Z.current.style.setProperty("--nn-setting-nav-font-size-mobile",`${ft}px`),Z.current.style.setProperty("--nn-setting-nav-indent",`${p.navIndent}px`),Z.current.style.setProperty("--nn-nav-root-spacing",`${p.rootLevelSpacing}px`);let Tn=$ne(p.featureImageSize);Z.current.style.setProperty("--nn-file-thumbnail-max-size",`${Tn.listMaxSize}px`);let{titleLineHeight:Jn}=dw(o),qn=AA({compactItemHeight:p.compactItemHeight,scaleText:p.compactItemHeightScaleText,titleLineHeight:Jn}),ii=qn.fontSize/xn,er=qn.mobileFontSize/xn;Z.current.style.setProperty("--nn-file-padding-vertical-compact",`${qn.desktopPadding}px`),Z.current.style.setProperty("--nn-file-padding-vertical-compact-mobile",`${qn.mobilePadding}px`),Z.current.style.setProperty("--nn-compact-font-size",`${ii}px`),Z.current.style.setProperty("--nn-compact-font-size-mobile",`${er}px`)}},[p.navItemHeight,p.navItemHeightScaleText,p.navIndent,p.rootLevelSpacing,p.featureImageSize,p.compactItemHeight,p.compactItemHeightScaleText,o]),(0,$t.useEffect)(()=>{Z.current&&Z.current.style.setProperty("--nn-pane-transition-duration",`${p.paneTransitionDuration}ms`)},[Z,p.paneTransitionDuration]);let _r=(0,$t.useMemo)(()=>h.singlePane?{width:"100%",height:"100%"}:v==="vertical"?{width:"100%",flexBasis:`${Nt}px`,minHeight:`${E.minSize}px`}:{width:`${Nt}px`,height:"100%"},[h.singlePane,v,Nt,E.minSize]),Gn=h.singlePane&&p.calendarEnabled&&f.showCalendar&&p.calendarPlacement==="left-sidebar"&&p.calendarLeftPlacement==="below",{folderNavigationSource:mn,folderDecorationModel:ir,navRainbowState:Zn}=qle(),Fr=cde({app:r,settings:p,activeProfile:m,folderNavigationSource:mn,fileData:V,hydratedShortcuts:M,showHiddenItems:f.showHiddenItems,includeDescendantNotes:f.includeDescendantNotes}),co=ode({app:r,settings:p,expansionState:g,showHiddenItems:f.showHiddenItems,includeDescendantNotes:f.includeDescendantNotes,sourceState:Fr,selectionScope:H,tagTreeService:s,propertyTreeService:l}),Cr=$le({sourceState:Fr,treeSections:co,includeDescendantNotes:f.includeDescendantNotes,navRainbowState:Zn}),ud=(0,$t.useMemo)(()=>({tagTree:Fr.tagTreeForOrdering,rootTagOrderMap:Fr.rootTagOrderMap,tagComparator:Fr.tagComparator,rootPropertyNavigationOrderMap:Eg(co.resolvedRootPropertyKeys)}),[co.resolvedRootPropertyKeys,Fr.rootTagOrderMap,Fr.tagComparator,Fr.tagTreeForOrdering]);return(0,Rm.jsx)("div",{className:"nn-scale-wrapper","data-ui-scale":F,style:T,children:(0,Rm.jsxs)("div",{ref:ze,className:Ie.join(" "),"data-focus-pane":h.singlePane?h.currentSinglePaneView==="navigation"?"navigation":"files":h.focusedPane,"data-navigator-focused":Kn()?re:"true","data-nav-count-leader-style":p.navCountLeaderStyle,tabIndex:-1,onKeyDown:()=>{},children:[p.checkForUpdatesOnStart&&(0,Rm.jsx)(Ble,{notice:j,onDismiss:_}),(0,Rm.jsx)(JK,{ref:Fe,style:_r,uiScale:w,rootContainerRef:Z,navigationSourceState:Fr,navigationTreeSections:co,folderDecorationModel:ir,navRainbowState:Zn,searchNavFilters:ne,onExecuteSearchShortcut:ue,onNavigateToFolder:me,onRevealTag:Ne,onRevealProperty:xe,onRevealFile:rt,onRevealShortcutFile:vn,onModifySearchWithTag:ee,onModifySearchWithProperty:ie,onModifySearchWithDateFilter:Ce}),(0,Rm.jsx)(Mie,{ref:te,rootContainerRef:Z,folderDecorationModel:ir,fileItemPillDecorationModel:Cr,fileItemPillOrderModel:ud,onSearchTokensChange:pe,onNavigateToFolder:me,onRevealTag:Ne,onRevealProperty:xe,resizeHandleProps:h.singlePane?void 0:Zt}),Gn?(0,Rm.jsx)("div",{className:"nn-single-pane-calendar",children:(0,Rm.jsx)(Cm,{onWeekCountChange:Sn,onAddDateFilter:Ce})}):null]})})}))});var fde,Ro,yde,vde=U(()=>{fde=he(Ve()),Ro=he($e()),yde=fde.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,Ro.jsxs)("div",{className:a,children:[(0,Ro.jsx)("div",{className:"nn-skeleton-list-header"}),r&&(0,Ro.jsx)("div",{className:"nn-skeleton-search-bar"}),(0,Ro.jsx)("div",{className:"nn-skeleton-content"})]}):o==="vertical"?(0,Ro.jsxs)(Ro.Fragment,{children:[(0,Ro.jsxs)("div",{className:"nn-skeleton-navigation-pane nn-skeleton-navigation-pane-vertical",style:{flexBasis:`${e}px`},children:[(0,Ro.jsx)("div",{className:"nn-skeleton-nav-header"}),(0,Ro.jsx)("div",{className:"nn-skeleton-content"})]}),(0,Ro.jsxs)("div",{className:`${a} nn-skeleton-list-pane-vertical`,children:[(0,Ro.jsx)("div",{className:"nn-skeleton-list-header"}),r&&(0,Ro.jsx)("div",{className:"nn-skeleton-search-bar"}),(0,Ro.jsx)("div",{className:"nn-skeleton-content"})]})]}):(0,Ro.jsxs)(Ro.Fragment,{children:[(0,Ro.jsxs)("div",{className:"nn-skeleton-navigation-pane",style:{width:`${e}px`},children:[(0,Ro.jsx)("div",{className:"nn-skeleton-nav-header"}),(0,Ro.jsx)("div",{className:"nn-skeleton-content"})]}),(0,Ro.jsxs)("div",{className:a,children:[(0,Ro.jsx)("div",{className:"nn-skeleton-list-header"}),r&&(0,Ro.jsx)("div",{className:"nn-skeleton-search-bar"}),(0,Ro.jsx)("div",{className:"nn-skeleton-content"})]})]})})});var Dh,eN,bde,Sde=U(()=>{Dh=he(Ve());cs();wa();on();fn();hde();vde();jr();tb();$r();s1();gr();eN=he($e()),bde=Dh.default.memo((0,Dh.forwardRef)(function(e,n){let{isStorageReady:r}=_o(),o=Qr(),a=yt(),i=jt(),{isMobile:s}=vt(),l=o.effectiveDualPaneOrientation,c=a.desktopBackground??"separate",{style:u,dataAttr:p}=KA({isMobile:s,desktopScale:a.desktopScale,mobileScale:a.mobileScale}),{defaultSize:m,minSize:g,storageKey:f}=Pc(l),[h,b]=(0,Dh.useState)(m);if((0,Dh.useEffect)(()=>{let y=Te.get(f);if(typeof y=="number"&&Number.isFinite(y)){b(Math.max(g,y));return}if(typeof y=="string"){let v=Number(y);if(!Number.isNaN(v)&&Number.isFinite(v)){b(Math.max(g,v));return}}b(m)},[m,g,f]),!r){let y=["nn-split-container"];return s?y.push("nn-mobile"):(y.push("nn-desktop"),y.push(...KI(c))),o.singlePane?(y.push("nn-single-pane"),y.push(o.currentSinglePaneView==="navigation"?"show-navigation":"show-files")):(y.push("nn-dual-pane"),y.push(`nn-orientation-${l}`)),(0,eN.jsx)("div",{className:"nn-scale-wrapper","data-ui-scale":p,style:u,children:(0,eN.jsx)("div",{className:y.join(" "),children:(0,eN.jsx)(yde,{paneSize:h,singlePane:o.singlePane,searchActive:i.searchActive,orientation:l})})})}return(0,eN.jsx)(gde,{ref:n})}))});function Vy(t){return activeDocument.createElementNS(MRe,t)}function DRe(t){let e=Vy("defs");if(!e.instanceOf(SVGDefsElement))return;let n=Vy("filter");if(!n.instanceOf(SVGFilterElement))return;let r=n;r.setAttribute("id",ARe),r.setAttribute("x","-20%"),r.setAttribute("y","-20%"),r.setAttribute("width","140%"),r.setAttribute("height","140%"),r.setAttribute("color-interpolation-filters","sRGB");let o=Vy("feGaussianBlur");if(!o.instanceOf(SVGFEGaussianBlurElement))return;let a=o;a.setAttribute("in","SourceGraphic"),a.setAttribute("stdDeviation","8"),a.setAttribute("result","blurred");let i=Vy("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=Vy("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=Vy("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 Tde(){if(activeDocument.getElementById(wde))return;let t=Vy("svg");if(!t.instanceOf(SVGSVGElement))return;let e=t;e.setAttribute("id",wde),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false"),e.classList.add("nn-svg-filters"),DRe(e),activeDocument.body.append(e)}var MRe,wde,ARe,kde=U(()=>{MRe="http://www.w3.org/2000/svg",wde="notebook-navigator-svg-filters",ARe="notebook-navigator-frosted"});var Nde={};En(Nde,{IOS_FLOATING_TOOLBARS_CLASS:()=>dT,NotebookNavigatorView:()=>tN,setupNotebookNavigatorViewContainer:()=>gO,teardownNotebookNavigatorViewContainer:()=>hO});function gO(t,e){t.empty(),t.classList.add("notebook-navigator"),Mm.Platform.isMobile&&(t.classList.add("notebook-navigator-mobile"),Mm.Platform.isAndroidApp?(t.classList.add("notebook-navigator-android"),ete(t)):Mm.Platform.isIosApp&&(t.classList.add("notebook-navigator-ios"),(e?.useFloatingToolbars??!0)&&t.classList.add(dT))),Tde()}function hO(t){e1(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(dT),t.empty()}var Fde,Cde,Mm,cd,dT,Pde,tN,fO=U(()=>{Fde=he(Ve()),Cde=he(WH()),Mm=require("obsidian");Sde();Tl();Ur();fn();on();cs();wa();ph();AK();GF();Oe();Vm();Ue();gr();t1();kde();cd=he($e()),dT="notebook-navigator-ios-floating-toolbars",Pde=0;tN=class extends Mm.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,Pde+=1,this.settingsUpdateListenerId=`notebook-navigator-view-${Pde}`}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=Mm.Platform.isIosApp&&this.plugin.settings.useFloatingToolbars;n.classList.toggle(dT,r)}getViewType(){return Ra}getDisplayText(){return d.plugin.viewName}getIcon(){return vs}async onOpen(){let n=this.containerEl.children[1];if(n.instanceOf(HTMLElement)&&(this.componentHandle=null,this.viewContainer=n,this.wasMobileContainerVisible=!1,gO(n,{useFloatingToolbars:this.plugin.settings.useFloatingToolbars}),this.plugin.registerSettingsUpdateListener(this.settingsUpdateListenerId,()=>{this.updatePlatformClasses()}),this.updatePlatformClasses(),this.root=(0,Cde.createRoot)(n),this.root.render((0,cd.jsx)(Fde.default.StrictMode,{children:(0,cd.jsx)(gA,{plugin:this.plugin,children:(0,cd.jsx)(yA,{plugin:this.plugin,children:(0,cd.jsx)(zie,{plugin:this.plugin,children:(0,cd.jsx)(uA,{plugin:this.plugin,children:(0,cd.jsx)(lee,{children:(0,cd.jsx)(IJ,{app:this.plugin.app,api:this.plugin.api,children:(0,cd.jsx)(BJ,{children:(0,cd.jsx)(ree,{app:this.plugin.app,api:this.plugin.api,tagTreeService:this.plugin.tagTreeService,propertyTreeService:this.plugin.propertyTreeService,onFileRename:(r,o)=>this.plugin.registerFileRenameListener(r,o),onFileRenameUnsubscribe:r=>this.plugin.unregisterFileRenameListener(r),children:(0,cd.jsx)(AJ,{children:(0,cd.jsx)(uee,{children:(0,cd.jsx)(bde,{ref:this.setComponentHandle})})})})})})})})})})})})),Mm.Platform.isAndroidApp)){let r=()=>n.querySelector(".nn-split-container.nn-mobile")instanceof HTMLElement?(nte(n),!0):!1,o=()=>!!r();if(!o()){let a=new MutationObserver(()=>{o()&&a.disconnect()});a.observe(n,{childList:!0,subtree:!0}),window.requestAnimationFrame(()=>{o()&&a.disconnect()}),window.setTimeout(()=>{if(o()){a.disconnect();return}window.setTimeout(()=>{if(o()){a.disconnect();return}window.setTimeout(()=>{o(),a.disconnect()},500)},200)},100),window.setTimeout(()=>a.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(),hO(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()}searchWithDescendants(){this.componentHandle?.searchWithDescendants()}triggerCollapse(){this.componentHandle?.triggerCollapse()}triggerListGroupCollapse(){return this.componentHandle?.triggerListGroupCollapse()??!1}triggerSelectedItemCollapse(){return this.componentHandle?.triggerSelectedItemCollapse()??!1}onResize(){if(!Mm.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 xde(){let{app:t,plugin:e}=vt(),n=yt(),r=(0,Na.useRef)(!0),o=(0,Na.useRef)(n);o.current=n;let a=(0,Na.useRef)(n),i=(0,Na.useRef)(null),s=(0,Na.useRef)([]),l=(0,Na.useRef)(new Set),[c,u]=(0,Na.useState)(()=>uh()),p=(0,Na.useCallback)(()=>{if(!i.current){let b=new LS(t),y=new OS;y.registerProvider(new zS(t,b)),i.current=y}return i.current},[t]),m=(0,Na.useCallback)(b=>{if(c||uh()||b.length===0)return;let y=b.filter(v=>v.extension==="md");y.length!==0&&p().queueFilesForAllProviders(y,o.current,{include:["markdownPipeline"]})},[p,c]);(0,Na.useEffect)(()=>(r.current=!0,()=>{r.current=!1,i.current?.stopAllProcessing(),i.current=null}),[]),(0,Na.useEffect)(()=>NJ(u),[]),(0,Na.useEffect)(()=>{if(c){i.current?.stopAllProcessing();return}m(s.current)},[m,c]),(0,Na.useEffect)(()=>{let b=t.vault.on("modify",y=>{c||!(y instanceof Ide.TFile)||y.extension!=="md"||l.current.has(y.path)&&m([y])});return()=>{t.vault.offref(b)}},[t.vault,m,c]),(0,Na.useEffect)(()=>{let b=a.current;if(a.current=n,b===n||c||uh())return;let{shouldClearFeatureImage:y,shouldClearPreview:v}=oA({oldSettings:b,newSettings:n}),S=b.showFeatureImage!==n.showFeatureImage&&n.showFeatureImage;if(!y&&!v&&!S)return;let w=new Map;s.current.forEach(k=>{k.extension==="md"&&w.set(k.path,k)});let T=Array.from(w.values());if(T.length===0)return;let F=i.current;F?.stopAllProcessing(),$(async()=>{if(await F?.getProvider("markdownPipeline")?.waitForIdle(),!r.current||uh())return;let k=Ft(),P=T.map(E=>E.path);v&&await k.batchClearFileContent(P,"preview"),y&&await k.batchClearFileContent(P,"featureImage"),!(!r.current||uh())&&m(T)})},[m,n,c]);let g=(0,Na.useCallback)(b=>{$(async()=>{let y=e.getNavigatorLeaves(),v=!0;y.length===0&&(await e.activateView(),y=e.getNavigatorLeaves(),v=!1);let S=y[0];if(!S)return;let w=S.view;w instanceof tN&&(w.addDateFilterToSearch(b),v&&await t.workspace.revealLeaf(S))})},[t.workspace,e]),f=(0,Na.useCallback)(b=>{s.current=b,l.current=new Set(b.map(y=>y.path)),m(b)},[m]),h=(0,Na.useCallback)(b=>{$(async()=>{c||!n.showFeatureImage||b.file.extension!=="md"||(await Ft().clearFileContent(b.file.path,"featureImage"),!r.current||uh())||m([b.file])})},[m,n.showFeatureImage,c]);return(0,yO.jsx)("div",{className:"nn-calendar-right-sidebar nn-list-pane",children:(0,yO.jsx)("div",{className:"nn-calendar-right-sidebar-content",children:(0,yO.jsx)(Cm,{weeksToShowOverride:6,onAddDateFilter:g,onMissingFeatureImage:h,onVisibleCalendarNoteFilesChange:f,isRightSidebar:!0})})})}var Na,Ide,yO,Ede=U(()=>{Na=he(Ve()),Ide=require("obsidian");fn();on();cs();st();Vn();mV();gV();TV();fO();kC();yO=he($e())});var Dde={};En(Dde,{NotebookNavigatorCalendarView:()=>nU});var Mde,Ade,vO,cT,Rde,nU,Ode=U(()=>{Mde=he(Ve()),Ade=he(WH()),vO=require("obsidian");on();gr();fn();Ede();Oe();Ue();lr();fO();cT=he($e()),Rde=0,nU=class extends vO.ItemView{constructor(n,r){super(n);this.root=null;this.viewContainer=null;this.plugin=r,Rde+=1,this.settingsUpdateListenerId=`notebook-navigator-calendar-view-${Rde}`}updatePlatformClasses(){let n=this.viewContainer;if(!n)return;let r=vO.Platform.isIosApp&&this.plugin.settings.useFloatingToolbars;n.classList.toggle(dT,r)}getViewType(){return Sp}getDisplayText(){return d.plugin.calendarViewName}getIcon(){return Qn(this.plugin.settings.interfaceIcons,"nav-calendar")}updateLeafHeader(){let n=Reflect.get(this.leaf,"updateHeader");typeof n=="function"&&Reflect.apply(n,this.leaf,[])}async onOpen(){if(!this.plugin.settings.calendarEnabled){this.leaf.detach();return}let n=this.containerEl.children[1];n.instanceOf(HTMLElement)&&(this.viewContainer=n,gO(n,{useFloatingToolbars:this.plugin.settings.useFloatingToolbars}),this.plugin.registerSettingsUpdateListener(this.settingsUpdateListenerId,()=>{this.updatePlatformClasses(),this.updateLeafHeader()}),this.updatePlatformClasses(),this.root=(0,Ade.createRoot)(n),this.root.render((0,cT.jsx)(Mde.default.StrictMode,{children:(0,cT.jsx)(gA,{plugin:this.plugin,children:(0,cT.jsx)(yA,{plugin:this.plugin,children:(0,cT.jsx)(uA,{plugin:this.plugin,children:(0,cT.jsx)(xde,{})})})})})))}async onClose(){this.plugin.unregisterSettingsUpdateListener(this.settingsUpdateListenerId),this.viewContainer=null;let n=this.containerEl.children[1];n.instanceOf(HTMLElement)&&(this.root?.unmount(),hO(n),this.root=null)}stopContentProcessing(){this.root?.unmount(),this.root=null}}});var zde={};En(zde,{FolderNoteSidebarPlaceholderView:()=>rU});var Lde,rU,Bde=U(()=>{Lde=require("obsidian");Vm();Oe();Ue();rU=class extends Lde.ItemView{constructor(e){super(e)}getViewType(){return qh}getDisplayText(){return d.plugin.folderNoteSidebarViewName}getIcon(){return vs}async onOpen(){let e=this.containerEl.children[1];e.instanceOf(HTMLElement)&&e.empty()}}});var Hde={};En(Hde,{WelcomeModal:()=>oU});var _de,oU,Vde=U(()=>{_de=require("obsidian");wd();Oe();Nd();ZT();oU=class extends _de.Modal{constructor(){super(...arguments);this.domDisposers=[];this.openVideoButton=null}onOpen(){let n=d.plugin.viewName;this.modalEl.addClass("nn-welcome-modal"),this.titleEl.setText(d.modals.welcome.title.replace("{pluginName}",n)),this.contentEl.empty(),this.attachCloseButtonHandler();let r=this.contentEl.createDiv({cls:"nn-welcome-body"});[d.modals.welcome.introText,d.modals.welcome.continueText,d.modals.welcome.thanksText].forEach(p=>{r.createEl("p",{text:p,cls:"nn-welcome-text"})});let i=r.createEl("a",{cls:"nn-welcome-thumbnail-link",attr:{href:Vh,target:"_blank",rel:"noopener noreferrer"}}).createDiv({cls:"nn-welcome-thumbnail-frame"}),s=hv(Vh);if(s){let p=i.createEl("img",{cls:"nn-welcome-thumbnail",attr:{alt:d.modals.welcome.videoAlt,width:"1920",height:"1080"}}),m=tg(s,"maxresdefault.jpg"),g=tg(s,"hqdefault.jpg"),f=i.createDiv({cls:["nn-youtube-play","nn-welcome-youtube-play"]});f.setAttr("aria-hidden","true"),f.hidden=!0,p.addEventListener("load",()=>{f.hidden=!1});let h=!1;p.addEventListener("error",()=>{h||(h=!0,p.src=g)}),p.src=m}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(kt(c,"click",()=>{window.open(Vh),this.close()})),this.openVideoButton=c;let u=l.createEl("button",{text:d.modals.welcome.closeButton});u.setAttr("type","button"),this.domDisposers.push(kt(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(kt(n,"click",r)),this.domDisposers.push(kt(n,"pointerdown",r))}}});function nN(t,e){return t instanceof Error?t:new Error(e)}function Kde(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 bO,Ude=U(()=>{bO=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(Kde(s)){n(s);return}n(null)},i.onerror=()=>{r(nN(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(nN(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(nN(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)Kde(l)&&s.push(l);e(s)},a.onerror=()=>{n(nN(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(nN(r.error,"Failed to open icon asset database"))},r.onblocked=()=>{n(new Error("Icon asset database open blocked"))}})}}});var Nl,Ky=U(()=>{yb();Nl=class{constructor(e){this.documentStates=new Map;this.isDisposed=!1;this.iconDefinitions=[];this.iconLookup=new Map;this.fontFamily=e.fontFamily,this.fontData=e.record.data,this.version=e.record?.version??null,this.parseMetadata(e.record.metadata)}dispose(){this.isDisposed||(this.isDisposed=!0,Array.from(this.documentStates.entries()).forEach(([e,n])=>{this.releaseDocumentState(e,n)}))}isAvailable(){return this.iconDefinitions.length>0}async prepare(e){let n=this.getOrCreateDocumentState(e);if(await n.ready,this.isDisposed||this.documentStates.get(e)!==n)throw new Error(`${this.getLogPrefix()} Font load completed after its document state was released`);if(!n.fontSet.has(n.fontFace))throw new Error(`${this.getLogPrefix()} Font face is unavailable in the target document`)}render(e,n,r){let o=this.iconLookup.get(n);if(Tg(e),!o)return"not-found";let a=sl(e),i=this.getOrCreateDocumentState(e.ownerDocument);return i.fontFace.status==="loaded"&&i.fontSet.has(i.fontFace)?(this.renderLoadedIcon(e,o.unicode,r),"rendered"):i.ready.then(()=>this.isDisposed||this.documentStates.get(e.ownerDocument)!==i||!i.fontSet.has(i.fontFace)||a&&sl(e)!==a?"not-found":(this.renderLoadedIcon(e,o.unicode,r),"rendered"))}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)}getOrCreateDocumentState(e){if(this.isDisposed)throw new Error(`${this.getLogPrefix()} Cannot load a disposed font provider`);let n=this.documentStates.get(e);if(n)return n;let r=e.defaultView,o=r?.FontFace,a=e.fonts,i;try{if(!o)throw new Error("FontFace constructor is unavailable in the target document");if(typeof a?.add!="function")throw new Error("FontFaceSet.add is unavailable in the target document");if(typeof a.delete!="function"||typeof a.has!="function")throw new Error("FontFaceSet lifecycle methods are unavailable in the target document");i=new o(this.fontFamily,this.fontData),a.add(i)}catch(u){throw console.error(`${this.getLogPrefix()} Failed to create font face`,u),u}let s;try{s=i.load()}catch(u){throw a.delete(i),console.error(`${this.getLogPrefix()} Failed to load font`,u),u}let l=()=>{this.releaseDocumentState(e,c)},c={fontFace:i,fontSet:a,ownerWindow:r,handlePageHide:l,ready:s};return this.documentStates.set(e,c),r.addEventListener("pagehide",l,{once:!0}),c.ready=s.then(u=>((this.isDisposed||this.documentStates.get(e)!==c)&&c.fontSet.delete(u),u)).catch(u=>{throw c.fontSet.delete(i),console.error(`${this.getLogPrefix()} Failed to load font`,u),u}),c}releaseDocumentState(e,n){this.documentStates.get(e)===n&&this.documentStates.delete(e),n.ownerWindow.removeEventListener("pagehide",n.handlePageHide);try{n.fontSet.delete(n.fontFace)}catch(r){console.error(`${this.getLogPrefix()} Failed to delete font face`,r)}}renderLoadedIcon(e,n,r){e.addClass("nn-iconfont"),e.addClass(this.getCssClass()),e.setText(this.unicodeToGlyph(n)),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"))}unicodeToGlyph(e){try{return String.fromCodePoint(parseInt(e,16))}catch{return""}}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 SO,Wde=U(()=>{Ky();SO=class extends Nl{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 wO,Gde=U(()=>{Ky();wO=class extends Nl{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 TO,jde=U(()=>{Ky();TO=class extends Nl{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 kO,qde=U(()=>{Ky();kO=class extends Nl{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 PO,Yde=U(()=>{Ky();PO=class extends Nl{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 FO,$de=U(()=>{Ky();FO=class extends Nl{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 Xde,Qde=U(()=>{Xde={"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 Zde={};En(Zde,{ExternalIconProviderController:()=>aU});var CO,aU,Jde=U(()=>{CO=require("obsidian");Ude();If();Wde();Gde();jde();qde();Yde();$de();Oe();ef();Qde();bn();Et();aU=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.preparingProviders=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.isDisposed=!1;this.iconService=n,this.settingsProvider=r,this.database=new bO(e)}async initialize(){if(this.isInitialized)return;await this.database.init(),(await this.database.getAll()).forEach(n=>{let r=n.id;il[r]&&(this.installedProviders.add(r),this.providerVersions.set(r,n.version))}),await this.removeDisabledProviders(),this.isInitialized=!0,await this.applyBundledUpdates()}dispose(){if(this.isDisposed)return;this.isDisposed=!0,new Set([...this.preparingProviders.keys(),...this.activeProviders.keys()]).forEach(n=>this.deactivateProvider(n)),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(()=>this.installProviderWithinQueue(e,n));this.downloadTasks.set(e,o);try{await o}finally{this.downloadTasks.delete(e)}}async installProviderWithinQueue(e,n){let r=this.requireProviderConfig(e),o=n.manifest??await this.fetchManifest(r),a=await this.downloadAssets(r,o);await this.database.put(a),this.installedProviders.add(e),this.providerVersions.set(e,a.version),this.removalNoticeProviders.delete(e),n.persistSetting!==!1&&this.markProviderSetting(e,!0);let i=await this.activateIfEnabled(r,a);i&&!n.suppressDownloadNotice&&this.showDownloadNotice(r),n.persistSetting!==!1?await this.settingsProvider.saveSettingsAndUpdate():i&&this.settingsProvider.notifySettingsUpdate()}async applyBundledUpdates(){let e=[];Object.entries(Xde).forEach(([n,r])=>{if(!this.installedProviders.has(n))return;let o=this.providerVersions.get(n);if(!o||Ri(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||Ri(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=He(e.externalIconProviders),r=[],o=!1;Object.keys(il).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=He(r.externalIconProviders);o[e]=n,r.externalIconProviders=o}deactivateProvider(e){let n=this.preparingProviders.get(e),r=this.activeProviders.get(e),o=!1;return n&&(n.dispose(),this.preparingProviders.delete(e),o=!0),r&&(r.provider.dispose(),this.activeProviders.delete(e),o=!0),this.iconService.unregisterProvider(e),o}async activateIfEnabled(e,n){let r=this.settingsProvider.settings;if(this.isDisposed||!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);if(!a)return this.showActivationFailureNotice(e),this.scheduleRecovery(e),!1;if(!a.isAvailable())return a.dispose(),this.showActivationFailureNotice(e),this.scheduleRecovery(e),!1;let i=this.preparingProviders.get(e.id);i&&i.dispose(),this.preparingProviders.set(e.id,a);let s=activeDocument;try{await a.prepare(s)}catch(u){a.dispose();let p=this.preparingProviders.get(e.id)===a;return!p||this.isDisposed||!this.isProviderEnabled(e.id)?(p&&this.preparingProviders.delete(e.id),!1):(this.preparingProviders.delete(e.id),console.error(`[IconProviders] Failed to prepare ${e.id} in the active document:`,u),this.showActivationFailureNotice(e),this.scheduleRecovery(e),!1)}let l=this.preparingProviders.get(e.id)===a;return!l||this.isDisposed||!this.isProviderEnabled(e.id)?(l&&this.preparingProviders.delete(e.id),a.dispose(),!1):(this.preparingProviders.delete(e.id),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))}isProviderEnabled(e){return!!this.settingsProvider.settings.externalIconProviders?.[e]}createProvider(e,n){switch(e.id){case"bootstrap-icons":return new TO({record:n,fontFamily:e.fontFamily});case"fontawesome-solid":return new SO({record:n,fontFamily:e.fontFamily});case"material-icons":return new kO({record:n,fontFamily:e.fontFamily});case"phosphor":return new PO({record:n,fontFamily:e.fontFamily});case"rpg-awesome":return new wO({record:n,fontFamily:e.fontFamily});case"simple-icons":return new FO({record:n,fontFamily:e.fontFamily});default:return null}}async fetchManifest(e){let n=await(0,CO.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,CO.requestUrl)({url:n.font,method:"GET",headers:{"User-Agent":"NotebookNavigator/1.0 (Obsidian Plugin)"},throw:!1}),o=await(0,CO.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=il[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);oe(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.installProviderWithinQueue(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);oe(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);oe(n)}showUpdateNotice(e,n){let r=d.fileSystem.notifications.iconPackUpdated.replace("{provider}",e.name).replace("{version}",n);oe(r,{variant:"success"})}}});var BRe={};En(BRe,{default:()=>NO});module.exports=Wr(BRe);var au=require("obsidian");var pE=require("obsidian");Vm();var uE=class extends pE.PluginSettingTab{constructor(n,r){super(n,r);this.delegate=null;this.plugin=r,this.icon=vs}getSettingDefinitions(){return(0,pE.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(){let n=this.getDelegate(),r=Reflect.get(n,"display");typeof r=="function"&&Reflect.apply(r,n,[])}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}=(K4(),Wr(V4)),r=new n(this.app,this.plugin);return r.setNativeSettingsHost(this),r}syncDelegateContainer(){this.delegate&&(this.delegate.containerEl=this.containerEl)}};Ue();var t5=require("obsidian");var O0=require("obsidian");Vn();Ue();Ha();Mi();ra();Ob();Et();hn();Ue();sn();Mi();Et();var _d=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}cleanupCollapsedPinnedContexts(e,n,r){let o=a=>OW(a,e,n);return r?o(r):this.settingsProvider.updateCollapsedPinnedContexts(o)}updateShortcuts(e,n){return vx(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===K.FOLDER?n==="color"?"folderColors":"folderBackgroundColors":e===K.TAG?n==="color"?"tagColors":"tagBackgroundColors":e===K.PROPERTY?n==="color"?"propertyColors":"propertyBackgroundColors":n==="color"?"fileColors":"fileBackgroundColors"}ensureColorRecord(e,n){let r=dn(e[n],Hn);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=rr(r);o&&await this.saveAndUpdate(a=>{if(e===K.FOLDER){let i=dn(a.folderIcons,Hn);i[n]=o,a.folderIcons=i}else if(e===K.TAG){let i=dn(a.tagIcons,Hn);i[n]=o,a.tagIcons=i}else if(e===K.PROPERTY){let i=dn(a.propertyIcons,Hn);i[n]=o,a.propertyIcons=i}else{let i=dn(a.fileIcons,Hn);i[n]=o,a.fileIcons=i}})}async removeEntityIcon(e,n){e===K.FOLDER&&this.settingsProvider.settings.folderIcons?.[n]?await this.saveAndUpdate(r=>{r.folderIcons&&delete r.folderIcons[n]}):e===K.TAG&&this.settingsProvider.settings.tagIcons?.[n]?await this.saveAndUpdate(r=>{r.tagIcons&&delete r.tagIcons[n]}):e===K.PROPERTY&&this.settingsProvider.settings.propertyIcons?.[n]?await this.saveAndUpdate(r=>{r.propertyIcons&&delete r.propertyIcons[n]}):e===K.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 rr(r)}getEntityIcon(e,n){return e===K.FOLDER?this.readIconRecord(this.settingsProvider.settings.folderIcons,n):e===K.TAG?this.readIconRecord(this.settingsProvider.settings.tagIcons,n):e===K.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=Su(r);if(!a)return!1;if(e===K.FOLDER){let i=dn(o.folderSortOverrides),s=He(i);s[n]=a,o.folderSortOverrides=s;return}if(e===K.TAG){let i=dn(o.tagSortOverrides),s=He(i);s[n]=a,o.tagSortOverrides=s;return}if(e===K.PROPERTY){let i=dn(o.propertySortOverrides),s=He(i);s[n]=a,o.propertySortOverrides=s;return}return!1})}async removeEntitySortOverride(e,n){e===K.FOLDER&&this.settingsProvider.settings.folderSortOverrides?.[n]?await this.saveAndUpdate(r=>{let o=dn(r.folderSortOverrides),a=He(o);delete a[n],r.folderSortOverrides=a}):e===K.TAG&&this.settingsProvider.settings.tagSortOverrides?.[n]?await this.saveAndUpdate(r=>{let o=dn(r.tagSortOverrides),a=He(o);delete a[n],r.tagSortOverrides=a}):e===K.PROPERTY&&this.settingsProvider.settings.propertySortOverrides?.[n]&&await this.saveAndUpdate(r=>{let o=dn(r.propertySortOverrides),a=He(o);delete a[n],r.propertySortOverrides=a})}getEntitySortOverride(e,n){if(e===K.FOLDER)return this.settingsProvider.settings.folderSortOverrides?.[n];if(e===K.TAG)return this.settingsProvider.settings.tagSortOverrides?.[n];if(e===K.PROPERTY)return this.settingsProvider.settings.propertySortOverrides?.[n]}async setEntityChildSortOrderOverride(e,n,r){await this.saveAndUpdate(o=>{if(e===K.FOLDER){let a=dn(o.folderTreeSortOverrides),i=He(a);i[n]=r,o.folderTreeSortOverrides=i}else if(e===K.TAG){let a=dn(o.tagTreeSortOverrides),i=He(a);i[n]=r,o.tagTreeSortOverrides=i}else{let a=dn(o.propertyTreeSortOverrides),i=He(a);i[n]=r,o.propertyTreeSortOverrides=i}})}async removeEntityChildSortOrderOverride(e,n){if(e===K.FOLDER){let o=this.settingsProvider.settings.folderTreeSortOverrides;if(!o||!Object.prototype.hasOwnProperty.call(o,n))return;await this.saveAndUpdate(a=>{let i=dn(a.folderTreeSortOverrides),s=He(i);delete s[n],a.folderTreeSortOverrides=s});return}if(e===K.TAG){let o=this.settingsProvider.settings.tagTreeSortOverrides;if(!o||!Object.prototype.hasOwnProperty.call(o,n))return;await this.saveAndUpdate(a=>{let i=dn(a.tagTreeSortOverrides),s=He(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=dn(o.propertyTreeSortOverrides),i=He(a);delete i[n],o.propertyTreeSortOverrides=i})}getEntityChildSortOrderOverride(e,n){if(e===K.FOLDER){let o=this.settingsProvider.settings.folderTreeSortOverrides;return o&&Object.prototype.hasOwnProperty.call(o,n)?o[n]:void 0}if(e===K.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}};Et();var rve=1e3,mE=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.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.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<=rve)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=He(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}/`)}};Vn();Mi();ra();Et();Ja();Tu();var ove=new Set(["md","canvas","base"]),ave=".excalidraw",gE=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=zo(n),a=Rn(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=mr();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"?rr(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=rr(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?gi(u.icon):null,m=u.color?.trim()||null,g=u.backgroundColor?.trim()||null,f=i.iconField,h=i.colorField,b=i.backgroundField,y=!!f&&(s||r.icon!==void 0),v=!!h&&(l||r.color!==void 0),S=!!b&&(c||r.backgroundColor!==void 0);try{await this.app.fileManager.processFrontMatter(a,F=>{f&&y&&this.updateFrontmatterField(F,f,p),h&&v&&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={};y&&(w.icon=u.icon&&u.icon.length>0?u.icon:void 0),v&&(w.color=m??void 0),S&&(w.background=g??void 0);let T=mr();if(T)try{await T.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:y,color:v,backgroundColor:S}}hasFolderDisplayNameMetadataChanges(e,n){let r=this.settingsProvider.settings;if(!r.useFrontmatterMetadata||!r.enableFolderNotes)return!1;let o=zo(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=Qs(s.path),c=i.get(l);if(c===void 0){let u=this.getFolderNoteSourceNameFromPath(l);c=cc(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=Xp(r,zo(this.settingsProvider.settings));return this.isFolderNotePathForExpectedName(e,o)}updateFrontmatterField(e,n,r){let o=Da(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 mb(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 ove.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}${ave}`}};function Y4({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 $4({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,y=e.includeBackgroundColor?h||r.backgroundColor:void 0;if(e.includeInheritedColors&&(e.includeColor&&!b||e.includeBackgroundColor&&!y)){let v=i({color:e.includeColor&&!b,backgroundColor:e.includeBackgroundColor&&!y});b||(b=v.color),y||(y=v.backgroundColor)}return{displayName:s?m?.name:void 0,color:b,backgroundColor:y,icon:e.includeIcon?g||r.icon:void 0}}function ive(t){return typeof t!="object"||t===null?!1:typeof Reflect.get(t,"registerSettingsUpdateListener")=="function"&&typeof Reflect.get(t,"unregisterSettingsUpdateListener")=="function"}var oP=class t extends _d{constructor(...n){super(...n);this.folderStyleChangeListener=null;this.folderDisplayCache=new mE;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 gE(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,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 ive(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=Qs(n);this.folderNoteMetadataAdapter.isFolderNotePathForFolder(n,r)&&this.folderDisplayCache.invalidateFolderAndDescendants(r)}handleFolderDisplayCacheVaultCreateOrDelete(n){if(!(n instanceof O0.TFile))return;let r=this.settingsProvider.settings;if(!r.useFrontmatterMetadata||!r.enableFolderNotes)return;let o=Qs(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 O0.TFile)||typeof r!="string")return;let o=this.settingsProvider.settings;if(!o.useFrontmatterMetadata||!o.enableFolderNotes)return;let a=Qs(r),i=Qs(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=mr();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(K.FOLDER,n),color:this.getEntityColor(K.FOLDER,n),backgroundColor:this.getEntityBackgroundColor(K.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"?rr(r.icon)??void 0:void 0;if(c!==l){let u=dn(i.folderIcons,Hn);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=dn(i.folderColors,Hn);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=dn(i.folderBackgroundColors,Hn);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 $4({folderPath:n,resolveOptions:r,useFrontmatterMetadata:o.useFrontmatterMetadata,directStyle:this.getFolderStyleFromSettings(n),frontmatterFields:this.folderNoteMetadataAdapter.getFolderFrontmatterFields(),getFolderNoteMetadata:a=>this.folderNoteMetadataAdapter.getFolderNoteMetadata(a),resolveInheritedFolderStyleValues:a=>Y4({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(K.FOLDER,n,r)}async removeFolderSortOverride(n){return this.removeEntitySortOverride(K.FOLDER,n)}getFolderSortOverride(n){return this.getEntitySortOverride(K.FOLDER,n)}async setFolderChildSortOrderOverride(n,r){if(this.validateFolder(n))return this.setEntityChildSortOrderOverride(K.FOLDER,n,r)}async removeFolderChildSortOrderOverride(n){return this.removeEntityChildSortOrderOverride(K.FOLDER,n)}getFolderChildSortOrderOverride(n){return this.getEntityChildSortOrderOverride(K.FOLDER,n)}async handleFolderRename(n,r,o){this.folderDisplayCache.clear();let a=Db(this.app,"folder",n,r);this.settingsProvider.updateCollapsedPinnedContexts(i=>iv(i,K.FOLDER,n,r,{descendantDelimiter:"/"})),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=this.updateShortcuts(i,c=>{if(!(!ia(c)||!a(c.path)))return{...c,path:r}})||s,o&&(s=o(i)||s),s})}async handleFolderDelete(n,r){this.folderDisplayCache.clear();let o=Db(this.app,"folder",n);this.settingsProvider.updateCollapsedPinnedContexts(a=>sv(a,K.FOLDER,n,{descendantDelimiter:"/"})),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=this.updateShortcuts(a,l=>{if(ia(l))return o(l.path)?null:void 0})||i,r&&(i=r(a)||i),i})}async cleanupFolderMetadata(n=this.settingsProvider.settings,r){this.folderDisplayCache.clear();let o=s=>this.getFolderByPath(s)!==null,a=this.cleanupCollapsedPinnedContexts(K.FOLDER,o,r),i=await Promise.all([this.cleanupMetadata(n,"folderColors",o),this.cleanupMetadata(n,"folderBackgroundColors",o),this.cleanupMetadata(n,"folderIcons",o),this.cleanupMetadata(n,"folderSortOverrides",o),this.cleanupMetadata(n,"folderTreeSortOverrides",o),this.cleanupMetadata(n,"folderAppearances",o)]);return a||i.some(s=>s)}async cleanupWithValidators(n,r=this.settingsProvider.settings,o){this.folderDisplayCache.clear();let a=l=>n.vaultFolders.has(l),i=this.cleanupCollapsedPinnedContexts(K.FOLDER,a,o);return{settingsChanged:(await Promise.all([this.cleanupMetadata(r,"folderColors",a),this.cleanupMetadata(r,"folderBackgroundColors",a),this.cleanupMetadata(r,"folderIcons",a),this.cleanupMetadata(r,"folderSortOverrides",a),this.cleanupMetadata(r,"folderTreeSortOverrides",a),this.cleanupMetadata(r,"folderAppearances",a)])).some(l=>l),localChanged:i}}};Ue();Cn();Et();sn();function X4(t,e){return t===Lt||t===wt||e(t)}var aP=class extends _d{constructor(n,r,o){super(n,r);this.getTagTreeProvider=o}async setTagColor(n,r){let o=at(n);return o?this.setEntityColor(K.TAG,o,r):Promise.resolve()}async setTagBackgroundColor(n,r){let o=at(n);return o?this.setEntityBackgroundColor(K.TAG,o,r):Promise.resolve()}async removeTagColor(n){let r=at(n);return r?this.removeEntityColor(K.TAG,r):Promise.resolve()}async removeTagBackgroundColor(n){let r=at(n);return r?this.removeEntityBackgroundColor(K.TAG,r):Promise.resolve()}resolveTagColorData(n,r,o){let a=r?this.getEntityColor(K.TAG,n):void 0,i=o?this.getEntityBackgroundColor(K.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(K.TAG,l);u&&(a=u)}if(o&&!i){let u=this.getEntityBackgroundColor(K.TAG,l);u&&(i=u)}if((!r||a)&&(!o||i))break}return{color:a,background:i}}getTagColorData(n){let r=at(n);return r?this.resolveTagColorData(r,!0,!0):{}}getTagColor(n){let r=at(n);if(r)return this.resolveTagColorData(r,!0,!1).color}getTagBackgroundColor(n){let r=at(n);if(r)return this.resolveTagColorData(r,!1,!0).background}async setTagIcon(n,r){let o=at(n);return o?this.setEntityIcon(K.TAG,o,r):Promise.resolve()}async removeTagIcon(n){let r=at(n);return r?this.removeEntityIcon(K.TAG,r):Promise.resolve()}getTagIcon(n){let r=at(n);if(r)return this.getEntityIcon(K.TAG,r)}async setTagSortOverride(n,r){let o=at(n);return o?this.setEntitySortOverride(K.TAG,o,r):Promise.resolve()}async removeTagSortOverride(n){let r=at(n);return r?this.removeEntitySortOverride(K.TAG,r):Promise.resolve()}getTagSortOverride(n){let r=at(n);if(r)return this.getEntitySortOverride(K.TAG,r)}async setTagChildSortOrderOverride(n,r){let o=at(n);return o?this.setEntityChildSortOrderOverride(K.TAG,o,r):Promise.resolve()}async removeTagChildSortOrderOverride(n){let r=at(n);return r?this.removeEntityChildSortOrderOverride(K.TAG,r):Promise.resolve()}getTagChildSortOrderOverride(n){let r=at(n);if(r)return this.getEntityChildSortOrderOverride(K.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=at(n),s=at(r);if(!i||!s||i===s){a&&await this.saveAndUpdate(g=>!!a(g));return}let l=this.settingsProvider.settings,c=this.hasTagMetadataForPath(l,i),u=yz(l,i),p=vz(l,i);this.settingsProvider.updateCollapsedPinnedContexts(g=>iv(g,K.TAG,i,s,{descendantDelimiter:"/",preserveExisting:o}));let m=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;!m&&!u&&!p&&!a||await this.saveAndUpdate(g=>{let f=!1;return m&&(f=this.updateNestedPaths(g.tagColors,i,s,o)||f,f=this.updateNestedPaths(g.tagBackgroundColors,i,s,o)||f,f=this.updateNestedPaths(g.tagIcons,i,s,o)||f,f=this.updateNestedPaths(g.tagSortOverrides,i,s,o)||f,f=this.updateNestedPaths(g.tagTreeSortOverrides,i,s,o)||f,f=this.updateNestedPaths(g.tagAppearances,i,s,o)||f),f=Xq(g,i,s)||f,f=Qq(g,i,s)||f,a&&(f=a(g)||f),f})}async handleTagDelete(n,r){let o=at(n);if(!o){r&&await this.saveAndUpdate(l=>!!r(l));return}this.settingsProvider.updateCollapsedPinnedContexts(l=>sv(l,K.TAG,o,{descendantDelimiter:"/"}));let a=this.settingsProvider.settings,i=this.hasTagMetadataForPath(a,o)||yz(a,o)||vz(a,o);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=Zq(l,o)||c,c=Jq(l,o)||c,r&&(c=r(l)||c),c})}async cleanupTagMetadata(n=this.settingsProvider.settings,r){let a=this.getTagTreeProvider()?.getAllTagPaths()||[],i=new Set(a.map(p=>at(p)).filter(p=>p!==null)),s=p=>{let m=at(p);return m?i.has(m):!1},l=p=>X4(p,s),c=this.cleanupCollapsedPinnedContexts(K.TAG,l,r),u=await Promise.all([this.cleanupMetadata(n,"tagColors",s),this.cleanupMetadata(n,"tagBackgroundColors",s),this.cleanupMetadata(n,"tagIcons",s),this.cleanupMetadata(n,"tagSortOverrides",s),this.cleanupMetadata(n,"tagTreeSortOverrides",s),this.cleanupMetadata(n,"tagAppearances",s)]);return c||u.some(p=>p)}async cleanupWithValidators(n,r=this.settingsProvider.settings,o){let a=n.dbFiles.some(({data:m})=>m.tags!==null);if(n.tagTree.size===0&&!a)return{settingsChanged:!1,localChanged:!1};let i=[];for(let m of n.tagTree.values()){let g=f=>{i.push(f.path);for(let h of f.children.values())g(h)};g(m)}let s=new Set(i.map(m=>at(m)).filter(m=>m!==null)),l=m=>{let g=at(m);return g?s.has(g):!1},c=m=>X4(m,l),u=this.cleanupCollapsedPinnedContexts(K.TAG,c,o);return{settingsChanged:(await Promise.all([this.cleanupMetadata(r,"tagColors",l),this.cleanupMetadata(r,"tagBackgroundColors",l),this.cleanupMetadata(r,"tagIcons",l),this.cleanupMetadata(r,"tagSortOverrides",l),this.cleanupMetadata(r,"tagTreeSortOverrides",l),this.cleanupMetadata(r,"tagAppearances",l)])).some(m=>m),localChanged:u}}};Ue();Vn();un();Et();sn();var iP=class extends _d{constructor(e,n){super(e,n)}async setPropertyColor(e,n){let r=en(e);return r?this.setEntityColor(K.PROPERTY,r,n):Promise.resolve()}async setPropertyBackgroundColor(e,n){let r=en(e);return r?this.setEntityBackgroundColor(K.PROPERTY,r,n):Promise.resolve()}async removePropertyColor(e){let n=en(e);return n?this.removeEntityColor(K.PROPERTY,n):Promise.resolve()}async removePropertyBackgroundColor(e){let n=en(e);return n?this.removeEntityBackgroundColor(K.PROPERTY,n):Promise.resolve()}resolvePropertyColorData(e,n,r){let o=n?this.getEntityColor(K.PROPERTY,e):void 0,a=r?this.getEntityBackgroundColor(K.PROPERTY,e):void 0;if(!(this.settingsProvider.settings.inheritPropertyColors&&(n&&!o||r&&!a)))return{color:o,background:a};let s=Xi(e);return!s||s===e?{color:o,background:a}:(n&&!o&&(o=this.getEntityColor(K.PROPERTY,s)),r&&!a&&(a=this.getEntityBackgroundColor(K.PROPERTY,s)),{color:o,background:a})}getPropertyColorData(e){let n=en(e);return n?this.resolvePropertyColorData(n,!0,!0):{}}getPropertyColor(e){let n=en(e);if(n)return this.resolvePropertyColorData(n,!0,!1).color}getPropertyBackgroundColor(e){let n=en(e);if(n)return this.resolvePropertyColorData(n,!1,!0).background}async setPropertyIcon(e,n){let r=en(e);return r?this.setEntityIcon(K.PROPERTY,r,n):Promise.resolve()}async removePropertyIcon(e){let n=en(e);return n?this.removeEntityIcon(K.PROPERTY,n):Promise.resolve()}getPropertyIcon(e){let n=en(e);if(n)return this.getEntityIcon(K.PROPERTY,n)}async setPropertySortOverride(e,n){let r=e===_e?e:en(e);return r?this.setEntitySortOverride(K.PROPERTY,r,n):Promise.resolve()}async removePropertySortOverride(e){let n=e===_e?e:en(e);return n?this.removeEntitySortOverride(K.PROPERTY,n):Promise.resolve()}getPropertySortOverride(e){let n=e===_e?e:en(e);if(n)return this.getEntitySortOverride(K.PROPERTY,n)}async setPropertyChildSortOrderOverride(e,n){let r=jv(e);return r?this.setEntityChildSortOrderOverride(K.PROPERTY,r,n):Promise.resolve()}async removePropertyChildSortOrderOverride(e){let n=jv(e);return n?this.removeEntityChildSortOrderOverride(K.PROPERTY,n):Promise.resolve()}getPropertyChildSortOrderOverride(e){let n=jv(e);if(n)return this.getEntityChildSortOrderOverride(K.PROPERTY,n)}createPropertyNodeValidator(e,n){let r=Uv({propertyFields:Kl(e),dbFiles:n.dbFiles})??(()=>!1);return o=>o===_e||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=Ee(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"?Ee(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,n){let r={dbFiles:Ft().getAllFiles(),tagTree:new Map,vaultFiles:new Set,vaultFolders:new Set},o=await this.cleanupWithValidators(r,e,n);return o.settingsChanged||o.localChanged}async cleanupWithValidators(e,n=this.settingsProvider.settings,r){let o=this.createPropertyNodeValidator(n,e),a=this.collectExistingPropertyKeys(e),i=this.cleanupCollapsedPinnedContexts(K.PROPERTY,o,r),s=await Promise.all([this.cleanupMetadata(n,"propertyColors",o),this.cleanupMetadata(n,"propertyBackgroundColors",o),this.cleanupMetadata(n,"propertyIcons",o),this.cleanupMetadata(n,"propertySortOverrides",o),this.cleanupMetadata(n,"propertyTreeSortOverrides",o),this.cleanupMetadata(n,"propertyAppearances",o)]);return{settingsChanged:this.pruneConfiguredPropertyKeys(n,a)||s.some(c=>c),localChanged:i}}};var Q4=require("obsidian");Ue();Ha();Vn();Mi();Et();Ob();var sP=class t extends _d{static{this.VAULT_ICON_PROVIDER_ID="vault"}getFile(e){let n=this.app.vault.getAbstractFileByPath(e);return n instanceof Q4.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=Ft(),i=[];if(a.forEachFile((l,c)=>{c.metadata?.icon===e&&i.push(l)}),i.length===0)return;let s=gi(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=Da(p,o);if(!m)return;let g=p[m];if(typeof g=="string"){if(hf(g)!==e)return;p[m]=s,u=!0;return}if(Array.isArray(g)){let h=g.map(b=>typeof b!="string"||hf(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=rr(r.trim());if(i=c&&c.length>0?c:null,i){let u=gi(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=Da(p,a)??a;if(l&&l.length>0){p[m]=l;return}Reflect.has(p,m)&&delete p[m]});let c=Ft(),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=Pd(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=Pd(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=Pd(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])=>Pd(o)[e]).map(([r])=>r):Object.keys(n)}async handleFileDelete(e){let n=Db(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(Do(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=Db(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(Do(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(K.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(K.FILE,e)}getFileIcon(e){return this.getEntityIcon(K.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(K.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(K.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(K.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(K.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[y,v]of o){let S=this.getFile(y);if(!S||S.extension!=="md"){u+=1;continue}let{success:w}=await this.writeFrontmatterValue(S,p,v,"icon");w?(await this.clearSettingsEntry("fileIcons",y),s.add(y),l+=1):u+=1}if(h)for(let[y,v]of a){let S=this.getFile(y);if(!S||S.extension!=="md"){u+=1;continue}let{success:w}=await this.writeFrontmatterValue(S,m,v,"color");w?(await this.clearSettingsEntry("fileColors",y),s.add(y),c+=1):u+=1}if(b)for(let[y,v]of i){let S=this.getFile(y);if(!S||S.extension!=="md"){u+=1;continue}let{success:w}=await this.writeFrontmatterValue(S,g,v,"background");w?(await this.clearSettingsEntry("fileBackgroundColors",y),s.add(y),c+=1):u+=1}return{iconsBefore:n,colorsBefore:r,migratedIcons:l,migratedColors:c,filesUpdated:s.size,failures:u}}getFileColor(e){return this.getEntityColor(K.FILE,e)??void 0}getFileBackgroundColor(e){return this.getEntityBackgroundColor(K.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 e5=require("obsidian");cP();un();Cn();Ue();Et();Vn();sn();Qa();var Z4="folder:",J4="tag:",cve=new Set([Lt,wt]),uP=class extends _d{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,Z4,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,Z4,r);return a&&this.markSeparatorsChangedIfLive(n),a}applyTagRename(n,r,o,a=!1){let i=n.navigationSeparators;if(!i)return!1;let s=at(r),l=at(o);if(!s||!l)return!1;let c=this.updatePrefixedPaths(i,J4,s,l,a);return c&&this.markSeparatorsChangedIfLive(n),c}applyTagDelete(n,r){let o=n.navigationSeparators;if(!o)return!1;let a=at(r);if(!a)return!1;let i=this.deletePrefixedPaths(o,J4,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 lP(n.id);if(n.type==="folder"){let o=this.normalizeFolderPath(n.path);return o?Lb(o):null}if(n.type==="property"){let o=en(n.nodeId);return o?zb(o):null}let r=at(n.path);return r?dP(r):null}normalizeFolderPath(n){let r=n?.trim()??"";if(r.length===0||r==="/")return"/";try{let o=(0,e5.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=dn(n.navigationSeparators,Zm);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 cve.has(n)}getKnownTagPaths(){let n=this.getTagTreeProvider?.();return n?new Set(n.getAllTagPaths()):null}collectValidatorTagPaths(n){let r=new Set;return n.forEach(o=>Hl(o,r)),r}createPropertyNodeValidator(n,r){if(r)return Uv({propertyFields:Kl(n),dbFiles:r.dbFiles});let o=Uv({propertyFields:Kl(n),propertyTreeProvider:this.getPropertyTreeProvider?.()??null});if(o)return o;let a=mr();if(!a)return null;let i=a.getAllFiles();return i.length===0?null:Uv({propertyFields:Kl(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=hE(l);if(!c){delete i[l],s=!0;return}let u=Hf(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=en(u.nodeId);if(!p){delete i[l],c!==l&&Object.prototype.hasOwnProperty.call(i,c)&&delete i[c],s=!0;return}let m=zb(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)}};Vn();un();Et();Qa();var fE=class t{constructor(e,n,r,o){this.app=e;this.settingsProvider=n,this.folderService=new oP(e,n),this.tagService=new aP(e,n,r),this.propertyService=new iP(e,n),this.fileService=new sP(e,n),this.navigationSeparatorService=new uP(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=Ft().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=Ft().getFile(e)?.metadata?.color?.trim();if(a)return a}return this.fileService.getFileColor(e)}getFileBackgroundColor(e){if(this.settingsProvider.settings.useFrontmatterMetadata){let a=Ft().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,n){let r=t.prepareCleanupValidators(this.app);return this.runUnifiedCleanup(r,e,n)}async cleanupTagMetadata(e=this.settingsProvider.settings){return this.tagService.cleanupTagMetadata(e)}async runUnifiedCleanup(e,n=this.settingsProvider.settings,r){let[o,a,i,s,l]=await Promise.all([this.folderService.cleanupWithValidators(e,n,r),this.tagService.cleanupWithValidators(e,n,r),this.propertyService.cleanupWithValidators(e,n,r),this.fileService.cleanupWithValidators(e,n),this.navigationSeparatorService.cleanupWithValidators(e,n)]);return{settingsChanged:o.settingsChanged||a.settingsChanged||i.settingsChanged||s||l,localChanged:o.localChanged||a.localChanged||i.localChanged}}async getCleanupSummary(){let e=t.cloneSettings(this.settingsProvider.settings),n=this.settingsProvider.getCollapsedPinnedContexts(),r=t.computeMetadataCounts(e,n);await this.cleanupAllMetadata(e,n);let o=t.computeMetadataCounts(e,n),a=Math.max(0,r.folders-o.folders),i=Math.max(0,r.tags-o.tags),s=Math.max(0,r.properties-o.properties),l=Math.max(0,r.files-o.files),c=Math.max(0,r.pinnedNotes-o.pinnedNotes),u=Math.max(0,r.separators-o.separators),p=a+i+s+l+c+u;return{folders:a,tags:i,properties:s,files:l,pinnedNotes:c,separators:u,total:p}}static cloneSettings(e){return JSON.parse(JSON.stringify(e))}static computeMetadataCounts(e,n){let r=t.collectUniqueKeys([e.folderColors,e.folderBackgroundColors,e.folderIcons,e.folderSortOverrides,e.folderAppearances]),o=t.collectUniqueKeys([e.tagColors,e.tagBackgroundColors,e.tagIcons,e.tagSortOverrides,e.tagAppearances]),a=t.collectUniqueKeys([e.fileIcons,e.fileColors,e.fileBackgroundColors]),i=t.collectUniqueKeys([e.propertyColors,e.propertyBackgroundColors,e.propertyIcons,e.propertySortOverrides,e.propertyAppearances,e.propertyTreeSortOverrides]);e.vaultProfiles.forEach(c=>{!Array.isArray(c.propertyKeys)||c.propertyKeys.length===0||c.propertyKeys.forEach(u=>{let p=typeof u?.key=="string"?Ee(u.key):"";p&&i.add(or(p))})}),Object.keys(n).forEach(c=>{let u=Qh(c,"folder");if(u!==null){r.add(u);return}let p=Qh(c,"tag");if(p!==null){o.add(p);return}let m=Qh(c,"property");m!==null&&i.add(m)});let s=e.pinnedNotes?Object.keys(e.pinnedNotes).length:0,l=e.navigationSeparators?Object.keys(e.navigationSeparators).length:0;return{folders:r.size,tags:o.size,properties:i.size,files:a.size,pinnedNotes:s,separators:l}}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=Ft(),o=n??jI(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 t5.TFolder&&s(c)})};return s(e.vault.getRoot()),{dbFiles:r.getAllFiles(),tagTree:o,vaultFiles:a,vaultFolders:i}}};var bE=require("obsidian");hn();Oe();$a();var r5=require("obsidian");Oe();st();_b();var yE=class extends r5.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"),tm(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",()=>{$(()=>this.handleSubmit())}),this.scope.register([],"Enter",l=>{activeDocument.activeElement===this.inputEl&&(l.preventDefault(),$(()=>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()}};Ol();Et();bn();st();_l();mo();un();Ln();hc();_b();Et();var vE=class{constructor(e){this.app=e}isMarkdownFile(e){return e.extension==="md"}async deletePropertyKeyFromFile(e,n){if(!this.isMarkdownFile(e))return!1;let r=Ee(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)Ee(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=Ee(n.oldKey),o=n.newKeyDisplay.trim(),a=Ee(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=>Ee(h)===r);if(c.length===0)return;let u=l.filter(h=>Ee(h)===a),p=new Set([...c,...u]);p.delete(o);let g=(()=>{let h=c.find(y=>y===n.oldKey);return h||(c.slice().sort((y,v)=>y.localeCompare(v))[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}};sn();Ue();var o5=Ut.operations.metadataMutationYieldBatchSize,a5=[{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}}],i5=[{read:t=>t.propertyTreeSortOverrides,write:(t,e)=>{t.propertyTreeSortOverrides=e}}];function s5(t,e,n){if(!t.propertySortKey.trim())return!1;let r=uI(t.propertySortKey,e,n);return r===t.propertySortKey?!1:(t.propertySortKey=r,!0)}function l5(t,e,n){let r=t.manualSortPropertyKey.trim();return!r||Ee(r)!==e?!1:(t.manualSortPropertyKey=n??"",!0)}function d5(t,e,n){let r=t.manualSortGroupHeaderProperty.trim();return!r||Ee(r)!==e?!1:(t.manualSortGroupHeaderProperty=n??"",!0)}function pve(t,e,n){if(!t)return!1;let r=!1;for(let o of Object.keys(t)){let a=Su(t[o]);!a||typeof a=="string"||Ee(a.propertyKey??"")===e&&(n?t[o]={...a,propertyKey:n}:delete t[o],r=!0)}return r}function c5(t,e,n){let r=!1;return pL.forEach(o=>{r=pve(t[o],e,n)||r}),r}var SE=class{constructor(e,n,r,o,a){this.app=e;this.getSettings=n;this.saveSettingsAndUpdate=r;this.getPropertyTreeService=o;this.updateCollapsedPinnedContexts=a;this.propertyKeyRenameListeners=new Set;this.propertyKeyDeleteListeners=new Set;this.fileMutations=new vE(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){oe(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"});return}let r=n.getKeyNode(e);if(!r){oe(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"});return}let o=this.collectPropertyKeyPathsFromVault(e),a=Bb(this.app,o),i=Promise.resolve().then(()=>this.collectRenameConflictSnapshot(e,o));new yE(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 oe(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"}),!1;let o=r.getKeyNode(e);if(!o)return oe(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 oe(d.modals.propertyOperation.invalidKeyName,{variant:"warning"}),!1;let r=Ee(n);if(!r)return oe(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){oe(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"});return}let r=n.getKeyNode(e);if(!r){oe(d.fileSystem.notifications.propertyOperationsNotAvailable,{variant:"warning"});return}let o=this.collectPropertyKeyPathsFromVault(e),a=Bb(this.app,o),i=a.total===1?d.modals.tagOperation.file:d.modals.tagOperation.files;new Pn(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),()=>{$(()=>this.runPropertyKeyDelete({keyNodeName:r.name,normalizedKey:e,affectedPaths:o}))},d.modals.propertyOperation.confirmDelete,{buildContent:l=>tm(l,a)}).open()}async runPropertyKeyRename(e){let n=Ee(e.oldKeyNormalized),r=e.oldKeyDisplay.trim(),o=e.newKeyDisplay.trim(),a=Ee(o);if(!n||!a||!o)return oe(d.modals.propertyOperation.invalidKeyName,{variant:"warning"}),!1;if(r===o)return oe(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 bE.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%o5===0&&await xg()}if(!(s===0&&i>0))return oe(`${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?oe(d.modals.propertyOperation.renameSettingsUpdateFailed.replace("{oldKey}",r).replace("{newKey}",o),{variant:"warning"}):oe(`${d.modals.propertyOperation.confirmRename}: ${r} → ${o} (${i}/${l})`,{variant:"success"}),!0}async runPropertyKeyDelete(e){let n=Ee(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 bE.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%o5===0&&await xg()}if(!(o===0&&r>0))return oe(`${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?oe(d.modals.propertyOperation.deleteSettingsUpdateFailed.replace("{property}",e.keyNodeName),{variant:"warning"}):r===1?oe(d.modals.propertyOperation.deleteSingleSuccess.replace("{property}",e.keyNodeName),{variant:"success"}):oe(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=He(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=He(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=He(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=He(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,a5,o=>this.renamePropertyNodeMetadataRecord(o,n,r))}renamePropertyKeyMetadataFields(e,n,r){return this.mutatePropertyMetadataRecords(e,i5,o=>this.renamePropertyKeyMetadataRecord(o,n,r))}removePropertyNodeMetadataFields(e,n){return this.mutatePropertyMetadataRecords(e,a5,r=>this.removePropertyNodeMetadataRecord(r,n))}removePropertyKeyMetadataFields(e,n){return this.mutatePropertyMetadataRecords(e,i5,r=>this.removePropertyKeyMetadataRecord(r,n))}migratePropertyMetadataAfterRename(e,n,r){let o=or(n),a=or(r),i=this.renamePropertyNodeMetadataFields(e,o,a),s=this.renamePropertyKeyMetadataFields(e,o,a);return this.updateCollapsedPinnedContexts(l=>iv(l,K.PROPERTY,o,a,{descendantDelimiter:"="})),i||s}removePropertyMetadataForDeletedKey(e,n){let r=or(n),o=this.removePropertyNodeMetadataFields(e,r),a=this.removePropertyKeyMetadataFields(e,r);return this.updateCollapsedPinnedContexts(i=>sv(i,K.PROPERTY,r,{descendantDelimiter:"="})),o||a}async updateSettingsAfterRename(e,n){let r=this.getSettings(),o=!1,a=Kl(r),i=Ee(n),s=Jj(a,e,n,!1);o=fz(r,s)||o,o=s5(r,e,n)||o,o=CL(r,e,n)||o,o=l5(r,e,n)||o,o=d5(r,e,n)||o,o=c5(r,e,n)||o,o=PL(r,e,n)||o,o=hL(r,e,n)||o,o=FL(r,e,n)||o,o=af(r).changed||o,o=cf(r).changed||o,i&&(o=this.migratePropertyMetadataAfterRename(r,e,i)||o),o&&await this.saveSettingsAndUpdate()}async updateSettingsAfterDelete(e){let n=this.getSettings(),r=!1,o=Kl(n),a=Zj(o,e);r=fz(n,a)||r,r=s5(n,e,null)||r,r=CL(n,e,null)||r,r=l5(n,e,null)||r,r=d5(n,e,null)||r,r=c5(n,e,null)||r,r=PL(n,e,null)||r,r=hL(n,e,null)||r,r=FL(n,e,null)||r,r=af(n).changed||r,r=cf(n).changed||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=Ee(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 bE.TFile)||!this.fileMutations.isMarkdownFile(i)))try{let s=this.app.metadataCache.getFileCache(i)?.frontmatter;if(!ht(s))continue;let l=Object.keys(s);if(l.length===0)continue;let c=new Set,u=!1;if(l.forEach(p=>{let m=Ee(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=Ee(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(!ht(i))continue;Object.keys(i).some(l=>Ee(l)===n)&&r.add(a.path)}return r}collectRenameConflictPathsFromSnapshot(e,n,r){let o=Ee(e),a=Ee(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=Bb(this.app,e.conflictPaths),r=n.total===1?d.modals.tagOperation.file:d.modals.tagOperation.files;return await new Promise(o=>{new Pn(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=>tm(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 wE=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 p5=require("obsidian");Ol();Oe();$a();Ue();PE();pP();st();bn();_b();var gve=Ut.operations.metadataMutationYieldBatchSize,hve=8,CE=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===Lt||e===wt)return;let n=this.getHooks(),r=this.getTagTreeService(),o=n.resolveDisplayTagPath(e);if(o.length===0)return;let a=new rs(o),i=U0(this.app,a,r),s=Array.from(new Set(i)),l=W0(this.app,s);if(l.total===0){oe(`#${o}: ${d.listPane.emptyStateNoNotes}`,{variant:"warning"});return}let c=l.total===1?d.modals.tagOperation.file:d.modals.tagOperation.files;new Pn(this.app,d.modals.tagOperation.deleteTitle.replace("{tag}",`#${o}`),d.modals.tagOperation.deleteWarning.replace("{tag}",`#${o}`).replace("{count}",l.total.toString()).replace("{files}",c),()=>{$(()=>this.runTagDelete(o))},d.modals.tagOperation.confirmDelete,{buildContent:p=>tm(p,l)}).open()}async runTagDelete(e,n){let r=this.getHooks(),o=new rs(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();U0(this.app,o,b).forEach(v=>{typeof v=="string"&&v.length>0&&a.add(v)})}if(a.size===0)return oe(`#${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,y)=>{b.length>=hve||b.push(y)};for(let b of a){u+=1;let y=this.app.vault.getAbstractFileByPath(b);if(!(y instanceof p5.TFile))l+=1,p["file-missing"]+=1,g(m["file-missing"],b);else if(!this.fileMutations.isMarkdownFile(y))l+=1,p["not-markdown"]+=1,g(m["not-markdown"],y.path);else try{await r.deleteTagFromFile(y,o)?s+=1:(l+=1,p["no-op"]+=1,g(m["no-op"],y.path))}catch(v){c+=1,console.error(`[Notebook Navigator] Failed to delete tag ${o.tag} in ${b}`,v)}u%gve===0&&await xg()}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,y=f&&c>0?`${b} ${d.modals.tagOperation.checkConsoleForDetails}`:b;return oe(`${d.modals.tagOperation.confirmDelete}: ${o.tag}. ${y}`,{variant:"warning"}),!1}if(f){let b=h(),y=c>0?`${b} ${d.modals.tagOperation.checkConsoleForDetails}`:b;return oe(`${d.modals.tagOperation.confirmDelete}: ${o.tag}. ${y}`,{variant:"warning"}),!0}return await r.removeTagMetadataAfterDelete(o.name),await r.removeTagShortcutsAfterDelete(o.name),r.notifyTagDeleted({path:o.name,canonicalPath:o.canonicalName}),s===1?oe(d.fileSystem.notifications.tagRemovedFromNote,{variant:"success"}):oe(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 P5=require("obsidian");Vn();Hr();Cn();H0();ll();Vb();Zs();Q0();Et();var T5="[^\\S\\r\\n]",k5=`#[^${Ff}]+`,xve=`(?=$|[${Ff}])`,IE=class t{constructor(e,n){this.app=e;this.getSettings=n}static{this.INLINE_TAG_PATTERN=new RegExp(`(${T5})?${k5}`,"gu")}static{this.INLINE_TAG_TEST_PATTERN=new RegExp(`(?:^|\\s)${k5}`,"u")}isMarkdownFile(e){return e.extension==="md"}isValidTagName(e){return $I(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=Ft(),o=Br({app:this.app,file:e,db:r}),a=Mt(n);return a.length===0?!1:o.some(i=>{let s=Mt(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=Mt(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=Mt(n);if(r.length===0)return null;let a=this.getTagsFromFiles([e]).filter(s=>Mt(s).startsWith(`${r}/`));if(a.length===0)return null;let i=new Set(a.map(s=>Mt(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=Ft();for(let o of e){if(!this.isMarkdownFile(o))continue;Br({app:this.app,file:o,db:r}).forEach(i=>{let s=Mt(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=TE(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=>Mt(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,P5.parseFrontMatterTags)({tags:e})??[];if(r.length===0)return{nextValue:e,changed:!1};let{filtered:o,removed:a}=this.filterStringArrayEntries(r,s=>Mt(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=Mt(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=Mt(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 Da(e,"tags")??Da(e,"tag")}dedupeCanonicalTagValues(e){let n=[],r=new Set;return e.forEach(o=>{let a=o.trim();if(a.length===0)return;let i=Mt(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=>XI(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(`(${T5})?#${o}${xve}`,"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!QI(m)||f5(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=Ec(e),r=jl(e,n),o=S5(e);return Hd([...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)}}};Ol();Oe();PE();var F5=require("obsidian");Oe();st();_b();var xE=class extends F5.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"),tm(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",()=>{$(()=>this.handleSubmit())}),this.scope.register([],"Enter",c=>{activeDocument.activeElement===this.inputEl&&(c.preventDefault(),$(()=>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()}};pP();bn();var Eve=Ut.operations.metadataMutationYieldBatchSize,EE=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 rs(r),a=Hb(this.app,o),i=G0(this.app,a);if(i.total===0){oe(`#${r}: ${d.listPane.emptyStateNoNotes}`,{variant:"warning"});return}new xE(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 rs(r),a=Hb(this.app,o);return G0(this.app,a).total===0?(oe(`#${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 oe(d.modals.tagOperation.invalidTagName,{variant:"warning"}),!1;let i=new rs(a);return K0(n,i)?(oe(d.modals.tagOperation.descendantRenameError,{variant:"warning"}),!1):await u5(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 rs(e),a=new rs(n),i=new kE(o,a),s=this.getTagTreeService(),l=r??Hb(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;oe(`${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(K0(a.oldTag,a.newTag))return oe(d.modals.tagOperation.descendantRenameError,{variant:"warning"}),!1;if(a.oldTag.tag===a.newTag.tag)return oe(d.modals.tagOperation.renameUnchanged.replace("{tag}",a.oldTag.tag),{variant:"warning"}),!1;if(a.targets.length===0)return oe(`#${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 oe(`${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 oe(`${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}),oe(`${d.modals.tagOperation.confirmRename}: ${a.oldTag.tag} → ${a.newTag.tag} (${i.renamed}/${i.total})`,{variant:"success"}),!0}};Cn();Ha();sn();var RE=class{constructor(e){this.getMetadataService=e}async updateTagShortcutsAfterRename(e,n){let r=at(e),o=at(n);!r||!o||r===o||await this.mutateTagShortcuts(a=>{let i=`${r}/`,s=new Set;for(let p of a)if(Oo(p)){let m=at(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(!Oo(p)){u.push(p);continue}let m=at(p.tagPath)??p.tagPath,g=m===r,f=m.startsWith(i),h=m;if(g||f){let y=f?m.slice(i.length):"";h=y.length>0?`${o}/${y}`: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=at(e);n&&await this.mutateTagShortcuts(r=>{let o=`${n}/`,a=!1,i=[];for(let s of r){if(!Oo(s)){i.push(s);continue}let l=at(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||!vx(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();pP();var ME=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 IE(this.app,this.getSettings),this.batchOperations=new wE(this.fileMutations),this.shortcutMutations=new RE(this.getMetadataService),this.renameWorkflow=new EE(this.app,this.fileMutations,this.getTagTreeService,this.getMetadataService,a=>this.resolveDisplayTagPath(a),()=>this.createRenameHooks()),this.deleteWorkflow=new CE(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===Lt||e===wt?!1:this.renameWorkflow.renameTag(e,n)}async promoteTagToRoot(e){if(e===Lt||e===wt)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===Lt||n===wt)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 FE(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)}}};Qa();Ln();Hr();var AE=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 $i(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(Hl(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(XL(n));return this.descendantFilePathsByNode.set(n,o),[...o]}getTaggedCount(){return this.taggedCount}normalizeLookupPath(e){return Mt(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)=>At(i.displayPath,s.displayPath)),{nodeByPath:n,flattenedTags:r}}notifyTreeUpdateListeners(){this.treeUpdateListeners.forEach(e=>{e()})}};un();var DE=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 cx(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 vq(e,n);if(!e.valuePath)return new Set;let r=this.getKeyNode(e.key);return r?yq(r,e.valuePath):new Set}};Z0();var N5=require("obsidian");ef();var Mve=/[",]/,Ave=/^[\x20-\x7E]+$/,Dve=/(^|\s)-?path\s*:/i,Ove="1.30.0";function Lve(t){return t instanceof N5.TFile}function C5(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 zve(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 Bve(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 _ve(t,e){let n=t.trim();return!n||Mve.test(n)?!1:e||Ave.test(n)}function Hve(t,e,n){let r=e?.pathScope?.trim();return!r||!_ve(r,n)||Dve.test(t)?t:`${t} path:"${r}/"`}var LE=class{constructor(e){this.app=e}resolveApi(){let r=this.app.plugins?.plugins?.omnisearch;if(r&&r.api&&C5(r.api))return r.api;let o=activeWindow.omnisearch;return o&&C5(o)?o:null}resolveInstalledVersion(){let r=this.app.plugins?.plugins?.omnisearch?.manifest?.version;return typeof r=="string"&&r.length>0?r:null}isAvailable(){return this.resolveApi()!==null}async search(e,n){let r=this.resolveApi();if(!r)return[];try{let o=this.resolveInstalledVersion(),a=o!==null&&Ri(o,Ove)>=0,i=Hve(e,n,a),s=await r.search(i),l=[];for(let c of s){if(!zve(c))continue;let u=this.app.vault.getAbstractFileByPath(c.path);Lve(u)&&l.push({file:u,path:c.path,basename:c.basename,score:c.score,excerpt:c.excerpt,matches:Bve(c.matches),foundWords:Array.isArray(c.foundWords)?c.foundWords.filter(p=>typeof p=="string"):[]})}return l}catch{return[]}}registerOnIndexed(e){let n=this.resolveApi();n&&n.registerOnIndexed(e)}unregisterOnIndexed(e){let n=this.resolveApi();n&&n.unregisterOnIndexed(e)}};hB();ei();eP();var o6=require("obsidian");go();Ja();var ZE=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 o6.TFolder?al(e,n,{enableFolderNotes:!0,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:Ae.recentNotesCount;return Math.max(1,n)}};var a6=require("obsidian");wd();ef();var nbe=1440*60*1e3,SP=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,a6.requestUrl)({url:oW,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()}};JE();jr();Lg();Vn();qb();Et();st();Ue();JE();var TP=class{constructor(e){this.plugin=e}detachCalendarViewLeaves(){let e=this.plugin.app.workspace.getLeavesOfType(Sp);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(Sp)[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:Sp,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(Ra);return r.length>0?(n=r[0],await e.revealLeaf(n)):(n=e.getLeftLeaf(!1),n&&(await n.setViewState({type:Ra,active:!0}),await e.revealLeaf(n))),n}getNavigatorLeaves(){return this.plugin.app.workspace.getLeavesOfType(Ra)}revealFileInActualFolder(e,n){this.getNavigatorLeaves().forEach(r=>{let{view:o}=r;dl(o)&&o.navigateToFile(e,n)})}revealFileInNearestFolder(e,n){this.getNavigatorLeaves().forEach(r=>{let{view:o}=r;dl(o)&&o.revealFileInNearestFolder(e,n)})}};var FP=require("obsidian");m0();Ue();lb();PP();Oe();pc();sn();var CP=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 y3(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=wp(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 FP.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=ro();if(!n)return!1;if(e==="day"&&this.plugin.settings.calendarIntegrationMode==="daily-notes")return!!zg(this.plugin.app);let r=qp(e,this.plugin.settings),o=yg(r.calendarCustomFilePattern,r.fallbackPattern);return r.isPatternValid(o,n)}resolvePeriodicHomepageFile(e){let n=ro();if(!n)return null;let r=Vi(),{calendarRulesLocale:o}=Ip(this.plugin.settings.calendarLocale,n,r),a=xp(this.plugin.settings.calendarPeriodicNotesLocaleSource,o,n),i=n().startOf("day");if(e==="day"&&this.plugin.settings.calendarIntegrationMode==="daily-notes"){let m=zg(this.plugin.app);return m?$b(this.plugin.app,i.clone().locale(ku(n)),m):null}let s=qp(e,this.plugin.settings),l=yg(s.calendarCustomFilePattern,s.fallbackPattern);if(!s.isPatternValid(l,n))return null;let c=Yp(e,i,l,a,a),u=vg(c,{calendarCustomRootFolder:nn(this.plugin.settings).periodicNotesFolder},s.calendarCustomFilePattern,s.fallbackPattern),p=this.plugin.app.vault.getAbstractFileByPath(u.filePath);return p instanceof FP.TFile?p:null}async createPeriodicHomepageFile(e){let n=ro();if(!n)return null;let r=Vi(),{calendarRulesLocale:o}=Ip(this.plugin.settings.calendarLocale,n,r),a=xp(this.plugin.settings.calendarPeriodicNotesLocaleSource,o,n),i=n().startOf("day");if(e==="day"&&this.plugin.settings.calendarIntegrationMode==="daily-notes"){let m=zg(this.plugin.app);return m?Xb(this.plugin.app,i.clone().locale(ku(n)),m):null}let s=qp(e,this.plugin.settings),l=yg(s.calendarCustomFilePattern,s.fallbackPattern);if(!s.isPatternValid(l,n))return null;let c=Yp(e,i,l,a,a),u=vg(c,{calendarCustomRootFolder:nn(this.plugin.settings).periodicNotesFolder},s.calendarCustomFilePattern,s.fallbackPattern),p=this.plugin.app.vault.getAbstractFileByPath(u.filePath);if(p instanceof FP.TFile)return p;try{let m=ib(e,this.plugin.settings);return await sb(this.plugin.app,u.folderPath,u.fileName,m)}catch(m){return console.error("Failed to create homepage note",m),null}}};var Mc=require("obsidian");Ue();st();Ja();qb();var f6="folder-note-sidebar-service",ybe=1e3,vbe={type:qh,state:{}},bbe=new Set(["markdown","canvas","base","excalidraw"]),lR=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(f6,()=>this.handleSettingsUpdate()))}dispose(){this.isStarted=!1,this.plugin.unregisterSettingsUpdateListener(f6),this.clearSidebarOpenSuppression()}handleWorkspaceReady(){this.workspaceReady=!0;let e=this.selectedFolder;if(e!==void 0){let n=this.syncToSelectedFolder(e);return $(()=>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){$(()=>this.detachCompanionLeaf());return}if(this.shouldFollowRelatedFolderNotes){let e=this.selectedFolder;e!==void 0&&$(()=>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,Mc.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=Rn(n,this.plugin.settings);if(r)return r;n=n.parent instanceof Mc.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||ul(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||ul(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||ul(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===qh}getFileFromLeaf(e){let n=e.view;return typeof Mc.FileView=="function"&&n instanceof Mc.FileView&&n.file instanceof Mc.TFile?n.file:null}getFilePathFromLeaf(e){let n=e.getViewState();if(!bbe.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 Mc.TFile)||!(n.parent instanceof Mc.TFolder)?!1:Rn(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(vbe),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},ybe))}clearSidebarOpenSuppression(){this.suppressionTimer!==null&&typeof window<"u"&&window.clearTimeout(this.suppressionTimer),this.suppressionTimer=null,this.suppressedSidebarOpenPath=null}};var Ac=require("obsidian");Oe();ei();st();Vm();sn();eP();function yB(t){let e=Fn(),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(wx(t.settings,s,l))try{await t.saveSettingsAndUpdate()}catch(u){console.error("Failed to persist hidden folder rename updates",u)}},a=async s=>{if(Tx(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(()=>{$(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(vs).onClick(()=>{$(async()=>{await t.navigateToFolder(l,{preserveNavigationFocus:!0})})})})})),t.ribbonIconEl=t.addRibbonIcon(vs,d.plugin.ribbonTooltip,()=>{$(()=>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)=>{$(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;let c=t.commandQueue?.isChangingFilePaths()??!1;(Jk(l)||Jk(s.path))&&(l3(s,l),kb(l),kb(s.path),e.invalidateIconValidationCache(),r()),t.recentNotesService?.renameEntry(l,s.path),await t.metadataService?.handleFileRename(l,s.path);let p=g=>{let f=g.lastIndexOf("/");return f>0?g.substring(0,f):"/"};p(l)!==p(s.path)&&s===t.app.workspace.getActiveFile()&&!c&&t.settings.autoRevealActiveFile&&await t.revealFileInActualFolder(s),t.notifyFileRenameListeners(l,s.path)})})),t.registerEvent(t.app.vault.on("create",s=>{$(async()=>{t.isShuttingDown()||!(s instanceof Ac.TFile)||!zd(s)||(i3(s),kb(s.path),e.invalidateIconValidationCache(),r())})})),t.registerEvent(t.app.vault.on("modify",s=>{$(async()=>{t.isShuttingDown()||!(s instanceof Ac.TFile)||!zd(s)||(kb(s.path),r())})})),t.registerEvent(t.app.vault.on("delete",s=>{$(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),zd(s)&&(s3(s.path),kb(s.path),e.invalidateIconValidationCache(),r()))}})}))}var A6=require("obsidian");Oe();var Abe=[{id:"open",name:d.commands.open},...A6.Platform.isMobile?[]:[{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:"collapse-expand-list-groups",name:d.commands.collapseExpandListGroups},{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}],Dbe=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}}),Obe=[...Abe,...Dbe],M6=new WeakMap;function Lbe(t){let e=M6.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}=(R6(),Wr(E6));a(t)}finally{r?t.addCommand=o:delete t.addCommand}return M6.set(t,n),n}function D6(t,e){return Lbe(t).get(e)}function zbe(t,e){let n=D6(t,e);if(!n?.callback){console.error(`Notebook Navigator command handler not found: ${e}`);return}n.callback()}function Bbe(t,e,n){let r=D6(t,e);return r?.checkCallback?r.checkCallback(n)===!0:(console.error(`Notebook Navigator command check handler not found: ${e}`),!1)}function SB(t){Obe.forEach(e=>{if(e.checkable){t.addCommand({id:e.id,name:e.name,checkCallback:n=>Bbe(t,e.id,n)});return}t.addCommand({id:e.id,name:e.name,callback:()=>zbe(t,e.id)})})}hn();Vm();go();var W6=require("obsidian");Ue();ST();Et();jr();mo();Wm();hn();function O6(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 wB(t,e){let n=t.toolbarVisibility,r=e&&typeof e=="object"?e:void 0;return{navigation:O6(n.navigation,r?.navigation),list:O6(n.list,r?.list)}}function xP(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 L6(t){let e=xP(t);if(e===null)return null;let n=Math.round(e);return nbu?null:n}function z6(t){let e=xP(t);if(e===null)return null;let n=Math.round(e);return n<10||n>24?null:n}function B6(t){let e=xP(t);if(e===null)return null;let n=Math.round(e);return n<20||n>28?null:n}function _6(t){return $m(t)?t:null}function H6(t){return Xm(t)?t:null}function V6(t){let e=xP(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 K6(t){let e=xP(t);if(e===null)return null;let n=Math.round(e);return n<20||n>28?null:n}function G6(t){let{settings:e,storedData:n,keys:r}=t,o=typeof n?.lastReleaseCheckAt=="number"&&Number.isFinite(n.lastReleaseCheckAt)?n.lastReleaseCheckAt:null,a=Te.get(r.releaseCheckTimestampKey),i=typeof a=="number"&&Number.isFinite(a)?a:o??null;return i&&i!==a&&Te.set(r.releaseCheckTimestampKey,i),delete e.lastReleaseCheckAt,delete e.latestKnownRelease,!!(n&&("lastReleaseCheckAt"in n||"latestKnownRelease"in n))}function j6(t){let{settings:e,storedData:n,keys:r}=t,o=Jm(n?.collapsedPinnedContexts),a=Jm(Te.get(r.collapsedPinnedContextsKey)),i=!1;return Object.keys(o).forEach(s=>{a[s]!==!0&&(a[s]=!0,i=!0)}),i&&Te.set(r.collapsedPinnedContextsKey,a),delete e.collapsedPinnedContexts,!!(n&&"collapsedPinnedContexts"in n)}function q6(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,Km):[],i=Te.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,Km);(s.length!==c.length||c.some((p,m)=>p!==s[m]))&&Te.set(r.recentColorsKey,c)}return delete e.recentColors,!!(n&&"recentColors"in n)}function Y6(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.paneTransitionDurationKey),a=L6(o);if(a!==null)return{value:a,migrated:!1};let i=e?.paneTransitionDuration,s=L6(i);if(s!==null)return Te.set(n.paneTransitionDurationKey,s),{value:s,migrated:!0};let l=r.paneTransitionDuration;return Te.set(n.paneTransitionDurationKey,l),{value:l,migrated:!1}}function $6(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.toolbarVisibilityKey);if(ht(o))return{value:wB(r,o),migrated:!1};let a=e?.toolbarVisibility;if(ht(a)){let s=wB(r,a);return Te.set(n.toolbarVisibilityKey,s),{value:s,migrated:!0}}let i=wB(r,null);return Te.set(n.toolbarVisibilityKey,i),{value:i,migrated:!1}}function X6(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.navIndentKey),a=z6(o);if(a!==null)return{value:a,migrated:!1};let i=e?.navIndent,s=z6(i);if(s!==null)return Te.set(n.navIndentKey,s),{value:s,migrated:!0};let l=r.navIndent;return Te.set(n.navIndentKey,l),{value:l,migrated:!1}}function Q6(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.navItemHeightKey),a=B6(o);if(a!==null)return{value:a,migrated:!1};let i=e?.navItemHeight,s=B6(i);if(s!==null)return Te.set(n.navItemHeightKey,s),{value:s,migrated:!0};let l=r.navItemHeight;return Te.set(n.navItemHeightKey,l),{value:l,migrated:!1}}function Z6(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.navItemHeightScaleTextKey);if(typeof o=="boolean")return{value:o,migrated:!1};let a=e?.navItemHeightScaleText;if(typeof a=="boolean")return Te.set(n.navItemHeightScaleTextKey,a),{value:a,migrated:!0};let i=r.navItemHeightScaleText;return Te.set(n.navItemHeightScaleTextKey,i),{value:i,migrated:!1}}function J6(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.pinNavigationBannerKey);if(typeof o=="boolean")return{value:o,migrated:!1};let a=e?.pinNavigationBanner;if(typeof a=="boolean")return Te.set(n.pinNavigationBannerKey,a),{value:a,migrated:!0};let i=r.pinNavigationBanner;return Te.set(n.pinNavigationBannerKey,i),{value:i,migrated:!1}}function e8(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.calendarPlacementKey),a=_6(o);if(a!==null)return{value:a,migrated:!1};let i=e?.calendarPlacement,s=_6(i);if(s!==null)return Te.set(n.calendarPlacementKey,s),{value:s,migrated:!0};let l=r.calendarPlacement;return Te.set(n.calendarPlacementKey,l),{value:l,migrated:!1}}function t8(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.calendarLeftPlacementKey),a=H6(o);if(a!==null)return{value:a,migrated:!1};let i=e?.calendarLeftPlacement,s=H6(i);if(s!==null)return Te.set(n.calendarLeftPlacementKey,s),{value:s,migrated:!0};let l=r.calendarLeftPlacement;return Te.set(n.calendarLeftPlacementKey,l),{value:l,migrated:!1}}function n8(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.calendarWeeksToShowKey),a=V6(o);if(a!==null)return{value:a,migrated:!1};let i=e?.calendarWeeksToShow,s=V6(i);if(s!==null)return Te.set(n.calendarWeeksToShowKey,s),{value:s,migrated:!0};let l=r.calendarWeeksToShow;return Te.set(n.calendarWeeksToShowKey,l),{value:l,migrated:!1}}function r8(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.compactItemHeightKey),a=K6(o);if(a!==null)return{value:a,migrated:!1};let i=e?.compactItemHeight,s=K6(i);if(s!==null)return Te.set(n.compactItemHeightKey,s),{value:s,migrated:!0};let l=r.compactItemHeight;return Te.set(n.compactItemHeightKey,l),{value:l,migrated:!1}}function o8(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.compactItemHeightScaleTextKey);if(typeof o=="boolean")return{value:o,migrated:!1};let a=e?.compactItemHeightScaleText;if(typeof a=="boolean")return Te.set(n.compactItemHeightScaleTextKey,a),{value:a,migrated:!0};let i=r.compactItemHeightScaleText;return Te.set(n.compactItemHeightScaleTextKey,i),{value:i,migrated:!1}}function a8(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.tagSortOrderKey),a=typeof o=="string"?o:null;if(a&&Ma(a))return a;let i=e?.tagSortOrder,s=typeof i=="string"?i:null;return s&&Ma(s)?(Te.set(n.tagSortOrderKey,s),s):(Te.set(n.tagSortOrderKey,r.tagSortOrder),r.tagSortOrder)}function i8(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.propertySortOrderKey),a=typeof o=="string"?o:null;if(a&&Ma(a))return a;let i=e?.propertySortOrder,s=typeof i=="string"?i:null;return s&&Ma(s)?(Te.set(n.propertySortOrderKey,s),s):(Te.set(n.propertySortOrderKey,r.propertySortOrder),r.propertySortOrder)}function s8(t){let{storedData:e,keys:n,defaultSettings:r}=t,o=Te.get(n.folderSortOrderKey),a=typeof o=="string"?o:null;if(a&&Ml(a))return a;let i=e?.folderSortOrder,s=typeof i=="string"?i:null;return s&&Ml(s)?(Te.set(n.folderSortOrderKey,s),s):(Te.set(n.folderSortOrderKey,r.folderSortOrder),r.folderSortOrder)}function U6(t,e){let n=i=>{if(typeof i=="number"&&Number.isFinite(i))return mi(i);if(typeof i=="string"){let s=Number(i);if(Number.isFinite(s))return mi(s)}return null},r=Te.get(t),o=n(r);if(o!==null)return o;let a=n(e);return a!==null?(Te.set(t,a),a):(Te.set(t,1),1)}function l8(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 mi(u);if(typeof u=="string"){let m=Number(u);if(Number.isFinite(m))return mi(m)}return mi(p)};if(W6.Platform.isMobile){let u=U6(r.uiScaleKey,s);e.mobileScale=u,e.desktopScale=c(i,e.desktopScale),a&&(a=!1)}else{let u=U6(r.uiScaleKey,i);e.desktopScale=u,e.mobileScale=c(s,e.mobileScale),o&&(o=!1)}return{migrated:l,shouldPersistDesktopScale:o,shouldPersistMobileScale:a}}function c8(t){return t.trim()}function _be(t){return t?t.includes("[")||t.includes("]"):!1}function d8(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 Hbe(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 Ube(t){let e="",n=0,r=!1,o=!1;for(;ntypeof t!="string"?"":t.replace(Gbe,"$1-");function qbe(t){return Qm(t)?t:t==="word"?"words":t==="character"?"characters":t==="word-character"?"both":null}function Ybe(t){return av(t)?t:t==="with-spaces"?"include":t==="without-spaces"?"exclude":null}function p8(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=a.showFileIconUnfinishedTask;typeof n?.unfinishedTaskIcon>"u"&&typeof i=="boolean"&&(e.unfinishedTaskIcon=i?"all":"none"),delete a.showFileIconUnfinishedTask;let s=n?n.noteGrouping:void 0,l=a.showIcons;typeof l=="boolean"&&(typeof n?.showSectionIcons>"u"&&(e.showSectionIcons=l),typeof n?.showFolderIcons>"u"&&(e.showFolderIcons=l),typeof n?.showTagIcons>"u"&&(e.showTagIcons=l)),delete a.showIcons;let c=a.showParentFolderNames;typeof c=="boolean"&&typeof n?.showParentFolder>"u"&&(e.showParentFolder=c),delete a.showParentFolderNames;let u=a.showParentFolderColors;typeof u=="boolean"&&typeof n?.showParentFolderColor>"u"&&(e.showParentFolderColor=u),delete a.showParentFolderColors;let p=a.groupByDate;typeof p=="boolean"&&typeof s>"u"&&(e.noteGrouping=p?"date":"custom"),delete a.groupByDate;let m=a.autoExpandFoldersTags;typeof m=="boolean"&&typeof n?.autoExpandNavItems>"u"&&(e.autoExpandNavItems=m),delete a.autoExpandFoldersTags;let g=typeof a.homepage=="object"&&a.homepage!==null&&!Array.isArray(a.homepage),f=Ba(typeof a.homepage=="string"?a.homepage:null),h=a.useMobileHomepage===!0;g||(e.homepage={source:f?"file":"none",file:f,createMissingPeriodicNote:o.homepage.createMissingPeriodicNote}),h&&(e.syncModes.homepage="local"),delete a.mobileHomepage,delete a.useMobileHomepage,e.noteGrouping=NT(e.noteGrouping)??o.noteGrouping;let b=O=>{O&&Object.values(O).forEach(AN)};b(e.folderAppearances),b(e.tagAppearances),b(e.propertyAppearances),typeof e.showSelectedNavigationPills!="boolean"&&(e.showSelectedNavigationPills=o.showSelectedNavigationPills),e.shortcutBadgeDisplay!=="index"&&e.shortcutBadgeDisplay!=="count"&&e.shortcutBadgeDisplay!=="none"&&(e.shortcutBadgeDisplay=o.shortcutBadgeDisplay);let y=a.hideFolderNotesInRecentNotes;typeof n?.hideRecentNotes>"u"&&typeof y=="boolean"&&(e.hideRecentNotes=y?"folder-notes":"none"),delete a.hideFolderNotesInRecentNotes,rv(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 O=qbe(a.wordCharacterCountDisplay);O!==null?e.textCountDisplay=O:typeof a.showWordCount=="boolean"&&(e.textCountDisplay=a.showWordCount?"words":"none")}if(delete a.showWordCount,delete a.wordCharacterCountDisplay,typeof n?.textCountPlacement>"u"&&ov(a.wordCountPlacement)&&(e.textCountPlacement=a.wordCountPlacement),delete a.wordCountPlacement,typeof n?.characterCountSpaces>"u"){let O=Ybe(a.characterCountMode);O!==null&&(e.characterCountSpaces=O)}delete a.characterCountMode;let w=a.propertyFields;typeof w!="string"?delete a.propertyFields:a.propertyFields=Fu(w);let T=a.customPropertyFields;typeof a.propertyFields>"u"&&typeof n?.propertyFields>"u"&&typeof T=="string"&&(a.propertyFields=Fu(T)),delete a.customPropertyFields;let F=a.showCustomPropertiesOnSeparateRows;typeof n?.showPropertiesOnSeparateRows>"u"&&typeof F=="boolean"&&(e.showPropertiesOnSeparateRows=F),delete a.showCustomPropertiesOnSeparateRows;let k=a.showCustomPropertyInCompactMode;typeof n?.showFilePropertiesInCompactMode>"u"&&typeof k=="boolean"&&(e.showFilePropertiesInCompactMode=k),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 E=a.useFolderColorForFileTitles;typeof n?.useFolderColorForTitles>"u"&&typeof E=="boolean"&&(e.useFolderColorForTitles=E),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),Qm(e.textCountDisplay)||(e.textCountDisplay=o.textCountDisplay),ov(e.textCountPlacement)||(e.textCountPlacement=o.textCountPlacement),av(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),Ma(e.propertySortOrder)||(e.propertySortOrder=o.propertySortOrder);let C=O=>{if(!O)return O;if(O.mode===void 0&&O.showDate===!1&&O.showPreview===!1&&O.showImage===!1){let x={...O,mode:"compact"};return delete x.showDate,delete x.showPreview,delete x.showImage,x}return O},L=O=>{O&&Object.entries(O).forEach(([D,x])=>{let B=C(x);if(B){let I=B;delete I.notePropertyType,delete I.customPropertyType,O[D]=B}})};L(e.folderAppearances),L(e.tagAppearances);let z=a.applyTagColorsToFileTags;typeof z=="boolean"&&(e.colorFileTags=z),delete a.applyTagColorsToFileTags;let G=a.slimItemHeight;if(typeof G=="number"&&Number.isFinite(G)){let O=Te.get(r.compactItemHeightKey);typeof n?.compactItemHeight>"u"&&O===null&&Te.set(r.compactItemHeightKey,G)}delete a.slimItemHeight;let Q=a.slimItemHeightScaleText;if(typeof Q=="boolean"){let O=Te.get(r.compactItemHeightScaleTextKey);typeof n?.compactItemHeightScaleText>"u"&&O===null&&Te.set(r.compactItemHeightScaleTextKey,Q)}delete a.slimItemHeightScaleText;let R=a.showFileTagsInSlimMode;typeof R=="boolean"&&typeof n?.showFileTagsInCompactMode>"u"&&(e.showFileTagsInCompactMode=R),delete a.showFileTagsInSlimMode}function m8(t){let{settings:e,storedData:n,defaultSettings:r}=t,o=e,a=e.folderNoteTemplate,i=Ba(a);e.folderNoteTemplate=i??r.folderNoteTemplate;let s=n?.folderNoteNamePattern,l=n?.folderNoteName;return typeof s=="string"&&s.length>0?e.folderNoteNamePattern=QO(s):typeof l=="string"&&l.length>0?e.folderNoteNamePattern=l:e.folderNoteNamePattern=r.folderNoteNamePattern,delete o.folderNoteName,Object.prototype.hasOwnProperty.call(o,"folderNoteProperties")&&delete o.folderNoteProperties,n?Object.prototype.hasOwnProperty.call(n,"folderNoteName")||Object.prototype.hasOwnProperty.call(n,"folderNoteNamePattern")&&s!==e.folderNoteNamePattern||Object.prototype.hasOwnProperty.call(n,"folderNoteProperties"):!1}function g8(t){let{settings:e}=t;typeof e.checkForUpdatesOnStart!="boolean"&&(e.checkForUpdatesOnStart=!0),Qm(e.textCountDisplay)||(e.textCountDisplay="none"),ov(e.textCountPlacement)||(e.textCountPlacement="title"),av(e.characterCountSpaces)||(e.characterCountSpaces="include"),NN(e.navCountLeaderStyle)||(e.navCountLeaderStyle=Ae.navCountLeaderStyle),e.narrowSidebarLayout=FN(e.narrowSidebarLayout)??Ae.narrowSidebarLayout,CN(e.narrowSidebarTriggerMode)||(e.narrowSidebarTriggerMode=Ae.narrowSidebarTriggerMode),(typeof e.narrowSidebarCustomWidth!="number"||!Number.isFinite(e.narrowSidebarCustomWidth))&&(e.narrowSidebarCustomWidth=Ae.narrowSidebarCustomWidth),typeof e.wordCountTargetProperty!="string"?e.wordCountTargetProperty=Ae.wordCountTargetProperty:e.wordCountTargetProperty=e.wordCountTargetProperty.trim(),typeof e.showWordCountPercentage!="boolean"&&(e.showWordCountPercentage=!1),typeof e.showFolderGroupPaths!="boolean"&&(e.showFolderGroupPaths=Ae.showFolderGroupPaths),typeof e.showGroupHeaderItemCounts!="boolean"&&(e.showGroupHeaderItemCounts=Ae.showGroupHeaderItemCounts),typeof e.showCurrentFolderFilesAtBottom!="boolean"&&(e.showCurrentFolderFilesAtBottom=Ae.showCurrentFolderFilesAtBottom)}function h8(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:Fu(i)}function f8(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=yx(n);o.length!==0&&e.vaultProfiles.forEach(a=>{Array.isArray(a.propertyKeys)&&a.propertyKeys.length>0||(a.propertyKeys=o.map(i=>({...i})))})}function y8(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!==zn.FOLDER&&i!==zn.NOTE&&i!==zn.TAG&&i!==zn.PROPERTY&&i!==zn.SEARCH||r.push({...a})}),r.length===0?[]:r}function v8(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=Lu(n);e.vaultProfiles.forEach(a=>{Array.isArray(a.shortcuts)&&a.shortcuts.length>0||(a.shortcuts=Lu(o))})}function b8(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!==zn.SEARCH)return i;let s=jbe(i.query);return s===i.query?i:(o=!0,{...i,query:s})});o&&(r.shortcuts=a,n=!0)}),n}function S8(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 w8(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===yo)??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 T8(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=Wi(r);return o.length>0?o:null}function k8(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)}))}hn();jr();wr();Mi();Oe();Et();Hr();sn();VI();un();cP();lr();Uh();Ln();hc();mo();ra();gv();ef();Ue();Zb();var RP=require("obsidian");jr();ra();Wm();function I8(t){let e=(u,p)=>{Te.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,preferRecordValue:m})=>{if(t.isLocal(u.settingId)&&!m){let f=u.resolveDeviceLocal(p);return u.setCurrent(f.value),{migrated:f.migrated}}let g=u.sanitizeSynced();return u.setCurrent(g),e(u.localStorageKey,g),{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:({preferRecordValue:p})=>{let m=Te.get(t.keys.uxPreferencesKey),g=t.isUXPreferencesRecord(m),f=g?{...t.defaultUXPreferences,...m}:{...t.defaultUXPreferences},h=t.isLocal(u.settingId),b=t.getSettings(),y=h&&!p?f[u.persistedKey]:t.sanitizeBooleanSetting(b[u.persistedKey],t.defaultSettings[u.persistedKey]);return b[u.persistedKey]=y,(!g||f[u.persistedKey]!==y)&&e(t.keys.uxPreferencesKey,{...f,[u.persistedKey]:y}),{migrated:!1}},mirrorToLocalStorage:()=>{t.mirrorUXPreferences({[u.persistedKey]:t.getSettings()[u.persistedKey]})}}),c=u=>{let p=u?.useMobileHomepage===!0,m=Ba(typeof u?.mobileHomepage=="string"?u.mobileHomepage:null),g=Ba(typeof u?.homepage=="string"?u.homepage:null),f=m??g;return p?{source:RP.Platform.isMobile?f?"file":"none":g?"file":"none",file:RP.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:({preferRecordValue:u})=>{let p=t.isLocal("vaultProfile"),m=t.getSettings();return m.vaultProfile=p&&!u?t.resolveActiveVaultProfileId():t.sanitizeVaultProfileId(m.vaultProfile),e(t.keys.vaultProfileKey,m.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=Te.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:s8({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:a8({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:i8({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:({preferRecordValue:u})=>{let p=t.isLocal("dualPane"),m=Te.get(t.keys.dualPaneKey),g=t.parseDualPanePreference(m),f=t.getSettings(),h=p&&!u?g??t.defaultSettings.dualPane:t.sanitizeBooleanSetting(f.dualPane,t.defaultSettings.dualPane);return f.dualPane=h,e(t.keys.dualPaneKey,h?"1":"0"),{migrated:!1}},mirrorToLocalStorage:n(t.keys.dualPaneKey,()=>t.getSettings().dualPane?"1":"0")}),dualPaneOrientation:a({persistedKeys:["dualPaneOrientation"],loadPhase:"preProfiles",resolveOnLoad:({preferRecordValue:u})=>{let p=t.isLocal("dualPaneOrientation"),m=Te.get(t.keys.dualPaneOrientationKey),g=t.parseDualPaneOrientation(m),f=t.getSettings(),h=p&&!u?g??t.defaultSettings.dualPaneOrientation:t.sanitizeDualPaneOrientationSetting(f.dualPaneOrientation);return f.dualPaneOrientation=h,e(t.keys.dualPaneOrientationKey,h),{migrated:!1}},mirrorToLocalStorage:n(t.keys.dualPaneOrientationKey,()=>t.getSettings().dualPaneOrientation)}),narrowSidebarLayout:a({persistedKeys:["narrowSidebarLayout"],loadPhase:"preProfiles",resolveOnLoad:({preferRecordValue:u})=>{let p=t.isLocal("narrowSidebarLayout"),m=Te.get(t.keys.narrowSidebarLayoutKey),g=t.getSettings(),f=p&&!u?t.sanitizeNarrowSidebarLayoutSetting(m):t.sanitizeNarrowSidebarLayoutSetting(g.narrowSidebarLayout);return g.narrowSidebarLayout=f,e(t.keys.narrowSidebarLayoutKey,f),{migrated:!1}},mirrorToLocalStorage:n(t.keys.narrowSidebarLayoutKey,()=>t.getSettings().narrowSidebarLayout)}),narrowSidebarTriggerMode:a({persistedKeys:["narrowSidebarTriggerMode"],loadPhase:"preProfiles",resolveOnLoad:({preferRecordValue:u})=>{let p=t.isLocal("narrowSidebarTriggerMode"),m=Te.get(t.keys.narrowSidebarTriggerModeKey),g=t.getSettings(),f=p&&!u?t.sanitizeNarrowSidebarTriggerModeSetting(m):t.sanitizeNarrowSidebarTriggerModeSetting(g.narrowSidebarTriggerMode);return g.narrowSidebarTriggerMode=f,e(t.keys.narrowSidebarTriggerModeKey,f),{migrated:!1}},mirrorToLocalStorage:n(t.keys.narrowSidebarTriggerModeKey,()=>t.getSettings().narrowSidebarTriggerMode)}),narrowSidebarCustomWidth:a({persistedKeys:["narrowSidebarCustomWidth"],loadPhase:"preProfiles",resolveOnLoad:({preferRecordValue:u})=>{let p=t.isLocal("narrowSidebarCustomWidth"),m=Te.get(t.keys.narrowSidebarCustomWidthKey),g=t.getSettings(),f=p&&!u?t.sanitizeNarrowSidebarCustomWidthSetting(m):t.sanitizeNarrowSidebarCustomWidthSetting(g.narrowSidebarCustomWidth);return g.narrowSidebarCustomWidth=f,e(t.keys.narrowSidebarCustomWidthKey,f),{migrated:!1}},mirrorToLocalStorage:n(t.keys.narrowSidebarCustomWidthKey,()=>t.getSettings().narrowSidebarCustomWidth)}),paneTransitionDuration:s({settingId:"paneTransitionDuration",loadPhase:"preProfiles",localStorageKey:t.keys.paneTransitionDurationKey,resolveDeviceLocal:u=>Y6({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=>$6({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=Te.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=>J6({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=>X6({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=>Q6({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=>Z6({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=>e8({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=>t8({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=>n8({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=>r8({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=>o8({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=Te.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=Te.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,preferRecordValue:p})=>{let m=t.isLocal("uiScale"),g=t.getSettings();if(m&&!p){let h=l8({settings:g,storedData:u,keys:t.keys,shouldPersistDesktopScale:t.getShouldPersistDesktopScale(),shouldPersistMobileScale:t.getShouldPersistMobileScale()});return t.setShouldPersistDesktopScale(h.shouldPersistDesktopScale),t.setShouldPersistMobileScale(h.shouldPersistMobileScale),{migrated:h.migrated}}g.desktopScale=mi(g.desktopScale),g.mobileScale=mi(g.mobileScale);let f=mi(RP.Platform.isMobile?g.mobileScale:g.desktopScale);return e(t.keys.uiScaleKey,f),{migrated:!1}},mirrorToLocalStorage:()=>{let u=t.getSettings(),p=mi(RP.Platform.isMobile?u.mobileScale:u.desktopScale);e(t.keys.uiScaleKey,p)}})}}var x8=require("obsidian");go();var MP={base:{searchActive:!1,showCalendar:!1,showHiddenItems:!1,pinShortcuts:!0,includeDescendantNotes:Ae.includeDescendantNotes},platform:{mobile:{},desktop:{}}},PB=Object.keys(MP.base).filter(t=>t in MP.base),eSe=new Set(PB);function Wf(){let t=x8.Platform.isMobile?MP.platform.mobile:MP.platform.desktop;return{...MP.base,...t}}function pR(t){if(t===null||typeof t!="object")return!1;let e=t;for(let n of PB){let r=e[n];if(typeof r<"u"&&typeof r!="boolean")return!1}return!0}function E8(t,e=Wf()){let n={...e};if(t===null||typeof t!="object")return{preferences:n,changed:!0};let r=t,o=!1;Object.keys(r).forEach(a=>{eSe.has(a)||(o=!0)});for(let a of PB){let i=r[a];if(typeof i=="boolean"){n[a]=i;continue}o=!0}return{preferences:n,changed:o}}var tSe=4,nSe=500,rSe=/^\d+(?:\.\d+)*$/;function mR(t){if(typeof t!="string")return"";let e=t.trim();return rSe.test(e)?e.split(".").some(r=>!Number.isSafeInteger(Number(r)))?"":e:""}function oSe(t,e){return Ri(t,e)>=0?t:e}function R8(t,e){if(typeof t!="string")return e;let n=t.trim();return n.length===0?e:n}var aSe=new Set(["vaultProfile","tagSortOrder","includeDescendantNotes","dualPane","dualPaneOrientation","paneTransitionDuration","toolbarVisibility","navIndent","navItemHeight","navItemHeightScaleText","calendarWeeksToShow","compactItemHeight","compactItemHeightScaleText","uiScale"]);function FB(t){return ht(t)?Object.values(t).some(e=>ht(e)&&e.groupBy==="none"):!1}function iSe(t){return t?t.noteGrouping==="none"||FB(t.folderAppearances)||FB(t.tagAppearances)||FB(t.propertyAppearances):!1}var gR=class{constructor(e){this.currentSettings=structuredClone(Ae);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}getLastShownVersion(){let e=this.resolveLastShownVersion(this.currentSettings.lastShownVersion);return this.currentSettings.lastShownVersion=e.version,e.version}advanceLastShownVersion(e){let n=mR(e),r=this.getLastShownVersion();return!n||Ri(n,r)<=0?!1:(Te.set(this.options.keys.lastShownVersionKey,n),this.currentSettings.lastShownVersion=n,!0)}resolveLastShownVersion(e){let n=mR(e),r=Te.get(this.options.keys.lastShownVersionKey),o=mR(r),a=oSe(n,o);return a&&r!==a?Te.set(this.options.keys.lastShownVersionKey,a):!a&&r!==null&&r!==void 0&&Te.remove(this.options.keys.lastShownVersionKey),{version:a,needsSyncedRepair:e!==void 0&&e!==n||Ri(a,n)>0}}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=He(this.currentSettings.syncModes,ev);return a[e]=r,this.currentSettings.syncModes=a,!0}mirrorAllSyncModeSettingsToLocalStorage(){let e=this.getSyncModeRegistry();Gm.forEach(n=>{e[n].mirrorToLocalStorage()})}prepareImportedUiScalePersistence(){this.isLocal("uiScale")&&(this.shouldPersistDesktopScale=!0,this.shouldPersistMobileScale=!0)}clearAllLocalStorage(){Object.keys(lt).forEach(n=>{if(n==="databaseSchemaVersionKey"||n==="databaseContentVersionKey"||n==="debugLoggingEnabledKey")return;let r=lt[n];Te.remove(r)}),tI.forEach(n=>{Te.remove(n)})}async loadSettings(e){if(e?.aborted)return"cancelled";let n=await this.options.loadData();if(e?.aborted)return"cancelled";if(!ht(n))return n===null?"missing":"unavailable";if(this.applySettingsRecord(n,{isFirstLaunch:!1})){if(e?.aborted)return"cancelled";await this.options.saveData(this.getPersistableSettings())}return e?.aborted?"cancelled":"loaded"}async loadSettingsAtStartup(e){let n=Math.max(1,e.maxAttempts??tSe),r=e.retryDelayMs??nSe,o=this.getStoredLocalStorageVersion(),a=o!=null,i=!1,s="missing";for(let l=0;l0&&!await this.waitForRetry(r,e.signal))return"cancelled";let c=e.signal?await this.loadSettings(e.signal):await this.loadSettings();if(c==="cancelled")return"cancelled";if(s=c,s==="loaded")return"loaded";if(s==="unavailable"){i=!0;continue}}return s==="missing"&&!i?a?"missing":(this.applySettingsRecord(null,{isFirstLaunch:!0}),"first-launch"):"unavailable"}async waitForRetry(e,n){return n?.aborted?!1:typeof window>"u"||e<=0?!0:await new Promise(r=>{let o=s=>{n?.removeEventListener("abort",i),r(s)},a=window.setTimeout(()=>o(!0),e),i=()=>{window.clearTimeout(a),o(!1)};n?.addEventListener("abort",i,{once:!0})})}applySettingsRecord(e,n){let{isFirstLaunch:r}=n,o=n.preferRecordLocalValues??!1,a=!!(e&&Object.prototype.hasOwnProperty.call(e,"propertyFields")),i=!!(e&&(typeof e.homepage=="string"||Object.prototype.hasOwnProperty.call(e,"mobileHomepage")||Object.prototype.hasOwnProperty.call(e,"useMobileHomepage"))),s=!!(e&&Object.prototype.hasOwnProperty.call(e,"useFolderColorForFileTitles")),l=!!(e&&Object.prototype.hasOwnProperty.call(e,"showPinnedIcon")),c=!!(e&&Object.prototype.hasOwnProperty.call(e,"showPinnedGroupHeader")),u=!!(e&&Object.prototype.hasOwnProperty.call(e,"showFileIconUnfinishedTask")),p=e?.interfaceIcons,m=!!(ht(p)&&Object.prototype.hasOwnProperty.call(p,"pinned-section")),g=!!(e&&Object.prototype.hasOwnProperty.call(e,"propertySortKey")&&typeof e.propertySortKey!="string"),f=!!(e&&Object.prototype.hasOwnProperty.call(e,"manualSortPropertyKey")&&typeof e.manualSortPropertyKey!="string"),h=!!(e&&Object.prototype.hasOwnProperty.call(e,"defaultFolderSort")&&!FT(e.defaultFolderSort)),b=!!(e&&Object.prototype.hasOwnProperty.call(e,"defaultFolderSortPropertyKey")&&typeof e.defaultFolderSortPropertyKey!="string"),y=!!(e&&Object.prototype.hasOwnProperty.call(e,"propertyGroupKey")&&typeof e.propertyGroupKey!="string"),v=!!(e&&!Object.prototype.hasOwnProperty.call(e,"propertyGroupKey")),S=iSe(e),w=!!(e&&Object.prototype.hasOwnProperty.call(e,"openFolderNotesInNewTab")),T=!!(e&&Object.prototype.hasOwnProperty.call(e,"shiftEnterOpenContext")&&!CT(e.shiftEnterOpenContext)),F=!!(e&&Object.prototype.hasOwnProperty.call(e,"cmdCtrlEnterOpenContext")&&!CT(e.cmdCtrlEnterOpenContext)),k=!!(e&&!Object.prototype.hasOwnProperty.call(e,"unfinishedTaskBackgroundColorDark")),P=e;this.shouldPersistDesktopScale=!!(e&&"desktopScale"in e),this.shouldPersistMobileScale=!!(e&&"mobileScale"in e),this.currentSettings={...structuredClone(Ae),...P??{}};let E=r?{version:mR(this.currentSettings.lastShownVersion),needsSyncedRepair:!1}:this.resolveLastShownVersion(this.currentSettings.lastShownVersion);this.currentSettings.lastShownVersion=E.version;let C=!!(e&&"searchProvider"in e),L=!!(e&&"lastAnnouncedRelease"in e),z=Te.get(this.options.keys.searchProviderKey);z==="internal"||z==="omnisearch"?this.currentSettings.searchProvider=z:(this.currentSettings.searchProvider="internal",Te.set(this.options.keys.searchProviderKey,"internal"));let G=this.currentSettings;delete G.showCalendar,delete G.calendarCustomPromptForTitle,delete G.saveMetadataToFrontmatter,delete G.lastAnnouncedRelease,delete G.optimizeNoteHeight,IN(e?.folderNoteOpenLocation)||(this.currentSettings.folderNoteOpenLocation=e?.openFolderNotesInNewTab===!0?"new-tab":Ae.folderNoteOpenLocation),delete G.openFolderNotesInNewTab,typeof this.currentSettings.propertySortKey!="string"&&(this.currentSettings.propertySortKey=Ae.propertySortKey),typeof this.currentSettings.propertyGroupKey!="string"&&(this.currentSettings.propertyGroupKey=Ae.propertyGroupKey),v&&(this.currentSettings.propertyGroupKey=this.currentSettings.propertySortKey),typeof this.currentSettings.manualSortPropertyKey!="string"&&(this.currentSettings.manualSortPropertyKey=Ae.manualSortPropertyKey),FT(this.currentSettings.defaultFolderSort)||(this.currentSettings.defaultFolderSort=Ae.defaultFolderSort),typeof this.currentSettings.defaultFolderSortPropertyKey!="string"&&(this.currentSettings.defaultFolderSortPropertyKey=Ae.defaultFolderSortPropertyKey),typeof this.currentSettings.manualSortGroupHeaderProperty!="string"&&(this.currentSettings.manualSortGroupHeaderProperty=Ae.manualSortGroupHeaderProperty),this.currentSettings.keyboardShortcuts=hW(this.currentSettings.keyboardShortcuts),CT(this.currentSettings.shiftEnterOpenContext)||(this.currentSettings.shiftEnterOpenContext=Ae.shiftEnterOpenContext),CT(this.currentSettings.cmdCtrlEnterOpenContext)||(this.currentSettings.cmdCtrlEnterOpenContext=Ae.cmdCtrlEnterOpenContext),this.normalizeSyncModes({storedData:e,isFirstLaunch:r});let Q=this.getSyncModeRegistry();p8({settings:this.currentSettings,storedData:e,keys:this.options.keys,defaultSettings:Ae}),this.sanitizeSettingsRecords(),this.pruneInheritedAppearanceValues();let R=ng(this.currentSettings),O=df(this.currentSettings),D=af(this.currentSettings),x=cf(this.currentSettings),B=u8({settings:this.currentSettings,defaultDateFormat:OO(),defaultTimeFormat:LO(),defaultSettings:Ae});this.currentSettings.dateFormat||(this.currentSettings.dateFormat=OO()),this.currentSettings.timeFormat||(this.currentSettings.timeFormat=LO()),(typeof this.currentSettings.recentNotesCount!="number"||this.currentSettings.recentNotesCount<=0)&&(this.currentSettings.recentNotesCount=Ae.recentNotesCount),rv(this.currentSettings.hideRecentNotes)||(this.currentSettings.hideRecentNotes=Ae.hideRecentNotes),this.currentSettings.calendarEnabled=this.sanitizeBooleanSetting(this.currentSettings.calendarEnabled,Ae.calendarEnabled),SN(this.currentSettings.propertySortSecondary)||(this.currentSettings.propertySortSecondary=Ae.propertySortSecondary),TN(this.currentSettings.manualSortNewNotePlacement)||(this.currentSettings.manualSortNewNotePlacement=Ae.manualSortNewNotePlacement),xN(this.currentSettings.calendarWeekendDays)||(this.currentSettings.calendarWeekendDays=Ae.calendarWeekendDays),EN(this.currentSettings.calendarMonthHeadingFormat)||(this.currentSettings.calendarMonthHeadingFormat=Ae.calendarMonthHeadingFormat),RN(this.currentSettings.calendarPeriodicNotesLocaleSource)||(this.currentSettings.calendarPeriodicNotesLocaleSource=Ae.calendarPeriodicNotesLocaleSource),Yh(this.currentSettings.featureImageSize)||(this.currentSettings.featureImageSize=Ae.featureImageSize),$h(this.currentSettings.featureImagePixelSize)||(this.currentSettings.featureImagePixelSize=Ae.featureImagePixelSize),PW(this.currentSettings.mouseBackForwardAction)||(this.currentSettings.mouseBackForwardAction=Ae.mouseBackForwardAction),Ml(this.currentSettings.folderSortOrder)||(this.currentSettings.folderSortOrder=Ae.folderSortOrder),this.currentSettings.deleteAttachments=fN(this.currentSettings.deleteAttachments,Ae.deleteAttachments),this.currentSettings.moveFileConflicts=yN(this.currentSettings.moveFileConflicts,Ae.moveFileConflicts);let I=!1;Gm.forEach(re=>{let Y=Q[re];if(Y.loadPhase!=="preProfiles")return;let ne=Y.resolveOnLoad({storedData:e,preferRecordValue:o});re==="uiScale"&&(I=ne.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 A=G6({settings:this.currentSettings,storedData:e,keys:this.options.keys}),N=q6({settings:this.currentSettings,storedData:e,keys:this.options.keys}),M=j6({settings:this.currentSettings,storedData:e,keys:this.options.keys}),H=!!(e&&Gm.some(re=>{let Y=Q[re];return!Y.cleanupOnLoad||!this.isLocal(re)?!1:Y.hasPersistedValue(e)})),q=m8({settings:this.currentSettings,storedData:e,defaultSettings:Ae});g8({settings:this.currentSettings});let X=S8({settings:this.currentSettings,storedData:e}),V=h8({settings:this.currentSettings,storedData:e}),j=y8({storedData:e}),_=T8({settings:this.currentSettings});Lo(this.currentSettings),k8({settings:this.currentSettings,legacyPeriodicNotesFolder:_}),w8({settings:this.currentSettings,migration:X}),f8({settings:this.currentSettings,legacyPropertyFields:V}),v8({settings:this.currentSettings,legacyShortcuts:j});let W=b8({settings:this.currentSettings});this.normalizeIconSettings(),k&&(this.currentSettings.unfinishedTaskBackgroundColorDark=this.currentSettings.unfinishedTaskBackgroundColor),this.normalizeTaskSettings(),this.normalizeFileIconMapSettings(),this.normalizeInterfaceIconsSettings(),Q.vaultProfile.resolveOnLoad({storedData:e,preferRecordValue:o}),this.normalizeTagSettings(),this.normalizePropertySettings(),this.normalizeNavigationSeparatorSettings(),this.refreshMatcherCachesIfNeeded();let J=A||N||M||H||C||L||a||i||s||l||c||u||m||g||f||h||b||y||v||D.changed||x.changed||S||w||T||F||k||R||O||I||B||q||W,Z=E.needsSyncedRepair;return J||Z}normalizeTagSettings(){let e=r=>{if(!r)return Object.create(null);let o=Object.create(null),a=He(r);for(let[i,s]of Object.entries(a)){let l=Mt(i);l&&(o[l]=s)}return o},n=r=>r?[...new Set(r.map(o=>Mt(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=He(r);for(let[i,s]of Object.entries(a)){let l=i===_e?_e:en(i);l&&(o[l]=s)}return o},n=r=>{if(!r)return Object.create(null);let o=Object.create(null),a=He(r);for(let[i,s]of Object.entries(a)){let l=jv(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=He(this.currentSettings.navigationSeparators,Zm);for(let[r,o]of Object.entries(n)){let a=hE(r);a&&(e[a]=o)}this.currentSettings.navigationSeparators=e}async saveSettings(){this.pruneInheritedAppearanceValues(),Lo(this.currentSettings),this.refreshMatcherCachesIfNeeded(),Te.set(this.options.keys.homepageKey,this.currentSettings.homepage),await this.options.saveData(this.getPersistableSettings())}getPersistableSettings(){this.currentSettings.lastShownVersion=this.getLastShownVersion();let e={...this.currentSettings};this.removeNonPersistableSettings(e);let n=this.getSyncModeRegistry();return Gm.forEach(r=>{this.isLocal(r)&&n[r].deleteFromPersisted(e)}),e}getPersistableDefaultSettings(){let e=structuredClone(Ae);Lo(e);let n=e;return this.removeNonPersistableSettings(n),n}removeNonPersistableSettings(e){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}refreshMatcherCachesIfNeeded(){let e=`${this.buildPatternCacheKey(i=>i.hiddenFolders)}${this.buildPatternCacheKey(i=>i.descendantExcludedFolders)}`,n=this.buildPatternCacheKey(i=>i.hiddenTags),r=this.buildPatternCacheKey(i=>i.hiddenFileTags),o=`${n}${r}`,a=this.buildPatternCacheKey(i=>i.hiddenFileNames);e!==this.hiddenFolderCacheKey&&(Bq(),this.hiddenFolderCacheKey=e),o!==this.hiddenTagCacheKey&&(O2(),this.hiddenTagCacheKey=o),a!==this.hiddenFileNamesCacheKey&&(aq(),this.hiddenFileNamesCacheKey=a)}setLocalStorageVersion(){Te.set(lt.localStorageVersionKey,iL)}getStoredLocalStorageVersion(){return Te.get(lt.localStorageVersionKey)}getCurrentLocalStorageVersion(){return iL}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{...Ae.homepage};let n=e,r=tv(n.source)?n.source:Ae.homepage.source,o=Ba(typeof n.file=="string"?n.file:null),a=typeof n.createMissingPeriodicNote=="boolean"?n.createMissingPeriodicNote:Ae.homepage.createMissingPeriodicNote;return{source:r,file:o,createMissingPeriodicNote:a}}sanitizeDualPaneOrientationSetting(e){return this.parseDualPaneOrientation(e)??Ae.dualPaneOrientation}sanitizeNarrowSidebarLayoutSetting(e){return FN(e)??Ae.narrowSidebarLayout}sanitizeNarrowSidebarTriggerModeSetting(e){return CN(e)?e:Ae.narrowSidebarTriggerMode}sanitizeNarrowSidebarCustomWidthSetting(e){return this.sanitizeBoundedIntegerSetting(e,{min:qm,max:Ym,fallback:Ae.narrowSidebarCustomWidth})}sanitizePaneTransitionDurationSetting(e){return this.sanitizeBoundedIntegerSetting(e,{min:vu,max:bu,fallback:Ae.paneTransitionDuration})}sanitizeNavIndentSetting(e){return this.sanitizeBoundedIntegerSetting(e,{min:10,max:24,fallback:Ae.navIndent})}sanitizeNavItemHeightSetting(e){return this.sanitizeBoundedIntegerSetting(e,{min:20,max:28,fallback:Ae.navItemHeight})}sanitizeCalendarPlacementSetting(e){return $m(e)?e:Ae.calendarPlacement}sanitizeCalendarLeftPlacementSetting(e){return Xm(e)?e:Ae.calendarLeftPlacement}sanitizeCalendarWeeksToShowSetting(e){let n=this.parseFiniteNumber(e);if(n===null)return Ae.calendarWeeksToShow;let r=Math.round(n);return r===1||r===2||r===3||r===4||r===5||r===6?r:Ae.calendarWeeksToShow}sanitizeCompactItemHeightSetting(e){return this.sanitizeBoundedIntegerSetting(e,{min:20,max:28,fallback:Ae.compactItemHeight})}sanitizeFeatureImageSizeSetting(e){return Yh(e)?e:Ae.featureImageSize}sanitizeFeatureImagePixelSizeSetting(e){return $h(e)?e:Ae.featureImagePixelSize}sanitizeTagSortOrderSetting(e){return typeof e=="string"&&Ma(e)?e:Ae.tagSortOrder}sanitizeFolderSortOrderSetting(e){return typeof e=="string"&&Ml(e)?e:Ae.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===yo);return o?o.id:n[0]?.id??yo}sanitizeToolbarVisibilitySetting(e){let n=Ae.toolbarVisibility,r=(o,a)=>{let i={...o};return Aa(a)&&Object.keys(o).forEach(s=>{let l=a[s];typeof l=="boolean"&&(i[s]=l)}),i};return Aa(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=Te.get(this.options.keys.vaultProfileKey),o=n(r);if(o)return o;let a=e.find(i=>i.id===yo);return a?a.id:e[0]?.id??yo}normalizeSyncModes(e){let{storedData:n,isFirstLaunch:r}=e,o=n?.syncModes,a=Aa(o)?o:null,i=He(void 0);Gm.forEach(s=>{let l=r?"synced":aSe.has(s)?"local":"synced",c=a?a[s]:void 0;i[s]=ev(c)?c:l}),this.currentSettings.syncModes=i}getSyncModeRegistry(){return this.syncModeRegistry?this.syncModeRegistry:(this.syncModeRegistry=I8({keys:this.options.keys,defaultSettings:Ae,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:Wf(),isUXPreferencesRecord:pR,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=>He(l,Hn),n=l=>{let c=Object.create(null);if(!l)return c;for(let u of Object.keys(l)){let p=Su(l[u]);p&&(c[u]=p)}return c},r=l=>He(l,Ml),o=l=>Aa(l),a=l=>{let c=He(l,o);return Object.entries(c).forEach(([u,p])=>{delete p.notePropertyType,AN(p);let m=_g(Yl(p),p.groupBy);m?c[u]=m:delete c[u]}),c},i=l=>He(l,Zm),s=l=>He(l,ev);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=Tp(this.currentSettings.pinnedNotes)}pruneInheritedAppearanceValues(){[this.currentSettings.folderAppearances,this.currentSettings.tagAppearances,this.currentSettings.propertyAppearances].forEach(n=>{Object.entries(n).forEach(([r,o])=>{o.titleRows===this.currentSettings.fileNameRows&&delete o.titleRows,o.previewRows===this.currentSettings.previewRows&&delete o.previewRows,o.textCount===this.currentSettings.textCountDisplay&&delete o.textCount,Object.keys(o).length===0&&delete n[r]})})}normalizeTaskSettings(){MN(this.currentSettings.unfinishedTaskIcon)||(this.currentSettings.unfinishedTaskIcon=Ae.unfinishedTaskIcon),typeof this.currentSettings.showFileTaskProgress!="boolean"&&(this.currentSettings.showFileTaskProgress=Ae.showFileTaskProgress),typeof this.currentSettings.showFileTaskProgressBar!="boolean"&&(this.currentSettings.showFileTaskProgressBar=Ae.showFileTaskProgressBar),typeof this.currentSettings.showFileTaskProgressCount!="boolean"&&(this.currentSettings.showFileTaskProgressCount=Ae.showFileTaskProgressCount),typeof this.currentSettings.hideFileTaskProgressWhenComplete!="boolean"&&(this.currentSettings.hideFileTaskProgressWhenComplete=Ae.hideFileTaskProgressWhenComplete),typeof this.currentSettings.showFileBackgroundUnfinishedTask!="boolean"&&(this.currentSettings.showFileBackgroundUnfinishedTask=Ae.showFileBackgroundUnfinishedTask),this.currentSettings.unfinishedTaskBackgroundColor=R8(this.currentSettings.unfinishedTaskBackgroundColor,Ae.unfinishedTaskBackgroundColor),this.currentSettings.unfinishedTaskBackgroundColorDark=R8(this.currentSettings.unfinishedTaskBackgroundColorDark,this.currentSettings.unfinishedTaskBackgroundColor)}normalizeIconSettings(){let e=n=>{let r=He(n,Hn);return Object.keys(r).forEach(o=>{let a=rr(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(!Aa(n))return dk(o,r);let a=He(void 0);return Object.entries(n).forEach(([i,s])=>{typeof s=="string"&&(a[i]=s)}),dk(a,r)};typeof this.currentSettings.showCategoryIcons!="boolean"&&(this.currentSettings.showCategoryIcons=Ae.showCategoryIcons),typeof this.currentSettings.showFilenameMatchIcons!="boolean"&&(this.currentSettings.showFilenameMatchIcons=Ae.showFilenameMatchIcons),mv(this.currentSettings.fileTypeIconPreset)||(this.currentSettings.fileTypeIconPreset=Ae.fileTypeIconPreset),this.currentSettings.fileTypeIconMap=e(this.currentSettings.fileTypeIconMap,ag,Ae.fileTypeIconMap),this.currentSettings.fileNameIconMap=e(this.currentSettings.fileNameIconMap,ig,Ae.fileNameIconMap)}normalizeInterfaceIconsSettings(){let e=this.currentSettings.interfaceIcons;if(!Aa(e)){this.currentSettings.interfaceIcons=He(Ae.interfaceIcons,Hn);return}let n=He(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=He(B$(n),Hn)}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:kf(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 CB=require("obsidian");ST();go();hn();go();jr();Mi();Et();mo();Bz();var M8=1e3,hR=class{constructor(e){this.notesCache=[];this.notesByProfileCache=He(void 0);this.iconsCache=He(void 0);this.notesPersistTimer=null;this.iconsPersistTimer=null;this.lastPersistedNotesByProfile=He(void 0);this.lastPersistedIcons=He(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=Te.get(this.keys.recentNotesKey),r=this.getValidVaultProfileIds(),o=He(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(ht(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&&Te.set(this.keys.recentNotesKey,this.cloneIconMap(o))}hydrateRecentIcons(){let e=Te.get(this.keys.recentIconsKey),n=ht(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))&&Te.set(this.keys.recentIconsKey,a)}scheduleRecentNotesPersist(){this.notesPersistTimer!==null&&window.clearTimeout(this.notesPersistTimer),this.notesPersistTimer=window.setTimeout(()=>{this.notesPersistTimer=null,this.persistRecentNotesAsync()},M8)}scheduleRecentIconsPersist(){this.iconsPersistTimer!==null&&window.clearTimeout(this.iconsPersistTimer),this.iconsPersistTimer=window.setTimeout(()=>{this.iconsPersistTimer=null,this.persistRecentIconsAsync()},M8)}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);Te.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);Te.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=He(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=rr(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=He(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 AP=class{constructor(e){this.storage=null;this.options=e}initialize(e){this.dispose(),this.storage=new hR({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();Wm();Ue();Et();sn();st();hn();function sSe(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&n.every(o=>t[o]===e[o])}var fR=class{constructor(e){this.dualPanePreference=!0;this.dualPaneOrientationPreference="horizontal";this.recentDataManager=null;this.recentDataListeners=new Map;this.uxPreferences=Wf();this.uxPreferenceListeners=new Map;this.collapsedPinnedContexts=Jm(void 0);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 AP({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=Wf(),n=Te.get(this.options.keys.uxPreferencesKey),r=E8(n,e);this.uxPreferences=r.preferences,(r.changed||!pR(n))&&this.persistUXPreferences(!1),this.syncCollapsedPinnedContextsFromLocalStorage()}resetUXPreferencesToDefaults(){this.uxPreferences=Wf(),this.persistUXPreferences(!1),this.collapsedPinnedContexts=Jm(void 0)}getCollapsedPinnedContexts(){return Jm(this.collapsedPinnedContexts)}syncCollapsedPinnedContextsFromLocalStorage(){let e=Jm(Te.get(this.options.keys.collapsedPinnedContextsKey));return sSe(this.collapsedPinnedContexts,e)?!1:(this.collapsedPinnedContexts=e,!0)}updateCollapsedPinnedContexts(e){let n=e(this.collapsedPinnedContexts);return n&&(Te.set(this.options.keys.collapsedPinnedContextsKey,this.collapsedPinnedContexts),this.notifyUXPreferencesUpdate()),n}togglePinnedGroupCollapsed(e){this.updateCollapsedPinnedContexts(n=>(n[e]?delete n[e]:n[e]=!0,!0))}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,Te.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,Te.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,Te.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,Te.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(Ym,Math.max(qm,n)),o=this.options.getSettings();o.narrowSidebarCustomWidth!==r&&(o.narrowSidebarCustomWidth=r,Te.set(this.options.keys.narrowSidebarCustomWidthKey,r),this.options.persistSyncModeSettingUpdate("narrowSidebarCustomWidth"))}getUIScale(){let e=this.options.getSettings(),n=CB.Platform.isMobile?e.mobileScale:e.desktopScale;return mi(n)}setUIScale(e){let n=mi(e),r=this.options.getSettings(),o=CB.Platform.isMobile,a=mi(o?r.mobileScale:r.desktopScale);o?r.mobileScale=n:r.desktopScale=n,Te.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();!Ma(e)||n.tagSortOrder===e||(n.tagSortOrder=e,Te.set(this.options.keys.tagSortOrderKey,e),this.options.persistSyncModeSettingUpdate("tagSortOrder"))}setPropertySortOrder(e){let n=this.options.getSettings();!Ma(e)||n.propertySortOrder===e||(n.propertySortOrder=e,Te.set(this.options.keys.propertySortOrderKey,e),this.options.persistSyncModeSettingUpdate("propertySortOrder"))}setFolderSortOrder(e){let n=this.options.getSettings();!Ml(e)||n.folderSortOrder===e||(n.folderSortOrder=e,Te.set(this.options.keys.folderSortOrderKey,e),this.options.persistSyncModeSettingUpdate("folderSortOrder"))}getReleaseCheckTimestamp(){let e=Te.get(this.options.keys.releaseCheckTimestampKey);return typeof e=="number"&&Number.isFinite(e)?e:null}setReleaseCheckTimestamp(e){Te.set(this.options.keys.releaseCheckTimestampKey,e)}getRecentColors(){let e=Te.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):[];Te.set(this.options.keys.recentColorsKey,n.slice(0,Km))}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,Te.set(this.options.keys.searchProviderKey,r),this.options.notifySettingsUpdate())}setPaneTransitionDuration(e){this.updateBoundedNumberSettingAndMirror({settingId:"paneTransitionDuration",localStorageKey:this.options.keys.paneTransitionDurationKey,rawValue:e,min:vu,max:bu,fallback:Ae.paneTransitionDuration})}persistToolbarVisibility(){Te.set(this.options.keys.toolbarVisibilityKey,this.options.getSettings().toolbarVisibility),this.options.notifySettingsUpdate(),!this.options.isLocal("toolbarVisibility")&&$(()=>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:Ae.navIndent})}setNavItemHeight(e){this.updateBoundedNumberSettingAndMirror({settingId:"navItemHeight",localStorageKey:this.options.keys.navItemHeightKey,rawValue:e,min:20,max:28,fallback:Ae.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:Ae.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();Lo(n);let r=n.vaultProfiles.find(o=>o.id===e)??n.vaultProfiles.find(o=>o.id===yo)??n.vaultProfiles[0];!r||n.vaultProfile===r.id||(n.vaultProfile=r.id,Te.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){Te.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,Te.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}};xB();Mp();Cz();go();jp();bn();Oe();function ORe(t){let e=t.setting;return!e||typeof e.open!="function"||typeof e.openTabById!="function"?null:e}var LRe=2e3,zRe=600*1e3,NO=class extends au.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={...Ae};this.fileSystemOps=null;this.omnisearchService=null;this.externalIconController=null;this.api=null;this.recentNotesService=null;this.releaseCheckService=null;this.debugLoggingService=null;this.keys=lt;this.settingsUpdateListeners=new Map;this.fileRenameListeners=new Map;this.updateNoticeListeners=new Map;this.isUnloading=!1;this.hasStartedWithSettings=!1;this.pendingExternalSettingsChange=!1;this.startupSettingsAbortController=null;this.missingSettingsAwaitingUserEnable=!1;this.missingSettingsNoticeTimer=null;this.isRestoringDefaultSettings=!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 gR({keys:this.keys,loadData:()=>this.loadData(),saveData:n=>this.saveData(n),mirrorUXPreferences:n=>this.preferencesController.mirrorUXPreferences(n)});this.preferencesController=new fR({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=ORe(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||IB()}async setSyncMode(n,r){await this.settingsController.setSyncMode(n,r)&&await this.saveSettingsAndUpdate()}persistSyncModeSettingUpdate(n){if(this.isLocal(n)){this.notifySettingsUpdate();return}$(()=>this.saveSettingsAndUpdate())}async persistSyncModeSettingUpdateAsync(n){if(this.isLocal(n)){this.notifySettingsUpdate();return}await this.saveSettingsAndUpdate()}async onExternalSettingsChange(){if(this.isUnloading)return;if(!this.hasStartedWithSettings){this.pendingExternalSettingsChange=!0;return}if(await this.loadSettings()!=="loaded")return;let r=this.preferencesController.syncMirrorsFromSettings(),o=this.preferencesController.syncCollapsedPinnedContextsFromLocalStorage();this.preferencesController.initializeRecentDataManager(),this.notifySettingsUpdateWithFullRefresh(),(r||o)&&this.preferencesController.notifyUXPreferencesUpdate()}async loadSettings(){let n=await this.settingsController.loadSettings();return this.settings=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(au.FileView);return!r?.file||r.file.path!==n.path?!1:ul(this.app,r.leaf??null)==="right-sidebar"}async onload(){Te.init(this.app),this.debugLoggingService=new oI(this.app,{pluginVersion:this.manifest.version}),dL(this.debugLoggingService),this.debugLoggingService.initialize(),this.debugLoggingService.isEnabled()||IB(),Sr("onload.start",{pluginVersion:this.manifest.version,minAppVersion:this.manifest.minAppVersion}),typeof au.addIcon=="function"&&(0,au.addIcon)(vs,dU);let n=this.app.appId||"",r=au.Platform.isMobile?200:1e3,o=au.Platform.isMobile?1e4:5e4,a=au.Platform.isMobile?20:50;Sr("database.init.scheduled",{featureImageCacheMaxEntries:r,previewTextCacheMaxEntries:o,previewLoadMaxBatch:a}),$(async()=>{try{Sr("database.init.start"),await E2(n,{featureImageCacheMaxEntries:r,previewTextCacheMaxEntries:o,previewLoadMaxBatch:a}),Sr("database.init.complete")}catch(l){Sr("database.init.failed",{error:l}),console.error("Failed to initialize database:",l)}},{onError:l=>{Sr("database.init.failed",{error:l}),console.error("Failed to initialize database:",l)}});let i=new AbortController;this.startupSettingsAbortController=i;let s=await this.settingsController.loadSettingsAtStartup({signal:i.signal});if(this.startupSettingsAbortController===i&&(this.startupSettingsAbortController=null),!(this.isUnloading||s==="cancelled")){if(this.settings=this.settingsController.settings,Sr("settings.loaded",{result:s}),s==="unavailable"){this.enterSettingsUnavailableState();return}if(s==="missing"){if(this.missingSettingsAwaitingUserEnable=!0,typeof window>"u"){this.enterSettingsUnavailableState();return}this.missingSettingsNoticeTimer=window.setTimeout(()=>{this.missingSettingsNoticeTimer=null,this.enterSettingsUnavailableState()},LRe);return}await this.completeStartup(s==="first-launch")}}onUserEnable(){this.missingSettingsAwaitingUserEnable&&(this.missingSettingsAwaitingUserEnable=!1,this.missingSettingsNoticeTimer!==null&&(window.clearTimeout(this.missingSettingsNoticeTimer),this.missingSettingsNoticeTimer=null),$(()=>this.runUserEnableSettingsRecovery()))}async runUserEnableSettingsRecovery(){try{if(this.isUnloading)return;let n=await this.loadSettings();if(this.isUnloading)return;if(Sr("settings.userEnableRecovery",{result:n}),n==="loaded"){await this.completeStartup(!1);return}if(n==="unavailable"){this.enterSettingsUnavailableState();return}await this.confirmStartWithDefaultSettings()}catch(n){this.handleSettingsRecoveryError(n)}}async confirmStartWithDefaultSettings(){let n=await this.wasPluginFolderRecentlyWritten();if(this.isUnloading)return;Sr("settings.freshStartPrompt",{recentlyInstalled:n});let{ConfirmModal:r}=await Promise.resolve().then(()=>($a(),oL)),o=d.plugin.settingsMissingConfirm;new r(this.app,o.title,n?o.messageRecentInstall:o.messageExistingInstall,()=>this.startWithDefaultSettings(),o.confirmButton,{onCancel:()=>{this.isUnloading||(Sr("settings.freshStartCancelled"),this.enterSettingsUnavailableState())}}).open()}async startWithDefaultSettings(){try{if(this.isUnloading)return;let n=await this.loadSettings();if(this.isUnloading)return;if(Sr("settings.freshStartConfirmed",{result:n}),n==="loaded"){await this.completeStartup(!1);return}if(n==="unavailable"){this.enterSettingsUnavailableState();return}this.settingsController.applySettingsRecord(null,{isFirstLaunch:!0}),this.settings=this.settingsController.settings,await this.completeStartup(!0)}catch(n){this.handleSettingsRecoveryError(n)}}async wasPluginFolderRecentlyWritten(){let n=this.manifest.dir;if(!n)return!1;try{let r=await this.app.vault.adapter.stat(`${n}/manifest.json`);return!r||r.mtime<=0?!1:Date.now()-r.mtime<=zRe}catch(r){return console.error("Failed to read plugin manifest timestamp:",r),!1}}handleSettingsRecoveryError(n){console.error("Failed to recover settings after user enable:",n),this.isUnloading||this.enterSettingsUnavailableState()}async completeStartup(n){this.preferencesController.syncMirrorsFromSettings();let r=this.settingsController.getStoredLocalStorageVersion();if(this.preferencesController.loadUXPreferences(),n){if(this.settingsController.clearAllLocalStorage(),this.preferencesController.resetUXPreferencesToDefaults(),this.settingsController.mirrorAllSyncModeSettingsToLocalStorage(),this.preferencesController.syncMirrorsFromSettings(),this.settings.showRootFolder){let i=["/"];Te.set(lt.expandedFoldersKey,i)}if(this.settingsController.setLocalStorageVersion(),await this.saveData(this.settingsController.getPersistableSettings()),this.isUnloading)return}else{let i=typeof r=="number"?r:Number(r??Number.NaN);(!i||i!==this.settingsController.getCurrentLocalStorageVersion())&&(tI.forEach(s=>{Te.remove(s)}),this.settingsController.setLocalStorageVersion())}this.preferencesController.initializeRecentDataManager(),this.recentNotesService=new ZE(this),this.workspaceCoordinator=new TP(this),this.homepageController=new CP(this,this.workspaceCoordinator),this.tagTreeService=new AE,this.propertyTreeService=new DE,this.metadataService=new fE(this.app,this,()=>this.tagTreeService,()=>this.propertyTreeService),this.tagOperations=new ME(this.app,()=>this.settings,()=>this.tagTreeService,()=>this.metadataService),this.propertyOperations=new SE(this.app,()=>this.settings,()=>this.saveSettingsAndUpdate(),()=>this.propertyTreeService,i=>this.preferencesController.updateCollapsedPinnedContexts(i)),this.commandQueue=new OE,this.folderNoteSidebarService=new lR(this),this.folderNoteSidebarService.start(),this.fileSystemOps=new QE(this.app,()=>this.tagTreeService,()=>this.propertyTreeService,()=>this.commandQueue,()=>this.metadataService,()=>({includeDescendantNotes:this.preferencesController.getUXPreferences().includeDescendantNotes,showHiddenItems:this.preferencesController.getUXPreferences().showHiddenItems}),this),this.omnisearchService=new LE(this.app),this.api=new iR(this,this.app),this.metadataService.setFolderStyleChangeListener(i=>{this.isUnloading||!this.api||this.api[Ka].metadata.emitFolderChangedForPath(i)}),this.releaseCheckService=new SP(this),Sr("services.initialized"),Fn().registerProvider(new Zx(this.app)),this.hasEnabledExternalIconProviders()&&this.syncExternalIconController(),this.registerSettingsUpdateListener("external-icon-controller",()=>{(this.externalIconController||this.hasEnabledExternalIconProviders())&&this.syncExternalIconController()}),this.registerView(Ra,i=>{let{NotebookNavigatorView:s}=(fO(),Wr(Nde));return new s(i,this)}),this.registerView(Sp,i=>{let{NotebookNavigatorCalendarView:s}=(Ode(),Wr(Dde));return new s(i,this)}),this.registerView(qh,i=>{let{FolderNoteSidebarPlaceholderView:s}=(Bde(),Wr(zde));return new s(i)}),SB(this),this.settingTab=new uE(this.app,this),this.addSettingTab(this.settingTab),yB(this);let a=n;this.app.workspace.onLayoutReady(()=>{this.hasWorkspaceLayoutReady=!0,Sr("layout.ready"),$(async()=>{if(Sr("layout.readyTasks.start"),this.isUnloading)return;if(await this.homepageController?.handleWorkspaceReady({shouldActivateOnStartup:a}),await this.folderNoteSidebarService?.handleWorkspaceReady(),n){let{WelcomeModal:l}=await Promise.resolve().then(()=>(Vde(),Hde));new l(this.app).open()}let i=_8();if(i){this.debugLoggingService?.logReport("PDF processing from previous run",{path:i});let{InfoModal:l}=await Promise.resolve().then(()=>(bD(),Jre));new l(this.app,{title:"PDF processing from previous run",intro:"The previous app session ended while this PDF thumbnail was being processed.",items:[`\`${i}\``,"This can also happen if Obsidian or Android closed the app before cleanup finished."]}).open()}typeof window>"u"?await this.checkForVersionUpdate({isFirstLaunch:n}):window.setTimeout(()=>{$(async()=>{this.isUnloading||await this.checkForVersionUpdate({isFirstLaunch:n})})},1e3),this.app.workspace.trigger("parse-style-settings"),this.applyCalendarPlacementView({force:!0,reveal:!1}),this.settings.checkForUpdatesOnStart&&$(()=>this.runReleaseUpdateCheck()),Sr("layout.readyTasks.complete"),DG({shouldActivateOnStartup:a})})}),Sr("onload.complete"),this.hasStartedWithSettings=!0,this.pendingExternalSettingsChange&&(this.pendingExternalSettingsChange=!1,$(()=>this.onExternalSettingsChange()))}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()}togglePinnedGroupCollapsed(n){this.preferencesController.togglePinnedGroupCollapsed(n)}getCollapsedPinnedContexts(){return this.preferencesController.getCollapsedPinnedContexts()}updateCollapsedPinnedContexts(n){return this.preferencesController.updateCollapsedPinnedContexts(n)}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(Ra)[0];if(!n)throw new Error("Notebook Navigator view not available");let{view:r}=n;if(!dl(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=He(this.settings.externalIconProviders);return Object.values(n).some(Boolean)}getExternalIconController(){if(!this.externalIconController){let{ExternalIconProviderController:n}=(Jde(),Wr(Zde));this.externalIconController=new n(this.app,Fn(),this)}return this.externalIconController}syncExternalIconController(){$(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,this.startupSettingsAbortController?.abort(),this.startupSettingsAbortController=null,this.missingSettingsAwaitingUserEnable=!1,this.missingSettingsNoticeTimer!==null&&(window.clearTimeout(this.missingSettingsNoticeTimer),this.missingSettingsNoticeTimer=null);try{this.preferencesController.flushPendingPersists()}catch(n){console.error("Failed to flush recent data during shutdown:",n)}this.commandQueue&&this.commandQueue.clearAllOperations(),this.stopNavigatorContentProcessing(),M2()}}stopNavigatorContentProcessing(){try{let n=this.app.workspace.getLeavesOfType(Ra);for(let o of n){let a=o.view;dl(a)&&a.stopContentProcessing()}let r=this.app.workspace.getLeavesOfType(Sp);for(let o of r){let a=o.view;i6(a)&&a.stopContentProcessing()}}catch(n){console.error("Failed stopping content processing during shutdown:",n)}}onunload(){this.initiateShutdown(),this.debugLoggingService?.dispose(),dL(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()}async advanceLastShownVersion(n){this.settingsController.advanceLastShownVersion(n)&&await this.saveSettingsAndUpdate()}createSettingsTransferJson(){return JSON.stringify(hY(this.settings,this.manifest.version),null,2)}async saveSettingsTransferBackupToVaultRoot(){let n=Fz(),r=Cs("",n,"json",this.app),o=ol("",r,"json");return(await this.app.vault.create(o,this.createSettingsTransferJson())).path}async importSettingsTransfer(n){if(this.isUnloading)throw new Error("Plugin is unloading");let r=fY(this.settings,n);this.settingsController.applySettingsRecord(r,{isFirstLaunch:!1,preferRecordLocalValues:!0}),this.settings=this.settingsController.settings,this.settingsController.prepareImportedUiScalePersistence(),await this.settingsController.saveSettings();let o=this.preferencesController.syncMirrorsFromSettings();this.preferencesController.initializeRecentDataManager(),this.notifySettingsUpdateWithFullRefresh(),o&&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=He(this.settings.syncModes,ev);this.settingsController.clearAllLocalStorage(),this.settingsController.applySettingsRecord({},{isFirstLaunch:!1}),this.settings=this.settingsController.settings,this.settings.syncModes=n,await this.saveSettingsAndUpdate(),this.preferencesController.resetUXPreferencesToDefaults(),this.settingsController.mirrorAllSyncModeSettingsToLocalStorage(),this.preferencesController.syncMirrorsFromSettings(),this.settingsController.setLocalStorageVersion(),this.settings.showRootFolder&&Te.set(lt.expandedFoldersKey,["/"]),this.preferencesController.initializeRecentDataManager(),this.onSettingsUpdate(),this.preferencesController.notifyUXPreferencesUpdate()}enterSettingsUnavailableState(){this.missingSettingsAwaitingUserEnable=!1,this.registerSettingsRecoveryCommand(),oe(d.plugin.settingsUnavailableNotice,{timeout:3e4,variant:"warning"})}registerSettingsRecoveryCommand(){this.addCommand({id:"restore-default-settings",name:d.commands.restoreDefaultSettings,callback:()=>{$(async()=>{let{ConfirmModal:n}=await Promise.resolve().then(()=>($a(),oL));new n(this.app,d.plugin.settingsRecovery.confirmTitle,d.plugin.settingsRecovery.confirmMessage,()=>this.restoreDefaultSettingsFile(),d.plugin.settingsRecovery.confirmButton).open()})}})}async restoreDefaultSettingsFile(){if(!this.isRestoringDefaultSettings){this.isRestoringDefaultSettings=!0;try{await this.restoreDefaultSettingsFileInternal()}finally{this.isRestoringDefaultSettings=!1}}}async restoreDefaultSettingsFileInternal(){let n=this.manifest.dir;if(!n){oe(d.plugin.settingsRecovery.failedNotice,{variant:"warning"});return}let r=this.app.vault.adapter,o=`${n}/data.json`,a=null;try{await r.exists(o)&&(a=await r.read(o))}catch(s){console.error("Failed to read settings file before recovery:",s),oe(d.plugin.settingsRecovery.failedNotice,{variant:"warning"});return}if(a!==null)try{let s=await this.getAvailableSettingsBackupPath(n);if(await r.write(s,a),await r.read(s)!==a)throw new Error("Settings backup verification failed")}catch(s){console.error("Failed to back up settings file before recovery:",s),oe(d.plugin.settingsRecovery.failedNotice,{variant:"warning"});return}let i=JSON.stringify(this.settingsController.getPersistableDefaultSettings(),null,2);try{if(await r.write(o,i),await r.read(o)!==i)throw new Error("Settings file verification failed after recovery write")}catch(s){console.error("Failed to write default settings during recovery:",s),oe(d.plugin.settingsRecovery.failedNotice,{variant:"warning"});return}this.settingsController.clearAllLocalStorage(),this.settingsController.applySettingsRecord(null,{isFirstLaunch:!0}),this.settings=this.settingsController.settings,this.settingsController.setLocalStorageVersion(),this.settings.showRootFolder&&Te.set(lt.expandedFoldersKey,["/"]),oe(d.plugin.settingsRecovery.completedNotice,{timeout:1e4})}async getAvailableSettingsBackupPath(n){let r=new Date().toISOString().replace(/\D/g,"").slice(0,14),o=`${n}/data-backup-${r}`,a=0;for(;;){let i=`${o}${a===0?"":`-${a}`}.json`;if(!await this.app.vault.adapter.exists(i))return i;a+=1}}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;$(()=>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.settingsChanged&&await this.saveSettingsAndUpdate(),n.settingsChanged||n.localChanged}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[Ka].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(Ra)}async navigateToFolder(n,r){await this.activateView();let o=this.app.workspace.getLeavesOfType(Ra);if(o.length===0)return;let i=o[0].view;dl(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.settingsController.getLastShownVersion();if(!a){if(r){await this.advanceLastShownVersion(o);return}let{getLatestReleaseNotes:p,isReleaseAutoDisplayEnabled:m}=await Promise.resolve().then(()=>(nk(),tk));if(!m(o)){await this.advanceLastShownVersion(o);return}let{WhatsNewModal:g}=await Promise.resolve().then(()=>(ek(),JT)),f=p();new g(this.app,f,()=>{window.setTimeout(()=>{$(async()=>{await this.advanceLastShownVersion(o)})},1e3)}).open();return}let{getReleaseNotesBetweenVersions:i,compareVersions:s,shouldAutoDisplayReleaseNotesForUpdate:l}=await Promise.resolve().then(()=>(nk(),tk));if(s(o,a)<=0||!l(a,o))return;let{WhatsNewModal:c}=await Promise.resolve().then(()=>(ek(),JT)),u=i(a,o);new c(this.app,u,()=>{window.setTimeout(()=>{$(async()=>{await this.advanceLastShownVersion(o)})},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 */