function ue(i){return i.split("/").filter((e,t,n)=>e!==""||t>0&&t<n.length-1).map(encodeURIComponent).join("/")}function I(i){return encodeURIComponent(i.trim().replace(/^\/+|\/+$/g,""))}function me(i){return i.trim().replace(/^\/+/,"")}function he(i){let e=I(i);return e?`/${e}/`:"/"}function R(i,e=""){let t=e.trim().replace(/^\/+/,""),n=he(i);return t?`${n}${ue(t)}`:n}function pe(i,e){let t=I(i),n=me(e);return t?`/_/${t}/${n}`:`/_/${n}`}function B(i){return pe(i,"files/delete")}var P=i=>{if(!i)return null;let e=i.getBoundingClientRect().top,t=i.querySelectorAll(".md-diff-file-section[data-file-path]"),n=null;for(let o of t)if(o.getBoundingClientRect().top<=e+4)n=o.dataset.filePath||n;else break;let r=t[0];return!n&&r&&(n=r.dataset.filePath||null),n},F=i=>{let e=i.querySelector(".md-diff-file-header");return e?e.offsetHeight:48},V=i=>{let e=parseInt(i.dataset.line||"",10);if(Number.isNaN(e))return null;let t=parseInt(i.dataset.lineEnd||"",10);return{start:e,end:Number.isNaN(t)?e:Math.max(e,t)}},N=(i,e)=>{let t=i.getBoundingClientRect().top+F(e)+1,n=null;return e.querySelectorAll("[data-line]").forEach(r=>{if(n!==null)return;let o=r.getBoundingClientRect();if(o.bottom<=t)return;let s=V(r);if(!s)return;let l=o.height>0?Math.min(1,Math.max(0,(t-o.top)/o.height)):0;n=s.start+l*(s.end-s.start)}),n},$=(i,e,t)=>{let n=null;if(t!==null){let s=e.querySelectorAll("[data-line]");for(let l of s){let a=V(l);if(!a)continue;if(a.start>t)break;let d=l.getBoundingClientRect();if(t<=a.end){let f=a.end>a.start?(t-a.start)/(a.end-a.start):0;n=d.top+f*d.height}else n=d.bottom}}let o=(n??e.getBoundingClientRect().top)-i.getBoundingClientRect().top-F(e);i.scrollTop=Math.max(0,i.scrollTop+o)},G=i=>{if(!i)return null;try{return`markon:diff:collapsed:${new URL(i,window.location.origin).pathname}`}catch{return`markon:diff:collapsed:${i}`}},U=i=>{let e=G(i);if(!e)return new Set;try{let t=window.localStorage.getItem(e);if(!t)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(r=>typeof r=="string")):new Set}catch{return new Set}},W=(i,e)=>{let t=G(i);if(t)try{window.localStorage.setItem(t,JSON.stringify([...e]))}catch{}},q=i=>{if(!i)return null;try{return`markon:diff:viewed:${new URL(i,window.location.origin).pathname}`}catch{return`markon:diff:viewed:${i}`}},z=i=>{let e=q(i);if(!e)return new Set;try{let t=window.localStorage.getItem(e);if(!t)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(r=>typeof r=="string")):new Set}catch{return new Set}},j=(i,e)=>{let t=q(i);if(t)try{window.localStorage.setItem(t,JSON.stringify([...e]))}catch{}},ge=i=>{if(!i)return null;try{return`markon:diff:showviewed:${new URL(i,window.location.origin).pathname}`}catch{return`markon:diff:showviewed:${i}`}},K=i=>{let e=ge(i);if(!e)return!1;try{let t=window.localStorage.getItem(e);return t===null?!1:t!=="0"}catch{return!1}};var Z="markon:diff-viewed-changed",Y="markon:diff-showviewed",we='<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path fill="currentColor" d="M12.78 6.22a.75.75 0 0 1 0 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L3.22 7.28a.75.75 0 0 1 1.06-1.06L8 9.94l3.72-3.72a.75.75 0 0 1 1.06 0Z"/></svg>',Ee='<svg viewBox="0 0 16 16" width="14" height="14" aria-hidden="true"><path fill="currentColor" d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"/><path fill="currentColor" d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"/></svg>',ke='<svg viewBox="0 0 16 16" width="16" height="16" aria-hidden="true"><path fill="currentColor" d="M8 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3ZM1.5 9a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm13 0a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z"/></svg>',be='<svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path fill="currentColor" d="M5.22 14.78a.75.75 0 0 1 0-1.06L12.44 6.5H7.75a.75.75 0 0 1 0-1.5h6.5a.75.75 0 0 1 .75.75v6.5a.75.75 0 0 1-1.5 0V7.56l-7.22 7.22a.75.75 0 0 1-1.06 0Z"/></svg>',O=()=>document.querySelector('meta[name="workspace-id"]')?.getAttribute("content")||"",Te=(i,e)=>e&&e!==i?`${e} -> ${i}`:i,ye=(i,e,t)=>{let n=R(O(),i);if(!e)return n;let r=t&&t>0?`&line=${t}`:"";return`${n}?edit=1${r}`},X=(i,e,t)=>{O()&&window.open(ye(i,e,t),"_blank","noopener")},Se=i=>{let e=i.closest(".md-diff-file-section");if(!e)return;let t=e.parentElement;for(;t&&t.scrollHeight<=t.clientHeight+1;)t=t.parentElement;if(!t)return;let n=N(t,e);return n!=null?Math.max(1,Math.round(n)):void 0},Me=async(i,e)=>{try{await navigator.clipboard.writeText(i),e.classList.add("is-copied"),window.setTimeout(()=>e.classList.remove("is-copied"),1100)}catch{}},ve=async(i,e)=>{let t=O();if(t&&window.confirm(`Delete ${i}?
This removes the file from disk and cannot be undone.`))try{let n=await fetch(B(t),{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({path:i})}),r=await n.json().catch(()=>null);if(!(n.ok&&!!r&&r.success===!0)){let s=r?.message||"Delete failed";window.alert(`Could not delete ${i}: ${s}`);return}e?.()}catch(n){window.alert(`Could not delete ${i}: ${n instanceof Error?n.message:String(n)}`)}},Le=(i,e)=>{let t=document.createElement("span");t.className="md-diff-stat";let n=document.createElement("span");n.className="md-diff-stat-add",n.textContent=`+${i}`;let r=document.createElement("span");r.className="md-diff-stat-del",r.textContent=`-${e}`;let o=document.createElement("span");o.className="md-diff-stat-bars",o.setAttribute("aria-hidden","true");let s=i+e,l=0,a=0;if(s>0)for(l=i>0?Math.max(1,Math.round(i/s*5)):0,a=e>0?Math.max(1,Math.round(e/s*5)):0;l+a>5;)l>=a?l-=1:a-=1;for(let d=0;d<5;d+=1){let f=document.createElement("span");f.className=d<l?"md-diff-bar is-add":d<l+a?"md-diff-bar is-del":"md-diff-bar",o.appendChild(f)}return t.append(n,r,o),t},J=(i,e)=>{let t=i.closest(".md-diff-file-header");t&&(t.style.zIndex=e?"6":"")},_=(i,e)=>{let t=i.querySelector(".md-diff-menu-pop");t&&(t.hidden=!0),e.setAttribute("aria-expanded","false"),i.classList.remove("is-open"),J(i,!1),i.__cleanup?.(),i.__cleanup=void 0},_e=i=>{let e=document.createElement("div");e.className="md-diff-menu";let t=document.createElement("button");t.type="button",t.className="md-diff-menu-btn",t.setAttribute("aria-label","File actions"),t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded","false"),t.innerHTML=ke;let n=document.createElement("div");n.className="md-diff-menu-pop",n.setAttribute("role","menu"),n.hidden=!0;let r=[{label:"Edit file",action:()=>X(i.path,!0,Se(e))},{label:"Delete file",action:()=>{ve(i.path,i.onDeleted)},danger:!0}];for(let s of r){let l=document.createElement("button");l.type="button",l.className="md-diff-menu-item"+(s.danger?" is-danger":""),l.setAttribute("role","menuitem"),l.textContent=s.label,l.addEventListener("click",()=>{_(e,t),s.action()}),n.appendChild(l)}let o=s=>{if(n.hidden=!s,t.setAttribute("aria-expanded",s?"true":"false"),e.classList.toggle("is-open",s),J(e,s),s){let l=d=>{e.contains(d.target)||_(e,t)},a=d=>{d.key==="Escape"&&_(e,t)};e.__cleanup=()=>{document.removeEventListener("mousedown",l,!0),document.removeEventListener("keydown",a,!0)},document.addEventListener("mousedown",l,!0),document.addEventListener("keydown",a,!0)}else e.__cleanup?.(),e.__cleanup=void 0};return t.addEventListener("click",()=>o(!e.classList.contains("is-open"))),e.append(t,n),e};function Q(i){let e=document.createElement("header");e.className="md-diff-file-header md-diff-ui",e.classList.toggle("is-collapsed",i.collapsed);let t=document.createElement("div");t.className="md-diff-file-left";let n=document.createElement("button");n.type="button",n.className="md-diff-chevron",n.setAttribute("aria-label",i.collapsed?"Expand file":"Collapse file"),n.innerHTML=we,n.addEventListener("click",()=>i.onToggleCollapse());let r=document.createElement("span");r.className="md-diff-file-title",r.textContent=Te(i.path,i.oldPath);let o=document.createElement("button");o.type="button",o.className="md-diff-file-copy",o.title="Copy path",o.setAttribute("aria-label","Copy path"),o.innerHTML=Ee,o.addEventListener("click",()=>{Me(i.path,o)});let s=document.createElement("button");s.type="button",s.className="md-diff-file-open",s.title="Open file in new window",s.setAttribute("aria-label","Open file in new window"),s.innerHTML=be,s.addEventListener("click",()=>X(i.path,!1)),t.append(n,r,o,s);let l=document.createElement("div");l.className="md-diff-file-right";let a=document.createElement("label");a.className="md-diff-file-check";let d=document.createElement("input");d.type="checkbox",d.checked=i.viewed,d.addEventListener("change",()=>i.onToggleViewed());let f=document.createElement("span");return f.textContent="Viewed",a.append(d,f),i.status==="renamed"&&!i.additions&&!i.deletions||l.append(Le(i.additions||0,i.deletions||0)),l.append(a,_e(i)),e.append(t,l),e.addEventListener("dblclick",c=>{c.target?.closest(".md-diff-chevron, .md-diff-file-copy, .md-diff-file-check, .md-diff-menu")||(window.getSelection()?.removeAllRanges(),i.onToggleCollapse())}),e}var p=(i,e)=>{let t=i[e];if(t===void 0)throw new RangeError(`Index ${e} is outside array bounds`);return t},te=i=>{if(!i||typeof i!="object")return!1;let e=i;return!!e.engine&&Array.isArray(e.files)};function C(i,e=3){let t=i.length,n=new Array(t).fill(!1);for(let s=0;s<t;s+=1)if(p(i,s).kind!=="equal")for(let l=Math.max(0,s-e);l<=Math.min(t-1,s+e);l+=1)n[l]=!0;let r=[],o=0;for(;o<t;)if(n[o])r.push({kind:"block",block:p(i,o),index:o}),o+=1;else{let s=o,l=0;for(;o<t&&!n[o];)l+=1,o+=1;r.push({kind:"gap",start:s,count:l})}return r}var x=class{#n=new Map;has(e,t){return this.#n.get(e)?.has(t)??!1}add(e,t){let n=this.#n.get(e);n||(n=new Set,this.#n.set(e,n)),n.add(t)}},Ne=()=>{let i=globalThis;return i.__markonDiffExpansion__||(i.__markonDiffExpansion__=new Map),i.__markonDiffExpansion__},Oe=i=>{if(!i)return":default";try{return new URL(i,window.location.origin).pathname}catch{return i}};function ne(i){let e=Ne(),t=Oe(i),n=e.get(t);return n||(n=new x,e.set(t,n)),n}function ie(i,e,t){let n=document.createElement("button");n.type="button",n.className=t?.standalone?"md-diff-gap md-diff-gap-standalone":"md-diff-gap";let r=document.createElement("span");r.className="md-diff-gap-label",r.innerHTML='<svg class="md-diff-gap-icon" viewBox="0 0 16 16" width="13" height="13" aria-hidden="true"><path fill="currentColor" d="M8 2.5 11.2 5.7l-1.06 1.06L8 4.62 5.86 6.76 4.8 5.7 8 2.5Z"/><path fill="currentColor" d="M8 13.5 4.8 10.3l1.06-1.06L8 11.38l2.14-2.14 1.06 1.06L8 13.5Z"/></svg>';let o=document.createElement("span"),s=i===1?"Show 1 unchanged block":`Show ${i} unchanged blocks`;return o.textContent=t?.standalone?t.note||s:t?.note?`${t.note} \xB7 ${s}`:s,r.appendChild(o),n.appendChild(r),n.addEventListener("click",()=>e(n)),n}var ee=i=>i.match(/\s+|[A-Za-z0-9_]+|[^\s]/gu)??[];function A(i,e){let t=ee(i),n=ee(e),r=t.length,o=n.length,s=Array.from({length:r+1},()=>new Array(o+1).fill(0));for(let c=r-1;c>=0;c-=1)for(let u=o-1;u>=0;u-=1){let m=p(s,c),w=p(s,c+1);m[u]=p(t,c)===p(n,u)?p(w,u+1)+1:Math.max(p(w,u),p(m,u+1))}let l=[],a=[],d=(c,u,m)=>{let w=c[c.length-1];w&&w.cls===m?w.text+=u:c.push({text:u,cls:m})},f=0,h=0;for(;f<r&&h<o;){let c=p(t,f),u=p(n,h);c===u?(d(l,c,null),d(a,u,null),f+=1,h+=1):p(p(s,f+1),h)>=p(p(s,f),h+1)?(d(l,c,"del"),f+=1):(d(a,u,"add"),h+=1)}for(;f<r;)d(l,p(t,f),"del"),f+=1;for(;h<o;)d(a,p(n,h),"add"),h+=1;return{old:l,new:a}}function re(i,e){let t=i.length,n=e.length,r=Array.from({length:t+1},()=>new Array(n+1).fill(0));for(let h=t-1;h>=0;h-=1)for(let c=n-1;c>=0;c-=1){let u=p(r,h),m=p(r,h+1);u[c]=p(i,h)===p(e,c)?p(m,c+1)+1:Math.max(p(m,c),p(u,c+1))}let o=[],s=0,l=0,a=(h,c)=>{let u=Math.min(h.length,c.length);for(let m=0;m<u;m+=1)o.push({type:"replace",oldIndex:p(h,m),newIndex:p(c,m)});for(let m=u;m<h.length;m+=1)o.push({type:"del",oldIndex:p(h,m)});for(let m=u;m<c.length;m+=1)o.push({type:"add",newIndex:p(c,m)})},d=[],f=[];for(;s<t&&l<n;)p(i,s)===p(e,l)?(a(d,f),d=[],f=[],o.push({type:"equal",oldIndex:s,newIndex:l}),s+=1,l+=1):p(p(r,s+1),l)>=p(p(r,s),l+1)?(d.push(s),s+=1):(f.push(l),l+=1);for(;s<t;)d.push(s),s+=1;for(;l<n;)f.push(l),l+=1;return a(d,f),o}function y(i,e,t){let n=document.createTreeWalker(i,NodeFilter.SHOW_TEXT),r=[],o=n.nextNode();for(;o;)r.push(o),o=n.nextNode();let s=0,l=0;for(let a of r){let d=a.textContent??"",f=[];for(;d.length&&s<e.length;){let c=p(e,s),u=Math.min(c.text.length-l,d.length);f.push({text:d.slice(0,u),marked:c.cls!=null}),d=d.slice(u),l+=u,l>=c.text.length&&(s+=1,l=0)}if(d.length&&f.push({text:d,marked:!1}),!f.some(c=>c.marked))continue;let h=document.createDocumentFragment();for(let c of f)if(c.marked){let u=document.createElement("span");u.className=t,u.textContent=c.text,h.appendChild(u)}else h.appendChild(document.createTextNode(c.text));a.parentNode?.replaceChild(h,a)}}var g=typeof window<"u"&&window.__MARKON_I18N__?.t||(i=>i),oe={t(i,...e){let t=typeof window<"u"&&window.__MARKON_I18N__?.t||null;return t?t(i,...e):i}},E={BREAKPOINTS:{WIDE_SCREEN:1400},DIMENSIONS:{NOTE_CARD_WIDTH:280,NOTE_CARD_RIGHT_MARGIN:40,HEADING_TOP_MARGIN:64,HEADING_TOP_MARGIN_TIGHT:5,POPOVER_OFFSET:10},THRESHOLDS:{NOTE_CLUSTER:50,NOTE_MIN_SPACING:32,HEADING_SCROLL_THRESHOLD:40},WEBSOCKET:{INITIAL_RECONNECT_DELAY:1e3,MAX_RECONNECT_DELAY:3e4,STABLE_CONNECTION_THRESHOLD:5e3},ANIMATION:{RESIZE_DEBOUNCE:150,PANEL_TRANSITION:200},UNDO:{MAX_STACK_SIZE:50},SHORTCUTS:{HELP:{key:"?",ctrl:!1,shift:!1,desc:g("web.kbd.help"),cat:"global"},THEME_PANEL:{key:"t",ctrl:!1,shift:!1,desc:g("web.kbd.theme"),cat:"global"},UNDO:{key:"z",ctrl:!0,shift:!1,desc:g("web.kbd.undo"),cat:"core"},REDO:{key:"z",ctrl:!0,shift:!0,desc:g("web.kbd.redo"),cat:"core"},REDO_ALT:{key:"y",ctrl:!0,shift:!1,desc:g("web.kbd.redo.alt"),cat:"core"},ESCAPE:{key:"Escape",ctrl:!1,shift:!1,desc:g("web.kbd.escape"),cat:"core"},TOGGLE_TOC:{key:"\\",ctrl:!0,shift:!1,desc:g("web.kbd.toc"),cat:"core"},SEARCH:{key:"/",ctrl:!1,shift:!1,desc:g("web.kbd.search"),cat:"search",feature:"workspace_spotlight"},EXPORT_NOTES:{key:"x",ctrl:!1,shift:!1,desc:g("web.kbd.exportnotes"),cat:"core"},WORKSPACE_NAVIGATOR:{key:"g",ctrl:!1,shift:!1,desc:g("web.kbd.workspace_nav"),cat:"search",feature:"workspace_spotlight"},PREV_HEADING:{key:"k",ctrl:!1,shift:!1,desc:g("web.kbd.prevheading"),cat:"nav"},NEXT_HEADING:{key:"j",ctrl:!1,shift:!1,desc:g("web.kbd.nextheading"),cat:"nav"},PREV_ANNOTATION:{key:"k",ctrl:!0,shift:!1,desc:g("web.kbd.prevanno"),cat:"nav"},NEXT_ANNOTATION:{key:"j",ctrl:!0,shift:!1,desc:g("web.kbd.nextanno"),cat:"nav"},SCROLL_HALF_PAGE_DOWN:{key:" ",ctrl:!1,shift:!1,desc:g("web.kbd.scroll"),cat:"nav"},TOGGLE_SECTION_COLLAPSE:{key:"o",ctrl:!1,shift:!1,desc:g("web.kbd.collapse"),cat:"viewed"},TOGGLE_VIEWED:{key:"v",ctrl:!1,shift:!1,desc:g("web.kbd.viewed"),cat:"viewed"},EDIT:{key:"e",ctrl:!1,shift:!1,desc:g("web.kbd.edit"),cat:"edit"},TOGGLE_LIVE_ACTIVE:{key:"l",ctrl:!1,shift:!1,desc:g("web.kbd.live.active"),cat:"live"},TOGGLE_LIVE_OFF:{key:"l",ctrl:!1,shift:!0,desc:g("web.kbd.live.off"),cat:"live"},TOGGLE_CHAT:{key:"c",ctrl:!1,shift:!1,desc:g("web.kbd.chat"),cat:"chat"},TOGGLE_CHAT_ALT:{key:"c",ctrl:!1,shift:!0,desc:g("web.kbd.chat.alt"),cat:"chat"},DIFF_TOGGLE_VIEW:{key:"m",ctrl:!1,shift:!1,desc:g("web.kbd.diff.view"),cat:"diff"},DIFF_NEXT_FILE:{key:"n",ctrl:!1,shift:!1,desc:g("web.kbd.diff.nextfile"),cat:"diff"},DIFF_PREV_FILE:{key:"p",ctrl:!1,shift:!1,desc:g("web.kbd.diff.prevfile"),cat:"diff"},VISUAL_ZOOM_IN:{key:"+",ctrl:!1,shift:!1,desc:g("web.kbd.visual.zoom_in"),cat:"visual",feature:"visual_zoom_in"},VISUAL_ZOOM_IN_ALT:{key:"=",ctrl:!1,shift:!1,desc:g("web.kbd.visual.zoom_in"),cat:"visual",feature:"visual_zoom_in"},VISUAL_ZOOM_OUT:{key:"-",ctrl:!1,shift:!1,desc:g("web.kbd.visual.zoom_out"),cat:"visual"},VISUAL_ZOOM_RESET:{key:"0",ctrl:!1,shift:!1,desc:g("web.kbd.visual.reset"),cat:"visual",feature:"visual_reset"},VISUAL_ZOOM_RESET_ALT:{key:"r",ctrl:!1,shift:!1,desc:g("web.kbd.visual.reset"),cat:"visual",feature:"visual_reset"},VISUAL_ZOOM_FIT:{key:"f",ctrl:!1,shift:!1,desc:g("web.kbd.visual.fit"),cat:"visual",feature:"visual_fit"},VISUAL_ZOOM_FIT_CMD:{key:"0",ctrl:!0,shift:!1,desc:g("web.kbd.visual.fit"),cat:"visual",feature:"visual_fit"},VISUAL_ZOOM_TOOL:{key:"z",ctrl:!1,shift:!1,desc:g("web.kbd.visual.tool"),cat:"visual"},VISUAL_ZOOM_TOOL_OUT:{key:"z",ctrl:!1,shift:!0,desc:g("web.kbd.visual.tool_out"),cat:"visual"},VISUAL_ZOOM_CLOSE:{key:"Escape",ctrl:!1,shift:!1,desc:g("web.kbd.visual.close"),cat:"visual",feature:"ESCAPE"}},STORAGE_KEYS:{ANNOTATIONS:i=>`markon-annotations-${i}`,VIEWED:i=>`markon-viewed-${i}`,LIVE_POS:"markon-live-pos",LIVE_COLOR:"markon-user-color",IDENTITY_NAME:"markon-user-name",LIVE_MODE:"markon-live-mode",CLIENT_ID:"markon-client-id",CHAT_POS:"markon-chat-pos",CHAT_SIZE:"markon-chat-size",NOTE_INPUT_OFFSET:"markon-note-input-offset",NOTE_INPUT_SIZE:"markon-note-input-size",POPOVER_OFFSET:"markon-popover-offset",SHORTCUTS_HELP_POS:"markon-shortcuts-help-pos",WORKSPACE_SPOTLIGHT_POS:"markon-workspace-spotlight-pos"},SELECTORS:{MARKDOWN_BODY:".markdown-body",HEADINGS:"h1, h2, h3, h4, h5, h6",TOC_CONTAINER:"#toc-container",TOC_ICON:"#toc-icon",HIGHLIGHT_CLASSES:".highlight-orange, .highlight-green, .highlight-yellow, .strikethrough"},SKIP_ELEMENTS:{IDS:new Set(["toc"]),CLASSES:new Set(["back-link","toc","selection-popover","note-card-margin","note-popup"])},META_TAGS:{FILE_PATH:"file-path",WORKSPACE_ID:"workspace-id",SHARED_ANNOTATION:"shared-annotation",ENABLE_SEARCH:"enable-search",ENABLE_VIEWED:"enable-viewed",ENABLE_EDIT:"enable-edit",ENABLE_LIVE:"enable-live",ENABLE_CHAT:"enable-chat",DEFAULT_CHAT_MODE:"default-chat-mode",CHAT_ONLY:"chat-only"},WS_MESSAGE_TYPES:{ALL_ANNOTATIONS:"all_annotations",NEW_ANNOTATION:"new_annotation",DELETE_ANNOTATION:"delete_annotation",CLEAR_ANNOTATIONS:"clear_annotations",VIEWED_STATE:"viewed_state",UPDATE_VIEWED_STATE:"update_viewed_state",LIVE_ACTION:"live_action",FILE_CHANGED:"file_changed"},COLLABORATION:{COLORS:["#3451B2","#E64560","#27AE60","#F39C12","#8E44AD","#0EA5E9","#EC4899","#14B8A6"],SYNC_DEBOUNCE:100},ANNOTATION_TYPES:{STRIKETHROUGH:"strikethrough",HAS_NOTE:"has-note"},HTML_TAGS:{HIGHLIGHT:"span",STRIKETHROUGH:"s"},BLOCK_TAGS:["P","DIV","LI","H1","H2","H3","H4","H5","H6","BLOCKQUOTE","PRE","TD","TH"]};if(typeof window<"u"&&window.__MARKON_SHORTCUTS__){let i=Object.entries(window.__MARKON_SHORTCUTS__);for(let[e,t]of i)E.SHORTCUTS[e]&&Object.assign(E.SHORTCUTS[e],t)}Object.freeze(E);Object.freeze(E.BREAKPOINTS);Object.freeze(E.DIMENSIONS);Object.freeze(E.THRESHOLDS);Object.freeze(E.WEBSOCKET);Object.freeze(E.ANIMATION);Object.freeze(E.UNDO);Object.freeze(E.SHORTCUTS);Object.freeze(E.SELECTORS);Object.freeze(E.SKIP_ELEMENTS);Object.freeze(E.META_TAGS);Object.freeze(E.WS_MESSAGE_TYPES);Object.freeze(E.COLLABORATION);Object.freeze(E.ANNOTATION_TYPES);Object.freeze(E.HTML_TAGS);var xe=(i,...e)=>oe.t(i,...e),se=i=>`${xe("web.export.label")} (${i})`,Ce=()=>{try{let i=window.location.hash;return i&&decodeURIComponent(i.slice(1))||null}catch{return null}},Ae=i=>{try{let e=new URL(i,window.location.origin);return e.searchParams.delete("f"),`${e.pathname}${e.search}${e.hash}`}catch{return i}},L=class{root;#n=null;#c=[];#s=null;#e=new Map;#l=null;#f=null;#t=new Set;#i=new Set;#r=!0;#a=null;#u=null;scrollElement=null;constructor(e){this.root=e,document.addEventListener(Y,t=>{let n=t.detail;n&&typeof n.showViewed=="boolean"&&(this.#r=n.showViewed,this.#E())}),document.addEventListener("markon:diff-annotations-ready",()=>{this.#k()}),document.addEventListener("markon:diff-notes-count-changed",()=>{this.#k()})}get bodyClass(){return""}fileLead(e){return null}onRender(e){}onFiles(e){}get emptyBlocksMessage(){return"No content to preview."}afterContentRendered(){}async load(){let e=this.root.dataset.diffDataUrl?Ae(this.root.dataset.diffDataUrl):void 0;if(e){if(this.#s===null&&(this.#s=Ce()),this.root.dataset.diffLoadedUrl===e){this.#o();return}if(this.root.dataset.diffLoadingUrl!==e){this.root.dataset.diffLoadingUrl=e;try{let t=await fetch(e,{headers:{Accept:"application/json"}});if(!t.ok)throw new Error(await t.text());let n=await t.json();if(!te(n))throw new Error("Invalid Markdown diff payload");this.#n=n,this.root.dataset.diffLoadedUrl=e,this.#o()}catch(t){delete this.root.dataset.diffLoadedUrl,this.#b(`Failed to load diff: ${t instanceof Error?t.message:String(t)}`,!0)}finally{delete this.root.dataset.diffLoadingUrl}}}}selectPath(e){this.#s=e||null,this.#e.size&&this.#s?this.scrollToPath(this.#s):this.#n||this.load()}scrollToPath(e){this.#e.get(e)?.section.scrollIntoView({block:"start",behavior:"instant"})}topAnchor(){let e=P(this.scrollElement);if(!e||!this.scrollElement)return null;let t=this.#e.get(e);return{path:e,line:t?N(this.scrollElement,t.section):null}}anchorTo(e){this.#a=e}syncLayout(){}#o(){let e=this.#n;if(e){if(this.onRender(e),!e.engine.enabled){this.#b(e.engine.message||"Markdown engine is not enabled.",!0);return}if(!e.files.length){this.#b("No Markdown files changed in this diff.");return}this.#p(e.files)}}#m(){return this.paneSelector?this.root.querySelector(this.paneSelector):this.root}#p(e){let t=this.#m();if(!t)return;this.#M(),this.onFiles(e),t.textContent="",t.classList.add(this.virtualizedClass),this.#c=e,this.#t=U(this.root.dataset.diffDataUrl),this.#i=z(this.root.dataset.diffDataUrl),this.#r=K(this.root.dataset.diffDataUrl),this.#u=ne(this.root.dataset.diffDataUrl),this.#e=new Map;let n=(this.scrollSelector?this.root.querySelector(this.scrollSelector):this.root)||this.root;this.scrollElement=n;let r=document.createDocumentFragment();for(let o of e){let s=this.#w(o);this.#e.set(o.path,s),r.appendChild(s.section)}if(t.appendChild(r),this.#E(),n.scrollTo({top:0,left:0,behavior:"instant"}),typeof IntersectionObserver<"u"){let o=new IntersectionObserver(s=>{for(let l of s){let a=l.target.dataset.filePath,d=a?this.#e.get(a):void 0;d&&(l.isIntersecting?this.#g(d):this.#_(d))}},{root:n,rootMargin:"1200px 0px"});this.#l=o;for(let s of this.#e.values())o.observe(s.section)}else for(let o of this.#e.values())this.#g(o);if(this.#f=()=>{this.#l?.disconnect(),this.#l=null},this.#a){let o=this.#a;this.#a=null;let s=this.#e.get(o.path);if(s){for(let l of this.#e.values())if(this.#g(l),l===s)break;$(n,s.section,o.line)}}else this.#s&&this.#e.get(this.#s)?.section.scrollIntoView({block:"start",behavior:"instant"});this.afterContentRendered()}#w(e){let t=document.createElement("section");t.className="md-diff-file-section",t.dataset.filePath=e.path,e.abs_path&&(t.dataset.absPath=e.abs_path),e.status==="renamed"&&!e.additions&&!e.deletions&&t.classList.add("is-pure-rename");let n=this.#t.has(e.path);t.classList.toggle("is-collapsed",n);let r=document.createElement("div");r.className=`md-diff-file-body${this.bodyClass?` ${this.bodyClass}`:""}`;let o={file:e,section:t,body:r,rendered:!1,estHeight:this.#N(e)};return t.append(this.#d(e),r),n||(r.style.minHeight=`${o.estHeight}px`),o}#d(e){let t={path:e.path,status:e.status,additions:e.additions||0,deletions:e.deletions||0,collapsed:this.#t.has(e.path),viewed:this.#i.has(e.path),onToggleCollapse:()=>this.#T(e.path),onToggleViewed:()=>this.#O(e.path),onDeleted:()=>{this.#e.get(e.path)?.section.remove(),this.#e.delete(e.path),this.#c=this.#c.filter(r=>r.path!==e.path)}};return Q(e.old_path===void 0?t:{...t,oldPath:e.old_path})}#h(e,t){let n=e.blocks[t];if(!n)throw new RangeError(`Diff block index ${t} is outside ${e.path}`);return n}#g(e){if(e.rendered||this.#t.has(e.file.path))return;let t=e.file,n=document.createDocumentFragment(),r=this.fileLead(t);if(r&&n.appendChild(r),!t.blocks.length)n.appendChild(this.#v(this.emptyBlocksMessage));else{let o=this.#u;for(let s of C(t.blocks))if(s.kind==="block")n.appendChild(this.renderBlock(t,s.block,s.index));else if(o?.has(t.path,s.start))for(let l=s.start;l<s.start+s.count;l+=1)n.appendChild(this.renderBlock(t,this.#h(t,l),l));else n.appendChild(this.#L(t,s.start,s.count))}e.body.replaceChildren(n),e.body.style.minHeight="",e.body.style.height="",e.rendered=!0,this.afterBodyRendered(e.body)}afterBodyRendered(e){}#L(e,t,n){let o=e.status==="renamed"&&!e.additions&&!e.deletions?{note:"This file was only renamed or moved \u2014 its content is unchanged.",standalone:!0}:void 0;return ie(n,s=>{this.#u?.add(e.path,t);let l=s.parentElement??this.root,a=document.createDocumentFragment();for(let b=t;b<t+n;b+=1)a.appendChild(this.renderBlock(e,this.#h(e,b),b));let d=this.scrollElement,f=s.nextElementSibling,h=f?f.getBoundingClientRect().top:null,c=()=>{d&&f&&h!==null&&(d.scrollTop+=f.getBoundingClientRect().top-h)};if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches||typeof requestAnimationFrame!="function"){s.replaceWith(a),c(),this.afterBodyRendered(l);return}d&&(d.style.overflowAnchor="none");let m=document.createElement("div");m.className="md-diff-reveal",m.appendChild(a),s.replaceWith(m),c();let w=!1,k=()=>{if(w)return;w=!0;let b=document.createDocumentFragment();for(;m.firstChild;)b.appendChild(m.firstChild);m.replaceWith(b),c(),this.afterBodyRendered(l)};m.addEventListener("transitionend",b=>{b.propertyName==="opacity"&&k()}),window.setTimeout(k,700),requestAnimationFrame(()=>{d&&(d.style.overflowAnchor=""),m.classList.add("is-open")})},o)}#_(e){if(!e.rendered||this.#t.has(e.file.path))return;let t=e.body.offsetHeight;e.body.replaceChildren(),e.body.style.minHeight=`${t||e.estHeight}px`,e.rendered=!1}#N(e){let t=e.diagnostics.length?40:0;if(!e.blocks.length)return t+58;let n=this.#u;for(let r of C(e.blocks))if(r.kind==="block")t+=this.estimateBlock(r.block);else if(n?.has(e.path,r.start))for(let o=r.start;o<r.start+r.count;o+=1)t+=this.estimateBlock(this.#h(e,o));else t+=30;return t}#T(e){let t=this.#e.get(e),n=!this.#t.has(e);if(n?this.#t.add(e):this.#t.delete(e),W(this.root.dataset.diffDataUrl,this.#t),!t)return;let r=this.scrollElement,o=t.section.getBoundingClientRect().top;if(t.section.classList.toggle("is-collapsed",n),t.section.firstElementChild?.replaceWith(this.#d(t.file)),n?(t.body.replaceChildren(),t.body.style.minHeight="",t.body.style.height="",t.rendered=!1):(t.body.style.minHeight=`${t.estHeight}px`,this.#g(t)),r){let s=t.section.getBoundingClientRect().top;r.scrollTop+=s-o}}#O(e){let t=!this.#i.has(e);if(t?this.#i.add(e):this.#i.delete(e),j(this.root.dataset.diffDataUrl,this.#i),t!==this.#t.has(e))this.#T(e);else{let n=this.#e.get(e);n?.section.firstElementChild?.replaceWith(this.#d(n.file))}this.#E(),document.dispatchEvent(new CustomEvent(Z,{detail:{viewed:[...this.#i]}}))}#E(){let e=!1;for(let[r,o]of this.#e){let s=!this.#r&&this.#i.has(r);o.section.hidden=s,s||(e=!0)}let t=this.#e.size>0&&[...this.#e.keys()].every(r=>this.#i.has(r)),n=this.#m();n&&(!this.#r&&this.#e.size>0&&!e?(n.querySelector(".md-diff-viewed-done")?.remove(),this.#y("empty")):(n.querySelector(".md-diff-viewed-empty")?.remove(),this.#r&&t?this.#y("done"):n.querySelector(".md-diff-viewed-done")?.remove()))}#y(e){let t=this.#m(),n=e==="empty"?"md-diff-viewed-empty":"md-diff-viewed-done";if(!t)return;if(t.querySelector(`.${n}`)){this.#k();return}let o=document.createElement("div");o.className=n,o.innerHTML='<div class="md-diff-viewed-empty-emoji">\u{1F389}</div><div class="md-diff-viewed-empty-title">All done \u2014 every changed file is marked Viewed.</div>';let s=document.createElement("div");s.className="md-diff-viewed-empty-actions";let l=document.createElement("button");l.type="button",l.className="md-diff-viewed-empty-link",l.textContent=e==="empty"?"Show all files":"Hide all Viewed files",l.addEventListener("click",()=>{let d=document.querySelector("[data-diff-show-viewed]");d&&(d.checked=e==="done",d.dispatchEvent(new Event("change",{bubbles:!0})))});let a=document.createElement("button");a.type="button",a.className="md-diff-viewed-empty-link md-diff-viewed-export-notes",a.textContent=se(0),a.addEventListener("click",()=>{if(a.disabled||a.getAttribute("aria-disabled")==="true")return;let d=window.markonDiffAnnotations?.exportNotes;d&&d(a)}),s.append(l,a),o.appendChild(s),t.appendChild(o),this.#S(a)}#k(){this.root.querySelectorAll(".md-diff-viewed-export-notes").forEach(e=>{this.#S(e)})}async#S(e){let t=Math.max(0,await(window.markonDiffAnnotations?.notesCount?.()??Promise.resolve(0)));if(!e.isConnected)return;e.textContent=se(t);let n=t===0;e.disabled=n,e.classList.toggle("is-disabled",n),e.setAttribute("aria-disabled",n?"true":"false")}#M(){this.#f?.(),this.#f=null,this.#l?.disconnect(),this.#l=null,this.#e=new Map,this.scrollElement=null}#v(e,t=!1){let n=document.createElement("div");return n.className="md-diff-empty",t&&(n.style.color="var(--markon-danger)"),n.textContent=e,n}#b(e,t=!1){this.#M();let n=this.#m();n&&(n.classList.remove(this.virtualizedClass),n.textContent="",n.appendChild(this.#v(e,t)))}text(e,t){let n=this.root.querySelector(e);n&&(n.textContent=t)}};var S=(i,e)=>{let t=i[e];if(!t)throw new RangeError(`Element index ${e} is outside array bounds`);return t},H=class extends L{#n=new WeakMap;get scrollSelector(){return'[data-diff-view-panel="rendered"]'}get paneSelector(){return"[data-md-diff-content]"}get virtualizedClass(){return"is-virtualized-md-diff"}get emptyBlocksMessage(){return"No Markdown blocks to preview."}onRender(e){let t=e.engine.enabled?`${e.engine.name} enabled`:`${e.engine.name} unavailable`;this.text("[data-md-engine-status]",e.engine.message?`${t} \xB7 ${e.engine.message}`:t)}onFiles(e){this.#n=new WeakMap}fileLead(e){let t=[...e.diagnostics.filter(n=>n.side==="old"),...e.diagnostics.filter(n=>n.side==="new")];return t.length?this.#u(t):null}afterBodyRendered(e){e.querySelectorAll(".md-diff-rendered-structural").forEach(t=>this.#c(t)),window.markonDiffAnnotations?.onBodyRendered(e)}#c(e){e.querySelectorAll(":scope > .md-diff-item-band").forEach(n=>n.remove());let t=e.getBoundingClientRect().top;for(let n of e.querySelectorAll(".md-diff-item-old, .md-diff-item-new")){let r=n.getBoundingClientRect(),o=n.classList.contains("md-diff-item-old"),s=document.createElement("div");s.className=`md-diff-item-band ${o?"md-diff-item-band-old":"md-diff-item-band-new"}`,s.dataset.diffMarker=o?"-":"+",s.style.top=`${r.top-t}px`,s.style.height=`${r.height}px`,e.appendChild(s)}}syncLayout(){this.root.querySelectorAll(".md-diff-rendered-structural").forEach(e=>this.#c(e))}afterContentRendered(){queueMicrotask(()=>{window.markonDiffAnnotations?.onContentRendered(),document.dispatchEvent(new CustomEvent("markon:markdown-diff-rendered"))})}estimateBlock(e){let t=e.old||null,n=e.new||null,r=e.kind==="modified"?this.#d(t)+this.#d(n):Math.max(this.#d(t),this.#d(n)),o=e.kind==="modified"?(t?.source?.length||t?.text?.length||0)+(n?.source?.length||n?.text?.length||0):Math.max(t?.source?.length||t?.text?.length||0,n?.source?.length||n?.text?.length||0),s=Math.ceil(o/110),l=Math.max(r,s),a=e.kind==="equal"?76:e.kind==="modified"?210:132;return Math.max(a,42+l*21)}renderBlock(e,t,n){let r=document.createElement("article");r.className=`diff-change-block md-diff-block is-${t.kind}`,r.dataset.mdDiffPair=String(n);let o=t.new??t.old;if(o?.start_line!=null&&(r.dataset.line=String(o.start_line),r.dataset.lineEnd=String(o.end_line??o.start_line)),t.kind==="equal"){let s=t.new?this.#a(t.new,this.#o(e,"new",t.new)):this.#a(t.old||null,this.#o(e,"old",t.old||null));return s.classList.add("md-diff-rendered-equal"),r.appendChild(s),r}if(t.kind==="modified"){let s=this.#e(t,e);if(s)return r.classList.add("is-structural"),r.appendChild(s),r;let l=this.#r("old","-",t.old||null,this.#o(e,"old",t.old||null)),a=this.#r("new","+",t.new||null,this.#o(e,"new",t.new||null));return this.#s(l,a),r.append(l,a),r}return t.kind==="deleted"?r.appendChild(this.#r("old","-",t.old||null,this.#o(e,"old",t.old||null))):r.appendChild(this.#r("new","+",t.new||null,this.#o(e,"new",t.new||null))),r}#s(e,t){let n=e.querySelector(".md-diff-rendered"),r=t.querySelector(".md-diff-rendered");if(!n||!r)return;let o=n.textContent??"",s=r.textContent??"";if(!o.trim()||!s.trim())return;let{old:l,new:a}=A(o,s);y(n,l,"git-diff-word-del"),y(r,a,"git-diff-word-add")}#e(e,t){let n=e.old?.html,r=e.new?.html;if(!n||!r)return null;let o=this.#l(n),s=this.#l(r);if(!o||!s)return null;let l=this.#t(o,s,!0);if(!l)return null;let a=document.createElement("div");a.className="md-diff-rendered md-diff-rendered-structural";let d=this.#o(t,"new",e.new||null);return a.dataset.mdSectionDepth=String(d),d>0&&(a.classList.add("md-diff-rendered-sectioned"),a.style.setProperty("--md-diff-section-indent",`${d*10}px`),a.style.setProperty("--md-diff-section-indent-wide",`${d*14}px`)),a.appendChild(l),a}#l(e){let t=document.createElement("div");return t.innerHTML=e,t.querySelector("ul, table")}#f(e){return e.tagName==="TABLE"?[...e.querySelectorAll("tr")]:[...e.children].filter(t=>t.tagName==="LI")}#t(e,t,n){if(e.tagName!==t.tagName)return null;let r=this.#f(e),o=this.#f(t);if(!r.length&&!o.length)return null;let s=w=>(w.textContent??"").trim().replace(/\s+/g," "),l=re(r.map(s),o.map(s));if(n&&(!l.some(w=>w.type==="equal")||!l.some(w=>w.type!=="equal")))return null;let a=t.tagName.toLowerCase(),d=document.createElement(a);d.className=t.className;let f=a==="table"?d.appendChild(document.createElement("tbody")):d,h=a==="ol",c=w=>w.cloneNode(!0),u=(w,k)=>{h&&k!=null&&w.setAttribute("value",String(k)),f.appendChild(w)},m=0;for(let w of l)if(w.type==="equal")m+=1,u(c(S(o,w.newIndex)),m);else if(w.type==="replace"){m+=1;let k=S(r,w.oldIndex),b=S(o,w.newIndex),D=this.#i(k,b);if(D)u(D,m);else{let M=c(k),v=c(b);M.classList.add("md-diff-item-old"),v.classList.add("md-diff-item-new");let{old:ce,new:fe}=A(M.textContent??"",v.textContent??"");y(M,ce,"git-diff-word-del"),y(v,fe,"git-diff-word-add"),u(M,m),u(v,m)}}else if(w.type==="del"){let k=c(S(r,w.oldIndex));k.classList.add("md-diff-item-old"),u(k,h?m+1:void 0)}else{m+=1;let k=c(S(o,w.newIndex));k.classList.add("md-diff-item-new"),u(k,m)}return d}#i(e,t){let n=f=>[...f.children].find(h=>h.tagName==="UL"||h.tagName==="OL"||h.tagName==="TABLE"),r=n(e),o=n(t);if(!r||!o||r.tagName!==o.tagName)return null;let s=(f,h)=>{let c=f.cloneNode(!0);return[...c.children].find(u=>u.tagName===h.tagName)?.remove(),(c.textContent??"").trim().replace(/\s+/g," ")};if(s(e,r)!==s(t,o))return null;let l=this.#t(r,o,!1);if(!l)return null;let a=t.cloneNode(!0),d=[...a.children].find(f=>f.tagName===o.tagName);return d?(d.replaceWith(l),a):null}#r(e,t,n,r){let o=document.createElement("section");return o.className=`md-diff-change-card md-diff-change-card-${e}`,o.dataset.diffMarker=t,n&&(o.title=`${n.kind} \xB7 ${this.#h(n,e)}`,o.setAttribute("aria-label",this.#h(n,e))),o.appendChild(this.#a(n,r)),o}#a(e,t=0){let n=document.createElement("div");if(n.className="md-diff-rendered",!e){let r=document.createElement("div");return r.className="md-diff-placeholder",r.setAttribute("aria-hidden","true"),n.appendChild(r),n}return n.dataset.mdBlockKind=e.kind,n.dataset.mdSectionDepth=String(t),t>0&&(n.classList.add("md-diff-rendered-sectioned"),n.style.setProperty("--md-diff-section-indent",`${t*10}px`),n.style.setProperty("--md-diff-section-indent-wide",`${t*14}px`)),n.innerHTML=e.html||"",n}#u(e){let t=document.createElement("div");return t.className="md-diff-diagnostics",t.textContent=e.map(n=>n.message).join(" \xB7 "),t}#o(e,t,n){return n?this.#m(e)[t].get(n.index)??0:0}#m(e){let t=this.#n.get(e);if(t)return t;let n={old:this.#p(e.old),new:this.#p(e.new)};return this.#n.set(e,n),n}#p(e){let t=new Map,n=[];for(let r of e?.blocks||[]){let o=this.#w(r);if(o!==null){for(;n.length&&(n[n.length-1]||0)>=o;)n.pop();t.set(r.index,n.length),n.push(o)}else t.set(r.index,n.length)}return t}#w(e){if(e.kind!=="heading")return null;let t=/^H([1-6])$/.exec(e.label||"");return t?Number(t[1]):1}#d(e){let t=e?.source||e?.text||"";return t?t.split(`
`).length:1}#h(e,t){let n=e.start_line?e.end_line&&e.end_line!==e.start_line?`L${e.start_line}-L${e.end_line}`:`L${e.start_line}`:`#${e.index+1}`;return`${t} \xB7 ${n}`}},le=new WeakMap,T=i=>{let e=le.get(i);return e||(e=new H(i),le.set(i,e)),e},ae=(i=document.querySelector("[data-markdown-diff]"))=>{i&&T(i).load()},He=(i,e=document.querySelector("[data-markdown-diff]"))=>{e&&T(e).selectPath(i||null)},de=()=>{document.querySelectorAll("[data-markdown-diff]").forEach(e=>{T(e),e.dataset.diffAutoload!=="false"&&ae(e)}),window.markonMarkdownDiff={load:()=>ae(),selectPath:e=>He(e),scrollToPath:e=>{let t=document.querySelector("[data-markdown-diff]");t&&T(t).scrollToPath(e)},topAnchor:()=>{let e=document.querySelector("[data-markdown-diff]");return e?T(e).topAnchor():null},anchorTo:e=>{let t=document.querySelector("[data-markdown-diff]");t&&T(t).anchorTo(e)}};let i=null;window.addEventListener("resize",()=>{i!==null&&window.clearTimeout(i),i=window.setTimeout(()=>{document.querySelectorAll("[data-markdown-diff]").forEach(e=>T(e).syncLayout())},120)})};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",de,{once:!0}):de();export{H as MarkdownDiffPage};