From f8a67a62fa3dbc4100c9cb6befd50ae11d09a964 Mon Sep 17 00:00:00 2001
From: Ying Zhong <0x00eeee@gmail.com>
Date: Tue, 23 Jun 2026 16:23:48 +0800
Subject: [PATCH] Remove cursor: pointer to be more native-like
---
dist/lite/markedit-preview.js | 10 ++++++----
dist/markedit-preview.js | 10 ++++++----
styles/main.css | 7 +++++--
styles/quicklook.css | 1 -
4 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/dist/lite/markedit-preview.js b/dist/lite/markedit-preview.js
index 7e56a1c..8acd866 100644
--- a/dist/lite/markedit-preview.js
+++ b/dist/lite/markedit-preview.js
@@ -1772,7 +1772,12 @@ ${e}
- `}}),Sl=new DOMParser,Fl="image-loader",uu="cm-md-image-preview",Ou=5;function Yt(e){const n=Sl.parseFromString(e,"text/html");return n.querySelectorAll("img").forEach(u=>{const o=u.getAttribute("src");o!==null&&(o.includes("://")||o.startsWith("data:image/")||(u.src=`${Fl}://${o}`))}),n.body.innerHTML}function Tl(e){typeof H.MarkEdit.getFileInfo=="function"&&(document.addEventListener("mousemove",n=>{Me.panelPresenter!==void 0&&(clearTimeout(Me.panelPresenter),Me.panelPresenter=void 0),Me.panelPresenter=setTimeout(()=>{const r=n.target,u=r?.closest(".cm-md-link"),o=u?.dataset.linkUrl??u?.innerText??"";u!==null&&wo(o)?Ml(u,o):r?.classList.contains(uu)||mn()},600)}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&mn(!1)}),e.addEventListener("scroll",()=>mn()))}async function Ml(e,n){if(e===Me.focusedElement)return;const r=(await H.MarkEdit.getFileInfo())?.parentPath;if(r===void 0)return;const u=Ye(r,n),o=await H.MarkEdit.getFileObject(u);if(o===void 0)return;const a=e.getBoundingClientRect(),c=document.createElement("img");c.className=uu,c.style.position="fixed",c.style.left=`${a.left}px`,c.style.zIndex="10000",c.style.borderRadius="5px",c.style.opacity="0",c.style.transition="opacity 120ms",c.style.cursor="pointer",c.onclick=()=>{mn(),window.open(n,"_blank")},c.onload=()=>{const s=Math.min(c.naturalHeight,240);c.style.height=`${s}px`;const f=a.top,b=window.innerHeight-a.bottom;f>b?c.style.top=`${a.top-s-Ou}px`:c.style.top=`${a.bottom+Ou}px`,requestAnimationFrame(()=>{c.style.opacity="1"})};const i=o.mimeType??"image/png";c.src=`data:${i};base64,${o.data}`,mn(!1),Me.focusedElement=e,document.body.appendChild(c)}function mn(e=!0){Me.focusedElement!==void 0&&(Me.focusedElement=void 0,document.querySelectorAll(`.${uu}`).forEach(n=>{e?(n.style.opacity="0",n.addEventListener("transitionend",()=>n.remove(),{once:!0})):n.remove()}))}const Me={panelPresenter:void 0,focusedElement:void 0};function Il(e,n){if(!Wc)return;Ve.lastSourceScrollTop=e.scrollTop;const r=()=>{Math.abs(e.scrollTop-Ve.lastSourceScrollTop)<.5||(Ve.lastSourceScrollTop=e.scrollTop,Kt(e,n))};"onscrollend"in window?e.addEventListener("scrollend",r):e.addEventListener("scroll",()=>{Ve.scrollUpdater!==void 0&&clearTimeout(Ve.scrollUpdater),Ve.scrollUpdater=setTimeout(r,100)})}function Kt(e,n,r=!0){const{line:u,progress:o}=Rl(e);Ll(n,u,o,r)}function Rl(e,n=0){const r=H.MarkEdit.editorView,u=r.lineBlockAtHeight(e.scrollTop+n),o=r.state.doc.lineAt(u.from).number-1,a=yo(r.domAtPos(u.from).node);if(a===null)return{line:o,progress:0};const c=e.getBoundingClientRect(),i=a.getBoundingClientRect(),s=c.top-i.top-n,f=i.height>0?tu(s/i.height):0;return{line:o,progress:f}}function Ll(e,n,r,u=!0){if(n===0&&r===0)return Zn(e,0,u);const o=Array.from(document.querySelectorAll("[data-line-from]")),a=Ol(o,n);if(a!==void 0){const{from:s,to:f}=Je(a);return kr(e,a,Nl(n,r,s,f),u)}if(n===0)return Zn(e,0,u);const{beforeBlock:c,afterBlock:i}=zl(o,n);if(c!==void 0&&i!==void 0){const s=Je(c),f=Je(i),b=Rr(e,c)+c.offsetHeight,l=Rr(e,i),d=f.from-s.to,h=n-s.to+r,m=d>0?tu(h/d):0,g=b+(l-b)*m;return Zn(e,g,u)}if(c!==void 0)return kr(e,c,1,u);if(i!==void 0)return kr(e,i,0,u)}function Ol(e,n){return e.find(r=>{const{from:u,to:o}=Je(r);return n>=u&&n<=o})}function Nl(e,n,r,u){const o=u-r;if(o<1)return e===r?n:0;const a=e-r+n;return tu(a/o)}function zl(e,n){let r,u;for(const o of e){const{from:a,to:c}=Je(o);if(cn){u=o;break}}return{beforeBlock:r,afterBlock:u}}function tu(e){return Math.max(0,Math.min(1,e))}const Ve={lastSourceScrollTop:0,scrollUpdater:void 0};function Pl(e){const n=e.match(/^((?:\s{0,3}>\s*)*\s*(?:[-*+]|\d+[.)])\s+\[)([ xX])\](?= )/);return n===null?null:{offset:n[1].length,replacement:n[2]===" "?"x":" "}}const qe={containerClass:"markdown-container",gutterViewClass:"markdown-gutter",dividerViewClass:"markdown-divider",previewPaneClass:"markdown-body",updatePillClass:"markdown-update-pill"},lr={viewModeCacheKey:"ui.view-mode",previewPageZoomKey:"ui.preview-page-zoom"};var Tr=function(e,n){return Number(e.slice(0,-1*n.length))},ql=function(e){return e.endsWith("px")?{value:e,type:"px",numeric:Tr(e,"px")}:e.endsWith("fr")?{value:e,type:"fr",numeric:Tr(e,"fr")}:e.endsWith("%")?{value:e,type:"%",numeric:Tr(e,"%")}:e==="auto"?{value:e,type:"auto"}:null},Jt=function(e){return e.split(" ").map(ql)},Bl=function(e,n,r,u){r===void 0&&(r=0),u===void 0&&(u=!1);var o=u?e+1:e,a=n.slice(0,o).reduce(function(i,s){return i+s.numeric},0),c=r?e*r:0;return a+c},Qt=function(e,n,r){return n.concat(r).map(function(u){return u.style[e]}).filter(function(u){return u!==void 0&&u!==""})},jl=function(e,n){return n.endsWith(e)?Number(n.slice(0,-1*e.length)):null},Nu=function(e){for(var n=0;n0)return n;return null},Be=function(){return!1},Hl=function(e,n,r){e.style[n]=r},K=function(e,n,r){var u=e[n];return u!==void 0?u:r};function Xt(e){var n;return(n=[]).concat.apply(n,Array.from(e.ownerDocument.styleSheets).map(function(r){var u=[];try{u=Array.from(r.cssRules||[])}catch{}return u})).filter(function(r){var u=!1;try{u=e.matches(r.selectorText)}catch{}return u})}var $l="grid-template-columns",Ul="grid-template-rows",re=function(n,r,u){this.direction=n,this.element=r.element,this.track=r.track,n==="column"?(this.gridTemplateProp=$l,this.gridGapProp="grid-column-gap",this.cursor=K(u,"columnCursor",K(u,"cursor","col-resize")),this.snapOffset=K(u,"columnSnapOffset",K(u,"snapOffset",30)),this.dragInterval=K(u,"columnDragInterval",K(u,"dragInterval",1)),this.clientAxis="clientX",this.optionStyle=K(u,"gridTemplateColumns")):n==="row"&&(this.gridTemplateProp=Ul,this.gridGapProp="grid-row-gap",this.cursor=K(u,"rowCursor",K(u,"cursor","row-resize")),this.snapOffset=K(u,"rowSnapOffset",K(u,"snapOffset",30)),this.dragInterval=K(u,"rowDragInterval",K(u,"dragInterval",1)),this.clientAxis="clientY",this.optionStyle=K(u,"gridTemplateRows")),this.onDragStart=K(u,"onDragStart",Be),this.onDragEnd=K(u,"onDragEnd",Be),this.onDrag=K(u,"onDrag",Be),this.writeStyle=K(u,"writeStyle",Hl),this.startDragging=this.startDragging.bind(this),this.stopDragging=this.stopDragging.bind(this),this.drag=this.drag.bind(this),this.minSizeStart=r.minSizeStart,this.minSizeEnd=r.minSizeEnd,r.element&&(this.element.addEventListener("mousedown",this.startDragging),this.element.addEventListener("touchstart",this.startDragging))};re.prototype.getDimensions=function(){var n=this.grid.getBoundingClientRect(),r=n.width,u=n.height,o=n.top,a=n.bottom,c=n.left,i=n.right;this.direction==="column"?(this.start=o,this.end=a,this.size=u):this.direction==="row"&&(this.start=c,this.end=i,this.size=r)};re.prototype.getSizeAtTrack=function(n,r){return Bl(n,this.computedPixels,this.computedGapPixels,r)};re.prototype.getSizeOfTrack=function(n){return this.computedPixels[n].numeric};re.prototype.getRawTracks=function(){var n=Qt(this.gridTemplateProp,[this.grid],Xt(this.grid));if(!n.length){if(this.optionStyle)return this.optionStyle;throw Error("Unable to determine grid template tracks from styles.")}return n[0]};re.prototype.getGap=function(){var n=Qt(this.gridGapProp,[this.grid],Xt(this.grid));return n.length?n[0]:null};re.prototype.getRawComputedTracks=function(){return window.getComputedStyle(this.grid)[this.gridTemplateProp]};re.prototype.getRawComputedGap=function(){return window.getComputedStyle(this.grid)[this.gridGapProp]};re.prototype.setTracks=function(n){this.tracks=n.split(" "),this.trackValues=Jt(n)};re.prototype.setComputedTracks=function(n){this.computedTracks=n.split(" "),this.computedPixels=Jt(n)};re.prototype.setGap=function(n){this.gap=n};re.prototype.setComputedGap=function(n){this.computedGap=n,this.computedGapPixels=jl("px",this.computedGap)||0};re.prototype.getMousePosition=function(n){return"touches"in n?n.touches[0][this.clientAxis]:n[this.clientAxis]};re.prototype.startDragging=function(n){if(!("button"in n&&n.button!==0)){n.preventDefault(),this.element?this.grid=this.element.parentNode:this.grid=n.target.parentNode,this.getDimensions(),this.setTracks(this.getRawTracks()),this.setComputedTracks(this.getRawComputedTracks()),this.setGap(this.getGap()),this.setComputedGap(this.getRawComputedGap());var r=this.trackValues.filter(function(i){return i.type==="%"}),u=this.trackValues.filter(function(i){return i.type==="fr"});if(this.totalFrs=u.length,this.totalFrs){var o=Nu(u);o!==null&&(this.frToPixels=this.computedPixels[o].numeric/u[o].numeric)}if(r.length){var a=Nu(r);a!==null&&(this.percentageToPixels=this.computedPixels[a].numeric/r[a].numeric)}var c=this.getSizeAtTrack(this.track,!1)+this.start;if(this.dragStartOffset=this.getMousePosition(n)-c,this.aTrack=this.track-1,this.tracki&&(r=a),ra&&(r=a);var s=r-this.aTrackStart-this.dragStartOffset-this.computedGapPixels,f=this.bTrackEnd-r+this.dragStartOffset-u-this.computedGapPixels;if(this.dragInterval>1){var b=Math.round(s/this.dragInterval)*this.dragInterval;f-=b-s,s=b}if(s`}}),Sl=new DOMParser,Fl="image-loader",uu="cm-md-image-preview",Ou=5;function Yt(e){const n=Sl.parseFromString(e,"text/html");return n.querySelectorAll("img").forEach(u=>{const o=u.getAttribute("src");o!==null&&(o.includes("://")||o.startsWith("data:image/")||(u.src=`${Fl}://${o}`))}),n.body.innerHTML}function Tl(e){typeof H.MarkEdit.getFileInfo=="function"&&(document.addEventListener("mousemove",n=>{Me.panelPresenter!==void 0&&(clearTimeout(Me.panelPresenter),Me.panelPresenter=void 0),Me.panelPresenter=setTimeout(()=>{const r=n.target,u=r?.closest(".cm-md-link"),o=u?.dataset.linkUrl??u?.innerText??"";u!==null&&wo(o)?Ml(u,o):r?.classList.contains(uu)||mn()},600)}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&mn(!1)}),e.addEventListener("scroll",()=>mn()))}async function Ml(e,n){if(e===Me.focusedElement)return;const r=(await H.MarkEdit.getFileInfo())?.parentPath;if(r===void 0)return;const u=Ye(r,n),o=await H.MarkEdit.getFileObject(u);if(o===void 0)return;const a=e.getBoundingClientRect(),c=document.createElement("img");c.className=uu,c.style.position="fixed",c.style.left=`${a.left}px`,c.style.zIndex="10000",c.style.borderRadius="5px",c.style.opacity="0",c.style.transition="opacity 120ms",c.style.cursor="pointer",c.onclick=()=>{mn(),window.open(n,"_blank")},c.onload=()=>{const s=Math.min(c.naturalHeight,240);c.style.height=`${s}px`;const f=a.top,b=window.innerHeight-a.bottom;f>b?c.style.top=`${a.top-s-Ou}px`:c.style.top=`${a.bottom+Ou}px`,requestAnimationFrame(()=>{c.style.opacity="1"})};const i=o.mimeType??"image/png";c.src=`data:${i};base64,${o.data}`,mn(!1),Me.focusedElement=e,document.body.appendChild(c)}function mn(e=!0){Me.focusedElement!==void 0&&(Me.focusedElement=void 0,document.querySelectorAll(`.${uu}`).forEach(n=>{e?(n.style.opacity="0",n.addEventListener("transitionend",()=>n.remove(),{once:!0})):n.remove()}))}const Me={panelPresenter:void 0,focusedElement:void 0};function Il(e,n){if(!Wc)return;Ve.lastSourceScrollTop=e.scrollTop;const r=()=>{Math.abs(e.scrollTop-Ve.lastSourceScrollTop)<.5||(Ve.lastSourceScrollTop=e.scrollTop,Kt(e,n))};"onscrollend"in window?e.addEventListener("scrollend",r):e.addEventListener("scroll",()=>{Ve.scrollUpdater!==void 0&&clearTimeout(Ve.scrollUpdater),Ve.scrollUpdater=setTimeout(r,100)})}function Kt(e,n,r=!0){const{line:u,progress:o}=Rl(e);Ll(n,u,o,r)}function Rl(e,n=0){const r=H.MarkEdit.editorView,u=r.lineBlockAtHeight(e.scrollTop+n),o=r.state.doc.lineAt(u.from).number-1,a=yo(r.domAtPos(u.from).node);if(a===null)return{line:o,progress:0};const c=e.getBoundingClientRect(),i=a.getBoundingClientRect(),s=c.top-i.top-n,f=i.height>0?tu(s/i.height):0;return{line:o,progress:f}}function Ll(e,n,r,u=!0){if(n===0&&r===0)return Zn(e,0,u);const o=Array.from(document.querySelectorAll("[data-line-from]")),a=Ol(o,n);if(a!==void 0){const{from:s,to:f}=Je(a);return kr(e,a,Nl(n,r,s,f),u)}if(n===0)return Zn(e,0,u);const{beforeBlock:c,afterBlock:i}=zl(o,n);if(c!==void 0&&i!==void 0){const s=Je(c),f=Je(i),b=Rr(e,c)+c.offsetHeight,l=Rr(e,i),d=f.from-s.to,h=n-s.to+r,m=d>0?tu(h/d):0,g=b+(l-b)*m;return Zn(e,g,u)}if(c!==void 0)return kr(e,c,1,u);if(i!==void 0)return kr(e,i,0,u)}function Ol(e,n){return e.find(r=>{const{from:u,to:o}=Je(r);return n>=u&&n<=o})}function Nl(e,n,r,u){const o=u-r;if(o<1)return e===r?n:0;const a=e-r+n;return tu(a/o)}function zl(e,n){let r,u;for(const o of e){const{from:a,to:c}=Je(o);if(cn){u=o;break}}return{beforeBlock:r,afterBlock:u}}function tu(e){return Math.max(0,Math.min(1,e))}const Ve={lastSourceScrollTop:0,scrollUpdater:void 0};function Pl(e){const n=e.match(/^((?:\s{0,3}>\s*)*\s*(?:[-*+]|\d+[.)])\s+\[)([ xX])\](?= )/);return n===null?null:{offset:n[1].length,replacement:n[2]===" "?"x":" "}}const qe={containerClass:"markdown-container",gutterViewClass:"markdown-gutter",dividerViewClass:"markdown-divider",previewPaneClass:"markdown-body",updatePillClass:"markdown-update-pill"},lr={viewModeCacheKey:"ui.view-mode",previewPageZoomKey:"ui.preview-page-zoom"};var Tr=function(e,n){return Number(e.slice(0,-1*n.length))},ql=function(e){return e.endsWith("px")?{value:e,type:"px",numeric:Tr(e,"px")}:e.endsWith("fr")?{value:e,type:"fr",numeric:Tr(e,"fr")}:e.endsWith("%")?{value:e,type:"%",numeric:Tr(e,"%")}:e==="auto"?{value:e,type:"auto"}:null},Jt=function(e){return e.split(" ").map(ql)},Bl=function(e,n,r,u){r===void 0&&(r=0),u===void 0&&(u=!1);var o=u?e+1:e,a=n.slice(0,o).reduce(function(i,s){return i+s.numeric},0),c=r?e*r:0;return a+c},Qt=function(e,n,r){return n.concat(r).map(function(u){return u.style[e]}).filter(function(u){return u!==void 0&&u!==""})},jl=function(e,n){return n.endsWith(e)?Number(n.slice(0,-1*e.length)):null},Nu=function(e){for(var n=0;n0)return n;return null},Be=function(){return!1},Hl=function(e,n,r){e.style[n]=r},K=function(e,n,r){var u=e[n];return u!==void 0?u:r};function Xt(e){var n;return(n=[]).concat.apply(n,Array.from(e.ownerDocument.styleSheets).map(function(r){var u=[];try{u=Array.from(r.cssRules||[])}catch{}return u})).filter(function(r){var u=!1;try{u=e.matches(r.selectorText)}catch{}return u})}var $l="grid-template-columns",Ul="grid-template-rows",re=function(n,r,u){this.direction=n,this.element=r.element,this.track=r.track,n==="column"?(this.gridTemplateProp=$l,this.gridGapProp="grid-column-gap",this.cursor=K(u,"columnCursor",K(u,"cursor","col-resize")),this.snapOffset=K(u,"columnSnapOffset",K(u,"snapOffset",30)),this.dragInterval=K(u,"columnDragInterval",K(u,"dragInterval",1)),this.clientAxis="clientX",this.optionStyle=K(u,"gridTemplateColumns")):n==="row"&&(this.gridTemplateProp=Ul,this.gridGapProp="grid-row-gap",this.cursor=K(u,"rowCursor",K(u,"cursor","row-resize")),this.snapOffset=K(u,"rowSnapOffset",K(u,"snapOffset",30)),this.dragInterval=K(u,"rowDragInterval",K(u,"dragInterval",1)),this.clientAxis="clientY",this.optionStyle=K(u,"gridTemplateRows")),this.onDragStart=K(u,"onDragStart",Be),this.onDragEnd=K(u,"onDragEnd",Be),this.onDrag=K(u,"onDrag",Be),this.writeStyle=K(u,"writeStyle",Hl),this.startDragging=this.startDragging.bind(this),this.stopDragging=this.stopDragging.bind(this),this.drag=this.drag.bind(this),this.minSizeStart=r.minSizeStart,this.minSizeEnd=r.minSizeEnd,r.element&&(this.element.addEventListener("mousedown",this.startDragging),this.element.addEventListener("touchstart",this.startDragging))};re.prototype.getDimensions=function(){var n=this.grid.getBoundingClientRect(),r=n.width,u=n.height,o=n.top,a=n.bottom,c=n.left,i=n.right;this.direction==="column"?(this.start=o,this.end=a,this.size=u):this.direction==="row"&&(this.start=c,this.end=i,this.size=r)};re.prototype.getSizeAtTrack=function(n,r){return Bl(n,this.computedPixels,this.computedGapPixels,r)};re.prototype.getSizeOfTrack=function(n){return this.computedPixels[n].numeric};re.prototype.getRawTracks=function(){var n=Qt(this.gridTemplateProp,[this.grid],Xt(this.grid));if(!n.length){if(this.optionStyle)return this.optionStyle;throw Error("Unable to determine grid template tracks from styles.")}return n[0]};re.prototype.getGap=function(){var n=Qt(this.gridGapProp,[this.grid],Xt(this.grid));return n.length?n[0]:null};re.prototype.getRawComputedTracks=function(){return window.getComputedStyle(this.grid)[this.gridTemplateProp]};re.prototype.getRawComputedGap=function(){return window.getComputedStyle(this.grid)[this.gridGapProp]};re.prototype.setTracks=function(n){this.tracks=n.split(" "),this.trackValues=Jt(n)};re.prototype.setComputedTracks=function(n){this.computedTracks=n.split(" "),this.computedPixels=Jt(n)};re.prototype.setGap=function(n){this.gap=n};re.prototype.setComputedGap=function(n){this.computedGap=n,this.computedGapPixels=jl("px",this.computedGap)||0};re.prototype.getMousePosition=function(n){return"touches"in n?n.touches[0][this.clientAxis]:n[this.clientAxis]};re.prototype.startDragging=function(n){if(!("button"in n&&n.button!==0)){n.preventDefault(),this.element?this.grid=this.element.parentNode:this.grid=n.target.parentNode,this.getDimensions(),this.setTracks(this.getRawTracks()),this.setComputedTracks(this.getRawComputedTracks()),this.setGap(this.getGap()),this.setComputedGap(this.getRawComputedGap());var r=this.trackValues.filter(function(i){return i.type==="%"}),u=this.trackValues.filter(function(i){return i.type==="fr"});if(this.totalFrs=u.length,this.totalFrs){var o=Nu(u);o!==null&&(this.frToPixels=this.computedPixels[o].numeric/u[o].numeric)}if(r.length){var a=Nu(r);a!==null&&(this.percentageToPixels=this.computedPixels[a].numeric/r[a].numeric)}var c=this.getSizeAtTrack(this.track,!1)+this.start;if(this.dragStartOffset=this.getMousePosition(n)-c,this.aTrack=this.track-1,this.tracki&&(r=a),ra&&(r=a);var s=r-this.aTrackStart-this.dragStartOffset-this.computedGapPixels,f=this.bTrackEnd-r+this.dragStartOffset-u-this.computedGapPixels;if(this.dragInterval>1){var b=Math.round(s/this.dragInterval)*this.dragInterval;f-=b-s,s=b}if(s
- `}}),yDe=new DOMParser,vDe="image-loader",Hz="cm-md-image-preview",EK=5;function Uce(t){const e=yDe.parseFromString(t,"text/html");return e.querySelectorAll("img").forEach(n=>{const i=n.getAttribute("src");i!==null&&(i.includes("://")||i.startsWith("data:image/")||(n.src=`${vDe}://${i}`))}),e.body.innerHTML}function _De(t){typeof Yr.MarkEdit.getFileInfo=="function"&&(document.addEventListener("mousemove",e=>{Ld.panelPresenter!==void 0&&(clearTimeout(Ld.panelPresenter),Ld.panelPresenter=void 0),Ld.panelPresenter=setTimeout(()=>{const r=e.target,n=r?.closest(".cm-md-link"),i=n?.dataset.linkUrl??n?.innerText??"";n!==null&&sNe(i)?bDe(n,i):r?.classList.contains(Hz)||zE()},600)}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&zE(!1)}),t.addEventListener("scroll",()=>zE()))}async function bDe(t,e){if(t===Ld.focusedElement)return;const r=(await Yr.MarkEdit.getFileInfo())?.parentPath;if(r===void 0)return;const n=Em(r,e),i=await Yr.MarkEdit.getFileObject(n);if(i===void 0)return;const a=t.getBoundingClientRect(),s=document.createElement("img");s.className=Hz,s.style.position="fixed",s.style.left=`${a.left}px`,s.style.zIndex="10000",s.style.borderRadius="5px",s.style.opacity="0",s.style.transition="opacity 120ms",s.style.cursor="pointer",s.onclick=()=>{zE(),window.open(e,"_blank")},s.onload=()=>{const l=Math.min(s.naturalHeight,240);s.style.height=`${l}px`;const u=a.top,d=window.innerHeight-a.bottom;u>d?s.style.top=`${a.top-l-EK}px`:s.style.top=`${a.bottom+EK}px`,requestAnimationFrame(()=>{s.style.opacity="1"})};const o=i.mimeType??"image/png";s.src=`data:${o};base64,${i.data}`,zE(!1),Ld.focusedElement=t,document.body.appendChild(s)}function zE(t=!0){Ld.focusedElement!==void 0&&(Ld.focusedElement=void 0,document.querySelectorAll(`.${Hz}`).forEach(e=>{t?(e.style.opacity="0",e.addEventListener("transitionend",()=>e.remove(),{once:!0})):e.remove()}))}const Ld={panelPresenter:void 0,focusedElement:void 0};function EDe(t,e){if(!D9e)return;Og.lastSourceScrollTop=t.scrollTop;const r=()=>{Math.abs(t.scrollTop-Og.lastSourceScrollTop)<.5||(Og.lastSourceScrollTop=t.scrollTop,Gce(t,e))};"onscrollend"in window?t.addEventListener("scrollend",r):t.addEventListener("scroll",()=>{Og.scrollUpdater!==void 0&&clearTimeout(Og.scrollUpdater),Og.scrollUpdater=setTimeout(r,100)})}function Gce(t,e,r=!0){const{line:n,progress:i}=SDe(t);TDe(e,n,i,r)}function SDe(t,e=0){const r=Yr.MarkEdit.editorView,n=r.lineBlockAtHeight(t.scrollTop+e),i=r.state.doc.lineAt(n.from).number-1,a=iNe(r.domAtPos(n.from).node);if(a===null)return{line:i,progress:0};const s=t.getBoundingClientRect(),o=a.getBoundingClientRect(),l=s.top-o.top-e,u=o.height>0?Vz(l/o.height):0;return{line:i,progress:u}}function TDe(t,e,r,n=!0){if(e===0&&r===0)return B3(t,0,n);const i=Array.from(document.querySelectorAll("[data-line-from]")),a=xDe(i,e);if(a!==void 0){const{from:l,to:u}=Um(a);return g8(t,a,CDe(e,r,l,u),n)}if(e===0)return B3(t,0,n);const{beforeBlock:s,afterBlock:o}=wDe(i,e);if(s!==void 0&&o!==void 0){const l=Um(s),u=Um(o),d=nM(t,s)+s.offsetHeight,h=nM(t,o),f=u.from-l.to,p=e-l.to+r,g=f>0?Vz(p/f):0,m=d+(h-d)*g;return B3(t,m,n)}if(s!==void 0)return g8(t,s,1,n);if(o!==void 0)return g8(t,o,0,n)}function xDe(t,e){return t.find(r=>{const{from:n,to:i}=Um(r);return e>=n&&e<=i})}function CDe(t,e,r,n){const i=n-r;if(i<1)return t===r?e:0;const a=t-r+e;return Vz(a/i)}function wDe(t,e){let r,n;for(const i of t){const{from:a,to:s}=Um(i);if(se){n=i;break}}return{beforeBlock:r,afterBlock:n}}function Vz(t){return Math.max(0,Math.min(1,t))}const Og={lastSourceScrollTop:0,scrollUpdater:void 0};function kDe(t){const e=t.match(/^((?:\s{0,3}>\s*)*\s*(?:[-*+]|\d+[.)])\s+\[)([ xX])\](?= )/);return e===null?null:{offset:e[1].length,replacement:e[2]===" "?"x":" "}}const cp={containerClass:"markdown-container",gutterViewClass:"markdown-gutter",dividerViewClass:"markdown-divider",previewPaneClass:"markdown-body",updatePillClass:"markdown-update-pill"},Qw={viewModeCacheKey:"ui.view-mode",previewPageZoomKey:"ui.preview-page-zoom"};var w8=function(t,e){return Number(t.slice(0,-1*e.length))},ADe=function(t){return t.endsWith("px")?{value:t,type:"px",numeric:w8(t,"px")}:t.endsWith("fr")?{value:t,type:"fr",numeric:w8(t,"fr")}:t.endsWith("%")?{value:t,type:"%",numeric:w8(t,"%")}:t==="auto"?{value:t,type:"auto"}:null},qce=function(t){return t.split(" ").map(ADe)},RDe=function(t,e,r,n){r===void 0&&(r=0),n===void 0&&(n=!1);var i=n?t+1:t,a=e.slice(0,i).reduce(function(o,l){return o+l.numeric},0),s=r?t*r:0;return a+s},Yce=function(t,e,r){return e.concat(r).map(function(n){return n.style[t]}).filter(function(n){return n!==void 0&&n!==""})},NDe=function(t,e){return e.endsWith(t)?Number(e.slice(0,-1*t.length)):null},SK=function(t){for(var e=0;e0)return e;return null},up=function(){return!1},IDe=function(t,e,r){t.style[e]=r},Pi=function(t,e,r){var n=t[e];return n!==void 0?n:r};function Hce(t){var e;return(e=[]).concat.apply(e,Array.from(t.ownerDocument.styleSheets).map(function(r){var n=[];try{n=Array.from(r.cssRules||[])}catch{}return n})).filter(function(r){var n=!1;try{n=t.matches(r.selectorText)}catch{}return n})}var ODe="grid-template-columns",DDe="grid-template-rows",$a=function(e,r,n){this.direction=e,this.element=r.element,this.track=r.track,e==="column"?(this.gridTemplateProp=ODe,this.gridGapProp="grid-column-gap",this.cursor=Pi(n,"columnCursor",Pi(n,"cursor","col-resize")),this.snapOffset=Pi(n,"columnSnapOffset",Pi(n,"snapOffset",30)),this.dragInterval=Pi(n,"columnDragInterval",Pi(n,"dragInterval",1)),this.clientAxis="clientX",this.optionStyle=Pi(n,"gridTemplateColumns")):e==="row"&&(this.gridTemplateProp=DDe,this.gridGapProp="grid-row-gap",this.cursor=Pi(n,"rowCursor",Pi(n,"cursor","row-resize")),this.snapOffset=Pi(n,"rowSnapOffset",Pi(n,"snapOffset",30)),this.dragInterval=Pi(n,"rowDragInterval",Pi(n,"dragInterval",1)),this.clientAxis="clientY",this.optionStyle=Pi(n,"gridTemplateRows")),this.onDragStart=Pi(n,"onDragStart",up),this.onDragEnd=Pi(n,"onDragEnd",up),this.onDrag=Pi(n,"onDrag",up),this.writeStyle=Pi(n,"writeStyle",IDe),this.startDragging=this.startDragging.bind(this),this.stopDragging=this.stopDragging.bind(this),this.drag=this.drag.bind(this),this.minSizeStart=r.minSizeStart,this.minSizeEnd=r.minSizeEnd,r.element&&(this.element.addEventListener("mousedown",this.startDragging),this.element.addEventListener("touchstart",this.startDragging))};$a.prototype.getDimensions=function(){var e=this.grid.getBoundingClientRect(),r=e.width,n=e.height,i=e.top,a=e.bottom,s=e.left,o=e.right;this.direction==="column"?(this.start=i,this.end=a,this.size=n):this.direction==="row"&&(this.start=s,this.end=o,this.size=r)};$a.prototype.getSizeAtTrack=function(e,r){return RDe(e,this.computedPixels,this.computedGapPixels,r)};$a.prototype.getSizeOfTrack=function(e){return this.computedPixels[e].numeric};$a.prototype.getRawTracks=function(){var e=Yce(this.gridTemplateProp,[this.grid],Hce(this.grid));if(!e.length){if(this.optionStyle)return this.optionStyle;throw Error("Unable to determine grid template tracks from styles.")}return e[0]};$a.prototype.getGap=function(){var e=Yce(this.gridGapProp,[this.grid],Hce(this.grid));return e.length?e[0]:null};$a.prototype.getRawComputedTracks=function(){return window.getComputedStyle(this.grid)[this.gridTemplateProp]};$a.prototype.getRawComputedGap=function(){return window.getComputedStyle(this.grid)[this.gridGapProp]};$a.prototype.setTracks=function(e){this.tracks=e.split(" "),this.trackValues=qce(e)};$a.prototype.setComputedTracks=function(e){this.computedTracks=e.split(" "),this.computedPixels=qce(e)};$a.prototype.setGap=function(e){this.gap=e};$a.prototype.setComputedGap=function(e){this.computedGap=e,this.computedGapPixels=NDe("px",this.computedGap)||0};$a.prototype.getMousePosition=function(e){return"touches"in e?e.touches[0][this.clientAxis]:e[this.clientAxis]};$a.prototype.startDragging=function(e){if(!("button"in e&&e.button!==0)){e.preventDefault(),this.element?this.grid=this.element.parentNode:this.grid=e.target.parentNode,this.getDimensions(),this.setTracks(this.getRawTracks()),this.setComputedTracks(this.getRawComputedTracks()),this.setGap(this.getGap()),this.setComputedGap(this.getRawComputedGap());var r=this.trackValues.filter(function(o){return o.type==="%"}),n=this.trackValues.filter(function(o){return o.type==="fr"});if(this.totalFrs=n.length,this.totalFrs){var i=SK(n);i!==null&&(this.frToPixels=this.computedPixels[i].numeric/n[i].numeric)}if(r.length){var a=SK(r);a!==null&&(this.percentageToPixels=this.computedPixels[a].numeric/r[a].numeric)}var s=this.getSizeAtTrack(this.track,!1)+this.start;if(this.dragStartOffset=this.getMousePosition(e)-s,this.aTrack=this.track-1,this.tracko&&(r=a),ra&&(r=a);var l=r-this.aTrackStart-this.dragStartOffset-this.computedGapPixels,u=this.bTrackEnd-r+this.dragStartOffset-n-this.computedGapPixels;if(this.dragInterval>1){var d=Math.round(l/this.dragInterval)*this.dragInterval;u-=d-l,l=d}if(l`}}),yDe=new DOMParser,vDe="image-loader",Hz="cm-md-image-preview",EK=5;function Uce(t){const e=yDe.parseFromString(t,"text/html");return e.querySelectorAll("img").forEach(n=>{const i=n.getAttribute("src");i!==null&&(i.includes("://")||i.startsWith("data:image/")||(n.src=`${vDe}://${i}`))}),e.body.innerHTML}function _De(t){typeof Yr.MarkEdit.getFileInfo=="function"&&(document.addEventListener("mousemove",e=>{Ld.panelPresenter!==void 0&&(clearTimeout(Ld.panelPresenter),Ld.panelPresenter=void 0),Ld.panelPresenter=setTimeout(()=>{const r=e.target,n=r?.closest(".cm-md-link"),i=n?.dataset.linkUrl??n?.innerText??"";n!==null&&sNe(i)?bDe(n,i):r?.classList.contains(Hz)||zE()},600)}),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&zE(!1)}),t.addEventListener("scroll",()=>zE()))}async function bDe(t,e){if(t===Ld.focusedElement)return;const r=(await Yr.MarkEdit.getFileInfo())?.parentPath;if(r===void 0)return;const n=Em(r,e),i=await Yr.MarkEdit.getFileObject(n);if(i===void 0)return;const a=t.getBoundingClientRect(),s=document.createElement("img");s.className=Hz,s.style.position="fixed",s.style.left=`${a.left}px`,s.style.zIndex="10000",s.style.borderRadius="5px",s.style.opacity="0",s.style.transition="opacity 120ms",s.style.cursor="pointer",s.onclick=()=>{zE(),window.open(e,"_blank")},s.onload=()=>{const l=Math.min(s.naturalHeight,240);s.style.height=`${l}px`;const u=a.top,d=window.innerHeight-a.bottom;u>d?s.style.top=`${a.top-l-EK}px`:s.style.top=`${a.bottom+EK}px`,requestAnimationFrame(()=>{s.style.opacity="1"})};const o=i.mimeType??"image/png";s.src=`data:${o};base64,${i.data}`,zE(!1),Ld.focusedElement=t,document.body.appendChild(s)}function zE(t=!0){Ld.focusedElement!==void 0&&(Ld.focusedElement=void 0,document.querySelectorAll(`.${Hz}`).forEach(e=>{t?(e.style.opacity="0",e.addEventListener("transitionend",()=>e.remove(),{once:!0})):e.remove()}))}const Ld={panelPresenter:void 0,focusedElement:void 0};function EDe(t,e){if(!D9e)return;Og.lastSourceScrollTop=t.scrollTop;const r=()=>{Math.abs(t.scrollTop-Og.lastSourceScrollTop)<.5||(Og.lastSourceScrollTop=t.scrollTop,Gce(t,e))};"onscrollend"in window?t.addEventListener("scrollend",r):t.addEventListener("scroll",()=>{Og.scrollUpdater!==void 0&&clearTimeout(Og.scrollUpdater),Og.scrollUpdater=setTimeout(r,100)})}function Gce(t,e,r=!0){const{line:n,progress:i}=SDe(t);TDe(e,n,i,r)}function SDe(t,e=0){const r=Yr.MarkEdit.editorView,n=r.lineBlockAtHeight(t.scrollTop+e),i=r.state.doc.lineAt(n.from).number-1,a=iNe(r.domAtPos(n.from).node);if(a===null)return{line:i,progress:0};const s=t.getBoundingClientRect(),o=a.getBoundingClientRect(),l=s.top-o.top-e,u=o.height>0?Vz(l/o.height):0;return{line:i,progress:u}}function TDe(t,e,r,n=!0){if(e===0&&r===0)return B3(t,0,n);const i=Array.from(document.querySelectorAll("[data-line-from]")),a=xDe(i,e);if(a!==void 0){const{from:l,to:u}=Um(a);return g8(t,a,CDe(e,r,l,u),n)}if(e===0)return B3(t,0,n);const{beforeBlock:s,afterBlock:o}=wDe(i,e);if(s!==void 0&&o!==void 0){const l=Um(s),u=Um(o),d=nM(t,s)+s.offsetHeight,h=nM(t,o),f=u.from-l.to,p=e-l.to+r,g=f>0?Vz(p/f):0,m=d+(h-d)*g;return B3(t,m,n)}if(s!==void 0)return g8(t,s,1,n);if(o!==void 0)return g8(t,o,0,n)}function xDe(t,e){return t.find(r=>{const{from:n,to:i}=Um(r);return e>=n&&e<=i})}function CDe(t,e,r,n){const i=n-r;if(i<1)return t===r?e:0;const a=t-r+e;return Vz(a/i)}function wDe(t,e){let r,n;for(const i of t){const{from:a,to:s}=Um(i);if(se){n=i;break}}return{beforeBlock:r,afterBlock:n}}function Vz(t){return Math.max(0,Math.min(1,t))}const Og={lastSourceScrollTop:0,scrollUpdater:void 0};function kDe(t){const e=t.match(/^((?:\s{0,3}>\s*)*\s*(?:[-*+]|\d+[.)])\s+\[)([ xX])\](?= )/);return e===null?null:{offset:e[1].length,replacement:e[2]===" "?"x":" "}}const cp={containerClass:"markdown-container",gutterViewClass:"markdown-gutter",dividerViewClass:"markdown-divider",previewPaneClass:"markdown-body",updatePillClass:"markdown-update-pill"},Qw={viewModeCacheKey:"ui.view-mode",previewPageZoomKey:"ui.preview-page-zoom"};var w8=function(t,e){return Number(t.slice(0,-1*e.length))},ADe=function(t){return t.endsWith("px")?{value:t,type:"px",numeric:w8(t,"px")}:t.endsWith("fr")?{value:t,type:"fr",numeric:w8(t,"fr")}:t.endsWith("%")?{value:t,type:"%",numeric:w8(t,"%")}:t==="auto"?{value:t,type:"auto"}:null},qce=function(t){return t.split(" ").map(ADe)},RDe=function(t,e,r,n){r===void 0&&(r=0),n===void 0&&(n=!1);var i=n?t+1:t,a=e.slice(0,i).reduce(function(o,l){return o+l.numeric},0),s=r?t*r:0;return a+s},Yce=function(t,e,r){return e.concat(r).map(function(n){return n.style[t]}).filter(function(n){return n!==void 0&&n!==""})},NDe=function(t,e){return e.endsWith(t)?Number(e.slice(0,-1*t.length)):null},SK=function(t){for(var e=0;e0)return e;return null},up=function(){return!1},IDe=function(t,e,r){t.style[e]=r},Pi=function(t,e,r){var n=t[e];return n!==void 0?n:r};function Hce(t){var e;return(e=[]).concat.apply(e,Array.from(t.ownerDocument.styleSheets).map(function(r){var n=[];try{n=Array.from(r.cssRules||[])}catch{}return n})).filter(function(r){var n=!1;try{n=t.matches(r.selectorText)}catch{}return n})}var ODe="grid-template-columns",DDe="grid-template-rows",$a=function(e,r,n){this.direction=e,this.element=r.element,this.track=r.track,e==="column"?(this.gridTemplateProp=ODe,this.gridGapProp="grid-column-gap",this.cursor=Pi(n,"columnCursor",Pi(n,"cursor","col-resize")),this.snapOffset=Pi(n,"columnSnapOffset",Pi(n,"snapOffset",30)),this.dragInterval=Pi(n,"columnDragInterval",Pi(n,"dragInterval",1)),this.clientAxis="clientX",this.optionStyle=Pi(n,"gridTemplateColumns")):e==="row"&&(this.gridTemplateProp=DDe,this.gridGapProp="grid-row-gap",this.cursor=Pi(n,"rowCursor",Pi(n,"cursor","row-resize")),this.snapOffset=Pi(n,"rowSnapOffset",Pi(n,"snapOffset",30)),this.dragInterval=Pi(n,"rowDragInterval",Pi(n,"dragInterval",1)),this.clientAxis="clientY",this.optionStyle=Pi(n,"gridTemplateRows")),this.onDragStart=Pi(n,"onDragStart",up),this.onDragEnd=Pi(n,"onDragEnd",up),this.onDrag=Pi(n,"onDrag",up),this.writeStyle=Pi(n,"writeStyle",IDe),this.startDragging=this.startDragging.bind(this),this.stopDragging=this.stopDragging.bind(this),this.drag=this.drag.bind(this),this.minSizeStart=r.minSizeStart,this.minSizeEnd=r.minSizeEnd,r.element&&(this.element.addEventListener("mousedown",this.startDragging),this.element.addEventListener("touchstart",this.startDragging))};$a.prototype.getDimensions=function(){var e=this.grid.getBoundingClientRect(),r=e.width,n=e.height,i=e.top,a=e.bottom,s=e.left,o=e.right;this.direction==="column"?(this.start=i,this.end=a,this.size=n):this.direction==="row"&&(this.start=s,this.end=o,this.size=r)};$a.prototype.getSizeAtTrack=function(e,r){return RDe(e,this.computedPixels,this.computedGapPixels,r)};$a.prototype.getSizeOfTrack=function(e){return this.computedPixels[e].numeric};$a.prototype.getRawTracks=function(){var e=Yce(this.gridTemplateProp,[this.grid],Hce(this.grid));if(!e.length){if(this.optionStyle)return this.optionStyle;throw Error("Unable to determine grid template tracks from styles.")}return e[0]};$a.prototype.getGap=function(){var e=Yce(this.gridGapProp,[this.grid],Hce(this.grid));return e.length?e[0]:null};$a.prototype.getRawComputedTracks=function(){return window.getComputedStyle(this.grid)[this.gridTemplateProp]};$a.prototype.getRawComputedGap=function(){return window.getComputedStyle(this.grid)[this.gridGapProp]};$a.prototype.setTracks=function(e){this.tracks=e.split(" "),this.trackValues=qce(e)};$a.prototype.setComputedTracks=function(e){this.computedTracks=e.split(" "),this.computedPixels=qce(e)};$a.prototype.setGap=function(e){this.gap=e};$a.prototype.setComputedGap=function(e){this.computedGap=e,this.computedGapPixels=NDe("px",this.computedGap)||0};$a.prototype.getMousePosition=function(e){return"touches"in e?e.touches[0][this.clientAxis]:e[this.clientAxis]};$a.prototype.startDragging=function(e){if(!("button"in e&&e.button!==0)){e.preventDefault(),this.element?this.grid=this.element.parentNode:this.grid=e.target.parentNode,this.getDimensions(),this.setTracks(this.getRawTracks()),this.setComputedTracks(this.getRawComputedTracks()),this.setGap(this.getGap()),this.setComputedGap(this.getRawComputedGap());var r=this.trackValues.filter(function(o){return o.type==="%"}),n=this.trackValues.filter(function(o){return o.type==="fr"});if(this.totalFrs=n.length,this.totalFrs){var i=SK(n);i!==null&&(this.frToPixels=this.computedPixels[i].numeric/n[i].numeric)}if(r.length){var a=SK(r);a!==null&&(this.percentageToPixels=this.computedPixels[a].numeric/r[a].numeric)}var s=this.getSizeAtTrack(this.track,!1)+this.start;if(this.dragStartOffset=this.getMousePosition(e)-s,this.aTrack=this.track-1,this.tracko&&(r=a),ra&&(r=a);var l=r-this.aTrackStart-this.dragStartOffset-this.computedGapPixels,u=this.bTrackEnd-r+this.dragStartOffset-n-this.computedGapPixels;if(this.dragInterval>1){var d=Math.round(l/this.dragInterval)*this.dragInterval;u-=d-l,l=d}if(l