@codingame/monaco-vscode-markdown-language-features-default-extension 31.0.1 → 32.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +13 -13
- package/package.json +2 -2
- package/resources/extension.js +64 -60
- package/resources/extension.js.map +4 -4
- package/resources/index.js +3 -1
- package/resources/index2.js +17 -17
- package/resources/markdown.css.txt +186 -0
- package/resources/package.json +1 -1
- package/resources/package.nls.json +1 -1
- package/resources/pre.js +1 -1
- package/resources/serverWorkerMain.js +23401 -2
package/resources/index.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
var ze=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var Re=ze((kt,ke)=>{var Ie="Expected a function",De=NaN,lt="[object Symbol]",ct=/^\s+|\s+$/g,dt=/^[-+]0x[0-9a-f]+$/i,ut=/^0b[01]+$/i,ft=/^0o[0-7]+$/i,mt=parseInt,gt=typeof global=="object"&&global&&global.Object===Object&&global,pt=typeof self=="object"&&self&&self.Object===Object&&self,ht=gt||pt||Function("return this")(),vt=Object.prototype,bt=vt.toString,wt=Math.max,Tt=Math.min,pe=function(){return ht.Date.now()};function yt(e,r,n){var t,i,o,s,a,l,f=0,v=!1,h=!1,y=!0;if(typeof e!="function")throw new TypeError(Ie);r=He(r)||0,ne(n)&&(v=!!n.leading,h="maxWait"in n,o=h?wt(He(n.maxWait)||0,r):o,y="trailing"in n?!!n.trailing:y);function S(g){var E=t,D=i;return t=i=void 0,f=g,s=e.apply(D,E),s}function re(g){return f=g,a=setTimeout(L,r),v?S(g):s}function z(g){var E=g-l,D=g-f,H=r-E;return h?Tt(H,o-D):H}function R(g){var E=g-l,D=g-f;return l===void 0||E>=r||E<0||h&&D>=o}function L(){var g=pe();if(R(g))return B(g);a=setTimeout(L,z(g))}function B(g){return a=void 0,y&&t?S(g):(t=i=void 0,s)}function F(){a!==void 0&&clearTimeout(a),f=0,t=l=i=a=void 0}function G(){return a===void 0?s:B(pe())}function M(){var g=pe(),E=R(g);if(t=arguments,i=this,l=g,E){if(a===void 0)return re(l);if(h)return a=setTimeout(L,r),S(l)}return a===void 0&&(a=setTimeout(L,r)),s}return M.cancel=F,M.flush=G,M}function Et(e,r,n){var t=!0,i=!0;if(typeof e!="function")throw new TypeError(Ie);return ne(n)&&(t="leading"in n?!!n.leading:t,i="trailing"in n?!!n.trailing:i),yt(e,r,{leading:t,maxWait:r,trailing:i})}function ne(e){var r=typeof e;return!!e&&(r=="object"||r=="function")}function Lt(e){return!!e&&typeof e=="object"}function St(e){return typeof e=="symbol"||Lt(e)&&bt.call(e)==lt}function He(e){if(typeof e=="number")return e;if(St(e))return De;if(ne(e)){var r=typeof e.valueOf=="function"?e.valueOf():e;e=ne(r)?r+"":r}if(typeof e!="string")return e===0?e:+e;e=e.replace(ct,"");var n=ut.test(e);return n||ft.test(e)?mt(e.slice(2),n?2:8):dt.test(e)?De:+e}ke.exports=Et});var Ee="code-line",j=class{constructor(r,n,t,i){this.element=r;this.line=n;this.codeElement=t;this.endLine=i;this.#e=Array.from(Xe(r,"DETAILS"))}#e;get isVisible(){if(this.#e.some(t=>!t.open))return!1;let r=window.getComputedStyle(this.element);if(r.display==="none"||r.visibility==="hidden")return!1;let n=this.element.getBoundingClientRect();return!(n.height===0||n.width===0)}},ae=(()=>{let e,r=-1;return n=>{if(!e||n!==r){r=n,e=[new j(document.body,-1)];for(let t of document.getElementsByClassName(Ee)){if(!(t instanceof HTMLElement))continue;let i=+t.getAttribute("data-line");if(!isNaN(i))if(t.tagName==="CODE"&&t.parentElement&&t.parentElement.tagName==="PRE"){let s=((t.textContent||"").match(/\n/g)||[]).length+1,a=i+s-1;e.push(new j(t.parentElement,i,t,a))}else t.tagName==="PRE"||t.tagName==="UL"||t.tagName==="OL"||e.push(new j(t,i))}}return e}})();function le(e,r){let n=Math.floor(e),t=ae(r),i=t[0]||null;for(let o of t){if(o.line===n)return{previous:o,next:void 0};if(o.line>n)return{previous:i,next:o};i=o}return{previous:i}}function Ge(e,r){let n=ae(r).filter(l=>l.isVisible),t=e-window.scrollY,i=-1,o=n.length-1;for(;i+1<o;){let l=Math.floor((i+o)/2),f=I(n[l]);f.top+f.height>=t?o=l:i=l}let s=n[o],a=I(s);return o>=1&&a.top>t?{previous:n[i],next:s}:o>1&&o<n.length&&a.top+a.height>t?{previous:s,next:n[o+1]}:{previous:s}}function I(e){let{element:r,codeElement:n}=e,t=r.getBoundingClientRect();if(n)return t;let i=r.querySelector(`.${Ee}`);if(i){let o=i.getBoundingClientRect(),s=Math.max(1,o.top-t.top);return{top:t.top,height:s}}return t}function Le(e){let{element:r,codeElement:n}=e,t=I(e);if(n){let i=window.getComputedStyle(r),o=parseFloat(i.paddingTop)||0,s=parseFloat(i.paddingBottom)||0;return{top:t.top+o,height:t.height-o-s,paddingTop:o,paddingBottom:s}}return{top:t.top,height:t.height,paddingTop:0,paddingBottom:0}}function J(e,r,n){if(!n.settings?.scrollPreviewWithEditor)return;if(e<=0){window.scroll(window.scrollX,0);return}let{previous:t,next:i}=le(e,r);if(!t)return;let o=0,s=I(t),a=s.top;if(t.endLine&&t.endLine>t.line)if(e<t.endLine){let l=Le(t),f=(e-t.line)/(t.endLine-t.line);o=window.scrollY+l.top+l.height*f}else if(i&&i.line!==t.line){let l=(e-t.endLine)/(i.line-t.endLine),f=window.scrollY+a+s.height,h=window.scrollY+i.element.getBoundingClientRect().top-f;o=f+l*h}else o=window.scrollY+a+s.height;else if(i&&i.line!==t.line){let l=(e-t.line)/(i.line-t.line),f=window.scrollY+a+s.height,h=window.scrollY+i.element.getBoundingClientRect().top-f;o=f+l*h}else{let l=e-Math.floor(e);o=window.scrollY+a+s.height*l}window.scroll(window.scrollX,Math.max(1,o))}function ce(e,r){let{previous:n,next:t}=Ge(e,r);if(n){if(n.line<0)return 0;let i=I(n),o=e-window.scrollY-i.top;if(n.endLine&&n.endLine>n.line){let s=Le(n),a=e-window.scrollY-s.top;if(a>=0&&a<=s.height){let l=a/s.height;return n.line+l*(n.endLine-n.line)}else if(t&&a>s.height){let l=a-s.height,f=I(t),v=s.top+s.height,h=f.top-v,y=l/h;return n.endLine+y*(t.line-n.endLine)}else a<0}if(t){let s=o/(I(t).top-i.top);return n.line+s*(t.line-n.line)}else{let s=o/i.height;return n.line+s}}return null}function Se(e,r){return ae(r).find(n=>n.element.id===e)}function*Xe(e,r){for(let n=e.parentElement;n;n=n.parentElement)n.tagName===r&&(yield n)}var Q=class{#e;onDidChangeTextEditorSelection(r,n){let{previous:t}=le(r,n);this.#t(t&&(t.codeElement||t.element))}#t(r){this.#n(this.#e),this.#r(r),this.#e=r}#n(r){r&&r.classList.toggle("code-active-line",!1)}#r(r){r&&r.classList.toggle("code-active-line",!0)}};function Ae(e){document.readyState==="loading"||document.readyState==="uninitialized"?document.addEventListener("DOMContentLoaded",e):e()}var xe=(e,r)=>({postMessage(n,t){e.postMessage({type:n,source:r.settings.source,...t})}});function de(e){let r=document.getElementById("vscode-markdown-preview-data");if(r){let n=r.getAttribute(e);if(n)return n}throw new Error(`Could not load data for ${e}`)}function ue(e){return JSON.parse(de(e))}var Z=class{#e=ue("data-settings");get settings(){return this.#e}updateSettings(r){this.#e=r}};var Ce=11;function $e(e,r){var n=r.attributes,t,i,o,s,a;if(!(r.nodeType===Ce||e.nodeType===Ce)){for(var l=n.length-1;l>=0;l--)t=n[l],i=t.name,o=t.namespaceURI,s=t.value,o?(i=t.localName||i,a=e.getAttributeNS(o,i),a!==s&&(t.prefix==="xmlns"&&(i=t.name),e.setAttributeNS(o,i,s))):(a=e.getAttribute(i),a!==s&&e.setAttribute(i,s));for(var f=e.attributes,v=f.length-1;v>=0;v--)t=f[v],i=t.name,o=t.namespaceURI,o?(i=t.localName||i,r.hasAttributeNS(o,i)||e.removeAttributeNS(o,i)):r.hasAttribute(i)||e.removeAttribute(i)}}var ee,Ke="http://www.w3.org/1999/xhtml",T=typeof document>"u"?void 0:document,Je=!!T&&"content"in T.createElement("template"),Qe=!!T&&T.createRange&&"createContextualFragment"in T.createRange();function Ze(e){var r=T.createElement("template");return r.innerHTML=e,r.content.childNodes[0]}function et(e){ee||(ee=T.createRange(),ee.selectNode(T.body));var r=ee.createContextualFragment(e);return r.childNodes[0]}function tt(e){var r=T.createElement("body");return r.innerHTML=e,r.childNodes[0]}function nt(e){return e=e.trim(),Je?Ze(e):Qe?et(e):tt(e)}function te(e,r){var n=e.nodeName,t=r.nodeName,i,o;return n===t?!0:(i=n.charCodeAt(0),o=t.charCodeAt(0),i<=90&&o>=97?n===t.toUpperCase():o<=90&&i>=97?t===n.toUpperCase():!1)}function rt(e,r){return!r||r===Ke?T.createElement(e):T.createElementNS(r,e)}function it(e,r){for(var n=e.firstChild;n;){var t=n.nextSibling;r.appendChild(n),n=t}return r}function fe(e,r,n){e[n]!==r[n]&&(e[n]=r[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n))}var Me={OPTION:function(e,r){var n=e.parentNode;if(n){var t=n.nodeName.toUpperCase();t==="OPTGROUP"&&(n=n.parentNode,t=n&&n.nodeName.toUpperCase()),t==="SELECT"&&!n.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!r.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),n.selectedIndex=-1)}fe(e,r,"selected")},INPUT:function(e,r){fe(e,r,"checked"),fe(e,r,"disabled"),e.value!==r.value&&(e.value=r.value),r.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,r){var n=r.value;e.value!==n&&(e.value=n);var t=e.firstChild;if(t){var i=t.nodeValue;if(i==n||!n&&i==e.placeholder)return;t.nodeValue=n}},SELECT:function(e,r){if(!r.hasAttribute("multiple")){for(var n=-1,t=0,i=e.firstChild,o,s;i;)if(s=i.nodeName&&i.nodeName.toUpperCase(),s==="OPTGROUP")o=i,i=o.firstChild,i||(i=o.nextSibling,o=null);else{if(s==="OPTION"){if(i.hasAttribute("selected")){n=t;break}t++}i=i.nextSibling,!i&&o&&(i=o.nextSibling,o=null)}e.selectedIndex=n}}},Y=1,Ne=11,Pe=3,Oe=8;function O(){}function ot(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function st(e){return function(n,t,i){if(i||(i={}),typeof t=="string")if(n.nodeName==="#document"||n.nodeName==="HTML"||n.nodeName==="BODY"){var o=t;t=T.createElement("html"),t.innerHTML=o}else t=nt(t);else t.nodeType===Ne&&(t=t.firstElementChild);var s=i.getNodeKey||ot,a=i.onBeforeNodeAdded||O,l=i.onNodeAdded||O,f=i.onBeforeElUpdated||O,v=i.onElUpdated||O,h=i.onBeforeNodeDiscarded||O,y=i.onNodeDiscarded||O,S=i.onBeforeElChildrenUpdated||O,re=i.skipFromChildren||O,z=i.addChild||function(c,d){return c.appendChild(d)},R=i.childrenOnly===!0,L=Object.create(null),B=[];function F(c){B.push(c)}function G(c,d){if(c.nodeType===Y)for(var p=c.firstChild;p;){var u=void 0;d&&(u=s(p))?F(u):(y(p),p.firstChild&&G(p,d)),p=p.nextSibling}}function M(c,d,p){h(c)!==!1&&(d&&d.removeChild(c),y(c),G(c,p))}function g(c){if(c.nodeType===Y||c.nodeType===Ne)for(var d=c.firstChild;d;){var p=s(d);p&&(L[p]=d),g(d),d=d.nextSibling}}g(n);function E(c){l(c);for(var d=c.firstChild;d;){var p=d.nextSibling,u=s(d);if(u){var m=L[u];m&&te(d,m)?(d.parentNode.replaceChild(m,d),H(m,d)):E(d)}else E(d);d=p}}function D(c,d,p){for(;d;){var u=d.nextSibling;(p=s(d))?F(p):M(d,c,!0),d=u}}function H(c,d,p){var u=s(d);if(u&&delete L[u],!p){var m=f(c,d);if(m===!1||(m instanceof HTMLElement&&(c=m,g(c)),e(c,d),v(c),S(c,d)===!1))return}c.nodeName!=="TEXTAREA"?_e(c,d):Me.TEXTAREA(c,d)}function _e(c,d){var p=re(c,d),u=d.firstChild,m=c.firstChild,W,A,U,$,N;e:for(;u;){for($=u.nextSibling,W=s(u);!p&&m;){if(U=m.nextSibling,u.isSameNode&&u.isSameNode(m)){u=$,m=U;continue e}A=s(m);var K=m.nodeType,P=void 0;if(K===u.nodeType&&(K===Y?(W?W!==A&&((N=L[W])?U===N?P=!1:(c.insertBefore(N,m),A?F(A):M(m,c,!0),m=N,A=s(m)):P=!1):A&&(P=!1),P=P!==!1&&te(m,u),P&&H(m,u)):(K===Pe||K==Oe)&&(P=!0,m.nodeValue!==u.nodeValue&&(m.nodeValue=u.nodeValue))),P){u=$,m=U;continue e}A?F(A):M(m,c,!0),m=U}if(W&&(N=L[W])&&te(N,u))p||z(c,N),H(N,u);else{var se=a(u);se!==!1&&(se&&(u=se),u.actualize&&(u=u.actualize(c.ownerDocument||T)),z(c,u),E(u))}u=$,m=U}D(c,m,A);var ye=Me[c.nodeName];ye&&ye(c,d)}var b=n,X=b.nodeType,Te=t.nodeType;if(!R){if(X===Y)Te===Y?te(n,t)||(y(n),b=it(n,rt(t.nodeName,t.namespaceURI))):b=t;else if(X===Pe||X===Oe){if(Te===X)return b.nodeValue!==t.nodeValue&&(b.nodeValue=t.nodeValue),b;b=t}}if(b===t)y(n);else{if(t.isSameNode&&t.isSameNode(b))return;if(H(b,t,R),B)for(var ie=0,qe=B.length;ie<qe;ie++){var oe=L[B[ie]];oe&&M(oe,oe.parentNode,!1)}}return!R&&b!==n&&n.parentNode&&(b.actualize&&(b=b.actualize(n.ownerDocument||T)),n.parentNode.replaceChild(b,n)),b}}var at=st($e),Be=at;var me=Object.freeze({http:"http",https:"https",file:"file",untitled:"untitled",mailto:"mailto",vscode:"vscode","vscode-insiders":"vscode-insiders",notebookCell:"vscode-notebook-cell"});function ge(e,r){return r.toLowerCase().startsWith(e+":")}var Fe=Re(),k=0,he,We=new Q,w=new Z,x=0,V=w.settings.source,_=acquireVsCodeApi(),ve=_.getState()??{},C={...ve,...ue("data-state")};typeof ve.scrollProgress<"u"&&ve?.resource!==C.resource&&(C.scrollProgress=0);_.setState(C);var q=xe(_,w);window.cspAlerter.setPoster(q);window.styleLoadingMonitor.setPoster(q);function be(e){let r=document.getElementsByTagName("img");if(r.length>0){let n=Array.from(r,t=>t.complete?Promise.resolve():new Promise(i=>{t.addEventListener("load",()=>i()),t.addEventListener("error",()=>i())}));Promise.all(n).then(()=>setTimeout(e,0))}else setTimeout(e,0)}Ae(()=>{let n=[...new DOMParser().parseFromString(de("data-initial-md-content"),"text/html").body.children];document.body.append(...n);for(let i of n)i instanceof HTMLElement&&we(i);let t=C.scrollProgress;if(Ue(),typeof t=="number"&&!w.settings.fragment){be(()=>{k+=1;let i=Math.max(1,t*document.body.clientHeight);window.scrollTo(0,i)});return}w.settings.scrollPreviewWithEditor&&be(()=>{if(w.settings.fragment){let i;try{i=encodeURIComponent(w.settings.fragment)}catch{i=w.settings.fragment}C.fragment=void 0,_.setState(C);let o=Se(i,x);o&&(k+=1,J(o.line,x,w))}else isNaN(w.settings.line)||(k+=1,J(w.settings.line,x,w))}),typeof w.settings.selectedLine=="number"&&We.onDidChangeTextEditorSelection(w.settings.selectedLine,x)});var At=(()=>{let e=Fe(r=>{k=1,he&&clearTimeout(he),he=window.setTimeout(()=>{k=0},50),be(()=>J(r,x,w))},50);return r=>{isNaN(r)||(C.line=r,e(r))}})();window.addEventListener("resize",()=>{k+=1,je()},!0);function Ue(){let e=document.getElementsByTagName("img"),r=0;for(let n of e){n.id="image-"+r,r+=1;let t=n.getAttribute("data-src"),o=t&&!(ge(me.http,t)||ge(me.https,t))?"localImage":"image";n.setAttribute("data-vscode-context",JSON.stringify({webviewSection:o,id:n.id,preventDefaultContextMenuItems:!0,resource:V,imageSource:t}))}}async function Ve(e,r=5){if(!document.hasFocus()&&r>0){setTimeout(()=>{Ve(e,r-1)},20);return}try{await navigator.clipboard.write([new ClipboardItem({"image/png":new Promise(n=>{let t=document.createElement("canvas");t!==null&&(t.width=e.naturalWidth,t.height=e.naturalHeight,t.getContext("2d")?.drawImage(e,0,0)),t.toBlob(i=>{i&&n(i),t.remove()},"image/png")})})])}catch(n){console.error(n);let t=window.getSelection();if(!t){await navigator.clipboard.writeText(e.getAttribute("data-src")??e.src);return}t.removeAllRanges();let i=document.createRange();i.selectNode(e),t.addRange(i),document.execCommand("copy"),t.removeAllRanges()}}window.addEventListener("message",async e=>{let r=e.data;switch(r.type){case"copyImage":{let n=document.getElementById(r.id);n instanceof HTMLImageElement&&Ve(n);return}case"onDidChangeTextEditorSelection":r.source===V&&We.onDidChangeTextEditorSelection(r.line,x);return;case"updateView":r.source===V&&At(r.line);return;case"updateContent":{let n=document.querySelector(".markdown-body"),i=new DOMParser().parseFromString(r.content,"text/html");for(let o of Array.from(i.querySelectorAll("meta")))o.hasAttribute("http-equiv")&&o.remove();if(r.source!==V){V=r.source;let o=i.querySelector(".markdown-body");n.replaceWith(o),we(o)}else{let o=i.querySelector(".markdown-body"),s=o.querySelectorAll("link");for(let a of s)a.remove();o.prepend(...s),Be(n,o,{childrenOnly:!0,onBeforeElUpdated:(a,l)=>{if(Ye(a,l)){let f=a.querySelectorAll("[data-line]"),v=l.querySelectorAll("[data-line]");f.length!==v.length&&console.log("unexpected line number change");for(let h=0;h<f.length;++h){let y=f[h],S=v[h];S&&y.setAttribute("data-line",S.getAttribute("data-line"))}return!1}return a.tagName==="DETAILS"&&l.tagName==="DETAILS"&&a.hasAttribute("open")&&l.setAttribute("open",""),!0},addChild:(a,l)=>{a.appendChild(l),l instanceof HTMLElement&&we(l)}})}++x,window.dispatchEvent(new CustomEvent("vscode.markdown.updateContent")),Ue();break}}},!1);document.addEventListener("dblclick",e=>{if(!w.settings.doubleClickToSwitchToEditor||V.endsWith(".copilotmd"))return;for(let t=e.target;t;t=t.parentNode)if(t.tagName==="A")return;let r=e.pageY,n=ce(r,x);typeof n=="number"&&!isNaN(n)&&q.postMessage("didClick",{line:Math.floor(n)})});var xt=["http:","https:","mailto:","vscode:","vscode-insiders:"];document.addEventListener("click",e=>{if(!e)return;let r=e.target;for(;r;){if(r.tagName&&r.tagName==="A"&&r.href){if(r.getAttribute("href")?.startsWith("#"))return;let n=r.getAttribute("data-href");if(!n&&(n=r.getAttribute("href"),n&&xt.some(t=>n.startsWith(t))))return;if(n&&!/^[a-z\-]+:/i.test(n)){q.postMessage("openLink",{href:n}),e.preventDefault(),e.stopPropagation();return}return}r=r.parentElement}},!0);window.addEventListener("scroll",Fe(()=>{if(je(),k>0)return;let e=ce(window.scrollY,x);typeof e=="number"&&!isNaN(e)&&q.postMessage("revealLine",{line:e})},50));function je(){C.scrollProgress=window.scrollY/document.body.clientHeight,_.setState(C)}function Ye(e,r){let n=["open"];if(e.isEqualNode(r))return!0;if(e.tagName!==r.tagName||e.textContent!==r.textContent)return!1;let t=[...e.attributes].filter(a=>!n.includes(a.name)),i=[...r.attributes].filter(a=>!n.includes(a.name));if(t.length!==i.length)return!1;for(let a=0;a<t.length;++a){let l=t[a],f=i[a];if(l.name!==f.name||l.value!==f.value&&l.name!=="data-line")return!1}let o=Array.from(e.children),s=Array.from(r.children);return o.length===s.length&&o.every((a,l)=>Ye(a,s[l]))}function we(e){let r=["type","src","nonce","noModule","async"],n=e.tagName==="SCRIPT"?[e]:Array.from(e.getElementsByTagName("script"));for(let t of n){if(!(t instanceof HTMLElement))continue;let i=document.createElement("script"),o=t.innerText;i.text=o;for(let s of r){let a=t.getAttribute?.(s);a&&i.setAttribute(s,a)}t.insertAdjacentElement("afterend",i),t.remove()}}
|
|
1
|
+
var et=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var We=et((en,Fe)=>{var Re="Expected a function",Be=NaN,vt="[object Symbol]",yt=/^\s+|\s+$/g,bt=/^[-+]0x[0-9a-f]+$/i,wt=/^0b[01]+$/i,St=/^0o[0-7]+$/i,Tt=parseInt,Et=typeof global=="object"&&global&&global.Object===Object&&global,Lt=typeof self=="object"&&self&&self.Object===Object&&self,Ct=Et||Lt||Function("return this")(),xt=Object.prototype,At=xt.toString,Mt=Math.max,Nt=Math.min,be=function(){return Ct.Date.now()};function Dt(e,t,n){var i,r,o,s,a,l,d=0,c=!1,m=!1,b=!0;if(typeof e!="function")throw new TypeError(Re);t=Ie(t)||0,se(n)&&(c=!!n.leading,m="maxWait"in n,o=m?Mt(Ie(n.maxWait)||0,t):o,b="trailing"in n?!!n.trailing:b);function L(h){var A=i,I=r;return i=r=void 0,d=h,s=e.apply(I,A),s}function S(h){return d=h,a=setTimeout(M,t),c?L(h):s}function K(h){var A=h-l,I=h-d,R=t-A;return m?Nt(R,o-I):R}function q(h){var A=h-l,I=h-d;return l===void 0||A>=t||A<0||m&&I>=o}function M(){var h=be();if(q(h))return B(h);a=setTimeout(M,K(h))}function B(h){return a=void 0,b&&i?L(h):(i=r=void 0,s)}function U(){a!==void 0&&clearTimeout(a),d=0,i=l=r=a=void 0}function J(){return a===void 0?s:B(be())}function P(){var h=be(),A=q(h);if(i=arguments,r=this,l=h,A){if(a===void 0)return S(l);if(m)return a=setTimeout(M,t),L(l)}return a===void 0&&(a=setTimeout(M,t)),s}return P.cancel=U,P.flush=J,P}function Pt(e,t,n){var i=!0,r=!0;if(typeof e!="function")throw new TypeError(Re);return se(n)&&(i="leading"in n?!!n.leading:i,r="trailing"in n?!!n.trailing:r),Dt(e,t,{leading:i,maxWait:t,trailing:r})}function se(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function kt(e){return!!e&&typeof e=="object"}function Ht(e){return typeof e=="symbol"||kt(e)&&At.call(e)==vt}function Ie(e){if(typeof e=="number")return e;if(Ht(e))return Be;if(se(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=se(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(yt,"");var n=wt.test(e);return n||St.test(e)?Tt(e.slice(2),n?2:8):bt.test(e)?Be:+e}Fe.exports=Pt});var Le="code-line",$=class{constructor(t,n,i,r){this.element=t;this.line=n;this.codeElement=i;this.endLine=r;this.#e=Array.from(nt(t,"DETAILS"))}#e;get isVisible(){if(this.#e.some(i=>!i.open))return!1;let t=window.getComputedStyle(this.element);if(t.display==="none"||t.visibility==="hidden")return!1;let n=this.element.getBoundingClientRect();return!(n.height===0||n.width===0)}},ue=(()=>{let e,t=-1;return n=>{if(!e||n!==t){t=n,e=[new $(document.body,-1)];for(let i of document.getElementsByClassName(Le)){if(!(i instanceof HTMLElement))continue;let r=+i.getAttribute("data-line");if(!isNaN(r))if(i.tagName==="CODE"&&i.parentElement&&i.parentElement.tagName==="PRE"){let s=((i.textContent||"").match(/\n/g)||[]).length+1,a=r+s-1;e.push(new $(i.parentElement,r,i,a))}else i.tagName==="PRE"||i.tagName==="UL"||i.tagName==="OL"||e.push(new $(i,r))}}return e}})();function W(e,t){let n=Math.floor(e),i=ue(t),r=i[0]||null;for(let o of i){if(o.line===n)return{previous:o,next:void 0};if(o.line>n)return{previous:r,next:o};r=o}return{previous:r}}function tt(e,t){let n=ue(t).filter(l=>l.isVisible),i=e-window.scrollY,r=-1,o=n.length-1;for(;r+1<o;){let l=Math.floor((r+o)/2),d=F(n[l]);d.top+d.height>=i?o=l:r=l}let s=n[o],a=F(s);return o>=1&&a.top>i?{previous:n[r],next:s}:o>1&&o<n.length&&a.top+a.height>i?{previous:s,next:n[o+1]}:{previous:s}}function F(e){let{element:t,codeElement:n}=e,i=t.getBoundingClientRect();if(n)return i;let r=t.querySelector(`.${Le}`);if(r){let o=r.getBoundingClientRect(),s=Math.max(1,o.top-i.top);return{top:i.top,height:s}}return i}function Ce(e){let{element:t,codeElement:n}=e,i=F(e);if(n){let r=window.getComputedStyle(t),o=parseFloat(r.paddingTop)||0,s=parseFloat(r.paddingBottom)||0;return{top:i.top+o,height:i.height-o-s,paddingTop:o,paddingBottom:s}}return{top:i.top,height:i.height,paddingTop:0,paddingBottom:0}}function z(e,t,n){if(!n.settings?.scrollPreviewWithEditor)return;if(e<=0){window.scroll(window.scrollX,0);return}let{previous:i,next:r}=W(e,t);if(!i)return;let o=0,s=F(i),a=s.top;if(i.endLine&&i.endLine>i.line)if(e<i.endLine){let l=Ce(i),d=(e-i.line)/(i.endLine-i.line);o=window.scrollY+l.top+l.height*d}else if(r&&r.line!==i.line){let l=(e-i.endLine)/(r.line-i.endLine),d=window.scrollY+a+s.height,m=window.scrollY+r.element.getBoundingClientRect().top-d;o=d+l*m}else o=window.scrollY+a+s.height;else if(r&&r.line!==i.line){let l=(e-i.line)/(r.line-i.line),d=window.scrollY+a+s.height,m=window.scrollY+r.element.getBoundingClientRect().top-d;o=d+l*m}else{let l=e-Math.floor(e);o=window.scrollY+a+s.height*l}window.scroll(window.scrollX,Math.max(1,o))}function me(e,t){let{previous:n,next:i}=tt(e,t);if(n){if(n.line<0)return 0;let r=F(n),o=e-window.scrollY-r.top;if(n.endLine&&n.endLine>n.line){let s=Ce(n),a=e-window.scrollY-s.top;if(a>=0&&a<=s.height){let l=a/s.height;return n.line+l*(n.endLine-n.line)}else if(i&&a>s.height){let l=a-s.height,d=F(i),c=s.top+s.height,m=d.top-c,b=l/m;return n.endLine+b*(i.line-n.endLine)}else a<0}if(i){let s=o/(F(i).top-r.top);return n.line+s*(i.line-n.line)}else{let s=o/r.height;return n.line+s}}return null}function xe(e,t){return ue(t).find(n=>n.element.id===e)}function*nt(e,t){for(let n=e.parentElement;n;n=n.parentElement)n.tagName===t&&(yield n)}var te=class{#e;onDidChangeTextEditorSelection(t,n){let{previous:i}=W(t,n);this.#i(i&&(i.codeElement||i.element))}#i(t){this.#n(this.#e),this.#t(t),this.#e=t}#n(t){t&&t.classList.toggle("code-active-line",!1)}#t(t){t&&t.classList.toggle("code-active-line",!0)}};function Ae(e){document.readyState==="loading"||document.readyState==="uninitialized"?document.addEventListener("DOMContentLoaded",e):e()}var Me=(e,t)=>({postMessage(n,i){e.postMessage({type:n,source:t.settings.source,...i})}});function ge(e){let t=document.getElementById("vscode-markdown-preview-data");if(t){let n=t.getAttribute(e);if(n)return n}throw new Error(`Could not load data for ${e}`)}function pe(e){return JSON.parse(ge(e))}var ne=class{#e=pe("data-settings");get settings(){return this.#e}updateSettings(t){this.#e=t}};var Ne=11;function it(e,t){var n=t.attributes,i,r,o,s,a;if(!(t.nodeType===Ne||e.nodeType===Ne)){for(var l=n.length-1;l>=0;l--)i=n[l],r=i.name,o=i.namespaceURI,s=i.value,o?(r=i.localName||r,a=e.getAttributeNS(o,r),a!==s&&(i.prefix==="xmlns"&&(r=i.name),e.setAttributeNS(o,r,s))):(a=e.getAttribute(r),a!==s&&e.setAttribute(r,s));for(var d=e.attributes,c=d.length-1;c>=0;c--)i=d[c],r=i.name,o=i.namespaceURI,o?(r=i.localName||r,t.hasAttributeNS(o,r)||e.removeAttributeNS(o,r)):t.hasAttribute(r)||e.removeAttribute(r)}}var ie,rt="http://www.w3.org/1999/xhtml",E=typeof document>"u"?void 0:document,ot=!!E&&"content"in E.createElement("template"),st=!!E&&E.createRange&&"createContextualFragment"in E.createRange();function at(e){var t=E.createElement("template");return t.innerHTML=e,t.content.childNodes[0]}function lt(e){ie||(ie=E.createRange(),ie.selectNode(E.body));var t=ie.createContextualFragment(e);return t.childNodes[0]}function dt(e){var t=E.createElement("body");return t.innerHTML=e,t.childNodes[0]}function ct(e){return e=e.trim(),ot?at(e):st?lt(e):dt(e)}function re(e,t){var n=e.nodeName,i=t.nodeName,r,o;return n===i?!0:(r=n.charCodeAt(0),o=i.charCodeAt(0),r<=90&&o>=97?n===i.toUpperCase():o<=90&&r>=97?i===n.toUpperCase():!1)}function ft(e,t){return!t||t===rt?E.createElement(e):E.createElementNS(t,e)}function ut(e,t){for(var n=e.firstChild;n;){var i=n.nextSibling;t.appendChild(n),n=i}return t}function he(e,t,n){e[n]!==t[n]&&(e[n]=t[n],e[n]?e.setAttribute(n,""):e.removeAttribute(n))}var De={OPTION:function(e,t){var n=e.parentNode;if(n){var i=n.nodeName.toUpperCase();i==="OPTGROUP"&&(n=n.parentNode,i=n&&n.nodeName.toUpperCase()),i==="SELECT"&&!n.hasAttribute("multiple")&&(e.hasAttribute("selected")&&!t.selected&&(e.setAttribute("selected","selected"),e.removeAttribute("selected")),n.selectedIndex=-1)}he(e,t,"selected")},INPUT:function(e,t){he(e,t,"checked"),he(e,t,"disabled"),e.value!==t.value&&(e.value=t.value),t.hasAttribute("value")||e.removeAttribute("value")},TEXTAREA:function(e,t){var n=t.value;e.value!==n&&(e.value=n);var i=e.firstChild;if(i){var r=i.nodeValue;if(r==n||!n&&r==e.placeholder)return;i.nodeValue=n}},SELECT:function(e,t){if(!t.hasAttribute("multiple")){for(var n=-1,i=0,r=e.firstChild,o,s;r;)if(s=r.nodeName&&r.nodeName.toUpperCase(),s==="OPTGROUP")o=r,r=o.firstChild,r||(r=o.nextSibling,o=null);else{if(s==="OPTION"){if(r.hasAttribute("selected")){n=i;break}i++}r=r.nextSibling,!r&&o&&(r=o.nextSibling,o=null)}e.selectedIndex=n}}},G=1,Pe=11,ke=3,He=8;function O(){}function mt(e){if(e)return e.getAttribute&&e.getAttribute("id")||e.id}function gt(e){return function(n,i,r){if(r||(r={}),typeof i=="string")if(n.nodeName==="#document"||n.nodeName==="HTML"||n.nodeName==="BODY"){var o=i;i=E.createElement("html"),i.innerHTML=o}else i=ct(i);else i.nodeType===Pe&&(i=i.firstElementChild);var s=r.getNodeKey||mt,a=r.onBeforeNodeAdded||O,l=r.onNodeAdded||O,d=r.onBeforeElUpdated||O,c=r.onElUpdated||O,m=r.onBeforeNodeDiscarded||O,b=r.onNodeDiscarded||O,L=r.onBeforeElChildrenUpdated||O,S=r.skipFromChildren||O,K=r.addChild||function(f,u){return f.appendChild(u)},q=r.childrenOnly===!0,M=Object.create(null),B=[];function U(f){B.push(f)}function J(f,u){if(f.nodeType===G)for(var v=f.firstChild;v;){var g=void 0;u&&(g=s(v))?U(g):(b(v),v.firstChild&&J(v,u)),v=v.nextSibling}}function P(f,u,v){m(f)!==!1&&(u&&u.removeChild(f),b(f),J(f,v))}function h(f){if(f.nodeType===G||f.nodeType===Pe)for(var u=f.firstChild;u;){var v=s(u);v&&(M[v]=u),h(u),u=u.nextSibling}}h(n);function A(f){l(f);for(var u=f.firstChild;u;){var v=u.nextSibling,g=s(u);if(g){var p=M[g];p&&re(u,p)?(u.parentNode.replaceChild(p,u),R(p,u)):A(u)}else A(u);u=v}}function I(f,u,v){for(;u;){var g=u.nextSibling;(v=s(u))?U(v):P(u,f,!0),u=g}}function R(f,u,v){var g=s(u);if(g&&delete M[g],!v){var p=d(f,u);if(p===!1||(p instanceof HTMLElement&&(f=p,h(f)),e(f,u),c(f),L(f,u)===!1))return}f.nodeName!=="TEXTAREA"?Qe(f,u):De.TEXTAREA(f,u)}function Qe(f,u){var v=S(f,u),g=u.firstChild,p=f.firstChild,j,D,V,Z,k;e:for(;g;){for(Z=g.nextSibling,j=s(g);!v&&p;){if(V=p.nextSibling,g.isSameNode&&g.isSameNode(p)){g=Z,p=V;continue e}D=s(p);var ee=p.nodeType,H=void 0;if(ee===g.nodeType&&(ee===G?(j?j!==D&&((k=M[j])?V===k?H=!1:(f.insertBefore(k,p),D?U(D):P(p,f,!0),p=k,D=s(p)):H=!1):D&&(H=!1),H=H!==!1&&re(p,g),H&&R(p,g)):(ee===ke||ee==He)&&(H=!0,p.nodeValue!==g.nodeValue&&(p.nodeValue=g.nodeValue))),H){g=Z,p=V;continue e}D?U(D):P(p,f,!0),p=V}if(j&&(k=M[j])&&re(k,g))v||K(f,k),R(k,g);else{var fe=a(g);fe!==!1&&(fe&&(g=fe),g.actualize&&(g=g.actualize(f.ownerDocument||E)),K(f,g),A(g))}g=Z,p=V}I(f,p,D);var Ee=De[f.nodeName];Ee&&Ee(f,u)}var T=n,Q=T.nodeType,Te=i.nodeType;if(!q){if(Q===G)Te===G?re(n,i)||(b(n),T=ut(n,ft(i.nodeName,i.namespaceURI))):T=i;else if(Q===ke||Q===He){if(Te===Q)return T.nodeValue!==i.nodeValue&&(T.nodeValue=i.nodeValue),T;T=i}}if(T===i)b(n);else{if(i.isSameNode&&i.isSameNode(T))return;if(R(T,i,q),B)for(var de=0,Ze=B.length;de<Ze;de++){var ce=M[B[de]];ce&&P(ce,ce.parentNode,!1)}}return!q&&T!==n&&n.parentNode&&(T.actualize&&(T=T.actualize(n.ownerDocument||E)),n.parentNode.replaceChild(T,n)),T}}var pt=gt(it),Oe=pt;var ve=Object.freeze({http:"http",https:"https",file:"file",untitled:"untitled",mailto:"mailto",vscode:"vscode","vscode-insiders":"vscode-insiders",notebookCell:"vscode-notebook-cell"});function ye(e,t){return t.toLowerCase().startsWith(e+":")}var oe=class{#e=Math.random().toString(36).slice(2,10);#i;#n;#t;#r=0;constructor(t,n){this.#i=n,this.#n=t,this.#t=new BroadcastChannel(t.channelName),this.#t.onmessage=i=>{let{line:r,sender:o}=i.data;if(o===this.#e||typeof r!="number"||isNaN(r))return;let s=ht(r,this.#n.lineMappings);this.#r=Date.now()+100,this.#i(s)}}update(t){this.#n=t}broadcastScroll(t){!this.#t||Date.now()<this.#r||this.#t.postMessage({line:t,sender:this.#e})}};function ht(e,t){if(!t?.length)return e;let n=Math.floor(e),i=e-n,r=t[n]??e;if(i<=0)return Math.max(0,r);let o=t[n+1];return typeof o!="number"?Math.max(0,r+i):Math.max(0,r+(o-r)*i)}var Ve=We(),C=0,w,Ye=new te,y=new ne,x=0,Y=y.settings.source,we=y.settings.lineChanges,_=acquireVsCodeApi(),Ot=e=>{C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},100),le(()=>z(e,x,y))},_e=y.settings.diffScrollSync?new oe(y.settings.diffScrollSync,Ot):void 0,ae=_.getState()??{},N={...ae,...pe("data-state")},Bt=typeof y.settings.line=="number"&&!isNaN(y.settings.line);typeof ae.scrollProgress<"u"&&(ae?.resource!==N.resource||Bt&&ae.line!==y.settings.line)&&(N.scrollProgress=void 0);_.setState(N);var X=Me(_,y);window.cspAlerter.setPoster(X);window.styleLoadingMonitor.setPoster(X);function le(e){let t=document.getElementsByTagName("img");if(t.length>0){let n=Array.from(t,i=>i.complete?Promise.resolve():new Promise(r=>{i.addEventListener("load",()=>r()),i.addEventListener("error",()=>r())}));Promise.all(n).then(()=>setTimeout(e,0))}else setTimeout(e,0)}Ae(()=>{let n=[...new DOMParser().parseFromString(ge("data-initial-md-content"),"text/html").body.children];document.body.append(...n);for(let r of n)r instanceof HTMLElement&&Se(r);let i=N.scrollProgress;if($e(),Ge(we),typeof i=="number"&&!y.settings.fragment){le(()=>{C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},200);let r=Math.max(1,i*document.body.clientHeight);window.scrollTo(0,r)});return}y.settings.scrollPreviewWithEditor&&le(()=>{if(y.settings.fragment){let r;try{r=encodeURIComponent(y.settings.fragment)}catch{r=y.settings.fragment}N.fragment=void 0,_.setState(N);let o=xe(r,x);o&&(C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},200),z(o.line,x,y))}else isNaN(y.settings.line)||(C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},200),z(y.settings.line,x,y))}),typeof y.settings.selectedLine=="number"&&Ye.onDidChangeTextEditorSelection(y.settings.selectedLine,x)});var It=(()=>{let e=Ve(t=>{C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},50),le(()=>z(t,x,y))},50);return t=>{isNaN(t)||(N.line=t,e(t))}})();window.addEventListener("resize",()=>{C=1,w&&clearTimeout(w),w=window.setTimeout(()=>{C=0},200),Ke()},!0);function $e(){let e=document.getElementsByTagName("img"),t=0;for(let n of e){n.id="image-"+t,t+=1;let i=n.getAttribute("data-src"),o=i&&!(ye(ve.http,i)||ye(ve.https,i))?"localImage":"image";n.setAttribute("data-vscode-context",JSON.stringify({webviewSection:o,id:n.id,preventDefaultContextMenuItems:!0,resource:Y,imageSource:i}))}}async function ze(e,t=5){if(!document.hasFocus()&&t>0){setTimeout(()=>{ze(e,t-1)},20);return}try{await navigator.clipboard.write([new ClipboardItem({"image/png":new Promise(n=>{let i=document.createElement("canvas");i!==null&&(i.width=e.naturalWidth,i.height=e.naturalHeight,i.getContext("2d")?.drawImage(e,0,0)),i.toBlob(r=>{r&&n(r),i.remove()},"image/png")})})])}catch(n){console.error(n);let i=window.getSelection();if(!i){await navigator.clipboard.writeText(e.getAttribute("data-src")??e.src);return}i.removeAllRanges();let r=document.createRange();r.selectNode(e),i.addRange(r),document.execCommand("copy"),i.removeAllRanges()}}window.addEventListener("message",async e=>{let t=e.data;switch(t.type){case"copyImage":{let n=document.getElementById(t.id);n instanceof HTMLImageElement&&ze(n);return}case"onDidChangeTextEditorSelection":t.source===Y&&Ye.onDidChangeTextEditorSelection(t.line,x);return;case"updateView":t.source===Y&&It(t.line);return;case"updateContent":{we=t.lineChanges,t.diffScrollSync&&_e?.update(t.diffScrollSync);let n=document.querySelector(".markdown-body"),r=new DOMParser().parseFromString(t.content,"text/html");for(let o of Array.from(r.querySelectorAll("meta")))o.hasAttribute("http-equiv")&&o.remove();if(t.source!==Y){Y=t.source;let o=r.querySelector(".markdown-body");n.replaceWith(o),Se(o)}else{let o=r.querySelector(".markdown-body"),s=o.querySelectorAll("link");for(let a of s)a.remove();o.prepend(...s),Oe(n,o,{childrenOnly:!0,onBeforeElUpdated:(a,l)=>{if(Je(a,l)){let d=a.querySelectorAll("[data-line]"),c=l.querySelectorAll("[data-line]");d.length!==c.length&&console.log("unexpected line number change");for(let m=0;m<d.length;++m){let b=d[m],L=c[m];L&&b.setAttribute("data-line",L.getAttribute("data-line"))}return!1}return a.tagName==="DETAILS"&&l.tagName==="DETAILS"&&a.hasAttribute("open")&&l.setAttribute("open",""),!0},addChild:(a,l)=>{a.appendChild(l),l instanceof HTMLElement&&Se(l)}})}++x,window.dispatchEvent(new CustomEvent("vscode.markdown.updateContent")),$e(),Ge(we);break}}},!1);function Ge(e){for(let t of document.querySelectorAll(".code-line-diff-added, .code-line-diff-deleted, .code-line-diff-modified"))t.classList.remove("code-line-diff","code-line-diff-added","code-line-diff-deleted","code-line-diff-modified");for(let t of document.querySelectorAll(".diff-change-indicator"))t.remove();for(let t of document.querySelectorAll(".diff-modification-gutter"))t.remove();qe(e?.added,"code-line-diff-added"),qe(e?.deleted,"code-line-diff-deleted"),Rt(e),jt(e)}function qe(e,t){if(e)for(let n of e){let{previous:i,next:r}=W(n,x),o=i.line>=0?i:r,s=o?.codeElement||o?.element;s&&s.classList.add("code-line-diff",t)}}function Rt(e){if(e?.changeIndicators?.length)for(let t of e.changeIndicators){let{previous:n,next:i}=W(t.modifiedLine,x);if(t.type==="deletion"){let r=n.line===t.modifiedLine?n.codeElement||n.element:i?.codeElement||i?.element||n.codeElement||n.element;if(!r)continue;let o=Ft(t);r.parentElement?.insertBefore(o,r)}else{let r=new Set,o=!0;for(let s=0;s<t.modifiedLineCount;s++){let a=t.modifiedLine+s,{previous:l,next:d}=W(a,x),c=l.line>=0?l:d,m=c?.codeElement||c?.element;m&&!r.has(m)&&(r.add(m),m.classList.add("code-line-diff-modified"),Wt(m,o?t:void 0),o=!1)}}}}function Ft(e){let t=document.createElement("div");t.className=`diff-change-indicator diff-change-indicator-${e.type}`,t.setAttribute("data-original-line-count",String(e.originalLineCount));let n=document.createElement("span");n.className="diff-change-indicator-arrow";let i=Xe(e.originalContent,e.modifiedContent);return n.appendChild(i),t.appendChild(n),t}function Wt(e,t){let n=document.createElement("div");if(n.className="diff-modification-gutter",t){let i=Xe(t.originalContent,t.modifiedContent);n.appendChild(i)}e.style.position="relative",e.appendChild(n)}function Xe(e,t){let n=document.createElement("div");n.className="diff-change-indicator-tooltip";let i=e?e.split(`
|
|
2
|
+
`):[],r=t?t.split(`
|
|
3
|
+
`):[],o=qt(i,r);for(let s of o)if(s.type==="equal"){let a=document.createElement("div");a.className="diff-tooltip-unchanged";let l=document.createElement("pre");l.textContent=s.text,a.appendChild(l),n.appendChild(a)}else if(s.type==="delete"){let a=document.createElement("div");a.className="diff-tooltip-deleted";let l=document.createElement("pre");l.textContent=s.text,a.appendChild(l),n.appendChild(a)}else if(s.type==="insert"){let a=document.createElement("div");a.className="diff-tooltip-added";let l=document.createElement("pre");l.textContent=s.text,a.appendChild(l),n.appendChild(a)}else if(s.type==="modify"){let a=document.createElement("div");a.className="diff-tooltip-deleted";let l=document.createElement("pre");je(l,s.oldTokens,s.newTokens,"delete"),a.appendChild(l),n.appendChild(a);let d=document.createElement("div");d.className="diff-tooltip-added";let c=document.createElement("pre");je(c,s.oldTokens,s.newTokens,"insert"),d.appendChild(c),n.appendChild(d)}return n}function qt(e,t){let n=e.length,i=t.length,r=Array.from({length:n+1},()=>new Array(i+1).fill(0));for(let c=1;c<=n;c++)for(let m=1;m<=i;m++)e[c-1]===t[m-1]?r[c][m]=r[c-1][m-1]+1:r[c][m]=Math.max(r[c-1][m],r[c][m-1]);let o=[],s=n,a=i;for(;s>0||a>0;)s>0&&a>0&&e[s-1]===t[a-1]?(o.push({type:"equal",line:e[s-1]}),s--,a--):a>0&&(s===0||r[s][a-1]>=r[s-1][a])?(o.push({type:"insert",line:t[a-1]}),a--):(o.push({type:"delete",line:e[s-1]}),s--);o.reverse();let l=[],d=0;for(;d<o.length;){let c=o[d];if(c.type==="equal")l.push({type:"equal",text:c.line}),d++;else{let m=[],b=[];for(;d<o.length&&o[d].type!=="equal";)o[d].type==="delete"?m.push(o[d].line):b.push(o[d].line),d++;let L=Math.min(m.length,b.length);for(let S=0;S<L;S++)l.push({type:"modify",text:"",oldTokens:Ue(m[S]),newTokens:Ue(b[S])});for(let S=L;S<m.length;S++)l.push({type:"delete",text:m[S]});for(let S=L;S<b.length;S++)l.push({type:"insert",text:b[S]})}}return l}function Ue(e){return e.match(/\S+|\s+/g)||[""]}function Ut(e,t){let n=e.length,i=t.length,r=Array.from({length:n+1},()=>new Array(i+1).fill(0));for(let d=1;d<=n;d++)for(let c=1;c<=i;c++)e[d-1]===t[c-1]?r[d][c]=r[d-1][c-1]+1:r[d][c]=Math.max(r[d-1][c],r[d][c-1]);let o=new Set,s=new Set,a=n,l=i;for(;a>0&&l>0;)e[a-1]===t[l-1]?(o.add(a-1),s.add(l-1),a--,l--):r[a][l-1]>=r[a-1][l]?l--:a--;return[o,s]}function je(e,t,n,i){let[r,o]=Ut(t,n),s=i==="delete"?t:n,a=i==="delete"?r:o,l=i==="delete"?"diff-inline-deleted":"diff-inline-added";for(let d=0;d<s.length;d++)if(a.has(d))e.appendChild(document.createTextNode(s[d]));else{let c=document.createElement("span");c.className=l,c.textContent=s[d],e.appendChild(c)}}function jt(e){let t="diff-inner-added",n="diff-inner-deleted";if(CSS.highlights?.delete(t),CSS.highlights?.delete(n),!e?.innerChanges?.length||!CSS.highlights)return;let i=e.added?t:n,r=[],o=document.querySelector(".markdown-body");if(!o)return;let s=0;for(;;){let a=o.querySelector(`[data-diff-start="${s}"]`),l=o.querySelector(`[data-diff-end="${s}"]`);if(!a||!l)break;let d=new Range;d.setStartAfter(a),d.setEndBefore(l),r.push(d),s++}r.length>0&&CSS.highlights.set(i,new Highlight(...r))}document.addEventListener("dblclick",e=>{if(!y.settings.doubleClickToSwitchToEditor||Y.endsWith(".copilotmd"))return;for(let i=e.target;i;i=i.parentNode)if(i.tagName==="A")return;let t=e.pageY,n=me(t,x);typeof n=="number"&&!isNaN(n)&&X.postMessage("didClick",{line:Math.floor(n)})});var Vt=["http:","https:","mailto:","vscode:","vscode-insiders:"];document.addEventListener("click",e=>{if(!e)return;let t=e.target;for(;t;){if(t.tagName&&t.tagName==="A"&&t.href){if(t.getAttribute("href")?.startsWith("#"))return;let n=t.getAttribute("data-href");if(!n&&(n=t.getAttribute("href"),n&&Vt.some(i=>n.startsWith(i))))return;if(n&&!/^[a-z\-]+:/i.test(n)){X.postMessage("openLink",{href:n}),e.preventDefault(),e.stopPropagation();return}return}t=t.parentElement}},!0);window.addEventListener("scroll",Ve(()=>{if(Ke(),C>0)return;let e=me(window.scrollY,x);typeof e=="number"&&!isNaN(e)&&(N.line=e,_.setState(N),X.postMessage("revealLine",{line:e}),_e?.broadcastScroll(e))},50));function Ke(){N.scrollProgress=window.scrollY/document.body.clientHeight,_.setState(N)}function Je(e,t){let n=["open"];if(e.isEqualNode(t))return!0;if(e.tagName!==t.tagName||e.textContent!==t.textContent)return!1;let i=[...e.attributes].filter(a=>!n.includes(a.name)),r=[...t.attributes].filter(a=>!n.includes(a.name));if(i.length!==r.length)return!1;for(let a=0;a<i.length;++a){let l=i[a],d=r[a];if(l.name!==d.name||l.value!==d.value&&l.name!=="data-line")return!1}let o=Array.from(e.children),s=Array.from(t.children);return o.length===s.length&&o.every((a,l)=>Je(a,s[l]))}function Se(e){let t=["type","src","nonce","noModule","async"],n=e.tagName==="SCRIPT"?[e]:Array.from(e.getElementsByTagName("script"));for(let i of n){if(!(i instanceof HTMLElement))continue;let r=document.createElement("script"),o=i.innerText;r.text=o;for(let s of t){let a=i.getAttribute?.(s);a&&r.setAttribute(s,a)}i.insertAdjacentElement("afterend",r),i.remove()}}
|