"use strict";(()=>{var t=(t,e,i)=>{if(!e.has(t))throw TypeError("Cannot "+i)},e=(e,i,s)=>(t(e,i,"read from private field"),s?s.call(e):i.get(e)),i=(t,e,i)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,i)},s=(e,i,s,n)=>(t(e,i,"write to private field"),n?n.call(e,s):i.set(e,s),s),n=(e,i,s)=>(t(e,i,"access private method"),s);async function o(t){return new Promise((e=>setTimeout(e,t)))}async function a(t,e=100){for(;!t();)await o(e)}function r(t,e){const i=document.createElement("div");i.style.position="absolute",i.style.visibility="hidden",i.style.width=t,e.appendChild(i);const s=i.offsetWidth;return e.removeChild(i),s}var h=class{get width(){return this.right-this.left}set width(t){this.right=this.left+t}get height(){return this.bottom-this.top}set height(t){this.bottom=this.top+t}get center(){return new c(this.left+this.width/2,this.top+this.height/2)}get min(){return new c(this.left,this.top)}set min(t){this.left=t.x,this.top=t.y}set position(t){this.min=t}get max(){return new c(this.right,this.bottom)}set max(t){this.right=t.x,this.bottom=t.y}get size(){return new c(this.width,this.height)}set size(t){this.width=t.x,this.height=t.y}constructor(t,e,i,s){this.left=t,this.top=e,this.right=t+i,this.bottom=e+s}containsPoint(t){return t.x>=this.left&&t.x<=this.right&&t.y>=this.top&&t.y<=this.bottom}containsBounds(t){return t.left>=this.left&&t.right<=this.right&&t.top>=this.top&&t.bottom<=this.bottom}encapsulate(t){return this.left=Math.min(this.left,t.left),this.top=Math.min(this.top,t.top),this.right=Math.max(this.right,t.right),this.bottom=Math.max(this.bottom,t.bottom),this}encapsulatePoint(t){if(!t.isUndefined)return this.left=Math.min(this.left,t.x),this.top=Math.min(this.top,t.y),this.right=Math.max(this.right,t.x),this.bottom=Math.max(this.bottom,t.y),this}expand(t){return this.left-=t,this.right+=t,this.top-=t,this.bottom+=t,this}translate(t){return this.left+=t.x,this.right+=t.x,this.top+=t.y,this.bottom+=t.y,this}scale(t){let e=this.width,i=this.height;return this.left+=e*(1-t)/2,this.right-=e*(1-t)/2,this.top+=i*(1-t)/2,this.bottom-=i*(1-t)/2,this}overlaps(t){return this.leftt.left&&this.topt.top}static fromElement(t){const e=t.getBoundingClientRect();return new h(e.x,e.y,e.width,e.height)}static get screenBounds(){return new h(0,0,window.innerWidth,window.innerHeight)}},l=class{constructor(t,e){this.x=t,this.y=e}add(t){return new l(this.x+t.x,this.y+t.y)}sub(t){return new l(this.x-t.x,this.y-t.y)}scale(t){return new l(this.x*t,this.y*t)}divide(t){return new l(this.x/t,this.y/t)}get isUndefined(){return isNaN(this.x)||isNaN(this.y)}get magnitude(){return Math.sqrt(this.sqrMagnitude)}get sqrMagnitude(){return this.x*this.x+this.y*this.y}get normalized(){const t=this.magnitude;return new l(this.x/t,this.y/t)}get inverse(){return new l(-this.x,-this.y)}static distance(t,e){return t.sub(e).magnitude}static dot(t,e){return t.x*e.x+t.y*e.y}},c=l;c.Undefined=new l(NaN,NaN);var d=class{constructor(t){this.callbacks=[],this.targetFPS=t,this.measuredFPS=t,this._lastTime=performance.now(),this._deltaTime=1/t,this._time=this._lastTime}get deltaTime(){return this._deltaTime/1e3}get time(){return this._time}async start(){for(;;){this._time=performance.now(),requestAnimationFrame((()=>{for(let t of this.callbacks)t(this.deltaTime)}));const t=this._time-this._lastTime;let e=t-1e3/this.targetFPS;this._lastTime=this._time+Math.max(e,0),await o(Math.max(0,e)),this._deltaTime=Math.min(t+Math.max(e,0),1e3/this.targetFPS*3),this.measuredFPS=1/this.deltaTime*.1+.9*this.measuredFPS}}add(t){this.callbacks.push(t)}};function u(t,e=500){"none"!==t.style.display&&(t.style.transitionProperty="height, margin, padding",t.style.transitionTimingFunction="ease-in-out",t.style.transitionDuration=e+"ms",t.style.boxSizing="border-box",t.style.height=t.offsetHeight+"px",t.offsetHeight,t.style.overflow="hidden",t.style.height="0",t.style.paddingTop="0",t.style.paddingBottom="0",t.style.marginTop="0",t.style.marginBottom="0",window.setTimeout((async()=>{t.style.display="none",t.style.removeProperty("height"),t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property")}),e))}function p(t,e=500){if("none"!==window.getComputedStyle(t).display)return;t.style.removeProperty("display");let i=window.getComputedStyle(t).display;"none"===i&&(i="block"),t.style.display=i;const s=t.offsetHeight;t.style.overflow="hidden",t.style.height="0",t.style.paddingTop="0",t.style.paddingBottom="0",t.style.marginTop="0",t.style.marginBottom="0",t.offsetHeight,t.style.boxSizing="border-box",t.style.transitionProperty="height, margin, padding",t.style.transitionTimingFunction="ease-in-out",t.style.transitionDuration=e+"ms",t.style.height=s+"px",t.style.removeProperty("padding-top"),t.style.removeProperty("padding-bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),window.setTimeout((async()=>{t.style.removeProperty("height"),t.style.removeProperty("overflow"),t.style.removeProperty("transition-duration"),t.style.removeProperty("transition-property")}),e)}function m(t){return{x:t.clientX,y:t.clientY}}function g(t,e,i){let s=2*(i/=2)*(1-i)+.5;return s-=.5,s*=2,t+(e-t)*s}function f(t,e,i,s,n){return function(t,e,i){return Math.max(e,Math.min(t,i))}(function(t,e,i,s,n){return s+(n-s)*(t-e)/(i-e)}(t,e,i,s,n),s,n)}var b=class{constructor(t,e){if(this.isFocused=!1,this.canvas=t,this.nodeEl=e,this.nodeEl.nodeObj=this,this.labelEl=e.querySelector(".canvas-node-label"),this.containerEl=e.querySelector(".canvas-node-container"),this.contentEl=e.querySelector(".canvas-node-content"),!this.labelEl||!this.containerEl||!this.contentEl)return void console.error("Failed to find all required elements for canvas node",this);const i=this.contentEl.classList;if(i.contains("image-embed")?this.type="image":i.contains("video-embed")?this.type="video":i.contains("audio-embed")?this.type="audio":i.contains("markdown-embed")&&i.contains("external-markdown-embed")?this.type="external-markdown":i.contains("markdown-embed")?this.type="markdown":i.contains("canvas-embed")?this.type="canvas":"IFRAME"===this.contentEl.firstElementChild?.tagName?this.type="website":this.nodeEl.classList.contains("canvas-node-group")?this.type="group":this.type="none","external-markdown"==this.type){const e=this.contentEl.querySelector(".obsidian-document");console.log(e);const i=t.document.children.find((t=>t.documentEl==e));i?this.document=i:console.error("Failed to find document object for external markdown node",this)}this.initEvents()}get size(){return new c(parseFloat(this.nodeEl.style.width.replace("px","")),parseFloat(this.nodeEl.style.height.replace("px","")))}set size(t){this.nodeEl.style.width=t.x+"px",this.nodeEl.style.height=t.y+"px",this.nodeEl.style.setProperty("--canvas-node-width",t.x+"px"),this.nodeEl.style.setProperty("--canvas-node-height",t.y+"px")}get position(){const t=this.nodeEl.style.transform.match(/translate\(([^,]+)px, ([^,]+)px\)/),e=this.nodeEl.style.translate.match(/([^,]+)px ([^,]+)px/);let i=0,s=0;return t&&(i+=parseFloat(t[1]),s+=parseFloat(t[2])),e&&(i+=parseFloat(e[1]),s+=parseFloat(e[2])),new c(i,s)}set position(t){this.nodeEl.style.transform=`translate(${t.x}px, ${t.y}px)`}get bounds(){let t=new h(0,0,0,0),e=this.size.scale(this.canvas.scale),i=this.position.scale(this.canvas.scale).add(this.canvas.position);return t.position=i,t.size=e,t}get label(){return this.labelEl.textContent??""}set label(t){this.labelEl.textContent=t}get isScrollable(){return!!this.document&&this.document?.documentEl.scrollHeight>this.document?.documentEl.clientHeight}get scrollContainer(){return this.document?.documentEl}focus(t=!0){this.isFocused&&t||(this.canvas.focusedNode!=this&&this.canvas.focusedNode?.focus(!1),this.nodeEl.classList.toggle("is-focused",t),this.canvas.focusedNode=t?this:null,this.isFocused=t)}initEvents(){const t=this;function e(){console.log("leave"),t.focus(!1),t.nodeEl.removeEventListener("mouseleave",e),t.nodeEl.removeEventListener("touchend",e)}this.nodeEl.addEventListener("dblclick",(e=>{t.fitToView(!1)})),this.nodeEl.addEventListener("pointerenter",(function(i){t.focus(!0),t.nodeEl.addEventListener("mouseleave",e),t.nodeEl.addEventListener("touchend",e),i.stopPropagation()}))}fitToView(t=!1){this.canvas.fitToBounds(this.bounds,.9,t)}},v=class{constructor(t){this.hiddenNodes=[],this.focusedNode=null,this._renderScale=1,this._minScale=.1,this._maxScale=5,this._targetScale=1,this._scale=1,this._targetPosition=new c(0,0),this._position=new c(0,0),this._backgroundBaseScale=20,this._invisibleBackgroundScale=2,this._backgroundScale=this._backgroundBaseScale,this._backgroundDotSize=1,this._backgroundPosition=new c(0,0),this.lastTime=0,this.document=t,this.nodes=Array.from(t.documentEl.querySelectorAll(".canvas-node")).map((t=>new b(this,t))),this.document.documentEl.style.position="absolute",this.document.documentEl.style.width="100%",this.document.documentEl.style.height="100%",this.document.documentEl.style.overflow="hidden",this.document.documentEl.style.top="0",this.document.documentEl.style.left="0",this.canvasEl=t.documentEl.querySelector(".canvas"),this.wrapperEl=t.documentEl.querySelector(".canvas-wrapper"),this.backgroundEl=t.documentEl.querySelector(".canvas-background pattern"),this.backgroundDotEl=this.backgroundEl?.querySelector("circle"),this.canvasEl.setAttribute("style","translate: 0px 1px; scale: 1;"),this.backgroundScale=this._backgroundScale,this.backgroundDotSize=this._backgroundDotSize,this.renderScale=this._renderScale;const e=h.fromElement(this.canvasEl).min.sub(this.nodeBounds.min);Array.from(this.canvasEl.children).forEach((t=>{t.style.translate=`${e.x}px ${e.y}px`})),this.forcePosition=this.nodeBounds.min.sub(this.wrapperBounds.min),requestAnimationFrame(this.updateScale.bind(this)),this.initEvents(),this.wrapperEl.style.transition="opacity 0.0s",this.wrapperEl.classList.add("hide"),this.wrapperEl.style.transition="opacity 3s",this.wrapperEl.classList.remove("hide"),this.fitToBounds(this.nodeBounds,3,!0),setTimeout((()=>{this.fitToBounds(this.nodeBounds,.9,!1)}),100)}get renderScale(){return this._renderScale}set renderScale(t){this._renderScale=t,this.canvasEl.style.zoom=100*t+"%",this.scale=this._scale,this.position=this._position}get nodeBounds(){if(0==this.nodes.length)return new h(0,0,0,0);const t=this.nodes[0].bounds;for(const e of this.nodes)t.encapsulate(e.bounds);return t}get wrapperBounds(){return h.fromElement(this.wrapperEl)}get minScale(){return this._minScale}get maxScale(){return this._maxScale}get targetScale(){return this._targetScale}set targetScale(t){t=Math.min(Math.max(t,this.minScale),this.maxScale),this._targetScale=t}get scale(){return this._scale}set scale(t){let e=t/this._scale;this._scale=t;const i=(t/this.renderScale).toString()??"1";this.canvasEl.style.scale=i;const s=(1/Math.sqrt(t)).toString()??"1";this.wrapperEl.style.setProperty("--zoom-multiplier",s),this.canvasEl.classList.toggle("small-scale",this.scale<.15),this.backgroundScale=this.backgroundScale*e}get targetPosition(){return this._targetPosition}set targetPosition(t){this._targetPosition=t}get position(){return this._position}set position(t){this._position=t;let e=t.divide(this.renderScale);this.canvasEl.style.translate=`${e.x}px ${e.y}px`,this.backgroundPosition=this.position}set forcePosition(t){this.targetPosition=t,this.position=t}get forcePosition(){return this.position}get backgroundScale(){return this._backgroundScale}set backgroundScale(t){const e=t.toString()??"20";this.backgroundEl?.setAttribute("width",e),this.backgroundEl?.setAttribute("height",e),this._backgroundScale=t,this.backgroundEl?.parentElement&&(this.backgroundEl.parentElement.style.opacity=(1-f(this._backgroundScale,this._backgroundBaseScale/2,this._invisibleBackgroundScale,0,1)).toString())}get backgroundDotSize(){return this._backgroundDotSize}set backgroundDotSize(t){const e=t.toString()??"0.7";this.backgroundDotEl?.setAttribute("r",e),this.backgroundDotEl?.setAttribute("cx",e),this.backgroundDotEl?.setAttribute("cy",e),this._backgroundDotSize=t}get backgroundPosition(){return this._backgroundPosition}set backgroundPosition(t){this.backgroundEl&&(this.backgroundEl?.setAttribute("x",t.x.toString()),this.backgroundEl?.setAttribute("y",t.y.toString()),this._backgroundPosition=t)}updateScale(t){0==this.lastTime&&(this.lastTime=t);const e=(t-this.lastTime)/1e3;var i,s,n;this.lastTime=t,Math.abs(this.targetScale-this.scale)>1e-4&&(this.scale=g(this.scale,this.targetScale,6*e)),this.targetPosition.sub(this.position).magnitude>.001&&(this.position=(i=this.position,s=this.targetPosition,n=6*e,new c(g(i.x,s.x,n),g(i.y,s.y,n))));let o=h.screenBounds;this.hiddenNodes.sort(((t,e)=>{const i=t.bounds.center,s=e.bounds.center;return i.sub(o.center).magnitude-s.sub(o.center).magnitude}));for(let t=0;t<50&&!(t>=this.hiddenNodes.length);t++){const e=this.hiddenNodes[t];if(!e){this.hiddenNodes.splice(t,1);continue}const i=e.bounds.expand(100).overlaps(o);e.nodeEl.style.display=i?"":"none",i&&this.hiddenNodes.splice(t,1)}requestAnimationFrame(this.updateScale.bind(this))}initEvents(){const t=new IntersectionObserver((t=>{t.forEach((t=>{t.target.style.display=t.isIntersecting?"":"none",t.isIntersecting||this.hiddenNodes.push(t.target.nodeObj)}))}),{root:null,rootMargin:"0px",threshold:0});this.nodes.forEach((e=>t.observe(e.nodeEl)));const e=this,i=navigator.userAgent.includes("Windows");function s(t){const i=e.wrapperEl.getBoundingClientRect(),s=t.clientX-i.left,n=t.clientY-i.top;return new c(s,n)}function n(t,e,i){const s=i?.scrollContainer;if(s){if(0!=s.scrollTop&&t<0&&Math.abs(t/(e+.01))>2)return!1;if(s.scrollHeight-s.scrollTop>s.clientHeight+1&&t>0&&Math.abs(t/(e+.01))>2)return!1;if(0!=s.scrollLeft&&e<0&&Math.abs(e/(t+.01))>2)return!1;if(s.scrollWidth-s.scrollLeft>s.clientWidth+1&&e>0&&Math.abs(e/(t+.01))>2)return!1}return!0}this.wrapperEl.addEventListener("pointerdown",(function(t){if("mouse"!=t.pointerType&&"pen"!=t.pointerType)return;const n=s(t),o=e.position,a=e.focusedNode;function r(t){if(i&&a?.isScrollable&&4==t.buttons)return;t.preventDefault();const r=s(t).sub(n);e.forcePosition=o.add(r)}document.addEventListener("mousemove",r),document.addEventListener("mouseup",(function t(e){document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",t)}))})),this.wrapperEl.addEventListener("wheel",(function(t){if(!n(t.deltaY,t.deltaX,e.focusedNode))return;let i=1;i-=t.deltaY/700*i,e.scaleAround(i,s(t))}),{passive:!0});let o=!1;this.wrapperEl.addEventListener("touchstart",(function(t){if(o)return;o=!0;const i=t.touches;function a(t){const e=s(t[0]),i=2==t.length?s(t[1]):null,n=i?e.add(i).scale(.5):e;return{touch1:e,touch2:i,center:n,distance:i?c.distance(e,i):0}}let r=a(i),h=2==i.length;const l=e.focusedNode;function d(t){const i=t.touches,s=a(i);if(2==i.length){h||(r=a(i),h=!0);const t=(s.distance-r.distance)/r.distance;e.scaleAround(1+t,s.center)}const o=s.center.sub(r.center);h||n(-o.y,o.x,l)?(t.preventDefault(),e.targetPosition=e.targetPosition.add(o),r=a(i)):r=a(i)}document.addEventListener("touchmove",d),document.addEventListener("touchend",(function t(e){document.removeEventListener("touchmove",d),document.removeEventListener("touchend",t),o=!1}))}))}scaleAround(t,e,i=!1){const s=this.targetScale;let n=s*t;n=Math.min(Math.max(n,this.minScale),this.maxScale),t=n/s;const o=e.sub(this.targetPosition).scale(t).add(this.targetPosition),a=e.sub(o);return i?(this.scale*=t,this.targetScale=this.scale,this.forcePosition=this.forcePosition.add(a)):(this.targetScale*=t,this.targetPosition=this.targetPosition.add(a)),a}setScaleAround(t,e,i=!1){this.scaleAround(t/this.targetScale,e,i)}fitToBounds(t=this.nodeBounds,e=.9,i=!1){this.hideNodesOutsideBounds(t.scale(2));const s=this.document.containerEl.clientWidth,n=this.document.containerEl.clientHeight,o=s/t.width,a=n/t.height,r=e*Math.min(o,a);this.scaleAround(r,t.center,i),this.centerView(t.center,i)}hideNodesOutsideBounds(t){for(const e of this.nodes)t.overlaps(e.bounds)||(e.nodeEl.style.display="none",this.hiddenNodes.push(e))}centerView(t,e=!1){const i=this.wrapperBounds.center.sub(t);e?this.forcePosition=this.forcePosition.add(i):this.targetPosition=this.targetPosition.add(i)}},w=class{constructor(t="#right-sidebar-content",e="start"){this.selector="#right-sidebar-content",this.type="start",this.selector=t,this.type=e}},y=class{constructor(){this.featureId="feature",this.enabled=!0,this.unavailable=!1,this.alwaysEnabled=!1,this.hideSettingsButton=!1}setAvailable(t){this.unavailable=!t,this.enabled=t}},E=class extends y{constructor(t,e){super(),this.featurePlacement=new w,this.featureId=t??"inserted-feature",this.featurePlacement=e??new w}insertFeature(t,e){if(!t)return!1;let i=t.querySelector(this.featurePlacement.selector);if(i)switch(this.featurePlacement.type){case"before":return i.before(e),!0;case"after":return i.after(e),!0;case"start":return i.prepend(e),!0;case"end":return i.append(e),!0;default:return!1}return!1}},S=class extends E{constructor(){super(...arguments),this.displayTitle="Feature"}},_=class extends E{constructor(){super(...arguments)}},k=class extends S{constructor(){super(),this.featureId="aliases",this.displayTitle="Aliases",this.featurePlacement=new w(".header .data-bar","start")}},L=class extends S{constructor(){super(),this.featureId="backlinks",this.displayTitle="",this.featurePlacement=new w(".footer","start")}},x=class{};x.libFolderName="site-lib",x.mediaFolderName="media",x.scriptsFolderName="scripts",x.cssFolderName="styles",x.fontFolderName="fonts",x.htmlFolderName="html",x.metadataFileName="metadata.json",x.searchIndexFileName="search-index.json";var P=class extends _{constructor(){super(),this.sourcePath="",this.featureId="custom-head",this.featurePlacement=new w("head","end"),this.includePath=`${x.libFolderName}/${x.htmlFolderName}/custom-head.html`}},C=class extends y{constructor(){super(),this.allowFoldingLists=!0,this.allowFoldingHeadings=!0,this.documentWidth="40em",this.featureId="obsidian-document",this.alwaysEnabled=!0}},T=class extends _{constructor(){super(),this.showCustomIcons=!1,this.showDefaultFolderIcons=!1,this.showDefaultFileIcons=!1,this.defaultFolderIcon="lucide//folder",this.defaultFileIcon="lucide//file",this.defaultMediaIcon="lucide//file-image",this.exposeStartingPath=!0,this.featureId="file-navigation",this.featurePlacement=new w("#left-sidebar-content","end"),this.includePath=`${x.libFolderName}/${x.htmlFolderName}/file-tree.html`}},O=class extends S{constructor(){super(),this.showOrphanNodes=!0,this.showAttachments=!1,this.allowGlobalGraph=!0,this.allowExpand=!0,this.attractionForce=1,this.linkLength=15,this.repulsionForce=80,this.centralForce=2,this.edgePruning=100,this.minNodeRadius=3,this.maxNodeRadius=7,this.featureId="graph-view",this.displayTitle="",this.featurePlacement=new w("#right-sidebar-content","start")}},F=class extends y{constructor(){super(),this.featureId="link-preview",this.hideSettingsButton=!0}},M=class extends S{constructor(){super(),this.startCollapsed=!1,this.minCollapseDepth=0,this.featureId="outline",this.displayTitle="",this.featurePlacement=new w("#right-sidebar-content","end")}},I=class extends S{constructor(){super(),this.featureId="properties",this.displayTitle="",this.featurePlacement=new w(".header","start")}},z=class extends y{constructor(){super(),this.siteUrl="",this.authorName="",this.featureId="rss"}},R=class extends S{constructor(){super(),this.featureId="search",this.displayTitle="",this.featurePlacement=new w("#left-sidebar .topbar-content","start")}},N=class extends y{constructor(){super(),this.allowResizing=!0,this.allowCollapsing=!0,this.rightDefaultWidth="20em",this.leftDefaultWidth="20em",this.featureId="sidebar"}},A=class extends S{constructor(){super(),this.showInlineTags=!0,this.showFrontmatterTags=!0,this.featureId="tags",this.displayTitle="",this.featurePlacement=new w(".header .data-bar","end")}},D=class extends S{constructor(){super(),this.featureId="theme-toggle",this.displayTitle="",this.featurePlacement=new w("#right-sidebar .topbar-content","start")}},W=class{static fromJSON(t){let e=Object.assign(new W,JSON.parse(t));return e.backlinks=Object.assign(new L,e.backlinks),e.tags=Object.assign(new A,e.tags),e.alias=Object.assign(new k,e.alias),e.properties=Object.assign(new I,e.properties),e.fileNavigation=Object.assign(new T,e.fileNavigation),e.search=Object.assign(new R,e.search),e.outline=Object.assign(new M,e.outline),e.themeToggle=Object.assign(new D,e.themeToggle),e.graphView=Object.assign(new O,e.graphView),e.sidebar=Object.assign(new N,e.sidebar),e.customHead=Object.assign(new P,e.customHead),e.document=Object.assign(new C,e.document),e.rss=Object.assign(new z,e.rss),e.linkPreview=Object.assign(new F,e.linkPreview),e}},H=class{constructor(){this.ignoreMetadata=!1,this.webpages={},this.fileInfo={},this.sourceToTarget={},this.attachments=[],this.shownInTree=[],this.allFiles=[],this.siteName="",this.vaultName="",this.createdTime=0,this.modifiedTime=0,this.pluginVersion="",this.exportRoot="",this.baseURL="",this.themeName="",this.bodyClasses="",this.hasFavicon=!1,this.featureOptions=new W}static fromJSON(t){let e=Object.assign(new H,JSON.parse(t));return e.featureOptions=W.fromJSON(JSON.stringify(e.featureOptions)),e}},q=class{constructor(t,e=!0){this._collapsed=!1,this.calloutEl=t,this.titleEl=t.querySelector(".callout-title-inner"),this.contentEl=t.querySelector(".callout-content"),this.iconEl=t.querySelector(".callout-icon"),this.foldIconEl=t.querySelector(".callout-fold");switch(t.getAttribute("data-callout-fold")){case"+":this.foldType=0,this._collapsed=!1;break;case"-":this.foldType=1,this._collapsed=!0;break;default:this.foldType=2,this._collapsed=!1}this.type=t.getAttribute("data-callout")??"",this.metadata=t.getAttribute("data-callout-metadata")??"",e&&this.init()}get title(){return this.titleEl?.textContent??""}set title(t){this.titleEl.textContent=t}get collapsed(){return this._collapsed}set collapsed(t){this.toggle(t)}toggle(t){2!=this.foldType&&(void 0===t&&(t=!this._collapsed),this.calloutEl?.classList.toggle("is-collapsed",t),this.foldIconEl?.classList.toggle("is-collapsed",t),t?u(this.contentEl,150):p(this.contentEl,150),this._collapsed=t)}collapse(){this.toggle(!0)}expand(){this.toggle(!1)}init(){this.foldIconEl&&this.foldIconEl.addEventListener("click",(()=>{this.toggle()}))}},V=class{constructor(t){this._children=[],this._isCollapsed=!1,this._content=[],this._divParent=t.parentElement,this._headerElement=t,this._collapseIndicatorElement=this._headerElement.querySelector(".heading-collapse-indicator"),this._id=t.id,this._level=parseInt(t.tagName.replace("H","")),V.headerMap.set(t,this),this._collapseIndicatorElement&&this._collapseIndicatorElement.addEventListener("click",(()=>{this.toggleCollapse()}))}get id(){return this._id}get text(){return this._headerElement.textContent??""}set text(t){this._headerElement.textContent=t}get level(){return this._level}get headerElement(){return this._headerElement}get collapseIndicatorElement(){return this._collapseIndicatorElement}get children(){return this._children}get isCollapsed(){return this._isCollapsed}scrollTo(t={behavior:"smooth",block:"start"}){this._headerElement.scrollIntoView(t)}find(t){if(t(this))return this;for(const e of this.children){const i=e.find(t);if(i)return i}}findByID(t){return t.startsWith("#")&&(t=t.substring(1)),this.find((e=>e.id===t))}getFlatChildren(){let t=[this];for(const e of this._children)t=t.concat(e.getFlatChildren());return t}toggleCollapse(){this._isCollapsed=!this._isCollapsed,this._collapseIndicatorElement?.classList.toggle("is-collapsed",this._isCollapsed),this._headerElement.classList.toggle("is-collapsed",this._isCollapsed),this.updateVisibility(this._isCollapsed)}updateVisibility(t){this._collapseIndicatorElement?.classList.toggle("is-collapsed",t),this._headerElement.classList.toggle("is-collapsed",t);for(const e of this._content)e.style.display=t?"none":"";for(const e of this._children)e.headerElement.style.display=t?"none":"",t?e.updateVisibility(!0):e.updateVisibility(e._isCollapsed)}getHeaderWithContentRecursive(){let t=[];t.push(this._divParent);for(const e of this._content)t.push(e);for(const e of this._children)t=t.concat(e.getHeaderWithContentRecursive());return t}static createHeaderTree(t){const e=Array.from(t.querySelectorAll("h1, h2, h3, h4, h5, h6")).map((t=>new V(t))),i=[],s=[];for(let t=0;t0&&s[s.length-1].level>=n.level;)s.pop();s.length>0?s[s.length-1].children.push(n):i.push(n),s.push(n);let o=n.headerElement.nextElementSibling;for(;o&&!(o instanceof HTMLHeadingElement);)o instanceof HTMLElement&&n._content.push(o),o=o.nextElementSibling;for(o=n.headerElement.parentElement?.nextElementSibling??null;o&&!o.querySelector("h1, h2, h3, h4, h5, h6");)o instanceof HTMLElement&&!o.classList.contains("footer")&&n._content.push(o),o=o.nextElementSibling}return i}},B=V;B.headerMap=new WeakMap;var j=class{constructor(t,e,i){this.isPinned=!1,this.resizeObserver=null,this.hoverTimeout=null,this.showTimeout=null,this.link=t,this.target=e,this.onRemove=i,this.createPreviewElements(),this.setupEventListeners(),this.positionPreview(),this.setupOutsideClickListener()}static savePinnedPreviews(){const t=j.pinnedPreviews.map((t=>({target:t.target,top:t.filePreviewPopover.style.top,left:t.filePreviewPopover.style.left,width:t.filePreviewPopover.style.width,height:t.filePreviewPopover.style.height,zIndex:t.filePreviewPopover.style.zIndex})));localStorage.setItem("pinnedPreviews",JSON.stringify(t))}static loadPinnedPreviews(){JSON.parse(localStorage.getItem("pinnedPreviews")??"[]").forEach((async t=>{const e=new j(null,t.target,(()=>{}));e.setPinned(!0),e.filePreviewPopover.style.top=t.top,e.filePreviewPopover.style.left=t.left,e.filePreviewPopover.style.width=t.width,e.filePreviewPopover.style.height=t.height,e.filePreviewPopover.style.zIndex=t.zIndex||j.baseZIndex.toString(),e.show()}))}static create(t,e,i,s=!0){const n=new j(null,t,(()=>{}));n.setPinned(s),n.filePreviewPopover.style.top=i+"px",n.filePreviewPopover.style.left=e+"px",n.show()}static initializeLink(t,e){let i=null;t.addEventListener("pointerenter",(function(){i||(i=new j(t,e,(()=>{i=null})),i.startShowTimeout())})),t.addEventListener("pointerleave",(function(){i&&(i.isPinned||i.startRemoveTimeout(),i.clearShowTimeout())})),t.addEventListener("click",(function(t){i&&(i.isPinned||i.startRemoveTimeout(),i.clearShowTimeout())}))}createPreviewElements(){this.filePreviewPopover=document.createElement("div"),this.filePreviewPopover.className="file-preview popover hover-popover hide",document.body.appendChild(this.filePreviewPopover),this.markdownEmbed=document.createElement("div"),this.markdownEmbed.className="markdown-embed",this.filePreviewPopover.appendChild(this.markdownEmbed),this.markdownEmbedContent=document.createElement("div"),this.markdownEmbedContent.className="markdown-embed-content",this.markdownEmbed.appendChild(this.markdownEmbedContent),this.actionContainer=document.createElement("div"),this.actionContainer.className="preview-action-container",this.filePreviewPopover.appendChild(this.actionContainer),this.dragHandle=document.createElement("div"),this.dragHandle.className="drag-handle clickable-icon popover-action",this.actionContainer.appendChild(this.dragHandle),this.pinButton=document.createElement("button"),this.pinButton.className="pin-button clickable-icon popover-action",this.actionContainer.appendChild(this.pinButton),this.goToButton=document.createElement("button"),this.goToButton.className="go-to-button clickable-icon popover-action",this.actionContainer.appendChild(this.goToButton),this.filePreviewPopover.style.zIndex=j.baseZIndex.toString(),this.bringToFront()}setPinned(t){this.isPinned=t,this.pinButton.classList.toggle("pinned",this.isPinned),this.filePreviewPopover.classList.toggle("pinned",this.isPinned),this.isPinned?j.pinnedPreviews.push(this):j.pinnedPreviews=j.pinnedPreviews.filter((t=>t!==this))}setupEventListeners(){this.pinButton.addEventListener("click",(()=>{this.setPinned(!this.isPinned),j.savePinnedPreviews()})),this.goToButton.addEventListener("click",(()=>{ObsidianSite.loadURL(this.target)})),this.setupDragHandleListeners(),this.filePreviewPopover.addEventListener("pointerenter",(()=>{this.clearRemoveTimeout()})),this.filePreviewPopover.addEventListener("pointerleave",(()=>{this.isPinned||this.startRemoveTimeout()})),this.setupResizeObserver()}updateMaxSize(){const t=window.innerWidth,e=window.innerHeight,i=this.filePreviewPopover.getBoundingClientRect(),s=t-i.left-10,n=e-i.top-10;this.filePreviewPopover.style.maxWidth=`${s}px`,this.filePreviewPopover.style.maxHeight=`${n}px`;const o=Math.max(10,i.left),a=Math.max(10,i.top);o!==i.left&&(this.filePreviewPopover.style.left=`${o}px`),a!==i.top&&(this.filePreviewPopover.style.top=`${a}px`),j.savePinnedPreviews()}setupResizeObserver(){this.updateMaxSize(),this.resizeObserver=new ResizeObserver((()=>{this.updateMaxSize()})),this.resizeObserver.observe(this.filePreviewPopover),window.addEventListener("resize",this.updateMaxSize)}dragPreviewCallback(t){t.stopPropagation(),this.bringToFront();const e=t.clientX-this.filePreviewPopover.getBoundingClientRect().left,i=t.clientY-this.filePreviewPopover.getBoundingClientRect().top,s=t=>{let s=t.clientX-e,n=t.clientY-i;const o=window.innerWidth,a=window.innerHeight,r=this.filePreviewPopover.getBoundingClientRect();s=Math.max(0,Math.min(s,o-r.width)),n=Math.max(0,Math.min(n,a-r.height)),this.filePreviewPopover.style.left=s+"px",this.filePreviewPopover.style.top=n+"px",this.updateMaxSize()},n=()=>{this.isPinned&&j.savePinnedPreviews(),document.removeEventListener("pointermove",s),document.removeEventListener("pointerup",n)};document.addEventListener("pointermove",s),document.addEventListener("pointerup",n)}setupDragHandleListeners(){this.dragHandle.addEventListener("pointerdown",this.dragPreviewCallback.bind(this)),this.actionContainer.addEventListener("pointerdown",this.dragPreviewCallback.bind(this))}positionPreview(){if(!this.link)return;const t=this.link.getBoundingClientRect(),e=this.filePreviewPopover.getBoundingClientRect(),i=window.innerWidth,s=window.innerHeight;this.filePreviewPopover.style.top="",this.filePreviewPopover.style.left="";const n=10;let o,a;o=s-t.bottom>=e.height+n?t.bottom+n:Math.max(n,t.top-e.height-n),a=t.left,a+e.width>i-n&&(a=Math.max(n,t.right-e.width)),o=Math.min(Math.max(n,o),s-e.height-n),a=Math.min(Math.max(n,a),i-e.width-n),this.filePreviewPopover.style.top=`${o}px`,this.filePreviewPopover.style.left=`${a}px`}setupOutsideClickListener(){this.outsideClickListener=t=>{this.isPinned||this.filePreviewPopover.contains(t.target)||this.link?.contains(t.target)||this.remove()},document.addEventListener("pointerdown",this.outsideClickListener)}startShowTimeout(){this.clearShowTimeout(),this.showTimeout=window.setTimeout((()=>this.show()),350)}clearShowTimeout(){null!==this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null)}async show(){this.filePreviewDocument=new J(this.target),await((await this.filePreviewDocument.load(null,this.markdownEmbedContent,!0,!0))?.show()),this.positionPreview(),this.filePreviewPopover.classList.remove("hide")}bringToFront(){let t=Math.max(j.baseZIndex,...j.pinnedPreviews.map((t=>parseInt(t.filePreviewPopover.style.zIndex)||j.baseZIndex)));t>=j.maxZIndex&&(j.pinnedPreviews.forEach(((t,e)=>{t.filePreviewPopover.style.zIndex=(j.baseZIndex+e).toString()})),t=j.baseZIndex+j.pinnedPreviews.length-1),this.filePreviewPopover.style.zIndex=(t+1).toString()}startRemoveTimeout(){this.clearRemoveTimeout(),this.hoverTimeout=window.setTimeout((()=>this.remove()),300)}clearRemoveTimeout(){null!==this.hoverTimeout&&(clearTimeout(this.hoverTimeout),this.hoverTimeout=null)}remove(){this.clearRemoveTimeout(),this.clearShowTimeout(),this.filePreviewPopover&&this.filePreviewPopover.parentNode&&this.filePreviewPopover.parentNode.removeChild(this.filePreviewPopover),this.resizeObserver&&this.resizeObserver.disconnect(),window.removeEventListener("resize",this.updateMaxSize),document.removeEventListener("pointerdown",this.outsideClickListener),this.onRemove()}},U=j;U.baseZIndex=100,U.maxZIndex=1e3,U.pinnedPreviews=[];var $=class{static initializeLinks(t){console.log("Initializing links on element",t),t?.querySelectorAll(".internal-link, a.tag, a.tree-item-self, a.footnote-link").forEach((function(t){const e=t.getAttribute("href")??"null";"null"!=e?(t.addEventListener("click",(function(i){if(i.preventDefault(),i.stopPropagation(),ObsidianSite.loadURL(e),"phone"===ObsidianSite.deviceSize){const e=t.closest("#left-sidebar"),i=t.closest("#right-sidebar");e&&!1===ObsidianSite.leftSidebar?.collapsed?ObsidianSite.leftSidebar.collapsed=!0:i&&!1===ObsidianSite.rightSidebar?.collapsed&&(ObsidianSite.rightSidebar.collapsed=!0)}})),!e||e.startsWith("http")||ObsidianSite.documentExists(e)?t.classList.contains("internal-link")&&!ObsidianSite.metadata?.ignoreMetadata&&ObsidianSite.metadata?.featureOptions?.linkPreview?.enabled&&U.initializeLink(t,e):t.classList.add("is-unresolved")):console.log("No target found for link")}))}static getPathnameFromURL(t){return""==t||"/"==t||"\\"==t?"index.html":t?.startsWith("#")||t?.startsWith("?")?(ObsidianSite.document?.pathname?.split("#")[0]?.split("?")[0]??"")+(t??""):t?.split("?")[0]?.split("#")[0]?.trim()??""}static getHashFromURL(t){return(t.split("#")[1]??"").split("?")[0]?.trim()??""}static getQueryFromURL(t){return t.split("?")[1]?.trim()??""}static getFileDataIdFromURL(t){for((t=this.getPathnameFromURL(t)).startsWith("./")&&(t=t.substring(2));t.startsWith("../");)t=t.substring(3);return btoa(encodeURI(t))}},G=class{constructor(t,e){this.parent=void 0,this.collapsible=!1,this.collapseEl=void 0,this.line=0,this.itemEl=t,this.parent=e,this.line=parseInt(this.itemEl.getAttribute("data-line")??"0"),this.collapseEl=Array.from(this.itemEl.children).find((t=>t.classList.contains("list-collapse-indicator")));const i=this.itemEl.querySelector("ol, ul");if(i&&(this.child=new Y(i,this),this.collapseEl)){this.collapsible=!0;const t=this;this.collapseEl.addEventListener("click",(function(e){t.isCollapsed=!t.isCollapsed,e.stopPropagation()}))}}get isChecked(){return this.itemEl.classList.contains("is-checked")}get isCollapsed(){return this.itemEl.classList.contains("is-collapsed")}set isCollapsed(t){this.itemEl.classList.toggle("is-collapsed",t),this.collapseEl&&this.collapseEl.classList.toggle("is-collapsed",t)}get textContent(){return Array.prototype.filter.call(this.itemEl.childNodes,(t=>t.nodeType===Node.TEXT_NODE)).map((t=>t.textContent)).join("").trim()}get htmlContent(){return this.itemEl.innerHTML}},Y=class{constructor(t,e){if(this.children=[],this.parent=void 0,"OL"!=t.tagName&&"UL"!=t.tagName)throw new Error("Invalid list element");this.listType="OL"==t.tagName?"ordered":t.classList.contains("contains-task-list")?"checklist":"unordered",this.listEl=t,this.parent=e;Array.from(this.listEl.children).filter((t=>"LI"==t.tagName)).forEach((t=>{this.children.push(new G(t,this))}))}get linearList(){let t=[];return this.children.forEach((e=>{t.push(e),e.child&&(t=t.concat(e.child.linearList))})),t}},K=class{constructor(t,e=5e3){this.message=t,this.duration=e,this.show()}show(){K.container||(K.container=document.createElement("div"),K.container.classList.add("notice-container"),K.container.style.top="0",K.container.style.right="0",document.body.appendChild(K.container)),this.notification=document.createElement("div"),this.notification.classList.add("notice"),this.notification.innerHTML=this.message,K.container.appendChild(this.notification),this.notification.style.opacity="0",this.notification.style.transform="translateX(350px)",this.notification.style.transition="all 0.5s",setTimeout((()=>{this.notification.style.opacity="1",this.notification.style.transform="translateX(0)",this.notification.style.height=this.notification.scrollHeight+"px"}),100),setTimeout((()=>{this.dismiss()}),this.duration),this.notification.addEventListener("click",(()=>{this.dismiss()}),{once:!0})}dismiss(){this.notification&&(this.notification.style.opacity="0",this.notification.style.height="0",this.notification.style.margin="0",this.notification.style.padding="0",setTimeout((()=>{this.notification.remove()}),500))}},J=class{constructor(t){if(this.title="",this.headers=[],this.callouts=[],this.lists=[],this.children=[],this.isPreview=!1,this.initialized=!1,this._exists=!1,!window?.location)return;if((t=t.trim()).startsWith("http")||t.startsWith("www")||t.startsWith("/")||t.startsWith("\\"))return void console.error("Please use a relative path from the root of the wesite to load a webpage");this.pathname=$.getPathnameFromURL(t),this.hash=$.getHashFromURL(t),this.query=$.getQueryFromURL(t);let e=window?.location?.origin;if("null"==e&&(e="file://"),this.info=ObsidianSite.getWebpageData(this.pathname),!this.info&&!ObsidianSite.metadata.ignoreMetadata)return new K("This page does not exist yet."),void console.warn("This page does not exist yet.",this.pathname);this._exists=!0,this.documentType=this.info?.type??"markdown",this.title=this.info?.title??this.pathname}get isMainDocument(){return null==this.parent&&!this.isPreview}get bounds(){return h.fromElement(this.documentEl)}get exists(){return this._exists}findHeader(t){for(const e of this.headers){let i=e.find(t);if(i)return i}return null}getFlatHeaders(){return this.headers.flatMap((t=>t.getFlatChildren()))}scrollToHeader(t){console.log("Scrolling to header",t);const e=this.findHeader((e=>e.id==t));e&&e.scrollTo()}findElements(){this.containerEl||(this.containerEl=ObsidianSite.centerContentEl),this.sizerEl="markdown"==this.documentType?this.containerEl.querySelector(".markdown-preview-sizer"):void 0,this.documentEl=this.containerEl.querySelector(".obsidian-document"),this.headerEl=this.containerEl.querySelector(".header"),this.footerEl=this.containerEl.querySelector(".footer")}async load(t=null,e=ObsidianSite.centerContentEl,i=!1,s=!1){if(this.parent=t,this.isPreview=i,!this.pathname||!this.exists)return this;ObsidianSite.document;await ObsidianSite.showLoading(!0,e),this.containerEl=e;const n=await ObsidianSite.fetch(this.pathname);if(!n?.ok)return new K("This document could not be loaded."),void console.error("Failed to load document",this.pathname);{const t=await n.text();this.sourceHtml=(new DOMParser).parseFromString(t,"text/html");let i=this.sourceHtml.querySelector(".obsidian-document");if(i){i=document.adoptNode(i);const t=e.querySelector(".obsidian-document");t?(t.before(i),t.remove()):e.appendChild(i)}if(await this.loadChildDocuments(),await this.postLoadInit(),this.sizerEl&&s&&this.hash&&""!=this.hash){var o=this.headers.find((t=>t.findByID(this.hash)))?.findByID(this.hash);o&&(this.sizerEl.innerHTML=o.getHeaderWithContentRecursive().map((t=>t.outerHTML)).join(""))}this.initialized=!1}return this}async show(){await ObsidianSite.showLoading(!1,this.containerEl)}async postLoadInit(){return this.findElements(),this.postProcess(),(this.isMainDocument||this.isPreview)&&(this.processHeaders(),this.processCallouts(),this.processLists()),"canvas"==this.documentType&&(this.canvas=new v(this)),(this.isMainDocument||this.isPreview)&&$.initializeLinks(this.documentEl??this.containerEl),this}processHeaders(){this.headers=B.createHeaderTree(this.documentEl)}processCallouts(){const t=Array.from(this.documentEl.querySelectorAll(".callout"));this.callouts=[];for(const e of t)this.callouts.push(new q(e))}processLists(){const t=Array.from(this.documentEl.querySelectorAll(":is(ul, ol):not(:is(ul, ol) :is(ul, ol))"));this.lists=[];for(const e of t)this.lists.push(new Y(e,void 0))}postProcess(){this.documentEl?.querySelectorAll(".kanban-plugin__item.is-complete input[type='checkbox']").forEach((t=>t.checked=!0)),ObsidianSite.metadata.ignoreMetadata||(this.documentEl?.classList.toggle("allow-fold-headings",ObsidianSite.metadata.featureOptions.document.allowFoldingHeadings),this.documentEl?.classList.toggle("allow-fold-lists",ObsidianSite.metadata.featureOptions.document.allowFoldingLists))}async loadChildDocuments(){this.findElements();let t=this,e=0;for(;t;)t=t.parent,e++;if(e>4)return;const i=Array.from(this.documentEl.querySelectorAll("link[itemprop='include-document']")),s=[];for(const t of i){const e=t.getAttribute("href");if(!e)continue;const i=new J(e).load(this,t.parentElement);s.push(i),console.log("Loading child",e),t.remove()}const n=await Promise.all(s);console.log("Loaded child documents",n),this.children.push(...n.filter((t=>null!=t)))}async loadChild(t,e){let i=new J(t),s=await i.load(this,e);return s&&this.children.push(s),s}async unloadChild(t){this.children=this.children.filter((e=>e!=t)),t.documentEl?.remove()}getMinReadableWidth(){return 30*parseFloat(getComputedStyle(this.sizerEl??this.documentEl).fontSize)}};function X(t,e,i,s){return new(i||(i=Promise))((function(n,o){function a(t){try{h(s.next(t))}catch(t){o(t)}}function r(t){try{h(s.throw(t))}catch(t){o(t)}}function h(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,r)}h((s=s.apply(t,e||[])).next())}))}var Q="KEYS",Z="VALUES",tt="",et=class{constructor(t,e){const i=t._tree,s=Array.from(i.keys());this.set=t,this._type=e,this._path=s.length>0?[{node:i,keys:s}]:[]}next(){const t=this.dive();return this.backtrack(),t}dive(){if(0===this._path.length)return{done:!0,value:void 0};const{node:t,keys:e}=it(this._path);if(it(e)===tt)return{done:!1,value:this.result()};const i=t.get(it(e));return this._path.push({node:i,keys:Array.from(i.keys())}),this.dive()}backtrack(){if(0===this._path.length)return;const t=it(this._path).keys;t.pop(),t.length>0||(this._path.pop(),this.backtrack())}key(){return this.set._prefix+this._path.map((({keys:t})=>it(t))).filter((t=>t!==tt)).join("")}value(){return it(this._path).node.get(tt)}result(){switch(this._type){case Z:return this.value();case Q:return this.key();default:return[this.key(),this.value()]}}[Symbol.iterator](){return this}},it=t=>t[t.length-1],st=(t,e,i,s,n,o,a,r)=>{const h=o*a;t:for(const l of t.keys())if(l===tt){const e=n[h-1];e<=i&&s.set(r,[t.get(l),e])}else{let h=o;for(let t=0;ti)continue t}st(t.get(l),e,i,s,n,h,a,r+l)}},nt=class{constructor(t=new Map,e=""){this._size=void 0,this._tree=t,this._prefix=e}atPrefix(t){if(!t.startsWith(this._prefix))throw new Error("Mismatched prefix");const[e,i]=ot(this._tree,t.slice(this._prefix.length));if(void 0===e){const[e,s]=dt(i);for(const i of e.keys())if(i!==tt&&i.startsWith(s)){const n=new Map;return n.set(i.slice(s.length),e.get(i)),new nt(n,t)}}return new nt(e,t)}clear(){this._size=void 0,this._tree.clear()}delete(t){return this._size=void 0,ht(this._tree,t)}entries(){return new et(this,"ENTRIES")}forEach(t){for(const[e,i]of this)t(e,i,this)}fuzzyGet(t,e){return((t,e,i)=>{const s=new Map;if(void 0===e)return s;const n=e.length+1,o=n+i,a=new Uint8Array(o*n).fill(i+1);for(let t=0;t{if(0===e.length||null==t)return[t,i];for(const s of t.keys())if(s!==tt&&e.startsWith(s))return i.push([t,s]),ot(t.get(s),e.slice(s.length),i);return i.push([t,e]),ot(void 0,"",i)},at=(t,e)=>{if(0===e.length||null==t)return t;for(const i of t.keys())if(i!==tt&&e.startsWith(i))return at(t.get(i),e.slice(i.length))},rt=(t,e)=>{const i=e.length;t:for(let s=0;t&&s{const[i,s]=ot(t,e);if(void 0!==i)if(i.delete(tt),0===i.size)lt(s);else if(1===i.size){const[t,e]=i.entries().next().value;ct(s,t,e)}},lt=t=>{if(0===t.length)return;const[e,i]=dt(t);if(e.delete(i),0===e.size)lt(t.slice(0,-1));else if(1===e.size){const[i,s]=e.entries().next().value;i!==tt&&ct(t.slice(0,-1),i,s)}},ct=(t,e,i)=>{if(0===t.length)return;const[s,n]=dt(t);s.set(n+e,i),s.delete(n)},dt=t=>t[t.length-1],ut="or",pt=class{constructor(t){if(null==(null==t?void 0:t.fields))throw new Error('MiniSearch: option "fields" must be provided');const e=null==t.autoVacuum||!0===t.autoVacuum?Ct:t.autoVacuum;this._options=Object.assign(Object.assign(Object.assign({},_t),t),{autoVacuum:e,searchOptions:Object.assign(Object.assign({},kt),t.searchOptions||{}),autoSuggestOptions:Object.assign(Object.assign({},Lt),t.autoSuggestOptions||{})}),this._index=new nt,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldIds={},this._fieldLength=new Map,this._avgFieldLength=[],this._nextId=0,this._storedFields=new Map,this._dirtCount=0,this._currentVacuum=null,this._enqueuedVacuum=null,this._enqueuedVacuumConditions=Pt,this.addFields(this._options.fields)}add(t){const{extractField:e,tokenize:i,processTerm:s,fields:n,idField:o}=this._options,a=e(t,o);if(null==a)throw new Error(`MiniSearch: document does not have ID field "${o}"`);if(this._idToShortId.has(a))throw new Error(`MiniSearch: duplicate ID ${a}`);const r=this.addDocumentId(a);this.saveStoredFields(r,t);for(const o of n){const n=e(t,o);if(null==n)continue;const a=i(n.toString(),o),h=this._fieldIds[o],l=new Set(a).size;this.addFieldLength(r,h,this._documentCount-1,l);for(const t of a){const e=s(t,o);if(Array.isArray(e))for(const t of e)this.addTerm(h,r,t);else e&&this.addTerm(h,r,e)}}}addAll(t){for(const e of t)this.add(e)}addAllAsync(t,e={}){const{chunkSize:i=10}=e,s={chunk:[],promise:Promise.resolve()},{chunk:n,promise:o}=t.reduce((({chunk:t,promise:e},s,n)=>(t.push(s),(n+1)%i==0?{chunk:[],promise:e.then((()=>new Promise((t=>setTimeout(t,0))))).then((()=>this.addAll(t)))}:{chunk:t,promise:e})),s);return o.then((()=>this.addAll(n)))}remove(t){const{tokenize:e,processTerm:i,extractField:s,fields:n,idField:o}=this._options,a=s(t,o);if(null==a)throw new Error(`MiniSearch: document does not have ID field "${o}"`);const r=this._idToShortId.get(a);if(null==r)throw new Error(`MiniSearch: cannot remove document with ID ${a}: it is not in the index`);for(const o of n){const n=s(t,o);if(null==n)continue;const a=e(n.toString(),o),h=this._fieldIds[o],l=new Set(a).size;this.removeFieldLength(r,h,this._documentCount,l);for(const t of a){const e=i(t,o);if(Array.isArray(e))for(const t of e)this.removeTerm(h,r,t);else e&&this.removeTerm(h,r,e)}}this._storedFields.delete(r),this._documentIds.delete(r),this._idToShortId.delete(a),this._fieldLength.delete(r),this._documentCount-=1}removeAll(t){if(t)for(const e of t)this.remove(e);else{if(arguments.length>0)throw new Error("Expected documents to be present. Omit the argument to remove all documents.");this._index=new nt,this._documentCount=0,this._documentIds=new Map,this._idToShortId=new Map,this._fieldLength=new Map,this._avgFieldLength=[],this._storedFields=new Map,this._nextId=0}}discard(t){const e=this._idToShortId.get(t);if(null==e)throw new Error(`MiniSearch: cannot discard document with ID ${t}: it is not in the index`);this._idToShortId.delete(t),this._documentIds.delete(e),this._storedFields.delete(e),(this._fieldLength.get(e)||[]).forEach(((t,i)=>{this.removeFieldLength(e,i,this._documentCount,t)})),this._fieldLength.delete(e),this._documentCount-=1,this._dirtCount+=1,this.maybeAutoVacuum()}maybeAutoVacuum(){if(!1===this._options.autoVacuum)return;const{minDirtFactor:t,minDirtCount:e,batchSize:i,batchWait:s}=this._options.autoVacuum;this.conditionalVacuum({batchSize:i,batchWait:s},{minDirtCount:e,minDirtFactor:t})}discardAll(t){const e=this._options.autoVacuum;try{this._options.autoVacuum=!1;for(const e of t)this.discard(e)}finally{this._options.autoVacuum=e}this.maybeAutoVacuum()}replace(t){const{idField:e,extractField:i}=this._options,s=i(t,e);this.discard(s),this.add(t)}vacuum(t={}){return this.conditionalVacuum(t)}conditionalVacuum(t,e){return this._currentVacuum?(this._enqueuedVacuumConditions=this._enqueuedVacuumConditions&&e,null!=this._enqueuedVacuum||(this._enqueuedVacuum=this._currentVacuum.then((()=>{const e=this._enqueuedVacuumConditions;return this._enqueuedVacuumConditions=Pt,this.performVacuuming(t,e)}))),this._enqueuedVacuum):!1===this.vacuumConditionsMet(e)?Promise.resolve():(this._currentVacuum=this.performVacuuming(t),this._currentVacuum)}performVacuuming(t,e){return X(this,void 0,void 0,(function*(){const i=this._dirtCount;if(this.vacuumConditionsMet(e)){const e=t.batchSize||xt.batchSize,s=t.batchWait||xt.batchWait;let n=1;for(const[t,i]of this._index){for(const[t,e]of i)for(const[s]of e)this._documentIds.has(s)||(e.size<=1?i.delete(t):e.delete(s));0===this._index.get(t).size&&this._index.delete(t),n%e==0&&(yield new Promise((t=>setTimeout(t,s)))),n+=1}this._dirtCount-=i}yield null,this._currentVacuum=this._enqueuedVacuum,this._enqueuedVacuum=null}))}vacuumConditionsMet(t){if(null==t)return!0;let{minDirtCount:e,minDirtFactor:i}=t;return e=e||Ct.minDirtCount,i=i||Ct.minDirtFactor,this.dirtCount>=e&&this.dirtFactor>=i}get isVacuuming(){return null!=this._currentVacuum}get dirtCount(){return this._dirtCount}get dirtFactor(){return this._dirtCount/(1+this._documentCount+this._dirtCount)}has(t){return this._idToShortId.has(t)}getStoredFields(t){const e=this._idToShortId.get(t);if(null!=e)return this._storedFields.get(e)}search(t,e={}){const i=this.executeQuery(t,e),s=[];for(const[t,{score:n,terms:o,match:a}]of i){const i=o.length||1,r={id:this._documentIds.get(t),score:n*i,terms:Object.keys(a),queryTerms:o,match:a};Object.assign(r,this._storedFields.get(t)),(null==e.filter||e.filter(r))&&s.push(r)}return t===pt.wildcard&&null==e.boostDocument&&null==this._options.searchOptions.boostDocument||s.sort(Ft),s}autoSuggest(t,e={}){e=Object.assign(Object.assign({},this._options.autoSuggestOptions),e);const i=new Map;for(const{score:s,terms:n}of this.search(t,e)){const t=n.join(" "),e=i.get(t);null!=e?(e.score+=s,e.count+=1):i.set(t,{score:s,terms:n,count:1})}const s=[];for(const[t,{score:e,terms:n,count:o}]of i)s.push({suggestion:t,terms:n,score:e/o});return s.sort(Ft),s}get documentCount(){return this._documentCount}get termCount(){return this._index.size}static loadJSON(t,e){if(null==e)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJS(JSON.parse(t),e)}static loadJSONAsync(t,e){return X(this,void 0,void 0,(function*(){if(null==e)throw new Error("MiniSearch: loadJSON should be given the same options used when serializing the index");return this.loadJSAsync(JSON.parse(t),e)}))}static getDefault(t){if(_t.hasOwnProperty(t))return wt(_t,t);throw new Error(`MiniSearch: unknown option "${t}"`)}static loadJS(t,e){const{index:i,documentIds:s,fieldLength:n,storedFields:o,serializationVersion:a}=t,r=this.instantiateMiniSearch(t,e);r._documentIds=It(s),r._fieldLength=It(n),r._storedFields=It(o);for(const[t,e]of r._documentIds)r._idToShortId.set(e,t);for(const[t,e]of i){const i=new Map;for(const t of Object.keys(e)){let s=e[t];1===a&&(s=s.ds),i.set(parseInt(t,10),It(s))}r._index.set(t,i)}return r}static loadJSAsync(t,e){return X(this,void 0,void 0,(function*(){const{index:i,documentIds:s,fieldLength:n,storedFields:o,serializationVersion:a}=t,r=this.instantiateMiniSearch(t,e);r._documentIds=yield zt(s),r._fieldLength=yield zt(n),r._storedFields=yield zt(o);for(const[t,e]of r._documentIds)r._idToShortId.set(e,t);let h=0;for(const[t,e]of i){const i=new Map;for(const t of Object.keys(e)){let s=e[t];1===a&&(s=s.ds),i.set(parseInt(t,10),yield zt(s))}++h%1e3==0&&(yield Rt(0)),r._index.set(t,i)}return r}))}static instantiateMiniSearch(t,e){const{documentCount:i,nextId:s,fieldIds:n,averageFieldLength:o,dirtCount:a,serializationVersion:r}=t;if(1!==r&&2!==r)throw new Error("MiniSearch: cannot deserialize an index created with an incompatible version");const h=new pt(e);return h._documentCount=i,h._nextId=s,h._idToShortId=new Map,h._fieldIds=n,h._avgFieldLength=o,h._dirtCount=a||0,h._index=new nt,h}executeQuery(t,e={}){if(t===pt.wildcard)return this.executeWildcardQuery(e);if("string"!=typeof t){const i=Object.assign(Object.assign(Object.assign({},e),t),{queries:void 0}),s=t.queries.map((t=>this.executeQuery(t,i)));return this.combineResults(s,i.combineWith)}const{tokenize:i,processTerm:s,searchOptions:n}=this._options,o=Object.assign(Object.assign({tokenize:i,processTerm:s},n),e),{tokenize:a,processTerm:r}=o,h=a(t).flatMap((t=>r(t))).filter((t=>!!t)).map(St(o)).map((t=>this.executeQuerySpec(t,o)));return this.combineResults(h,o.combineWith)}executeQuerySpec(t,e){const i=Object.assign(Object.assign({},this._options.searchOptions),e),s=(i.fields||this._options.fields).reduce(((t,e)=>Object.assign(Object.assign({},t),{[e]:wt(i.boost,e)||1})),{}),{boostDocument:n,weights:o,maxFuzzy:a,bm25:r}=i,{fuzzy:h,prefix:l}=Object.assign(Object.assign({},kt.weights),o),c=this._index.get(t.term),d=this.termResults(t.term,t.term,1,t.termBoost,c,s,n,r);let u,p;if(t.prefix&&(u=this._index.atPrefix(t.term)),t.fuzzy){const e=!0===t.fuzzy?.2:t.fuzzy,i=e<1?Math.min(a,Math.round(t.term.length*e)):e;i&&(p=this._index.fuzzyGet(t.term,i))}if(u)for(const[e,i]of u){const o=e.length-t.term.length;if(!o)continue;null==p||p.delete(e);const a=l*e.length/(e.length+.3*o);this.termResults(t.term,e,a,t.termBoost,i,s,n,r,d)}if(p)for(const e of p.keys()){const[i,o]=p.get(e);if(!o)continue;const a=h*e.length/(e.length+o);this.termResults(t.term,e,a,t.termBoost,i,s,n,r,d)}return d}executeWildcardQuery(t){const e=new Map,i=Object.assign(Object.assign({},this._options.searchOptions),t);for(const[t,s]of this._documentIds){const n=i.boostDocument?i.boostDocument(s,"",this._storedFields.get(t)):1;e.set(t,{score:n,terms:[],match:{}})}return e}combineResults(t,e=ut){if(0===t.length)return new Map;const i=e.toLowerCase(),s=yt[i];if(!s)throw new Error(`Invalid combination operator: ${e}`);return t.reduce(s)||new Map}toJSON(){const t=[];for(const[e,i]of this._index){const s={};for(const[t,e]of i)s[t]=Object.fromEntries(e);t.push([e,s])}return{documentCount:this._documentCount,nextId:this._nextId,documentIds:Object.fromEntries(this._documentIds),fieldIds:this._fieldIds,fieldLength:Object.fromEntries(this._fieldLength),averageFieldLength:this._avgFieldLength,storedFields:Object.fromEntries(this._storedFields),dirtCount:this._dirtCount,index:t,serializationVersion:2}}termResults(t,e,i,s,n,o,a,r,h=new Map){if(null==n)return h;for(const l of Object.keys(o)){const c=o[l],d=this._fieldIds[l],u=n.get(d);if(null==u)continue;let p=u.size;const m=this._avgFieldLength[d];for(const n of u.keys()){if(!this._documentIds.has(n)){this.removeTerm(d,n,e),p-=1;continue}const o=a?a(this._documentIds.get(n),e,this._storedFields.get(n)):1;if(!o)continue;const g=u.get(n),f=this._fieldLength.get(n)[d],b=i*s*c*o*Et(g,p,this._documentCount,f,m,r),v=h.get(n);if(v){v.score+=b,Tt(v.terms,t);const i=wt(v.match,e);i?i.push(l):v.match[e]=[l]}else h.set(n,{score:b,terms:[t],match:{[e]:[l]}})}}return h}addTerm(t,e,i){const s=this._index.fetch(i,Mt);let n=s.get(t);if(null==n)n=new Map,n.set(e,1),s.set(t,n);else{const t=n.get(e);n.set(e,(t||0)+1)}}removeTerm(t,e,i){if(!this._index.has(i))return void this.warnDocumentChanged(e,t,i);const s=this._index.fetch(i,Mt),n=s.get(t);null==n||null==n.get(e)?this.warnDocumentChanged(e,t,i):n.get(e)<=1?n.size<=1?s.delete(t):n.delete(e):n.set(e,n.get(e)-1),0===this._index.get(i).size&&this._index.delete(i)}warnDocumentChanged(t,e,i){for(const s of Object.keys(this._fieldIds))if(this._fieldIds[s]===e)return void this._options.logger("warn",`MiniSearch: document with ID ${this._documentIds.get(t)} has changed before removal: term "${i}" was not present in field "${s}". Removing a document after it has changed can corrupt the index!`,"version_conflict")}addDocumentId(t){const e=this._nextId;return this._idToShortId.set(t,e),this._documentIds.set(e,t),this._documentCount+=1,this._nextId+=1,e}addFields(t){for(let e=0;eObject.prototype.hasOwnProperty.call(t,e)?t[e]:void 0,yt={[ut]:(t,e)=>{for(const i of e.keys()){const s=t.get(i);if(null==s)t.set(i,e.get(i));else{const{score:t,terms:n,match:o}=e.get(i);s.score=s.score+t,s.match=Object.assign(s.match,o),Ot(s.terms,n)}}return t},and:(t,e)=>{const i=new Map;for(const s of e.keys()){const n=t.get(s);if(null==n)continue;const{score:o,terms:a,match:r}=e.get(s);Ot(n.terms,a),i.set(s,{score:n.score+o,terms:n.terms,match:Object.assign(n.match,r)})}return i},and_not:(t,e)=>{for(const i of e.keys())t.delete(i);return t}},Et=(t,e,i,s,n,o)=>{const{k:a,b:r,d:h}=o;return Math.log(1+(i-e+.5)/(e+.5))*(h+t*(a+1)/(t+a*(1-r+r*s/n)))},St=t=>(e,i,s)=>({term:e,fuzzy:"function"==typeof t.fuzzy?t.fuzzy(e,i,s):t.fuzzy||!1,prefix:"function"==typeof t.prefix?t.prefix(e,i,s):!0===t.prefix,termBoost:"function"==typeof t.boostTerm?t.boostTerm(e,i,s):1}),_t={idField:"id",extractField:(t,e)=>t[e],tokenize:t=>t.split(Nt),processTerm:t=>t.toLowerCase(),fields:void 0,searchOptions:void 0,storeFields:[],logger:(t,e)=>{"function"==typeof(null===console||void 0===console?void 0:console[t])&&console[t](e)},autoVacuum:!0},kt={combineWith:ut,prefix:!1,fuzzy:!1,maxFuzzy:6,boost:{},weights:{fuzzy:.45,prefix:.375},bm25:{k:1.2,b:.7,d:.5}},Lt={combineWith:"and",prefix:(t,e,i)=>e===i.length-1},xt={batchSize:1e3,batchWait:10},Pt={minDirtFactor:.1,minDirtCount:20},Ct=Object.assign(Object.assign({},xt),Pt),Tt=(t,e)=>{t.includes(e)||t.push(e)},Ot=(t,e)=>{for(const i of e)t.includes(i)||t.push(i)},Ft=({score:t},{score:e})=>e-t,Mt=()=>new Map,It=t=>{const e=new Map;for(const i of Object.keys(t))e.set(parseInt(i,10),t[i]);return e},zt=t=>X(void 0,void 0,void 0,(function*(){const e=new Map;let i=0;for(const s of Object.keys(t))e.set(parseInt(s,10),t[s]),++i%1e3==0&&(yield Rt(0));return e})),Rt=t=>new Promise((e=>setTimeout(e,t))),Nt=/[\n\r\p{Z}\p{P}]+/u,At=class{search(t,e=63){if(0==t.length)return void this.clear();this.input.value=t,this.input.style.color=63!=e?"var(--text-accent)":"";const i=[];1&e&&i.push("title"),2&e&&i.push("aliases"),4&e&&i.push("headers"),8&e&&i.push("tags"),16&e&&i.push("path"),32&e&&i.push("content"),console.log(1&e,2&e,4&e,8&e,16&e,32&e);const s=this.index.search(t,{prefix:!0,fuzzy:.2,boost:{title:2,aliases:1.8,headers:1.5,tags:1.3,path:1.1},fields:i});console.log("Search results",s),s.length>50&&s.splice(50);const n=[],o=new Map;for(const e of s){if(e.score<.3*s[0].score&&n.length>4||e.score<.1*s[0].score)break;if(n.push(e.path),t.length>2){const i=[];let s=!1;for(const n in e.match){if(e.match[n].includes("headers"))for(const o of e.headers)if(o.toLowerCase().includes(n.toLowerCase())&&(i.includes(o)||i.push(o),t.toLowerCase()!=n.toLowerCase())){s=!0;break}if(s)break}o.set(e.path,i)}}if(ObsidianSite.fileTree?.filter(n),ObsidianSite.fileTree?.setSubHeadings(o),ObsidianSite.fileTree?.sort(((t,e)=>t&&e?n.findIndex((e=>t.path==e))-n.findIndex((t=>e.path==t)):0)),!ObsidianSite.fileTree){const e=document.createElement("div");s.filter((t=>t.path.endsWith(".html"))).slice(0,20).forEach((i=>{const s=document.createElement("div");s.classList.add("search-result");const n=document.createElement("a");n.classList.add("tree-item-self");const o=i.path+"?mark="+encodeURIComponent(t);n.setAttribute("href",o),n.appendChild(document.createTextNode(i.title)),s.appendChild(n),e.append(s)})),this.dedicatedSearchResultsList.replaceChildren(e),this.container.after(this.dedicatedSearchResultsList),$.initializeLinks(this.dedicatedSearchResultsList)}}searchParseFilters(t){t.startsWith("?")&&(t=t.substring(1));let e=t.split(":")[0];t.includes(":")||(e=""),"content"==e||"text"==e||"body"==e?this.search(t,32):"title"==e||"name"==e?this.search(t,1):"path"==e?this.search(t,16):"header"==e||"headers"==e?this.search(t,4):"tag"==e||"tags"==e||t.startsWith("#")?this.search(t,8):"alias"==e||"aliases"==e?this.search(t,2):this.search(t)}clear(){this.container?.classList.remove("has-content"),this.input.value="",this.clearCurrentDocumentSearch(),ObsidianSite.fileTree?.unfilter(),ObsidianSite.fileTree?.removeSubHeadings(),ObsidianSite.fileTree?.unsort()}async init(){if(this.input=document.querySelector('input[type="search"]'),this.container=this.input?.closest("#search-container"),!this.input||!this.container)return;ObsidianSite.metadata.featureOptions.search.insertFeature(document.body,this.container);const t=await ObsidianSite.fetch(x.libFolderName+"/search-index.json");if(!t?.ok)return void console.error("Failed to fetch search index");const e=await t.json();try{this.index=pt.loadJS(e,{fields:["title","path","tags","headers"]})}catch(t){return void console.error("Failed to load search index: ",t)}const i=document.querySelector("#search-clear-button");return i?.addEventListener("click",(t=>{this.clear()})),this.input.addEventListener("input",(t=>{const e=t.target?.value??"";0!=e.length?this.searchParseFilters(e):this.clear()})),ObsidianSite.fileTree||(this.dedicatedSearchResultsList=document.createElement("div"),this.dedicatedSearchResultsList.setAttribute("id","search-results")),this}async searchCurrentDocument(t){this.clearCurrentDocumentSearch();(function(t){const e=[],i=document.createTreeWalker(t,NodeFilter.SHOW_TEXT,null);let s;for(;s=i.nextNode();)e.push(s);return e})(ObsidianSite.document.sizerEl??ObsidianSite.document.documentEl).forEach((async e=>{const i=e.nodeValue,s=i?.replace(new RegExp(t,"gi"),(t=>`${t}`));if(s&&s!==i){const t=document.createElement("div");t.innerHTML=s;Array.from(t.childNodes).forEach((t=>{t.nodeType!=Node.TEXT_NODE&&t?.setAttribute("class","search-mark"),e?.parentNode?.insertBefore(t,e)})),e?.parentNode?.removeChild(e)}}));const e=document.querySelector(".search-mark");setTimeout((()=>{e&&ObsidianSite.scrollTo(e)}),500)}clearCurrentDocumentSearch(){document.querySelectorAll(".search-mark").forEach((t=>{t.outerHTML=t.innerHTML}))}},Dt=class{constructor(t){if(this.minWidthEm=15,!t.classList.contains("sidebar"))throw new Error("Invalid sidebar container");this.containerEl=t,this.contentEl=t.querySelector(".leaf-content"),this.topbarEl=t.querySelector(".sidebar-topbar"),this.collapseEl=t.querySelector(".sidebar-collapse-icon"),this.topbarContentEl=t.querySelector(".topbar-content"),this.resizeHandleEl=t.querySelector(".sidebar-handle")??void 0,this._isLeft="left-sidebar"==t.id,this._sidebarID=t.id,this.collapseEl.addEventListener("click",(()=>{this.collapsed=!this.collapsed})),this.clickOutsideCollapse=this.clickOutsideCollapse.bind(this),this.minResizeWidth=parseFloat(getComputedStyle(this.resizeHandleEl?.parentElement??this.resizeHandleEl).fontSize)*this.minWidthEm,this.collapseWidth=this.minResizeWidth/4,this.setupSidebarResize()}get sidebarID(){return this._sidebarID}get isLeft(){return this._isLeft}get resizing(){return this._resizing}get collapsed(){return this._collapsed}set collapsed(t){if(this._collapsed===t)return;this._collapsed=t;const e="phone"===ObsidianSite.deviceSize,i="tablet"===ObsidianSite.deviceSize;t?document.body.removeEventListener("click",this.clickOutsideCollapse):(e&&(this.isLeft?ObsidianSite.rightSidebar&&!ObsidianSite.rightSidebar.collapsed&&(ObsidianSite.rightSidebar.collapsed=!0):ObsidianSite.leftSidebar&&!ObsidianSite.leftSidebar.collapsed&&(ObsidianSite.leftSidebar.collapsed=!0)),(e||i)&&(document.body.removeEventListener("click",this.clickOutsideCollapse),document.body.addEventListener("click",this.clickOutsideCollapse))),this.containerEl.classList.toggle("is-collapsed",t)}get floating(){return this._floating}set floating(t){this._floating=t,this.containerEl.classList.toggle("floating",t)}get width(){return this.containerEl.offsetWidth}set width(t){const e=`min(max(${t}px, ${this.minWidthEm}em), 40vw)`;tthis.minResizeWidth&&(this.containerEl.style.transitionDuration="0s")),ObsidianSite.graphView&&ObsidianSite.graphView.graphRenderer.autoResizeCanvas()}setupSidebarResize(){if(!this.resizeHandleEl)return;const t=localStorage.getItem(`${this.sidebarID}-width`);t&&this.containerEl.style.setProperty("--sidebar-width",t);const e=this;function i(t){if(!e.resizing)return;const i=e.isLeft?t.clientX:window.innerWidth-t.clientX;e.width=i}this.resizeHandleEl.addEventListener("pointerdown",(function(t){e._resizing=!0,e.containerEl.classList.add("is-resizing"),document.addEventListener("pointermove",i),document.addEventListener("pointerup",(function(){document.removeEventListener("pointermove",i);const t=getComputedStyle(e.containerEl).getPropertyValue("--sidebar-width");localStorage.setItem(`${e.sidebarID}-width`,t),e.containerEl.classList.remove("is-resizing"),e.containerEl.style.removeProperty("transition-duration")}))})),this.resizeHandleEl.addEventListener("dblclick",(function(t){e.resetWidth()}))}resetWidth(){this.containerEl.style.removeProperty("transition-duration"),this.containerEl.style.removeProperty("--sidebar-width"),localStorage.removeItem(`${this.sidebarID}-width`),setTimeout((()=>{console.log("Resizing canvas"),ObsidianSite.graphView&&(ObsidianSite.graphView.graphRenderer.autoResizeCanvas(),ObsidianSite.graphView.graphRenderer.centerCamera())}),500)}clickOutsideCollapse(t){if(t.target?.closest(`#${this.containerEl.id}`))return;const e="phone"===ObsidianSite.deviceSize,i="tablet"===ObsidianSite.deviceSize;(e||i)&&(this.collapsed=!0)}},Wt=class{constructor(t,e,i=0,s=1){this._path="",this.collapseAnimationLength=150,this._oldAnimationLength=this.collapseAnimationLength,this.root=this instanceof qt?this:e?.root??(e instanceof qt?e:void 0),this.parent=e,this.minCollapseDepth=s;let n=this instanceof qt;this.itemEl=t,this.selfEl=n?t:t.querySelector(".tree-item-self"),this.collapseIconEl=n?t:this.selfEl.querySelector(".collapse-icon"),this.innerEl=n?t:this.selfEl.querySelector(".tree-item-inner"),this.childrenEl=n?t:t.querySelector(".tree-item-children");const o=this.selfEl.getAttribute("href");o&&(this.path=o),this.children=[];if(Array.from(this.childrenEl.children).filter((t=>t.classList.contains("tree-item"))).forEach((t=>{this.children.push(new Wt(t,this,i+1,this.minCollapseDepth))})),this._isFolder=this.itemEl.classList.contains("nav-folder"),this._isLink="A"==this.selfEl.tagName,this.depth=i,this._isCollapsible=this.itemEl.classList.contains("mod-collapsible")&&this.depth>=this.minCollapseDepth,this._isCollapsible||(!this.collapseIconEl||this instanceof qt||(console.log(this),this.collapseIconEl.remove(),this.collapseIconEl=void 0),this.selfEl.classList.remove("mod-collapsible"),this.itemEl.classList.remove("mod-collapsible"),this.itemEl.classList.remove("is-collapsed")),this.collapsed=this.itemEl.classList.contains("is-collapsed"),this._isCollapsible){(this.isLink?this.collapseIconEl??this.selfEl:this.selfEl).addEventListener("click",(t=>{this.collapsed=!this.collapsed,t.preventDefault(),t.stopPropagation()}))}this._checkAnyChildrenOpen()}get path(){return this._path}set path(t){this.root.pathToItem&&(this.root.pathToItem.delete(this._path),this.root.pathToItem.set(t,this)),this._path=t,this.selfEl.setAttribute("href",t)}get title(){return this.innerEl.innerHTML}set title(t){this.innerEl.innerHTML=t}get isFolder(){return this._isFolder}get isLink(){return this._isLink}get collapsable(){return this._isCollapsible}get collapsed(){return this._collapsed}set collapsed(t){this.collapsable||(t=!1),this.collapsed!=t&&(!t&&this.parent instanceof Wt&&this.parent.collapsed&&(this.parent.collapsed=!1),this._collapsed=t,this.itemEl.classList.toggle("is-collapsed",t),this.collapseIconEl?.classList.toggle("is-collapsed",t),t?u(this.childrenEl,this.collapseAnimationLength):p(this.childrenEl,this.collapseAnimationLength),this.parent?._checkAnyChildrenOpen())}get collapsedRecursive(){return this._collapsedRecursive}set collapsedRecursive(t){this.collapsedRecursive!=t&&(this._collapsedRecursive=t,this.children.forEach((e=>{e.collapsed=t,e.collapsedRecursive=t})))}get anyChildrenOpen(){return this._anyChildrenOpen}_checkAnyChildrenOpen(){return this._anyChildrenOpen=this.children.some((t=>!t.collapsed&&t.collapsable)),this._collapsedRecursive=!this._anyChildrenOpen,this._anyChildrenOpen}forAllChildren(t){this.children.forEach((e=>{t(e),e.forAllChildren(t)}))}overrideAnimationLength(t){this._oldAnimationLength=this.collapseAnimationLength,this.collapseAnimationLength=t,this.children.forEach((e=>{e.overrideAnimationLength(t)}))}restoreAnimationLength(){this.collapseAnimationLength=this._oldAnimationLength,this.children.forEach((t=>{t.restoreAnimationLength()}))}setActive(){this.root.activeItem&&this.root.activeItem.selfEl.classList.remove("is-active"),this.root.activeItem=this,this.selfEl.classList.add("is-active")}setFiltered(t){t?this.itemEl.classList.add("filtered-out"):(this.itemEl.classList.remove("filtered-out"),this.parent?.setFiltered(!1))}filter(t){this.overrideAnimationLength(0),this.itemEl.classList.add("filtered"),this.collapsedRecursive=!1,this.forAllChildren((t=>{t.setFiltered(!0)})),t.forEach((t=>{const e=this.findByPath(t);e&&e.setFiltered(!1)}))}async unfilter(){this.itemEl.classList.remove("filtered"),this.forAllChildren((t=>{t.setFiltered(!1)})),this.collapsedRecursive=!0,this.restoreAnimationLength()}setSubHeadings(t){this.removeSubHeadings();for(const[e,i]of t){if(0==i.length)continue;const t=this.findByPath(e);if(!t)continue;t.itemEl.classList.add("has-hints");const s=document.createElement("div");s.classList.add("tree-hint-container"),t.itemEl.appendChild(s),i.forEach((t=>{const i=document.createElement("a");i.classList.add("tree-hint-label"),i.classList.add("internal-link"),i.textContent=t,i.href=e+"#"+t,s.appendChild(i)})),$.initializeLinks(s)}}removeSubHeadings(){this.itemEl.classList.remove("has-hints"),this.itemEl.querySelectorAll(".tree-hint-container").forEach((t=>{t.remove()})),this.itemEl.querySelectorAll(".has-hints").forEach((t=>{t.classList.remove("has-hints")}))}sort(t){this.itemEl.classList.add("sorted"),this.children.sort(t),this.children.forEach((e=>{e.sort(t)})),this.children.forEach((t=>{this.childrenEl.appendChild(t.itemEl)}))}unsort(){this.itemEl.classList.remove("sorted"),this.sort(((t,e)=>(ObsidianSite.getWebpageData(t.path)?.treeOrder??0)-(ObsidianSite.getWebpageData(e.path)?.treeOrder??0)))}find(t){if(t(this))return this;for(const e of this.children){const i=e.find(t);if(i)return i}}findByPath(t){return this.root.pathToItem.get(t)}},Ht=class extends Wt{constructor(t,e=1){const i=t.classList.contains("tree-container")?t:t.querySelector(".tree-container");if(null==i)throw new Error("Invalid tree container");super(i,void 0,0,e),this.pathToItem=new Map,this.rootEl=i,this.childrenEl=this.rootEl,this.selfEl=this.rootEl,this.innerEl=this.rootEl,this.collapseAllEl=this.rootEl.querySelector(".tree-collapse-all");const s=this.collapseAllEl?.querySelector("svg");s&&(s.innerHTML="",this.collapsePath1=s.querySelector("path"),this.collapsePath2=s.querySelector("path:last-child")),this.forAllChildren((t=>{""!=t.path&&this.pathToItem.set(t.path,t)})),this.collapseAllEl?.addEventListener("click",(()=>{this.setCollapseIcon(!this.collapsedRecursive),this.collapsedRecursive=!this.collapsedRecursive})),$.initializeLinks(this.rootEl),this.setCollapseIcon(!this.anyChildrenOpen)}_checkAnyChildrenOpen(){const t=super._checkAnyChildrenOpen();return this.setCollapseIcon(!t),t}setCollapseIcon(t){t?(this.collapsePath1?.setAttribute("d",Ht.collapsePaths[0]),this.collapsePath2?.setAttribute("d",Ht.collapsePaths[1])):(this.collapsePath1?.setAttribute("d",Ht.uncollapsePaths[0]),this.collapsePath2?.setAttribute("d",Ht.uncollapsePaths[1]))}revealPath(t){const e=this.findByPath(t);e&&(e.collapsed=!1)}},qt=Ht;qt.collapsePaths=["m7 15 5 5 5-5","m7 9 5-5 5 5"],qt.uncollapsePaths=["m7 20 5-5 5 5","m7 4 5 5 5-5"];var Vt,Bt,jt,Ut,$t,Gt,Yt,Kt,Jt=class{constructor(){this.nodeCount=0,this.linkCount=0,this.hoveredNode=-1,i(this,mt,0),i(this,gt,0),i(this,ft,0),i(this,bt,0),i(this,vt,0),this.startPositions=new Float32Array(0),this.linkSources=new Int32Array(0),this.linkTargets=new Int32Array(0),this.radii=new Float32Array(0),this.maxRadius=0,this.averageRadius=0,this.minRadius=0}init(t,i){if(this.free(),this.graphView=t,this.nodeCount=t.nodeCount,this.linkCount=t.linkCount,i?.length!=2*this.nodeCount)throw new Error("Invalid positions array length");this.radii=new Float32Array(t.radii),this.linkSources=new Int32Array(t.linkSources),this.linkTargets=new Int32Array(t.linkTargets),this.maxRadius=this.radii.reduce(((t,e)=>Math.max(t,e))),this.averageRadius=this.radii.reduce(((t,e)=>t+e))/this.radii.length,this.minRadius=this.radii.reduce(((t,e)=>Math.min(t,e))),this.startPositions=new Float32Array(2*this.nodeCount),this.startPositions=this.generatePositions(i),s(this,mt,Module._malloc(this.startPositions.byteLength)),s(this,gt,this.startPositions.byteLength),s(this,ft,Module._malloc(this.radii.byteLength)),s(this,bt,Module._malloc(this.linkSources.byteLength)),s(this,vt,Module._malloc(this.linkTargets.byteLength)),Module.HEAP32.set(new Int32Array(this.startPositions.buffer),e(this,mt)/this.startPositions.BYTES_PER_ELEMENT),Module.HEAP32.set(new Int32Array(this.radii.buffer),e(this,ft)/this.radii.BYTES_PER_ELEMENT),Module.HEAP32.set(new Int32Array(this.linkSources.buffer),e(this,bt)/this.linkSources.BYTES_PER_ELEMENT),Module.HEAP32.set(new Int32Array(this.linkTargets.buffer),e(this,vt)/this.linkTargets.BYTES_PER_ELEMENT),Module._Init(e(this,mt),e(this,ft),e(this,bt),e(this,vt),this.nodeCount,this.linkCount,t.batchFraction,t.ticker.deltaTime,t.options.attractionForce,t.options.linkLength,t.options.repulsionForce,t.options.centralForce)}get positions(){return Module.HEAP32.buffer.slice(e(this,mt),e(this,mt)+e(this,gt))}get positionsF(){return new Float32Array(this.positions)}generatePositions(t){let e=new Float32Array(t??new Array(2*this.nodeCount).fill(0));const i=2*this.averageRadius*Math.sqrt(this.nodeCount)*2;for(let t=0;tt.charCodeAt(0))));this.worker=new Worker(URL.createObjectURL(new Blob([t],{type:"application/javascript"})))}else this.worker=new Worker(new URL(e,window.location.href).pathname);this._cameraOffset=new c(0,0),this._cameraScale=1,this._hoveredNode=-1,this._grabbedNode=-1,this._colors={background:0,link:0,node:0,outline:0,text:0,accent:0},this._width=0,this._height=0,this.cameraOffset=new c(this.canvas.width,this.canvas.height).scale(.5),this.cameraScale=1,this.hoveredNode=-1,this.grabbedNode=-1,this.resampleColors(),n(this,Vt,Bt).call(this,!0),this.width=this.canvas.width,this.height=this.canvas.height,this.autoResizeCanvas()}get cameraOffset(){return this._cameraOffset}set cameraOffset(t){this._cameraOffset=t,n(this,$t,Gt).call(this,t,this.cameraScale)}get cameraScale(){return this._cameraScale}set cameraScale(t){this._cameraScale=t,n(this,$t,Gt).call(this,this.cameraOffset,t)}get hoveredNode(){return this._hoveredNode}set hoveredNode(t){this._hoveredNode=t,n(this,jt,Ut).call(this,t,this._grabbedNode)}get grabbedNode(){return this._grabbedNode}set grabbedNode(t){this._grabbedNode=t,n(this,jt,Ut).call(this,this._hoveredNode,t)}get colors(){return this._colors}set colors(t){this._colors=t,n(this,Yt,Kt).call(this,t)}get width(){return this._width}set width(t){this._width=t,this.resizeCanvas(t,this._height)}get height(){return this._height}set height(t){this._height=t,this.resizeCanvas(this._width,t)}set activeNode(t){this.worker.postMessage({type:"set_active",active:t})}updateData(t){this.graph=t,n(this,Vt,Bt).call(this)}sampleColor(t){const e=document.createElement("div");document.body.appendChild(e),e.style.setProperty("display","none"),e.style.setProperty("color","var("+t+")");const i=getComputedStyle(e).color,s=getComputedStyle(e).opacity;e.remove();const n=function(t){const e=t.match(/rgb?\((\d+),\s*(\d+),\s*(\d+)\)/);return e?{red:parseInt(e[1]),green:parseInt(e[2]),blue:parseInt(e[3]),alpha:1}:null}(i);return{a:parseFloat(s)*(n?.alpha??1),rgb:(n?.red??8912896)<<16|(n?.green??34816)<<8|(n?.blue??136)}}resampleColors(){this.colors={background:this.sampleColor("--background-secondary").rgb,link:this.sampleColor("--graph-line").rgb,node:this.sampleColor("--graph-node").rgb,outline:this.sampleColor("--graph-line").rgb,text:this.sampleColor("--graph-text").rgb,accent:this.sampleColor("--interactive-accent").rgb}}draw(t){this.worker.postMessage({type:"draw",positions:t},[t])}resizeCanvas(t,e){this.worker.postMessage({type:"resize",width:t,height:e}),this._width=t,this._height=e}autoResizeCanvas(){let t=this.canvas.offsetWidth,e=this.canvas.offsetHeight;this.width==t&&this.height==e||(this.centerCamera(),this.resizeCanvas(t,e))}centerCamera(){this.cameraOffset=new c(this.width,this.height).scale(.5)}toScreenSpace(t,e,i=!0){let s=t*this.cameraScale+this.cameraOffset.x,n=e*this.cameraScale+this.cameraOffset.y;return i&&(s=Math.floor(s),n=Math.floor(n)),new c(s,n)}vecToScreenSpace(t,e=!0){return this.toScreenSpace(t.x,t.y,e)}toWorldspace(t,e){const i=(t-this.cameraOffset.x)/this.cameraScale,s=(e-this.cameraOffset.y)/this.cameraScale;return new c(i,s)}vecToWorldspace(t){return this.toWorldspace(t.x,t.y)}setCameraCenterWorldspace(t){this.cameraOffset=new c(this.width/2-t.x*this.cameraScale,this.height/2-t.y*this.cameraScale)}getCameraCenterWorldspace(){return this.toWorldspace(this.width/2,this.height/2)}};Vt=new WeakSet,Bt=function(t=!1){const{width:e,height:i}=this.view;let s={width:e,height:i,view:this.view},n=[this.view];t||(s={width:e,height:i},n=[]),this.worker.postMessage({type:"init",linkCount:this.graph.graphSim.linkCount,linkSources:this.graph.graphSim.linkSources,linkTargets:this.graph.graphSim.linkTargets,nodeCount:this.graph.graphSim.nodeCount,radii:this.graph.graphSim.radii,labels:this.graph.labels,linkLength:this.graph.options.linkLength,edgePruning:this.graph.options.edgePruning,options:s},n)},jt=new WeakSet,Ut=function(t,e){const i={type:"update_interaction",hoveredNode:t,grabbedNode:e};this.worker.postMessage(i)},$t=new WeakSet,Gt=function(t,e){this.worker.postMessage({type:"update_camera",cameraOffset:t,cameraScale:e})},Yt=new WeakSet,Kt=function(t){this.worker.postMessage({type:"update_colors",colors:t})};var Qt=class{constructor(t,e){this.elements=new Map,this._options=t,e?this.replaceFeature(e):this.setupFeatureContainer(),this.options.insertFeature(document.body,this.getElement(Qt.FEATURE_KEY)),this.onAfterMount()}getElementDefinitions(){return{[Qt.FEATURE_KEY]:{type:"div",className:["feature","hide"],id:this.options.featureId},[Qt.HEADER_KEY]:{type:"div",className:"feature-header"},[Qt.CONTENT_KEY]:{type:"div",className:`${this.options.featureId}-content`},[Qt.TITLE_KEY]:{type:"div",className:"feature-title"}}}getElementHierarchy(){return{[Qt.FEATURE_KEY]:null,[Qt.HEADER_KEY]:Qt.FEATURE_KEY,[Qt.TITLE_KEY]:Qt.HEADER_KEY,[Qt.CONTENT_KEY]:Qt.FEATURE_KEY}}createElement(t){const e=document.createElement(t.type);if(t.className){const i=Array.isArray(t.className)?t.className:[t.className];e.classList.add(...i)}return t.id&&(e.id=t.id),t.attributes&&Object.entries(t.attributes).forEach((([t,i])=>{e.setAttribute(t,i)})),e}getElement(t){return this.elements.get(t)}setupFeatureContainer(){const t=this.getElementDefinitions(),e=this.getElementHierarchy();if(Object.entries(t).forEach((([t,e])=>{this.elements.set(t,this.createElement(e))})),Object.entries(e).forEach((([t,e])=>{if(null===e)return;const i=this.elements.get(t),s=this.elements.get(e);i&&s&&s.appendChild(i)})),this._options instanceof S&&this._options.displayTitle?.length>0){const t=this.getElement(Qt.TITLE_KEY);t&&(t.innerText=this._options.displayTitle)}setTimeout((()=>{const t=this.getElement(Qt.FEATURE_KEY);t?.classList.remove("hide")}),0)}replaceFeature(t){this.destroy();const e=this.getElementDefinitions(),i=this.getElementHierarchy();this.elements.set(Qt.FEATURE_KEY,t),Object.entries(e).forEach((([e,s])=>{if(e===Qt.FEATURE_KEY)return;let n=t.querySelector(`.${Array.isArray(s.className)?s.className[0]:s.className}`);if(!n){n=this.createElement(s);const t=i[e];if(t){const e=this.elements.get(t);e?.appendChild(n)}}this.elements.set(e,n)}))}onAfterMount(){}get options(){return this._options}destroy(){this.elements.forEach((t=>{t.parentNode&&t.parentNode.removeChild(t)})),this.elements.clear()}},Zt=Qt;Zt.FEATURE_KEY="feature",Zt.HEADER_KEY="header",Zt.CONTENT_KEY="content",Zt.TITLE_KEY="title";var te=class extends Zt{constructor(t){super(ObsidianSite.metadata.featureOptions.graphView,t),this.batchFraction=1,this.graphExpanded=!1,this._paused=!1,this._isGlobalGraph=!1,this.eventsInitialized=!1,this.updateRunning=!1,this.mouseWorldPos=new c(0,0),this.scrollVelocity=0,this.firstUpdate=!0,this.drawLastTime=0,this.graphSim=new Jt,this.graphContainer=document.querySelector(".graph-view-container"),this.globalGraphButton=document.querySelector(".graph-global.graph-icon"),this.expandGraphButton=document.querySelector(".graph-expand.graph-icon"),this.ticker=new d(60),this.ticker.add(this.update.bind(this)),this.ticker.start(),requestAnimationFrame(this.draw.bind(this))}set options(t){this._options=t,this.graphSim&&(this.graphSim.attractionForce=t.attractionForce,this.graphSim.centralForce=t.centralForce,this.graphSim.linkLength=t.linkLength,this.graphSim.repulsionForce=t.repulsionForce/this.batchFraction)}get options(){return this._options}set attractionForce(t){t!=this.options.attractionForce&&(this.options.attractionForce=t,this.graphSim&&(this.graphSim.attractionForce=t,this.graphSim.settleness=1))}get attractionForce(){return this.options.attractionForce}set centralForce(t){t!=this.options.centralForce&&(this.options.centralForce=t,this.graphSim&&(this.graphSim.centralForce=t,this.graphSim.settleness=1))}get centralForce(){return this.options.centralForce}set linkLength(t){t!=this.options.linkLength&&(this.options.linkLength=t,this.graphSim&&(this.graphSim.linkLength=t,this.graphSim.settleness=1))}get linkLength(){return this.options.linkLength}set repulsionForce(t){t!=this.options.repulsionForce&&(this.options.repulsionForce=t,this.graphSim&&(this.graphSim.repulsionForce=t/this.batchFraction,this.graphSim.settleness=1))}get repulsionForce(){return this.options.repulsionForce}get paused(){return this._paused}set paused(t){this._paused=t}get isGlobalGraph(){return this._isGlobalGraph}set isGlobalGraph(t){this._isGlobalGraph=t}initEvents(){const t=this;function e(e){const i=t.graphRenderer.canvas.getBoundingClientRect(),s=function(t){return new c(t.clientX,t.clientY)}(e);return new c(s.x-i.left,s.y-i.top)}function i(e){const i=t.graphRenderer.canvas.getBoundingClientRect(),s=function(t){const e=Array.from(t.touches),i=e.reduce(((t,e)=>t+e.clientX),0)/e.length,s=e.reduce(((t,e)=>t+e.clientY),0)/e.length;return new c(i,s)}(e);return new c(s.x-i.left,s.y-i.top)}let s=new c(0,0),n=new c(0,0),o=new c(0,0),a=new c(0,0),r=0,h=!1,l=!1,d=new c(0,0),u=-1,p=!1;const g=this.graphContainer,f=this.graphRenderer;this.graphRenderer.canvas.addEventListener("pointerenter",(function(b){let v=0,w=!1;function y(i){s=e(i),t.mouseWorldPos=f.vecToWorldspace(s),o=new c(s.x-n.x,s.y-n.y),n=s,-1!=f.grabbedNode&&(a=new c(s.x-d.x,s.y-d.y)),h&&-1!=f.hoveredNode&&-1==f.grabbedNode&&f.hoveredNode!=f.grabbedNode&&(f.grabbedNode=f.hoveredNode),h&&-1==f.hoveredNode&&-1==f.grabbedNode||l?f.cameraOffset=new c(f.cameraOffset.x+o.x,f.cameraOffset.y+o.y):-1!=f.hoveredNode?f.canvas.style.cursor="pointer":f.canvas.style.cursor="default"}function E(e){if(1==e.touches?.length)return w&&(n=i(e),w=!1),void y(e);if(2==e.touches?.length){const a=m(e.touches[0]),r=m(e.touches[1]);s=i(e),o=new c(s.x-n.x,s.y-n.y),n=s;const h=Math.sqrt(Math.pow(a.x-r.x,2)+Math.pow(a.y-r.y,2));w||(w=!0,v=h,o=new c(0,0),t.mouseWorldPos=c.Undefined,f.grabbedNode=-1,f.hoveredNode=-1);const l=(h-v)/v;t.scaleAround(f.vecToWorldspace(s),1+l,.15,15),f.cameraOffset=new c(f.cameraOffset.x+o.x,f.cameraOffset.y+o.y),v=h}}function S(e){document.removeEventListener("pointerup",S);const i=Date.now();setTimeout((()=>{h&&-1!=f.hoveredNode&&Math.abs(a.x)<=4&&Math.abs(a.y)<=4&&i-r<300&&t.navigateToNode(f.hoveredNode),h&&-1!=f.grabbedNode&&(f.grabbedNode=-1),0==e.button&&(h=!1),"touch"==e.pointerType&&u==e.pointerId&&(u=-1,h=!1),1==e.button&&(l=!1),p||(document.removeEventListener("mousemove",y),document.removeEventListener("touchmove",E))}),0)}function _(e){document.addEventListener("pointerup",S),t.mouseWorldPos=f.vecToWorldspace(s),a=new c(0,0),0==e.button&&(h=!0),"touch"==e.pointerType&&-1==u&&(u=e.pointerId,h=!0),1==e.button&&(l=!0),d=s,r=Date.now()}s=e(b),t.mouseWorldPos=f.vecToWorldspace(s),n=e(b),p=!0,document.addEventListener("mousemove",y),document.addEventListener("touchmove",E),g.addEventListener("pointerdown",_),g.addEventListener("pointerleave",(function e(i){setTimeout((()=>{p=!1,h||(document.removeEventListener("mousemove",y),document.removeEventListener("touchmove",E),t.mouseWorldPos=c.Undefined),g.removeEventListener("pointerdown",_),g.removeEventListener("pointerleave",e)}),1)}))})),this.expandGraphButton?.addEventListener("click",(e=>{e.stopPropagation(),t.toggleExpandedGraph()})),this.globalGraphButton?.addEventListener("click",(e=>{e.stopPropagation(),t.isGlobalGraph?t.showGraph([ObsidianSite.document.pathname]):t.showGraph()})),g.addEventListener("wheel",(function(e){const i=.065;e.deltaY>0?(t.scrollVelocity>=-.065&&(t.scrollVelocity=-.065),t.scrollVelocity*=1.16):(t.scrollVelocity<=i&&(t.scrollVelocity=i),t.scrollVelocity*=1.16)})),g.addEventListener("dblclick",(function(e){t.fitToNodes()})),document.querySelector(".theme-toggle-input")?.addEventListener("change",(t=>{setTimeout((()=>f.resampleColors()),0)}))}async generate(t){this.paths=t,this.nodeCount=this.paths.length,this.linkSources=[],this.linkTargets=[],this.labels=[],this.radii=[],this.colors=[];const e=[];for(let t=0;t$.getPathnameFromURL(t))).concat(s.attachments).concat(s.backlinks);let o=[...new Set(n)];o.push(t);for(const t of o){const s=this.paths.indexOf(t);-1!=s&&(this.linkSources.push(s),this.linkTargets.push(i),e[i]++,e[s]++)}i++}const s=Math.max(...e);this.radii=e.map((t=>g(this.options.minNodeRadius,this.options.maxNodeRadius,Math.min(t/(.8*s),1)))),this.linkCount=this.linkSources.length}async showGraph(t){this.paused=!0;let e=[];if(t){for(const i of t){const t=ObsidianSite.getWebpageData(i);t?.backlinks&&e.push(...t.backlinks),t?.links&&e.push(...t.links.map((t=>$.getPathnameFromURL(t)))),t?.attachments&&e.push(...t.attachments)}e.push(...t)}else e=ObsidianSite.metadata.allFiles;if(e.length==ObsidianSite.metadata.allFiles.length?this.isGlobalGraph=!0:this.isGlobalGraph=!1,e=e.filter((t=>{let e=ObsidianSite.getWebpageData(t);return!!(e?.backlinks&&e?.links&&e?.type)&&(0==e.backlinks.length&&console.log("No backlinks for",t),!(!this.options.showOrphanNodes&&0==e.backlinks.length&&0==e.links.length)&&!!(this.options.showAttachments||"attachment"!=e.type&&"media"!=e.type&&"other"!=e.type))})),0==e.length)return void console.log("No nodes to display.");const i=[...new Set(e)],s=new Array(2*i.length).fill(0);if(this.paths?.length>0){const t=this.graphSim.positionsF;for(let e=0;e':'',this.setActiveNodeByPath(ObsidianSite.document.pathname)}fitToNodes(){this.graphRenderer.centerCamera(),this.graphRenderer.cameraScale=1/Math.sqrt(this.nodeCount)*this.graphRenderer.canvas.width/200,this.graphSim.settleness=1}update(t){!this.paused&&this.graphRenderer&&this.graphSim&&(this.firstUpdate&&(setTimeout((()=>this.graphRenderer?.canvas?.classList.remove("hide")),500),this.firstUpdate=!1),this.graphSim.dt=t,this.graphSim.update(this.mouseWorldPos,this.graphRenderer.grabbedNode,this.graphRenderer.cameraScale),this.graphSim.hoveredNode!=this.graphRenderer.hoveredNode&&(this.graphRenderer.hoveredNode=this.graphSim.hoveredNode,this.graphRenderer.canvas.style.cursor=-1==this.graphSim.hoveredNode?"default":"pointer"))}async draw(t){if(!this.graphRenderer||!this.graphSim||0==this.paths.length)return;const e=(t-this.drawLastTime)/1e3;this.drawLastTime=t,this.graphRenderer.draw(this.graphSim.positions),0!=this.scrollVelocity&&(Math.abs(this.scrollVelocity)<.001&&(this.scrollVelocity=0),this.zoomAround(this.mouseWorldPos,this.scrollVelocity),this.scrollVelocity*=1-15*e),requestAnimationFrame(this.draw.bind(this))}zoomAround(t,e,i=.15,s=15){const n=this.graphRenderer.getCameraCenterWorldspace();if(this.graphRenderer.cameraScale=Math.max(Math.min(this.graphRenderer.cameraScale+e*this.graphRenderer.cameraScale,s),i),this.graphRenderer.cameraScale!=i&&this.graphRenderer.cameraScale!=s&&this.scrollVelocity>0&&!this.mouseWorldPos.isUndefined){const i=new c(t.x-n.x,t.y-n.y),s=new c(n.x+i.x*e,n.y+i.y*e);this.graphRenderer.setCameraCenterWorldspace(s)}else this.graphRenderer.setCameraCenterWorldspace(n)}scaleAround(t,e,i=.15,s=15){const n=this.graphRenderer.getCameraCenterWorldspace(),o=this.graphRenderer.cameraScale;this.graphRenderer.cameraScale=Math.max(Math.min(e*this.graphRenderer.cameraScale,s),i);const a=(o-this.graphRenderer.cameraScale)/o;if(this.graphRenderer.cameraScale!=i&&this.graphRenderer.cameraScale!=s&&0!=e){const e=new c(t.x-n.x,t.y-n.y),i=new c(n.x-e.x*a,n.y-e.y*a);this.graphRenderer.setCameraCenterWorldspace(i)}else this.graphRenderer.setCameraCenterWorldspace(n)}async navigateToNode(t){if(t<0||t>=this.nodeCount)return;this.graphExpanded&&this.toggleExpandedGraph();const e=this.paths[t];await ObsidianSite.loadURL(e)}toggleExpandedGraph(){const t=this.graphContainer.clientWidth,e=this.graphContainer.clientHeight;this.graphContainer.classList.add("scale-down");const i=this.graphContainer.animate({opacity:0},{duration:100,easing:"ease-in",fill:"forwards"}),s=this;function n(t){s.graphExpanded&&(t.composedPath().includes(s.graphContainer)?document.addEventListener("pointerdown",n,{once:!0}):s.toggleExpandedGraph())}i.addEventListener("finish",(function(){s.graphContainer.classList.toggle("expanded"),s.graphRenderer.autoResizeCanvas(),s.graphRenderer.centerCamera();const i=s.graphContainer.clientWidth,n=s.graphContainer.clientHeight;s.graphRenderer.cameraScale*=(i/t+n/e)/2,s.graphContainer.classList.remove("scale-down"),s.graphContainer.classList.add("scale-up");s.graphContainer.animate({opacity:1},{duration:200,easing:"ease-out",fill:"forwards"}).addEventListener("finish",(function(){s.graphContainer.classList.remove("scale-up")}))})),this.graphExpanded=!this.graphExpanded,this.graphExpanded?document.addEventListener("pointerdown",n,{once:!0}):document.removeEventListener("pointerdown",n),this.graphRenderer.autoResizeCanvas()}getNodeByPath(t){return this.paths.indexOf(t)}setActiveNode(t){t<0||t>=this.nodeCount||(this.graphRenderer.activeNode=t)}setActiveNodeByPath(t){this.setActiveNode(this.getNodeByPath(t))}},ee=class{constructor(){this.themeToggle=document.querySelector(".theme-toggle-input"),this.themeToggle?.addEventListener("change",(t=>{this.switchTheme()}))}switchTheme(){let t="light"==localStorage.getItem("theme")?"dark":"light";this.setTheme(t,!1)}setTheme(t,e=!1){let i="light"==t;this.themeToggle.checked=i;let s="";e&&(s=document.body.style.transition,document.body.style.transition="none"),!this.themeToggle.classList.contains("is-checked")&&i?this.themeToggle.classList.add("is-checked"):this.themeToggle.classList.contains("is-checked")&&!i&&this.themeToggle.classList.remove("is-checked"),i?(document.body.classList.contains("theme-dark")&&document.body.classList.remove("theme-dark"),document.body.classList.contains("theme-light")||document.body.classList.add("theme-light")):(document.body.classList.contains("theme-light")&&document.body.classList.remove("theme-light"),document.body.classList.contains("theme-dark")||document.body.classList.add("theme-dark")),e&&setTimeout((function(){document.body.style.transition=s}),100),localStorage.setItem("theme",i?"light":"dark")}},ie=class extends Zt{constructor(t,e,i){super(t,i),this.dependencies=e,this.updateContent()}regenerate(){this.updateContent()}updateDependencies(t,e=!0){this.dependencies=t,e&&this.regenerate()}modifyDependencies(t,e=!0){t(this.dependencies),e&&this.regenerate()}getDependencies(){return this.dependencies}updateContent(){const t=this.getElement(Zt.CONTENT_KEY);if(!t)return;for(;t.firstChild;)t.removeChild(t.firstChild);const e=this.getElement(Zt.FEATURE_KEY);!e?.isConnected&&e&&this.options.insertFeature(document.body,e),this.generateContent(t)}hide(){const t=this.getElement(Zt.FEATURE_KEY);t&&(t.style.display="none")}show(){const t=this.getElement(Zt.FEATURE_KEY);t&&(t.style.display="")}},se=class{get url(){return this._url}constructor(t,e){this.targetData=ObsidianSite.getWebpageData(e),this.targetData?(this._url=e,this.backlinkEl=document.createElement("a"),this.backlinkEl.href=e,this.backlinkEl.classList.add("backlink"),t.appendChild(this.backlinkEl),this.backlinkIconEl=document.createElement("div"),this.backlinkIconEl.classList.add("backlink-icon"),this.backlinkIconEl.innerHTML=this.targetData.icon,this.backlinkEl.appendChild(this.backlinkIconEl),this.backlinkTitleEl=document.createElement("div"),this.backlinkTitleEl.classList.add("backlink-title"),this.backlinkTitleEl.innerText=this.targetData.title,this.backlinkEl.appendChild(this.backlinkTitleEl),this.backlinkEl.addEventListener("click",(t=>{t.preventDefault(),ObsidianSite.loadURL(this.url)}))):console.error("Failed to find target for backlink",e)}},ne=class extends ie{constructor(t){super(ObsidianSite.metadata.featureOptions.backlinks,{backlinkPaths:t})}generateContent(t){const e=this.getDependencies();this.backlinks=e.backlinkPaths.map((e=>new se(t,e)))}},oe=class extends ie{constructor(t){super(ObsidianSite.metadata.featureOptions.tags,{tags:t})}generateContent(t){const e=this.getDependencies();for(const i of e.tags){const e=document.createElement("a");e.classList.add("tag"),e.setAttribute("href",`?query=tag:${i.replace("#","")}`),e.innerText=i,t.appendChild(e)}$.initializeLinks(t)}},ae=class extends ie{constructor(t){super(ObsidianSite.metadata.featureOptions.alias,{aliases:t})}generateContent(t){const e=this.getDependencies();for(const i of e.aliases){const e=document.createElement("span");e.classList.add("alias"),e.innerText=i,t.appendChild(e)}return t}};window&&window.location&&(window.ObsidianSite=new class{constructor(){this.LinkHandler=$,this.LinkPreview=U,this.isLoaded=!1,this.isHttp="file:"!=window.location.protocol,this.fileTree=void 0,this.outlineTree=void 0,this.search=void 0,this.leftSidebar=void 0,this.rightSidebar=void 0,this.graphView=void 0,this.backlinkList=void 0,this.tags=void 0,this.aliases=void 0,this.onloadCallbacks=[],this.cachedWebpageDataMap=new Map,this.cachedFileDataMap=new Map,this.lastScreenWidth=void 0,this.isResizing=!1,this.checkStillResizingTimeout=void 0,this._deviceSize="large-screen"}onDocumentLoad(t){this.onloadCallbacks.push(t)}async init(){window.addEventListener("load",(()=>ObsidianSite.onInit())),!this.isHttp||(this.metadata=await this.loadWebsiteData(),this.metadata)||console.error("Failed to load website data.")}async onInit(){this.isHttp||(this.metadata=await this.loadWebsiteData(),this.metadata||(console.error("Failed to load website data."),this.metadata=new H,this.metadata.ignoreMetadata=!0)),await a((()=>null!=this.metadata),16),console.log("Website init"),"file:"!=window.location.protocol&&await loadIncludes(),this.theme=new ee,this.bodyEl=document.body,this.horizontalLayout=document.querySelector("#main-horizontal"),this.centerContentEl=document.querySelector("#center-content");const t=document.querySelector("#file-explorer"),e=document.querySelector("#outline"),i=document.querySelector(".sidebar#left-sidebar"),s=document.querySelector(".sidebar#right-sidebar");this.bodyEl.className+=" "+this.metadata.bodyClasses,this.createLoadingEl(),t&&(this.fileTree=new qt(t)),e&&(this.outlineTree=new qt(e,this.metadata.featureOptions.outline.minCollapseDepth)),i&&(this.leftSidebar=new Dt(i)),s&&(this.rightSidebar=new Dt(s)),this.search=await(new At).init();const n=document.querySelector("meta[name='pathname']")?.getAttribute("content")??"unknown";if(this.entryPage=n,this.document=await new J(n),await this.document.loadChildDocuments(),await this.document.postLoadInit(),!ObsidianSite.metadata.ignoreMetadata&&ObsidianSite.metadata.featureOptions.graphView.enabled&&this.loadGraphView().then((()=>this.graphView?.showGraph([n]))),this.initEvents(),U.loadPinnedPreviews(),this.onDocumentLoad((t=>{if(!ObsidianSite.metadata.ignoreMetadata){const e=t.isMainDocument&&!ObsidianSite.metadata.ignoreMetadata&&ObsidianSite.metadata.featureOptions.backlinks.enabled&&"markdown"==t.documentType,i=t.isMainDocument&&!ObsidianSite.metadata.ignoreMetadata&&ObsidianSite.metadata.featureOptions.tags.enabled&&"markdown"==t.documentType,s=t.isMainDocument&&!ObsidianSite.metadata.ignoreMetadata&&ObsidianSite.metadata.featureOptions.alias.enabled&&"markdown"==t.documentType;if(e){const e=t.info.backlinks?.filter((e=>e!=t.pathname));this.backlinkList?this.backlinkList?.modifyDependencies((e=>{e.backlinkPaths=t.info.backlinks??[]})):this.backlinkList=new ne(t.info.backlinks??[]),e&&0!=e.length?this.backlinkList?.show():this.backlinkList?.hide()}else this.backlinkList?.hide();if(i){const e=[];ObsidianSite.metadata.featureOptions.tags.showInlineTags&&t.info.inlineTags&&e.push(...t.info.inlineTags),ObsidianSite.metadata.featureOptions.tags.showFrontmatterTags&&t.info.frontmatterTags&&e.push(...t.info.frontmatterTags),this.tags?this.tags?.modifyDependencies((t=>{t.tags=e})):this.tags=new oe(e),0==e.length?this.tags?.hide():this.tags?.show()}else this.tags?.hide();if(s){const e=t.info.aliases;this.aliases?this.aliases?.modifyDependencies((t=>{t.aliases=e??[]})):this.aliases=new ae(e??[]),e&&0!=e.length?this.aliases?.show():this.aliases?.hide()}else this.aliases?.hide()}})),this.isHttp){let t=this.document.pathname;"index.html"==t&&(t=""),history.replaceState({pathname:t},this.document.title,t)}this.isLoaded=!0,this.onloadCallbacks.forEach((t=>t(this.document)))}initEvents(){window.addEventListener("popstate",(async t=>{if(console.log("popstate",t),!t.state)return;const e=t.state.pathname;await ObsidianSite.loadURL(e,!1)}));const t=this;window.addEventListener("resize",(()=>{t.onResize()})),this.onResize()}updateMetaTag(t,e){let i=document.querySelector(`meta[name="${t}"], meta[property="${t}"]`);i||(i=document.createElement("meta"),t.startsWith("og:")?i.setAttribute("property",t):i.setAttribute("name",t),document.head.appendChild(i)),i.setAttribute("content",e)}async loadURL(t,e=!0){const i=$.getHashFromURL(t),s=$.getQueryFromURL(t);if(t=$.getPathnameFromURL(t),console.log("Loading URL",t,i,s),s&&s.startsWith("query="))return void this.search?.searchParseFilters(s.substring(6));if(this.document.pathname==t)return i?this.document.scrollToHeader(i):new K("This page is already loaded."),this.document;if(!ObsidianSite.getWebpageData(t))return new K("This page does not exist yet."),void console.warn("Page does not exist",t);const n=await new J(t).load();if(!n)return void new K("Failed to load page. Unknown error.");if(document.title=n.title,this.updateMetaTag("pathname",n.pathname),this.updateMetaTag("description",n.info?.description||""),this.updateMetaTag("author",n.info?.author||""),this.updateMetaTag("og:title",n.title),this.updateMetaTag("og:description",n.info?.description||""),this.updateMetaTag("og:url",window.location.href),this.updateMetaTag("og:image",n.info?.coverImageURL||""),await(this.graphView?.showGraph([n.pathname])),this.fileTree?.findByPath(n.pathname)?.setActive(),this.fileTree?.revealPath(n.pathname),this.graphView?.setActiveNodeByPath(n.pathname),this.document=n,this.document&&this.isHttp&&e){let t=this.document.pathname;"index.html"==t&&(t=""),history.pushState({pathname:t},this.document.title,t)}let o=n.sourceHtml.querySelector("#outline");return o&&(o=document.adoptNode(o),document.querySelector("#outline")?.replaceWith(o),ObsidianSite.outlineTree=new qt(o,this.metadata.featureOptions.outline.minCollapseDepth)),setTimeout((async()=>{this.onloadCallbacks.forEach((t=>t(n))),await n.show(),i&&n.scrollToHeader(i)}),100),n}async fetch(t){if(t=$.getPathnameFromURL(t),this.isHttp||t.startsWith("http")){const e=await fetch(t);return e.ok?e:void console.error("Failed to fetch",t)}{const e=this.getFileData(t);return e?.data?new Response(e.data,{status:200}):void console.error("Failed to fetch",t)}}documentExists(t){return t=$.getPathnameFromURL(t),this.isHttp?!!this.metadata.webpages[t]:!!this.getFileData(t)?.data}async loadWebsiteData(){if(!this.isHttp){const t=this.getLocalDataFromId("website-metadata");return t?H.fromJSON(JSON.stringify(t)):void 0}try{const t=await fetch(x.libFolderName+"/metadata.json");if(t.ok){const e=await t.text();return H.fromJSON(e)}}catch(t){console.error("Failed to load website metadata.",t),new K("Failed to load website metadata.")}}async loadGraphView(){const t=document.querySelector(".graph-view-wrapper");if(!t)return;const e=this;waitLoadScripts(["graph-render-worker","graph-wasm"],(()=>{async function i(){console.log("Initializing graph view");const i=new te(t);e.graphView=i,console.log("Graph view initialized")}console.log("scripts loaded"),Module.onRuntimeInitialized=()=>{console.log("Wasm loaded"),i()},run(),setTimeout((()=>{null==e.graphView&&i()}),100)})),await a((()=>null!=this.graphView))}getLocalDataFromId(t){const e=document.getElementById(t);if(e)return JSON.parse(decodeURI(atob(e.getAttribute("value")??"")))}getWebpageData(t){if(!this.isHttp){if(this.cachedWebpageDataMap.has(t))return this.cachedWebpageDataMap.get(t);{const e=this.getLocalDataFromId($.getFileDataIdFromURL(t));return this.cachedWebpageDataMap.set(t,e),e}}if(this.metadata){const e=this.metadata.webpages[t];if(e)return e}}getFileData(t){if(!this.isHttp){if(this.cachedFileDataMap.has(t))return this.cachedFileDataMap.get(t);{const e=this.getLocalDataFromId($.getFileDataIdFromURL(t));return this.cachedFileDataMap.set(t,e),e}}if(this.metadata){const e=this.metadata.fileInfo[t];if(e)return e}return{}}scrollTo(t){t.scrollIntoView()}async showLoading(t,e=this.centerContentEl){if(e.style.transitionDuration="",e.classList.toggle("hide",t),this.loadingEl.classList.toggle("show",t),t){const t=h.fromElement(e);this.loadingEl.style.left=t.center.x-this.loadingEl.offsetWidth/2+"px",this.loadingEl.style.top=t.center.y-this.loadingEl.offsetHeight/2+"px"}await o(200)}createLoadingEl(){this.loadingEl=document.createElement("div"),this.loadingEl.classList.add("loading-icon"),document.body.appendChild(this.loadingEl),this.loadingEl.innerHTML="
"}get documentBounds(){return h.fromElement(this.centerContentEl)}onEndResize(){this.graphView?.graphRenderer?.autoResizeCanvas(),document.body.classList.toggle("resizing",!1)}onStartResize(){document.body.classList.toggle("resizing",!0)}get deviceSize(){return this._deviceSize}set deviceSize(t){this._deviceSize=t}onResize(){this.isResizing||(this.onStartResize(),this.isResizing=!0);const t=this;function e(e,i){const s=window.innerWidth;return s>e&&se&&s=i)}function i(e){const i=window.innerWidth;return i>e&&null==t.lastScreenWidth||i>e&&(t.lastScreenWidth??0)e}const n=this.metadata.featureOptions.document?.documentWidth??"45em",o=this.metadata.featureOptions.sidebar?.leftDefaultWidth??"20em",a=this.metadata.featureOptions.sidebar?.rightDefaultWidth??"20em",h=r(n,this.centerContentEl),l=this.leftSidebar?r(o,this.leftSidebar?.containerEl):0,c=this.rightSidebar?r(a,this.rightSidebar?.containerEl):0;i(h+l+c)||i(1025)?(this.deviceSize="large-screen",document.body.classList.toggle("floating-sidebars",!1),document.body.classList.toggle("is-large-screen",!0),document.body.classList.toggle("is-small-screen",!1),document.body.classList.toggle("is-tablet",!1),document.body.classList.toggle("is-phone",!1),this.leftSidebar&&(this.leftSidebar.collapsed=!1),this.rightSidebar&&(this.rightSidebar.collapsed=!1)):e(h+l,h+l+c)||e(769,1024)?(this.deviceSize="small screen",document.body.classList.toggle("floating-sidebars",!1),document.body.classList.toggle("is-large-screen",!1),document.body.classList.toggle("is-small-screen",!0),document.body.classList.toggle("is-tablet",!1),document.body.classList.toggle("is-phone",!1),this.leftSidebar&&this.rightSidebar&&!this.leftSidebar.collapsed&&(this.rightSidebar.collapsed=!0)):e(l+c,h+l)||e(481,768)?(this.deviceSize="tablet",document.body.classList.toggle("floating-sidebars",!0),document.body.classList.toggle("is-large-screen",!1),document.body.classList.toggle("is-small-screen",!1),document.body.classList.toggle("is-tablet",!0),document.body.classList.toggle("is-phone",!1),this.leftSidebar&&this.rightSidebar&&!this.leftSidebar.collapsed&&(this.rightSidebar.collapsed=!0)):(s(l+c)||s(480))&&(this.deviceSize="phone",document.body.classList.toggle("floating-sidebars",!0),document.body.classList.toggle("is-large-screen",!1),document.body.classList.toggle("is-small-screen",!1),document.body.classList.toggle("is-tablet",!1),document.body.classList.toggle("is-phone",!0),this.leftSidebar&&(this.leftSidebar.collapsed=!0),this.rightSidebar&&(this.rightSidebar.collapsed=!0)),this.lastScreenWidth=window.innerWidth,null!=this.checkStillResizingTimeout&&clearTimeout(this.checkStillResizingTimeout);const d=window.innerWidth;this.checkStillResizingTimeout=setTimeout((function(){window.innerWidth==d&&(t.checkStillResizingTimeout=void 0,t.isResizing=!1,t.onEndResize())}),200)}},ObsidianSite=window.ObsidianSite,window.WebpageDocument=J,window.Canvas=v,window.Bounds=h,window.Vector2=c,window.LinkHandler=$,window.FilePreviewPopover=U,ObsidianSite.init())})()