md-editor-v3 2.9.1 → 2.9.3

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.
@@ -231,7 +231,7 @@ const staticTextDefault = {
231
231
  }
232
232
  }
233
233
  };
234
- const mermaidUrl = `${cdnBase}/mermaid/10.0.2/mermaid.esm.min.mjs`;
234
+ const mermaidUrl = `${cdnBase}/mermaid/9.4.0/mermaid.min.js`;
235
235
  const katexUrl = {
236
236
  js: `${cdnBase}/KaTeX/0.16.3/katex.min.js`,
237
237
  css: `${cdnBase}/KaTeX/0.16.3/katex.min.css`
@@ -6751,7 +6751,7 @@ const useMarked = (props) => {
6751
6751
  const mermaidData = useMermaid(props);
6752
6752
  const katexInited = useKatex(props, marked);
6753
6753
  const extensionsInited = computed(() => {
6754
- return mermaidData.mermaidInited && highlightInited.value && katexInited.value;
6754
+ return (props.noMermaid || mermaidData.mermaidInited) && highlightInited.value && (props.noKatex || katexInited.value);
6755
6755
  });
6756
6756
  let renderer = new marked.Renderer();
6757
6757
  renderer.image = (href, title, desc) => {
@@ -1,19 +1,19 @@
1
- (function(l,c){typeof exports=="object"&&typeof module!="undefined"?module.exports=c(require("vue")):typeof define=="function"&&define.amd?define(["vue"],c):(l=typeof globalThis!="undefined"?globalThis:l||self,l.MdEditorV3=c(l.Vue))})(this,function(l){"use strict";var _i=Object.defineProperty,Ii=Object.defineProperties;var Ri=Object.getOwnPropertyDescriptors;var Bt=Object.getOwnPropertySymbols;var Di=Object.prototype.hasOwnProperty,ji=Object.prototype.propertyIsEnumerable;var Ut=(l,c,J)=>c in l?_i(l,c,{enumerable:!0,configurable:!0,writable:!0,value:J}):l[c]=J,X=(l,c)=>{for(var J in c||(c={}))Di.call(c,J)&&Ut(l,J,c[J]);if(Bt)for(var J of Bt(c))ji.call(c,J)&&Ut(l,J,c[J]);return l},me=(l,c)=>Ii(l,Ri(c));const c="md-editor",J="md-editor-v3",qt="https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js",U="https://cdnjs.cloudflare.com/ajax/libs",Wt=`${U}/highlight.js/11.7.0/highlight.min.js`,st={main:`${U}/prettier/2.8.0/standalone.js`,markdown:`${U}/prettier/2.8.0/parser-markdown.js`},lt={css:`${U}/cropperjs/1.5.13/cropper.min.css`,js:`${U}/cropperjs/1.5.13/cropper.min.js`},Kt=`${U}/screenfull.js/5.2.0/screenfull.min.js`,ot=["bold","underline","italic","strikeThrough","-","title","sub","sup","quote","unorderedList","orderedList","task","-","codeRow","code","link","image","table","mermaid","katex","-","revoke","next","save","=","prettier","pageFullscreen","fullscreen","preview","htmlPreview","catalog","github"],rt=["markdownTotal","=","scrollSwitch"],at={"zh-CN":{toolbarTips:{bold:"\u52A0\u7C97",underline:"\u4E0B\u5212\u7EBF",italic:"\u659C\u4F53",strikeThrough:"\u5220\u9664\u7EBF",title:"\u6807\u9898",sub:"\u4E0B\u6807",sup:"\u4E0A\u6807",quote:"\u5F15\u7528",unorderedList:"\u65E0\u5E8F\u5217\u8868",orderedList:"\u6709\u5E8F\u5217\u8868",task:"\u4EFB\u52A1\u5217\u8868",codeRow:"\u884C\u5185\u4EE3\u7801",code:"\u5757\u7EA7\u4EE3\u7801",link:"\u94FE\u63A5",image:"\u56FE\u7247",table:"\u8868\u683C",mermaid:"mermaid\u56FE",katex:"katex\u516C\u5F0F",revoke:"\u540E\u9000",next:"\u524D\u8FDB",save:"\u4FDD\u5B58",prettier:"\u7F8E\u5316",pageFullscreen:"\u6D4F\u89C8\u5668\u5168\u5C4F",fullscreen:"\u5C4F\u5E55\u5168\u5C4F",preview:"\u9884\u89C8",htmlPreview:"html\u4EE3\u7801\u9884\u89C8",catalog:"\u76EE\u5F55",github:"\u6E90\u7801\u5730\u5740"},titleItem:{h1:"\u4E00\u7EA7\u6807\u9898",h2:"\u4E8C\u7EA7\u6807\u9898",h3:"\u4E09\u7EA7\u6807\u9898",h4:"\u56DB\u7EA7\u6807\u9898",h5:"\u4E94\u7EA7\u6807\u9898",h6:"\u516D\u7EA7\u6807\u9898"},imgTitleItem:{link:"\u6DFB\u52A0\u94FE\u63A5",upload:"\u4E0A\u4F20\u56FE\u7247",clip2upload:"\u88C1\u526A\u4E0A\u4F20"},linkModalTips:{linkTitle:"\u6DFB\u52A0\u94FE\u63A5",imageTitle:"\u6DFB\u52A0\u56FE\u7247",descLabel:"\u94FE\u63A5\u63CF\u8FF0\uFF1A",descLabelPlaceHolder:"\u8BF7\u8F93\u5165\u63CF\u8FF0...",urlLabel:"\u94FE\u63A5\u5730\u5740\uFF1A",urlLabelPlaceHolder:"\u8BF7\u8F93\u5165\u94FE\u63A5...",buttonOK:"\u786E\u5B9A"},clipModalTips:{title:"\u88C1\u526A\u56FE\u7247\u4E0A\u4F20",buttonUpload:"\u4E0A\u4F20"},copyCode:{text:"\u590D\u5236\u4EE3\u7801",successTips:"\u5DF2\u590D\u5236\uFF01",failTips:"\u590D\u5236\u5931\u8D25\uFF01"},mermaid:{flow:"\u6D41\u7A0B\u56FE",sequence:"\u65F6\u5E8F\u56FE",gantt:"\u7518\u7279\u56FE",class:"\u7C7B\u56FE",state:"\u72B6\u6001\u56FE",pie:"\u997C\u56FE",relationship:"\u5173\u7CFB\u56FE",journey:"\u65C5\u7A0B\u56FE"},katex:{inline:"\u884C\u5185\u516C\u5F0F",block:"\u5757\u7EA7\u516C\u5F0F"},footer:{markdownTotal:"\u5B57\u6570",scrollAuto:"\u540C\u6B65\u6EDA\u52A8"}},"en-US":{toolbarTips:{bold:"bold",underline:"underline",italic:"italic",strikeThrough:"strikeThrough",title:"title",sub:"subscript",sup:"superscript",quote:"quote",unorderedList:"unordered list",orderedList:"ordered list",task:"task list",codeRow:"inline code",code:"block-level code",link:"link",image:"image",table:"table",mermaid:"mermaid",katex:"formula",revoke:"revoke",next:"undo revoke",save:"save",prettier:"prettier",pageFullscreen:"fullscreen in page",fullscreen:"fullscreen",preview:"preview",htmlPreview:"html preview",catalog:"catalog",github:"source code"},titleItem:{h1:"Lv1 Heading",h2:"Lv2 Heading",h3:"Lv3 Heading",h4:"Lv4 Heading",h5:"Lv5 Heading",h6:"Lv6 Heading"},imgTitleItem:{link:"Add Img Link",upload:"Upload Img",clip2upload:"Clip Upload"},linkModalTips:{linkTitle:"Add Link",imageTitle:"Add Image",descLabel:"Desc:",descLabelPlaceHolder:"Enter a description...",urlLabel:"Link:",urlLabelPlaceHolder:"Enter a link...",buttonOK:"OK"},clipModalTips:{title:"Crop Image",buttonUpload:"Upload"},copyCode:{text:"Copy",successTips:"Copied!",failTips:"Copy failed!"},mermaid:{flow:"flow",sequence:"sequence",gantt:"gantt",class:"class",state:"state",pie:"pie",relationship:"relationship",journey:"journey"},katex:{inline:"inline",block:"block"},footer:{markdownTotal:"Word Count",scrollAuto:"Scroll Auto"}}},Zt=`${U}/mermaid/10.0.2/mermaid.esm.min.mjs`,Se={js:`${U}/KaTeX/0.16.3/katex.min.js`,css:`${U}/KaTeX/0.16.3/katex.min.css`},ct={a11y:{light:`${U}/highlight.js/11.7.0/styles/a11y-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/a11y-dark.min.css`},atom:{light:`${U}/highlight.js/11.7.0/styles/atom-one-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/atom-one-dark.min.css`},github:{light:`${U}/highlight.js/11.7.0/styles/github.min.css`,dark:`${U}/highlight.js/11.7.0/styles/github-dark.min.css`},gradient:{light:`${U}/highlight.js/11.7.0/styles/gradient-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/gradient-dark.min.css`},kimbie:{light:`${U}/highlight.js/11.7.0/styles/kimbie-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/kimbie-dark.min.css`},paraiso:{light:`${U}/highlight.js/11.7.0/styles/paraiso-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/paraiso-dark.min.css`},qtcreator:{light:`${U}/highlight.js/11.7.0/styles/qtcreator-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${U}/highlight.js/11.7.0/styles/stackoverflow-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/stackoverflow-dark.min.css`}},q={markedRenderer:s=>s,markedExtensions:[],markedOptions:{},editorExtensions:{},editorConfig:{}},Gt=s=>{if(s)for(const e in s){const t=s[e];t&&(q[e]=t)}};class Xt{constructor(){this.pools={}}remove(e,t,n){const o=this.pools[e]&&this.pools[e][t];o&&(this.pools[e][t]=o.filter(a=>a!==n))}clear(e){this.pools[e]={}}on(e,t){return this.pools[e]||(this.pools[e]={}),this.pools[e][t.name]||(this.pools[e][t.name]=[]),this.pools[e][t.name].push(t.callback),this.pools[e][t.name].includes(t.callback)}emit(e,t,...n){this.pools[e]||(this.pools[e]={});const o=this.pools[e][t];o&&o.forEach(a=>{try{a(...n)}catch(r){console.error(`${t} monitor event exception\uFF01`,r)}})}}var y=new Xt;const se=(s,e=0,t=e)=>new Promise((n,i)=>{s.setSelectionRange?setTimeout(()=>{s.setSelectionRange(e,t),s.focus(),n(!0)},0):(console.error("Can not reset position!"),i())}),Be=(s,e,t)=>{const{deviationStart:n=0,deviationEnd:i=0,direct:o=!1,select:a=!1}=t;let r="";if(s.selectionStart||s.selectionStart===0){const u=s.selectionStart,h=s.selectionEnd||0,{prefixVal:d=s.value.substring(0,u),subfixVal:p=s.value.substring(h,s.value.length)}=t;r=d+e+p,se(s,a?u+n:u+e.length+i,u+e.length+i)}else r+=e;return o&&(s.value=r),r},Qt=(s,e={newWindow:!0,nofollow:!0})=>{s||console.error("error link!");const t=document.createElement("a");t.href=s,t.style.display="none",e.newWindow&&(t.target="_blank"),e.nofollow&&(t.rel="noopener noreferrer"),document.body.appendChild(t),t.click(),document.body.removeChild(t)},dt=(s,e)=>{const t=Ee(()=>{s.removeEventListener("scroll",n),s.addEventListener("scroll",n),e.removeEventListener("scroll",n),e.addEventListener("scroll",n)},50),n=i=>{const o=s.clientHeight,a=e.clientHeight,r=s.scrollHeight,u=e.scrollHeight,h=(r-o)/(u-a);i.target===s?(e.removeEventListener("scroll",n),e.scrollTo({top:s.scrollTop/h}),t()):(s.removeEventListener("scroll",n),s.scrollTo({top:e.scrollTop*h}),t())};return[()=>{t().finally(()=>{s.dispatchEvent(new Event("scroll"))})},()=>{s.removeEventListener("scroll",n),e.removeEventListener("scroll",n)}]},Yt=(s,e="image.png")=>{const t=s.split(","),n=t[0].match(/:(.*?);/);if(n){const i=n[1],o=atob(t[1]);let a=o.length;const r=new Uint8Array(a);for(;a--;)r[a]=o.charCodeAt(a);return new File([r],e,{type:i})}return null},Ue=s=>{if(!s.trim())return s;const e=s.split(`
2
- `),t=['<span rn-wrapper aria-hidden="true">'];return e.forEach(()=>{t.push("<span></span>")}),t.push("</span>"),`<span class="code-block">${s}</span>${t.join("")}`},Ee=(s,e=200)=>{let t=0;return(...n)=>new Promise(i=>{t&&(clearTimeout(t),i("cancel")),t=window.setTimeout(()=>{s.apply(globalThis,n),t=0,i("done")},e)})},Jt=(s,e=200)=>{let t=0,n=null;return(...i)=>{const o=a=>{t===0&&(t=a),a-t>=e?(s.apply(globalThis,n),n=null,t=0):window.requestAnimationFrame(o)};n===null&&window.requestAnimationFrame(o),n=i}},ut=(s,e="$")=>{const t=s.split(e);let n=e,i="";for(let o=1;o<t.length;o++)if(/\\$/.test(t[o]))n+=t[o]+"$",i+=t[o]+"$";else{n+=t[o]+e,i+=t[o];break}return[n,i]},en=s=>{var t;return navigator.userAgent.indexOf("Firefox")>-1?s.value.substring(s.selectionStart,s.selectionEnd):((t=window.getSelection())==null?void 0:t.toString())||""},tn=(s,e)=>{const t=s==null?void 0:s.getBoundingClientRect();if(e===document.documentElement)return t.top-e.clientTop;const n=e==null?void 0:e.getBoundingClientRect();return t.top-n.top},nn=(s,e)=>{const t=X({},s);return e.forEach(n=>{Reflect.deleteProperty(t,n)}),t},sn=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`,ht=(s,e)=>{const t=n=>{const i=s.parentElement||document.body,o=i.offsetWidth,a=i.offsetHeight,{clientWidth:r}=document.documentElement,{clientHeight:u}=document.documentElement,h=n.offsetX,d=n.offsetY,p=f=>{let w=f.x+document.body.scrollLeft-document.body.clientLeft-h,v=f.y+document.body.scrollTop-document.body.clientTop-d;w=w<1?1:w<r-o-1?w:r-o-1,v=v<1?1:v<u-a-1?v:u-a-1,e?e(w,v):(i.style.left=`${w}px`,i.style.top=`${v}px`)};document.addEventListener("mousemove",p);const m=()=>{document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",m)};document.addEventListener("mouseup",m)};return s.addEventListener("mousedown",t),()=>{s.removeEventListener("mousedown",t)}},Q=(s,e="")=>{const t=document.getElementById(s.id),n=i=>{typeof s.onload=="function"&&s.onload(i),s.removeEventListener("load",n)};t?e!==""&&s.onload instanceof Function&&(Reflect.get(window,e)?s.dispatchEvent(new Event("load")):t.addEventListener("load",n)):(s.addEventListener("load",n),document.head.appendChild(s))},ln=Ee((s,e,t)=>{const n=document.getElementById(s);n&&n.setAttribute(e,t)},10),Te="onSave",qe="changeCatalogVisible",ft="changeFullscreen",mt="pageFullscreenChanged",pt="fullscreenChanged",We="previewChanged",gt="htmlPreviewChanged",bt="catalogVisibleChanged",kt="textareaFocus",on=(s,e)=>{const{editorId:t,noPrettier:n,previewOnly:i}=s,o=l.reactive({buildFinished:!1,html:""}),a=r=>{if(r.target===document.querySelector(`#${s.editorId}-textarea`))if(y.emit(t,"selectTextChange"),r.ctrlKey||r.metaKey)switch(r.code){case"KeyS":{r.shiftKey?y.emit(t,"replace","strikeThrough"):(y.emit(t,Te,s.modelValue),r.preventDefault());break}case"KeyB":{y.emit(t,"replace","bold"),r.preventDefault();break}case"KeyU":{r.shiftKey?(y.emit(t,"replace","unorderedList"),r.preventDefault()):(y.emit(t,"replace","underline"),r.preventDefault());break}case"KeyI":{r.shiftKey?(y.emit(t,"openModals","image"),r.preventDefault()):(y.emit(t,"replace","italic"),r.preventDefault());break}case"Digit1":{y.emit(t,"replace","h1"),r.preventDefault();break}case"Digit2":{y.emit(t,"replace","h2"),r.preventDefault();break}case"Digit3":{y.emit(t,"replace","h3"),r.preventDefault();break}case"Digit4":{y.emit(t,"replace","h4"),r.preventDefault();break}case"Digit5":{y.emit(t,"replace","h5"),r.preventDefault();break}case"Digit6":{y.emit(t,"replace","h6"),r.preventDefault();break}case"ArrowUp":{y.emit(t,"replace","sup"),r.preventDefault();break}case"ArrowDown":{y.emit(t,"replace","sub"),r.preventDefault();break}case"KeyQ":{if(r.key==="a"){r.target.select();return}y.emit(t,"replace","quote"),r.preventDefault();break}case"KeyA":if(r.key==="q"){y.emit(t,"replace","quote"),r.preventDefault();break}else return;case"KeyO":{y.emit(t,"replace","orderedList"),r.preventDefault();break}case"KeyC":{if(r.shiftKey)y.emit(t,"replace","code"),r.preventDefault();else if(r.altKey)y.emit(t,"replace","codeRow"),r.preventDefault();else{r.preventDefault(),y.emit(t,"replace","ctrlC");break}break}case"KeyL":{y.emit(t,"openModals","link"),r.preventDefault();break}case"KeyZ":{if(r.key==="w")return;r.shiftKey?(y.emit(t,"ctrlShiftZ"),r.preventDefault()):(y.emit(t,"ctrlZ"),r.preventDefault());break}case"KeyW":if(r.key==="z"){r.shiftKey?(y.emit(t,"ctrlShiftZ"),r.preventDefault()):(y.emit(t,"ctrlZ"),r.preventDefault());break}else return;case"KeyF":{r.shiftKey&&(n||(y.emit(t,"replace","prettier"),r.preventDefault()));break}case"KeyT":{r.altKey&&r.shiftKey&&(y.emit(t,"replace","table"),r.preventDefault());break}case"KeyX":{y.emit(t,"replace","ctrlX"),r.preventDefault();break}case"KeyD":{r.preventDefault(),y.emit(t,"replace","ctrlD");break}}else r.code==="Tab"&&(r.preventDefault(),r.shiftKey?y.emit(t,"replace","shiftTab"):y.emit(t,"replace","tab"))};l.watch(()=>s.modelValue,()=>{o.buildFinished=!1}),l.onMounted(()=>{i||(window.addEventListener("keydown",a),y.on(t,{name:"buildFinished",callback(r){o.buildFinished=!0,o.html=r}}),y.on(t,{name:Te,callback(){const r=new Promise(u=>{if(o.buildFinished)u(o.html);else{const h=d=>{u(d),y.remove(t,"buildFinished",h)};y.on(t,{name:"buildFinished",callback:h})}});s.onSave?s.onSave(s.modelValue,r):e.emit("onSave",s.modelValue,r)}}))}),l.onBeforeUnmount(()=>{i||window.removeEventListener("keydown",a)})},rn=s=>{var o;const{editorId:e,previewOnly:t}=s,n=(o=q==null?void 0:q.editorExtensions)==null?void 0:o.highlight;l.provide("editorId",e),l.provide("tabWidth",s.tabWidth),l.provide("theme",l.computed(()=>s.theme)),l.provide("highlight",l.computed(()=>{const a=X(X({},ct),n==null?void 0:n.css),r=s.codeStyleReverse&&s.codeStyleReverseList.includes(s.previewTheme)?"dark":s.theme;return{js:(n==null?void 0:n.js)||Wt,css:a[s.codeTheme]?a[s.codeTheme][r]:ct.atom[r]}})),l.provide("historyLength",s.historyLength),l.provide("previewOnly",t),l.provide("showCodeRowNumber",s.showCodeRowNumber);const i=l.computed(()=>{var r;const a=X(X({},at),(r=q==null?void 0:q.editorConfig)==null?void 0:r.languageUserDefined);return a[s.language]?a[s.language]:at["zh-CN"]});l.provide("usedLanguageText",i),l.provide("previewTheme",l.computed(()=>s.previewTheme))},an=s=>{var h,d,p,m,f,w;const{noPrettier:e,previewOnly:t,noIconfont:n,noUploadImg:i}=s,{editorExtensions:o}=q,a=e||!!((d=(h=q.editorExtensions)==null?void 0:h.prettier)!=null&&d.prettierInstance),r=e||!!((m=(p=q.editorExtensions)==null?void 0:p.prettier)!=null&&m.parserMarkdownInstance),u=i||!!((w=(f=q.editorExtensions)==null?void 0:f.cropper)!=null&&w.instance);l.onMounted(()=>{var E,V,D,C;const v=document.createElement("script");v.src=(o==null?void 0:o.iconfont)||qt,v.id=`${c}-icon`;const b=document.createElement("script"),k=document.createElement("script");b.src=((E=o==null?void 0:o.prettier)==null?void 0:E.standaloneJs)||st.main,b.id=`${c}-prettier`,k.src=((V=o==null?void 0:o.prettier)==null?void 0:V.parserMarkdownJs)||st.markdown,k.id=`${c}-prettierMD`;const x=document.createElement("link");x.rel="stylesheet",x.href=((D=o==null?void 0:o.cropper)==null?void 0:D.css)||lt.css,x.id=`${c}-cropperCss`;const $=document.createElement("script");$.src=((C=o==null?void 0:o.cropper)==null?void 0:C.js)||lt.js,$.id=`${c}-cropper`,n||Q(v),t||(u||(Q(x),Q($)),a||Q(b),r||Q(k))})},cn=(s,e)=>{const{editorId:t,previewOnly:n}=s,i=l.reactive({pageFullscreen:s.pageFullscreen,fullscreen:!1,preview:s.preview,htmlPreview:s.preview?!1:s.htmlPreview}),o=(u,h)=>{i[u]=h===void 0?!i[u]:h,u==="preview"&&i.preview?i.htmlPreview=!1:u==="htmlPreview"&&i.htmlPreview&&(i.preview=!1)};let a="";const r=()=>{i.pageFullscreen||i.fullscreen?document.body.style.overflow="hidden":document.body.style.overflow=a};return l.watch(()=>[i.pageFullscreen,i.fullscreen],r),l.onMounted(()=>{n||y.on(t,{name:"uploadImage",callback(u,h){const d=p=>{y.emit(t,"replace","image",{desc:"",urls:p}),h&&h()};s.onUploadImg?s.onUploadImg(u,d):e.emit("onUploadImg",u,d)}}),a=document.body.style.overflow,r()}),[i,o]},dn=s=>{const{editorId:e}=s,t=l.ref(!1);l.onMounted(()=>{y.on(e,{name:qe,callback:i=>{i===void 0?t.value=!t.value:t.value=i}})});const n=l.computed(()=>!s.toolbarsExclude.includes("catalog")&&s.toolbars.includes("catalog"));return[t,n]},un=(s,e,t,n,i)=>{const{editorId:o}=s;l.watch(()=>n.pageFullscreen,r=>{y.emit(o,mt,r)}),l.watch(()=>n.fullscreen,r=>{y.emit(o,pt,r)}),l.watch(()=>n.preview,r=>{y.emit(o,We,r)}),l.watch(()=>n.htmlPreview,r=>{y.emit(o,gt,r)}),l.watch(t,r=>{y.emit(o,bt,r)});const a={on(r,u){switch(r){case"pageFullscreen":{y.on(o,{name:mt,callback(h){u(h)}});break}case"fullscreen":{y.on(o,{name:pt,callback(h){u(h)}});break}case"preview":{y.on(o,{name:We,callback(h){u(h)}});break}case"htmlPreview":{y.on(o,{name:gt,callback(h){u(h)}});break}case"catalog":{y.on(o,{name:bt,callback(h){u(h)}});break}}},togglePageFullscreen(r){i("pageFullscreen",r)},toggleFullscreen(r){y.emit(o,ft,r)},togglePreview(r){i("preview",r)},toggleHtmlPreview(r){i("htmlPreview",r)},toggleCatalog(r){y.emit(o,qe,r)},triggerSave(){y.emit(o,Te)},insert(r){y.emit(o,"replace","universal",{generate:r})},focus(){y.emit(o,kt)}};e.expose(a)};var Oi="",hn=l.defineComponent({setup(){return()=>l.createVNode("div",{class:`${c}-divider`},null)}});const ee=({instance:s,ctx:e,props:t={}},n="default")=>{const i=(s==null?void 0:s.$slots[n])||(e==null?void 0:e.slots[n]);return(i?i(s):"")||t[n]};var Mi="";const fn=()=>({trigger:{type:String,default:"hover"},overlay:{type:[String,Object],default:""},visible:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}},relative:{type:String,default:"html"}});var pe=l.defineComponent({props:fn(),setup(s,e){const t=`${c}-dropdown-hidden`,n=l.reactive({overlayClass:[t],overlayStyle:{},triggerHover:!1,overlayHover:!1}),i=l.ref(),o=l.ref(),a=()=>{var $;s.trigger==="hover"&&(n.triggerHover=!0);const p=i.value,m=o.value,f=p.getBoundingClientRect(),w=p.offsetTop,v=p.offsetLeft,b=f.height,k=f.width,x=(($=document.querySelector(s.relative))==null?void 0:$.scrollLeft)||0;n.overlayStyle=me(X({},n.overlayStyle),{top:w+b+"px",left:v-m.offsetWidth/2+k/2-x+"px"}),s.onChange(!0)},r=()=>{n.overlayHover=!0};l.watch(()=>s.visible,p=>{p?n.overlayClass=n.overlayClass.filter(m=>m!==t):n.overlayClass.push(t)});const u=p=>{const m=i.value,f=o.value;!m.contains(p.target)&&!f.contains(p.target)&&s.onChange(!1)};let h=-1;const d=p=>{i.value===p.target?n.triggerHover=!1:n.overlayHover=!1,clearTimeout(h),h=window.setTimeout(()=>{!n.overlayHover&&!n.triggerHover&&s.onChange(!1)},10)};return l.onMounted(()=>{s.trigger==="click"?(i.value.addEventListener("click",a),document.addEventListener("click",u)):(i.value.addEventListener("mouseenter",a),i.value.addEventListener("mouseleave",d),o.value.addEventListener("mouseenter",r),o.value.addEventListener("mouseleave",d))}),l.onBeforeUnmount(()=>{s.trigger==="click"?(i.value.removeEventListener("click",a),document.removeEventListener("click",u)):(i.value.removeEventListener("mouseenter",a),i.value.removeEventListener("mouseleave",d),o.value.removeEventListener("mouseenter",r),o.value.removeEventListener("mouseleave",d))}),()=>{const p=ee({ctx:e}),m=ee({props:s,ctx:e},"overlay"),f=l.cloneVNode(p instanceof Array?p[0]:p,{ref:i}),w=l.createVNode("div",{class:[`${c}-dropdown`,n.overlayClass],style:n.overlayStyle,ref:o},[l.createVNode("div",{class:`${c}-dropdown-overlay`},[m instanceof Array?m[0]:m])]);return[f,w]}}}),Hi="";const mn=()=>({title:{type:String,default:""},visible:{type:Boolean,default:!1},width:{type:String,default:"auto"},height:{type:String,default:"auto"},onClose:{type:Function,default:()=>{}},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function,default:()=>{}},class:{type:String}});var Ke=l.defineComponent({props:mn(),setup(s,e){const t=l.ref(s.visible),n=l.ref([`${c}-modal`]),i=l.ref(),o=l.ref();let a=()=>{};const r=l.reactive({initPos:{left:"0px",top:"0px"},historyPos:{left:"0px",top:"0px"}}),u=l.computed(()=>s.isFullscreen?{width:"100%",height:"100%"}:{width:s.width,height:s.height});return l.onMounted(()=>{a=ht(o.value,(h,d)=>{r.initPos.left=h+"px",r.initPos.top=d+"px"})}),l.onBeforeUnmount(()=>{a()}),l.watch(()=>s.isFullscreen,h=>{h?a():a=ht(o.value,(d,p)=>{r.initPos.left=d+"px",r.initPos.top=p+"px"})}),l.watch(()=>s.visible,h=>{h?(n.value.push("zoom-in"),t.value=h,l.nextTick(()=>{const d=i.value.offsetWidth/2,p=i.value.offsetHeight/2,m=document.documentElement.clientWidth/2,f=document.documentElement.clientHeight/2;r.initPos.left=m-d+"px",r.initPos.top=f-p+"px"}),setTimeout(()=>{n.value=n.value.filter(d=>d!=="zoom-in")},140)):(n.value.push("zoom-out"),setTimeout(()=>{n.value=n.value.filter(d=>d!=="zoom-out"),t.value=h},130))}),()=>{const h=ee({ctx:e}),d=ee({props:s,ctx:e},"title");return l.createVNode("div",{class:[s.class],style:{display:t.value?"block":"none"}},[l.createVNode("div",{class:`${c}-modal-mask`,onClick:s.onClose},null),l.createVNode("div",{class:n.value,style:X(X({},r.initPos),u.value),ref:i},[l.createVNode("div",{class:`${c}-modal-header`,ref:o},[d||""]),l.createVNode("div",{class:`${c}-modal-body`},[h]),l.createVNode("div",{class:`${c}-modal-func`},[s.showAdjust&&l.createVNode("div",{class:`${c}-modal-adjust`,onClick:p=>{p.stopPropagation(),s.isFullscreen?r.initPos=r.historyPos:(r.historyPos=r.initPos,r.initPos={left:"0",top:"0"}),s.onAdjust(!s.isFullscreen)}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":`#md-editor-icon-${s.isFullscreen?"suoxiao":"fangda"}`},null)])]),l.createVNode("div",{class:`${c}-modal-close`,onClick:p=>{p.stopPropagation(),s.onClose&&s.onClose()}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-close"},null)])])])])])}}});const pn=()=>({type:{type:String,default:"link"},visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}});var gn=l.defineComponent({props:pn(),setup(s){const e=l.inject("usedLanguageText"),t=l.inject("editorId"),n=l.computed(()=>{var o,a;switch(s.type){case"link":return(o=e.value.linkModalTips)==null?void 0:o.linkTitle;case"image":return(a=e.value.linkModalTips)==null?void 0:a.imageTitle;default:return""}}),i=l.reactive({desc:"",url:""});return l.watch(()=>s.visible,o=>{o||setTimeout(()=>{i.desc="",i.url=""},200)}),()=>l.createVNode(Ke,{title:n.value,visible:s.visible,onClose:s.onCancel},{default:()=>{var o,a,r,u,h;return[l.createVNode("div",{class:`${c}-form-item`},[l.createVNode("label",{class:`${c}-label`,for:`link-desc-${t}`},[(o=e.value.linkModalTips)==null?void 0:o.descLabel]),l.createVNode("input",{placeholder:(a=e.value.linkModalTips)==null?void 0:a.descLabelPlaceHolder,class:`${c}-input`,id:`link-desc-${t}`,type:"text",value:i.desc,onChange:d=>{i.desc=d.target.value},autocomplete:"off"},null)]),l.createVNode("div",{class:`${c}-form-item`},[l.createVNode("label",{class:`${c}-label`,for:`link-url-${t}`},[(r=e.value.linkModalTips)==null?void 0:r.urlLabel]),l.createVNode("input",{placeholder:(u=e.value.linkModalTips)==null?void 0:u.urlLabelPlaceHolder,class:`${c}-input`,id:`link-url-${t}`,type:"text",value:i.url,onChange:d=>{i.url=d.target.value},autocomplete:"off"},null)]),l.createVNode("div",{class:`${c}-form-item`},[l.createVNode("button",{class:[`${c}-btn`,`${c}-btn-row`],type:"button",onClick:()=>{s.onOk(i),i.desc="",i.url=""}},[(h=e.value.linkModalTips)==null?void 0:h.buttonOK])])]}})}}),Pi="";const bn=()=>({visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}});var kn=l.defineComponent({props:bn(),setup(s){var d,p;const e=l.inject("usedLanguageText"),t=l.inject("editorId");let n=(p=(d=q==null?void 0:q.editorExtensions)==null?void 0:d.cropper)==null?void 0:p.instance;const i=l.ref(),o=l.ref(),a=l.ref(),r=l.reactive({cropperInited:!1,imgSelected:!1,imgSrc:"",isFullscreen:!1});let u=null;l.watch(()=>s.visible,()=>{s.visible&&!r.cropperInited&&(n=n||window.Cropper,i.value.onchange=()=>{if(!n){y.emit(t,"errorCatcher",{name:"Cropper",message:"Cropper is undefined"});return}const m=i.value.files||[];if(r.imgSelected=!0,(m==null?void 0:m.length)>0){const f=new FileReader;f.onload=w=>{r.imgSrc=w.target.result,l.nextTick(()=>{u=new n(o.value,{viewMode:2,preview:`.${c}-clip-preview-target`})})},f.readAsDataURL(m[0])}})}),l.watch(()=>[r.imgSelected],()=>{a.value.style=""}),l.watch(()=>r.isFullscreen,()=>{l.nextTick(()=>{u==null||u.destroy(),a.value.style="",o.value&&(u=new n(o.value,{viewMode:2,preview:`.${c}-clip-preview-target`}))})});const h=()=>{u.clear(),u.destroy(),u=null,i.value.value="",r.imgSelected=!1};return()=>{var m;return l.createVNode(Ke,{class:`${c}-modal-clip`,title:(m=e.value.clipModalTips)==null?void 0:m.title,visible:s.visible,onClose:s.onCancel,showAdjust:!0,isFullscreen:r.isFullscreen,onAdjust:f=>{r.isFullscreen=f},width:"668px",height:"421px"},{default:()=>{var f,w;return[l.createVNode("div",{class:`${c}-form-item ${c}-clip`},[l.createVNode("div",{class:`${c}-clip-main`},[r.imgSelected?l.createVNode("div",{class:`${c}-clip-cropper`},[l.createVNode("img",{src:r.imgSrc,ref:o,style:{display:"none"},alt:""},null),l.createVNode("div",{class:`${c}-clip-delete`,onClick:h},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-delete"},null)])])]):l.createVNode("div",{class:`${c}-clip-upload`,onClick:()=>{i.value.click()}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-upload"},null)])])]),l.createVNode("div",{class:`${c}-clip-preview`},[l.createVNode("div",{class:`${c}-clip-preview-target`,ref:a},null)])]),l.createVNode("div",{class:`${c}-form-item`},[l.createVNode("button",{class:`${c}-btn`,type:"button",onClick:()=>{if(u){const v=u.getCroppedCanvas();y.emit(t,"uploadImage",[Yt(v.toDataURL("image/png"))],s.onOk),h()}}},[((f=e.value.clipModalTips)==null?void 0:f.buttonUpload)||((w=e.value.linkModalTips)==null?void 0:w.buttonOK)])]),l.createVNode("input",{ref:i,accept:"image/*",type:"file",multiple:!1,style:{display:"none"}},null)]}})}}});const yn=()=>({type:{type:String,default:"link"},linkVisible:{type:Boolean,default:!1},clipVisible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}});var wn=l.defineComponent({props:yn(),setup(s){return()=>l.createVNode(l.Fragment,null,[l.createVNode(gn,{type:s.type,visible:s.linkVisible,onOk:s.onOk,onCancel:s.onCancel},null),l.createVNode(kn,{visible:s.clipVisible,onOk:s.onOk,onCancel:s.onCancel},null)])}});const vn=s=>{var u,h,d,p;const e=l.inject("editorId");let t=(h=(u=q.editorExtensions)==null?void 0:u.screenfull)==null?void 0:h.instance;const n=(p=(d=q.editorExtensions)==null?void 0:d.screenfull)==null?void 0:p.js,i=l.ref(!1),o=m=>{if(!t){y.emit(e,"errorCatcher",{name:"fullscreen",message:"fullscreen is undefined"});return}t.isEnabled?(i.value=!0,(m===void 0?!t.isFullscreen:m)?t.request():t.exit()):console.error("browser does not support screenfull!")},a=()=>{t&&t.isEnabled&&t.on("change",()=>{(i.value||s.setting.fullscreen)&&(i.value=!1,s.updateSetting("fullscreen"))})},r=()=>{t=window.screenfull,a()};return l.onMounted(()=>{if(a(),!t){const m=document.createElement("script");m.src=n||Kt,m.onload=r,m.id=`${c}-screenfull`,Q(m,"screenfull")}}),l.onMounted(()=>{y.on(e,{name:ft,callback:o})}),{fullscreenHandler:o}},xn=()=>({tableShape:{type:Array,default:()=>[6,4]},onSelected:{type:Function,default:()=>{}}}),$n=l.defineComponent({name:"TableShape",props:xn(),setup(s){const e=l.reactive({x:-1,y:-1});return()=>l.createVNode("div",{class:`${c}-table-shape`,onMouseleave:()=>{e.x=-1,e.y=-1}},[new Array(s.tableShape[1]).fill("").map((t,n)=>l.createVNode("div",{class:`${c}-table-shape-row`,key:`table-shape-row-${n}`},[new Array(s.tableShape[0]).fill("").map((i,o)=>l.createVNode("div",{class:`${c}-table-shape-col`,key:`table-shape-col-${o}`,onMouseenter:()=>{e.x=n,e.y=o},onClick:()=>{s.onSelected(e)}},[l.createVNode("div",{class:[`${c}-table-shape-col-default`,n<=e.x&&o<=e.y&&`${c}-table-shape-col-include`]},null)]))]))])}}),Cn=()=>({noPrettier:{type:Boolean},toolbars:{type:Array,default:()=>[]},toolbarsExclude:{type:Array,default:()=>[]},setting:{type:Object,default:()=>({})},screenfull:{type:Object,default:null},screenfullJs:{type:String,default:""},updateSetting:{type:Function,default:()=>{}},tableShape:{type:Array,default:()=>[6,4]},defToolbars:{type:Object},noUploadImg:{type:Boolean}});var Sn=l.defineComponent({name:"MDEditorToolbar",props:Cn(),setup(s){const e=l.inject("editorId"),t=l.inject("usedLanguageText"),{fullscreenHandler:n}=vn(s),i=`${e}-toolbar-wrapper`,o=l.reactive({title:!1,catalog:!1,image:!1,table:!1,mermaid:!1,katex:!1}),a=(f,w)=>{y.emit(e,"replace",f,w)},r=l.reactive({type:"link",linkVisible:!1,clipVisible:!1}),u=l.ref();l.onMounted(()=>{y.on(e,{name:"openModals",callback(f){r.type=f,r.linkVisible=!0}})});const h=l.computed(()=>{const f=s.toolbars.filter(k=>!s.toolbarsExclude.includes(k)),w=f.indexOf("="),v=w===-1?f:f.slice(0,w+1),b=w===-1?[]:f.slice(w,Number.MAX_SAFE_INTEGER);return[v,b]}),d=l.ref(),p=()=>{y.emit(e,"uploadImage",Array.from(d.value.files||[])),d.value.value=""};l.onMounted(()=>{d.value.addEventListener("change",p)});const m=f=>{var w,v,b,k,x,$,E,V,D,C,g,M,O,j,z,A,I,H,_,W,T,F,R,K,G,Y,ie,re,he,ce,fe,De,je,ke,ye,Oe,Me,we,He,Pe,Ce,Ht,Pt;if(ot.includes(f))switch(f){case"-":return l.createVNode(hn,null,null);case"bold":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(w=t.value.toolbarTips)==null?void 0:w.bold,onClick:()=>{a("bold")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-bold"},null)])]);case"underline":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(v=t.value.toolbarTips)==null?void 0:v.underline,onClick:()=>{a("underline")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-underline"},null)])]);case"italic":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(b=t.value.toolbarTips)==null?void 0:b.italic,onClick:()=>{a("italic")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-italic"},null)])]);case"strikeThrough":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(k=t.value.toolbarTips)==null?void 0:k.strikeThrough,onClick:()=>{a("strikeThrough")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-strike-through"},null)])]);case"title":return l.createVNode(pe,{relative:`#${i}`,visible:o.title,onChange:P=>{o.title=P},overlay:l.createVNode("ul",{class:`${c}-menu`,onClick:()=>{o.title=!1}},[l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h1")}},[(x=t.value.titleItem)==null?void 0:x.h1]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h2")}},[($=t.value.titleItem)==null?void 0:$.h2]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h3")}},[(E=t.value.titleItem)==null?void 0:E.h3]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h4")}},[(V=t.value.titleItem)==null?void 0:V.h4]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h5")}},[(D=t.value.titleItem)==null?void 0:D.h5]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h6")}},[(C=t.value.titleItem)==null?void 0:C.h6])])},{default:()=>{var P;return[l.createVNode("div",{class:`${c}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.title},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-title"},null)])])]}});case"sub":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(g=t.value.toolbarTips)==null?void 0:g.sub,onClick:()=>{a("sub")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-sub"},null)])]);case"sup":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(M=t.value.toolbarTips)==null?void 0:M.sup,onClick:()=>{a("sup")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-sup"},null)])]);case"quote":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(O=t.value.toolbarTips)==null?void 0:O.quote,onClick:()=>{a("quote")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-quote"},null)])]);case"unorderedList":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(j=t.value.toolbarTips)==null?void 0:j.unorderedList,onClick:()=>{a("unorderedList")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-unordered-list"},null)])]);case"orderedList":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(z=t.value.toolbarTips)==null?void 0:z.orderedList,onClick:()=>{a("orderedList")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-ordered-list"},null)])]);case"task":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(A=t.value.toolbarTips)==null?void 0:A.task,onClick:()=>{a("task")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-task"},null)])]);case"codeRow":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(I=t.value.toolbarTips)==null?void 0:I.codeRow,onClick:()=>{a("codeRow")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-code-row"},null)])]);case"code":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(H=t.value.toolbarTips)==null?void 0:H.code,onClick:()=>{a("code")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-code"},null)])]);case"link":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(_=t.value.toolbarTips)==null?void 0:_.link,onClick:()=>{r.type="link",r.linkVisible=!0}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-link"},null)])]);case"image":return s.noUploadImg?l.createVNode("div",{class:`${c}-toolbar-item`,title:(W=t.value.toolbarTips)==null?void 0:W.image,onClick:()=>{r.type="image",r.linkVisible=!0}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-image"},null)])]):l.createVNode(pe,{relative:`#${i}`,visible:o.image,onChange:P=>{o.image=P},overlay:l.createVNode("ul",{class:`${c}-menu`,onClick:()=>{o.title=!1}},[l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{r.type="image",r.linkVisible=!0}},[(T=t.value.imgTitleItem)==null?void 0:T.link]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{d.value.click()}},[(F=t.value.imgTitleItem)==null?void 0:F.upload]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{r.clipVisible=!0}},[(R=t.value.imgTitleItem)==null?void 0:R.clip2upload])])},{default:()=>{var P;return[l.createVNode("div",{class:`${c}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.image},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-image"},null)])])]}});case"table":return l.createVNode(pe,{relative:`#${i}`,visible:o.table,onChange:P=>{o.table=P},key:"bar-table",overlay:l.createVNode($n,{tableShape:s.tableShape,onSelected:P=>{a("table",{selectedShape:P})}},null)},{default:()=>{var P;return[l.createVNode("div",{class:`${c}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.table},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-table"},null)])])]}});case"revoke":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(K=t.value.toolbarTips)==null?void 0:K.revoke,onClick:()=>{y.emit(e,"ctrlZ")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-revoke"},null)])]);case"next":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(G=t.value.toolbarTips)==null?void 0:G.next,onClick:()=>{y.emit(e,"ctrlShiftZ")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-next"},null)])]);case"save":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(Y=t.value.toolbarTips)==null?void 0:Y.save,onClick:()=>{y.emit(e,Te)}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-baocun"},null)])]);case"prettier":return s.noPrettier?"":l.createVNode("div",{class:`${c}-toolbar-item`,title:(ie=t.value.toolbarTips)==null?void 0:ie.prettier,onClick:()=>{a("prettier")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-prettier"},null)])]);case"pageFullscreen":return!s.setting.fullscreen&&l.createVNode("div",{class:`${c}-toolbar-item`,title:(re=t.value.toolbarTips)==null?void 0:re.pageFullscreen,onClick:()=>{s.updateSetting("pageFullscreen")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":`#md-editor-icon-${s.setting.pageFullscreen?"suoxiao":"fangda"}`},null)])]);case"fullscreen":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(he=t.value.toolbarTips)==null?void 0:he.fullscreen,onClick:()=>{n()}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":`#md-editor-icon-${s.setting.fullscreen?"fullscreen-exit":"fullscreen"}`},null)])]);case"preview":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(ce=t.value.toolbarTips)==null?void 0:ce.preview,onClick:()=>{s.updateSetting("preview")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-preview"},null)])]);case"htmlPreview":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(fe=t.value.toolbarTips)==null?void 0:fe.htmlPreview,onClick:()=>{s.updateSetting("htmlPreview")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-coding"},null)])]);case"catalog":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(De=t.value.toolbarTips)==null?void 0:De.catalog,onClick:()=>{y.emit(e,qe)},key:"bar-catalog"},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-catalog"},null)])]);case"github":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(je=t.value.toolbarTips)==null?void 0:je.github,onClick:()=>Qt("https://github.com/imzbf/md-editor-v3")},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-github"},null)])]);case"mermaid":return l.createVNode(pe,{relative:`#${i}`,visible:o.mermaid,onChange:P=>{o.mermaid=P},overlay:l.createVNode("ul",{class:`${c}-menu`,onClick:()=>{o.mermaid=!1}},[l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("flow")}},[(ke=t.value.mermaid)==null?void 0:ke.flow]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("sequence")}},[(ye=t.value.mermaid)==null?void 0:ye.sequence]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("gantt")}},[(Oe=t.value.mermaid)==null?void 0:Oe.gantt]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("class")}},[(Me=t.value.mermaid)==null?void 0:Me.class]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("state")}},[(we=t.value.mermaid)==null?void 0:we.state]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("pie")}},[(He=t.value.mermaid)==null?void 0:He.pie]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("relationship")}},[(Pe=t.value.mermaid)==null?void 0:Pe.relationship]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("journey")}},[(Ce=t.value.mermaid)==null?void 0:Ce.journey])]),key:"bar-mermaid"},{default:()=>{var P;return[l.createVNode("div",{class:`${c}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.mermaid},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-mermaid"},null)])])]}});case"katex":return l.createVNode(pe,{relative:`#${i}`,visible:o.katex,onChange:P=>{o.katex=P},overlay:l.createVNode("ul",{class:`${c}-menu`,onClick:()=>{o.katex=!1}},[l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("katexInline")}},[(Ht=t.value.katex)==null?void 0:Ht.inline]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("katexBlock")}},[(Pt=t.value.katex)==null?void 0:Pt.block])]),key:"bar-katex"},{default:()=>{var P;return[l.createVNode("div",{class:`${c}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.katex},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-formula"},null)])])]}})}else return s.defToolbars instanceof Array?s.defToolbars[f]||"":s.defToolbars&&s.defToolbars.children instanceof Array&&s.defToolbars.children[f]||""};return()=>{const f=h.value[0].map(v=>m(v)),w=h.value[1].map(v=>m(v));return l.createVNode(l.Fragment,null,[s.toolbars.length>0&&l.createVNode("div",{class:`${c}-toolbar-wrapper`,id:i},[l.createVNode("div",{class:`${c}-toolbar`},[l.createVNode("div",{class:`${c}-toolbar-left`,ref:u},[f]),l.createVNode("div",{class:`${c}-toolbar-right`},[w])])]),l.createVNode("input",{ref:d,accept:"image/*",type:"file",multiple:!0,style:{display:"none"}},null),l.createVNode(wn,{linkVisible:r.linkVisible,clipVisible:r.clipVisible,type:r.type,onCancel:()=>{r.linkVisible=!1,r.clipVisible=!1},onOk:v=>{v&&a(r.type,{desc:v.desc,url:v.url}),r.linkVisible=!1,r.clipVisible=!1}},null)])}}});function yt(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let ge=yt();function En(s){ge=s}const wt=/[&<>"']/,Tn=new RegExp(wt.source,"g"),vt=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,zn=new RegExp(vt.source,"g"),Ln={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},xt=s=>Ln[s];function Z(s,e){if(e){if(wt.test(s))return s.replace(Tn,xt)}else if(vt.test(s))return s.replace(zn,xt);return s}const Nn=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function $t(s){return s.replace(Nn,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Fn=/(^|[^\[])\^/g;function B(s,e){s=typeof s=="string"?s:s.source,e=e||"";const t={replace:(n,i)=>(i=i.source||i,i=i.replace(Fn,"$1"),s=s.replace(n,i),t),getRegex:()=>new RegExp(s,e)};return t}const An=/[^\w:]/g,Vn=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Ct(s,e,t){if(s){let n;try{n=decodeURIComponent($t(t)).replace(An,"").toLowerCase()}catch{return null}if(n.indexOf("javascript:")===0||n.indexOf("vbscript:")===0||n.indexOf("data:")===0)return null}e&&!Vn.test(t)&&(t=Dn(e,t));try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}const ze={},_n=/^[^:]+:\/*[^/]*$/,In=/^([^:]+:)[\s\S]*$/,Rn=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Dn(s,e){ze[" "+s]||(_n.test(s)?ze[" "+s]=s+"/":ze[" "+s]=Ne(s,"/",!0)),s=ze[" "+s];const t=s.indexOf(":")===-1;return e.substring(0,2)==="//"?t?e:s.replace(In,"$1")+e:e.charAt(0)==="/"?t?e:s.replace(Rn,"$1")+e:s+e}const Le={exec:function(){}};function te(s){let e=1,t,n;for(;e<arguments.length;e++){t=arguments[e];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s}function St(s,e){const t=s.replace(/\|/g,(o,a,r)=>{let u=!1,h=a;for(;--h>=0&&r[h]==="\\";)u=!u;return u?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function Ne(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const o=s.charAt(n-i-1);if(o===e&&!t)i++;else if(o!==e&&t)i++;else break}return s.slice(0,n-i)}function jn(s,e){if(s.indexOf(e[1])===-1)return-1;const t=s.length;let n=0,i=0;for(;i<t;i++)if(s[i]==="\\")i++;else if(s[i]===e[0])n++;else if(s[i]===e[1]&&(n--,n<0))return i;return-1}function Et(s){s&&s.sanitize&&!s.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function Tt(s,e){if(e<1)return"";let t="";for(;e>1;)e&1&&(t+=s),e>>=1,s+=s;return t+s}function zt(s,e,t,n){const i=e.href,o=e.title?Z(e.title):null,a=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const r={type:"link",raw:t,href:i,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,r}return{type:"image",raw:t,href:i,title:o,text:Z(a)}}function On(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
1
+ (function(l,c){typeof exports=="object"&&typeof module!="undefined"?module.exports=c(require("vue")):typeof define=="function"&&define.amd?define(["vue"],c):(l=typeof globalThis!="undefined"?globalThis:l||self,l.MdEditorV3=c(l.Vue))})(this,function(l){"use strict";var _i=Object.defineProperty,Ii=Object.defineProperties;var Ri=Object.getOwnPropertyDescriptors;var Bt=Object.getOwnPropertySymbols;var Di=Object.prototype.hasOwnProperty,ji=Object.prototype.propertyIsEnumerable;var Ut=(l,c,J)=>c in l?_i(l,c,{enumerable:!0,configurable:!0,writable:!0,value:J}):l[c]=J,X=(l,c)=>{for(var J in c||(c={}))Di.call(c,J)&&Ut(l,J,c[J]);if(Bt)for(var J of Bt(c))ji.call(c,J)&&Ut(l,J,c[J]);return l},me=(l,c)=>Ii(l,Ri(c));const c="md-editor",J="md-editor-v3",qt="https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js",U="https://cdnjs.cloudflare.com/ajax/libs",Wt=`${U}/highlight.js/11.7.0/highlight.min.js`,st={main:`${U}/prettier/2.8.0/standalone.js`,markdown:`${U}/prettier/2.8.0/parser-markdown.js`},lt={css:`${U}/cropperjs/1.5.13/cropper.min.css`,js:`${U}/cropperjs/1.5.13/cropper.min.js`},Kt=`${U}/screenfull.js/5.2.0/screenfull.min.js`,ot=["bold","underline","italic","strikeThrough","-","title","sub","sup","quote","unorderedList","orderedList","task","-","codeRow","code","link","image","table","mermaid","katex","-","revoke","next","save","=","prettier","pageFullscreen","fullscreen","preview","htmlPreview","catalog","github"],rt=["markdownTotal","=","scrollSwitch"],at={"zh-CN":{toolbarTips:{bold:"\u52A0\u7C97",underline:"\u4E0B\u5212\u7EBF",italic:"\u659C\u4F53",strikeThrough:"\u5220\u9664\u7EBF",title:"\u6807\u9898",sub:"\u4E0B\u6807",sup:"\u4E0A\u6807",quote:"\u5F15\u7528",unorderedList:"\u65E0\u5E8F\u5217\u8868",orderedList:"\u6709\u5E8F\u5217\u8868",task:"\u4EFB\u52A1\u5217\u8868",codeRow:"\u884C\u5185\u4EE3\u7801",code:"\u5757\u7EA7\u4EE3\u7801",link:"\u94FE\u63A5",image:"\u56FE\u7247",table:"\u8868\u683C",mermaid:"mermaid\u56FE",katex:"katex\u516C\u5F0F",revoke:"\u540E\u9000",next:"\u524D\u8FDB",save:"\u4FDD\u5B58",prettier:"\u7F8E\u5316",pageFullscreen:"\u6D4F\u89C8\u5668\u5168\u5C4F",fullscreen:"\u5C4F\u5E55\u5168\u5C4F",preview:"\u9884\u89C8",htmlPreview:"html\u4EE3\u7801\u9884\u89C8",catalog:"\u76EE\u5F55",github:"\u6E90\u7801\u5730\u5740"},titleItem:{h1:"\u4E00\u7EA7\u6807\u9898",h2:"\u4E8C\u7EA7\u6807\u9898",h3:"\u4E09\u7EA7\u6807\u9898",h4:"\u56DB\u7EA7\u6807\u9898",h5:"\u4E94\u7EA7\u6807\u9898",h6:"\u516D\u7EA7\u6807\u9898"},imgTitleItem:{link:"\u6DFB\u52A0\u94FE\u63A5",upload:"\u4E0A\u4F20\u56FE\u7247",clip2upload:"\u88C1\u526A\u4E0A\u4F20"},linkModalTips:{linkTitle:"\u6DFB\u52A0\u94FE\u63A5",imageTitle:"\u6DFB\u52A0\u56FE\u7247",descLabel:"\u94FE\u63A5\u63CF\u8FF0\uFF1A",descLabelPlaceHolder:"\u8BF7\u8F93\u5165\u63CF\u8FF0...",urlLabel:"\u94FE\u63A5\u5730\u5740\uFF1A",urlLabelPlaceHolder:"\u8BF7\u8F93\u5165\u94FE\u63A5...",buttonOK:"\u786E\u5B9A"},clipModalTips:{title:"\u88C1\u526A\u56FE\u7247\u4E0A\u4F20",buttonUpload:"\u4E0A\u4F20"},copyCode:{text:"\u590D\u5236\u4EE3\u7801",successTips:"\u5DF2\u590D\u5236\uFF01",failTips:"\u590D\u5236\u5931\u8D25\uFF01"},mermaid:{flow:"\u6D41\u7A0B\u56FE",sequence:"\u65F6\u5E8F\u56FE",gantt:"\u7518\u7279\u56FE",class:"\u7C7B\u56FE",state:"\u72B6\u6001\u56FE",pie:"\u997C\u56FE",relationship:"\u5173\u7CFB\u56FE",journey:"\u65C5\u7A0B\u56FE"},katex:{inline:"\u884C\u5185\u516C\u5F0F",block:"\u5757\u7EA7\u516C\u5F0F"},footer:{markdownTotal:"\u5B57\u6570",scrollAuto:"\u540C\u6B65\u6EDA\u52A8"}},"en-US":{toolbarTips:{bold:"bold",underline:"underline",italic:"italic",strikeThrough:"strikeThrough",title:"title",sub:"subscript",sup:"superscript",quote:"quote",unorderedList:"unordered list",orderedList:"ordered list",task:"task list",codeRow:"inline code",code:"block-level code",link:"link",image:"image",table:"table",mermaid:"mermaid",katex:"formula",revoke:"revoke",next:"undo revoke",save:"save",prettier:"prettier",pageFullscreen:"fullscreen in page",fullscreen:"fullscreen",preview:"preview",htmlPreview:"html preview",catalog:"catalog",github:"source code"},titleItem:{h1:"Lv1 Heading",h2:"Lv2 Heading",h3:"Lv3 Heading",h4:"Lv4 Heading",h5:"Lv5 Heading",h6:"Lv6 Heading"},imgTitleItem:{link:"Add Img Link",upload:"Upload Img",clip2upload:"Clip Upload"},linkModalTips:{linkTitle:"Add Link",imageTitle:"Add Image",descLabel:"Desc:",descLabelPlaceHolder:"Enter a description...",urlLabel:"Link:",urlLabelPlaceHolder:"Enter a link...",buttonOK:"OK"},clipModalTips:{title:"Crop Image",buttonUpload:"Upload"},copyCode:{text:"Copy",successTips:"Copied!",failTips:"Copy failed!"},mermaid:{flow:"flow",sequence:"sequence",gantt:"gantt",class:"class",state:"state",pie:"pie",relationship:"relationship",journey:"journey"},katex:{inline:"inline",block:"block"},footer:{markdownTotal:"Word Count",scrollAuto:"Scroll Auto"}}},Zt=`${U}/mermaid/9.4.0/mermaid.min.js`,Se={js:`${U}/KaTeX/0.16.3/katex.min.js`,css:`${U}/KaTeX/0.16.3/katex.min.css`},ct={a11y:{light:`${U}/highlight.js/11.7.0/styles/a11y-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/a11y-dark.min.css`},atom:{light:`${U}/highlight.js/11.7.0/styles/atom-one-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/atom-one-dark.min.css`},github:{light:`${U}/highlight.js/11.7.0/styles/github.min.css`,dark:`${U}/highlight.js/11.7.0/styles/github-dark.min.css`},gradient:{light:`${U}/highlight.js/11.7.0/styles/gradient-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/gradient-dark.min.css`},kimbie:{light:`${U}/highlight.js/11.7.0/styles/kimbie-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/kimbie-dark.min.css`},paraiso:{light:`${U}/highlight.js/11.7.0/styles/paraiso-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/paraiso-dark.min.css`},qtcreator:{light:`${U}/highlight.js/11.7.0/styles/qtcreator-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${U}/highlight.js/11.7.0/styles/stackoverflow-light.min.css`,dark:`${U}/highlight.js/11.7.0/styles/stackoverflow-dark.min.css`}},q={markedRenderer:s=>s,markedExtensions:[],markedOptions:{},editorExtensions:{},editorConfig:{}},Gt=s=>{if(s)for(const e in s){const t=s[e];t&&(q[e]=t)}};class Xt{constructor(){this.pools={}}remove(e,t,n){const o=this.pools[e]&&this.pools[e][t];o&&(this.pools[e][t]=o.filter(a=>a!==n))}clear(e){this.pools[e]={}}on(e,t){return this.pools[e]||(this.pools[e]={}),this.pools[e][t.name]||(this.pools[e][t.name]=[]),this.pools[e][t.name].push(t.callback),this.pools[e][t.name].includes(t.callback)}emit(e,t,...n){this.pools[e]||(this.pools[e]={});const o=this.pools[e][t];o&&o.forEach(a=>{try{a(...n)}catch(r){console.error(`${t} monitor event exception\uFF01`,r)}})}}var y=new Xt;const se=(s,e=0,t=e)=>new Promise((n,i)=>{s.setSelectionRange?setTimeout(()=>{s.setSelectionRange(e,t),s.focus(),n(!0)},0):(console.error("Can not reset position!"),i())}),Be=(s,e,t)=>{const{deviationStart:n=0,deviationEnd:i=0,direct:o=!1,select:a=!1}=t;let r="";if(s.selectionStart||s.selectionStart===0){const u=s.selectionStart,h=s.selectionEnd||0,{prefixVal:d=s.value.substring(0,u),subfixVal:g=s.value.substring(h,s.value.length)}=t;r=d+e+g,se(s,a?u+n:u+e.length+i,u+e.length+i)}else r+=e;return o&&(s.value=r),r},Qt=(s,e={newWindow:!0,nofollow:!0})=>{s||console.error("error link!");const t=document.createElement("a");t.href=s,t.style.display="none",e.newWindow&&(t.target="_blank"),e.nofollow&&(t.rel="noopener noreferrer"),document.body.appendChild(t),t.click(),document.body.removeChild(t)},dt=(s,e)=>{const t=Ee(()=>{s.removeEventListener("scroll",n),s.addEventListener("scroll",n),e.removeEventListener("scroll",n),e.addEventListener("scroll",n)},50),n=i=>{const o=s.clientHeight,a=e.clientHeight,r=s.scrollHeight,u=e.scrollHeight,h=(r-o)/(u-a);i.target===s?(e.removeEventListener("scroll",n),e.scrollTo({top:s.scrollTop/h}),t()):(s.removeEventListener("scroll",n),s.scrollTo({top:e.scrollTop*h}),t())};return[()=>{t().finally(()=>{s.dispatchEvent(new Event("scroll"))})},()=>{s.removeEventListener("scroll",n),e.removeEventListener("scroll",n)}]},Yt=(s,e="image.png")=>{const t=s.split(","),n=t[0].match(/:(.*?);/);if(n){const i=n[1],o=atob(t[1]);let a=o.length;const r=new Uint8Array(a);for(;a--;)r[a]=o.charCodeAt(a);return new File([r],e,{type:i})}return null},Ue=s=>{if(!s.trim())return s;const e=s.split(`
2
+ `),t=['<span rn-wrapper aria-hidden="true">'];return e.forEach(()=>{t.push("<span></span>")}),t.push("</span>"),`<span class="code-block">${s}</span>${t.join("")}`},Ee=(s,e=200)=>{let t=0;return(...n)=>new Promise(i=>{t&&(clearTimeout(t),i("cancel")),t=window.setTimeout(()=>{s.apply(globalThis,n),t=0,i("done")},e)})},Jt=(s,e=200)=>{let t=0,n=null;return(...i)=>{const o=a=>{t===0&&(t=a),a-t>=e?(s.apply(globalThis,n),n=null,t=0):window.requestAnimationFrame(o)};n===null&&window.requestAnimationFrame(o),n=i}},ut=(s,e="$")=>{const t=s.split(e);let n=e,i="";for(let o=1;o<t.length;o++)if(/\\$/.test(t[o]))n+=t[o]+"$",i+=t[o]+"$";else{n+=t[o]+e,i+=t[o];break}return[n,i]},en=s=>{var t;return navigator.userAgent.indexOf("Firefox")>-1?s.value.substring(s.selectionStart,s.selectionEnd):((t=window.getSelection())==null?void 0:t.toString())||""},tn=(s,e)=>{const t=s==null?void 0:s.getBoundingClientRect();if(e===document.documentElement)return t.top-e.clientTop;const n=e==null?void 0:e.getBoundingClientRect();return t.top-n.top},nn=(s,e)=>{const t=X({},s);return e.forEach(n=>{Reflect.deleteProperty(t,n)}),t},sn=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`,ht=(s,e)=>{const t=n=>{const i=s.parentElement||document.body,o=i.offsetWidth,a=i.offsetHeight,{clientWidth:r}=document.documentElement,{clientHeight:u}=document.documentElement,h=n.offsetX,d=n.offsetY,g=f=>{let w=f.x+document.body.scrollLeft-document.body.clientLeft-h,v=f.y+document.body.scrollTop-document.body.clientTop-d;w=w<1?1:w<r-o-1?w:r-o-1,v=v<1?1:v<u-a-1?v:u-a-1,e?e(w,v):(i.style.left=`${w}px`,i.style.top=`${v}px`)};document.addEventListener("mousemove",g);const m=()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",m)};document.addEventListener("mouseup",m)};return s.addEventListener("mousedown",t),()=>{s.removeEventListener("mousedown",t)}},Q=(s,e="")=>{const t=document.getElementById(s.id),n=i=>{typeof s.onload=="function"&&s.onload(i),s.removeEventListener("load",n)};t?e!==""&&s.onload instanceof Function&&(Reflect.get(window,e)?s.dispatchEvent(new Event("load")):t.addEventListener("load",n)):(s.addEventListener("load",n),document.head.appendChild(s))},ln=Ee((s,e,t)=>{const n=document.getElementById(s);n&&n.setAttribute(e,t)},10),Te="onSave",qe="changeCatalogVisible",ft="changeFullscreen",mt="pageFullscreenChanged",gt="fullscreenChanged",We="previewChanged",pt="htmlPreviewChanged",bt="catalogVisibleChanged",kt="textareaFocus",on=(s,e)=>{const{editorId:t,noPrettier:n,previewOnly:i}=s,o=l.reactive({buildFinished:!1,html:""}),a=r=>{if(r.target===document.querySelector(`#${s.editorId}-textarea`))if(y.emit(t,"selectTextChange"),r.ctrlKey||r.metaKey)switch(r.code){case"KeyS":{r.shiftKey?y.emit(t,"replace","strikeThrough"):(y.emit(t,Te,s.modelValue),r.preventDefault());break}case"KeyB":{y.emit(t,"replace","bold"),r.preventDefault();break}case"KeyU":{r.shiftKey?(y.emit(t,"replace","unorderedList"),r.preventDefault()):(y.emit(t,"replace","underline"),r.preventDefault());break}case"KeyI":{r.shiftKey?(y.emit(t,"openModals","image"),r.preventDefault()):(y.emit(t,"replace","italic"),r.preventDefault());break}case"Digit1":{y.emit(t,"replace","h1"),r.preventDefault();break}case"Digit2":{y.emit(t,"replace","h2"),r.preventDefault();break}case"Digit3":{y.emit(t,"replace","h3"),r.preventDefault();break}case"Digit4":{y.emit(t,"replace","h4"),r.preventDefault();break}case"Digit5":{y.emit(t,"replace","h5"),r.preventDefault();break}case"Digit6":{y.emit(t,"replace","h6"),r.preventDefault();break}case"ArrowUp":{y.emit(t,"replace","sup"),r.preventDefault();break}case"ArrowDown":{y.emit(t,"replace","sub"),r.preventDefault();break}case"KeyQ":{if(r.key==="a"){r.target.select();return}y.emit(t,"replace","quote"),r.preventDefault();break}case"KeyA":if(r.key==="q"){y.emit(t,"replace","quote"),r.preventDefault();break}else return;case"KeyO":{y.emit(t,"replace","orderedList"),r.preventDefault();break}case"KeyC":{if(r.shiftKey)y.emit(t,"replace","code"),r.preventDefault();else if(r.altKey)y.emit(t,"replace","codeRow"),r.preventDefault();else{r.preventDefault(),y.emit(t,"replace","ctrlC");break}break}case"KeyL":{y.emit(t,"openModals","link"),r.preventDefault();break}case"KeyZ":{if(r.key==="w")return;r.shiftKey?(y.emit(t,"ctrlShiftZ"),r.preventDefault()):(y.emit(t,"ctrlZ"),r.preventDefault());break}case"KeyW":if(r.key==="z"){r.shiftKey?(y.emit(t,"ctrlShiftZ"),r.preventDefault()):(y.emit(t,"ctrlZ"),r.preventDefault());break}else return;case"KeyF":{r.shiftKey&&(n||(y.emit(t,"replace","prettier"),r.preventDefault()));break}case"KeyT":{r.altKey&&r.shiftKey&&(y.emit(t,"replace","table"),r.preventDefault());break}case"KeyX":{y.emit(t,"replace","ctrlX"),r.preventDefault();break}case"KeyD":{r.preventDefault(),y.emit(t,"replace","ctrlD");break}}else r.code==="Tab"&&(r.preventDefault(),r.shiftKey?y.emit(t,"replace","shiftTab"):y.emit(t,"replace","tab"))};l.watch(()=>s.modelValue,()=>{o.buildFinished=!1}),l.onMounted(()=>{i||(window.addEventListener("keydown",a),y.on(t,{name:"buildFinished",callback(r){o.buildFinished=!0,o.html=r}}),y.on(t,{name:Te,callback(){const r=new Promise(u=>{if(o.buildFinished)u(o.html);else{const h=d=>{u(d),y.remove(t,"buildFinished",h)};y.on(t,{name:"buildFinished",callback:h})}});s.onSave?s.onSave(s.modelValue,r):e.emit("onSave",s.modelValue,r)}}))}),l.onBeforeUnmount(()=>{i||window.removeEventListener("keydown",a)})},rn=s=>{var o;const{editorId:e,previewOnly:t}=s,n=(o=q==null?void 0:q.editorExtensions)==null?void 0:o.highlight;l.provide("editorId",e),l.provide("tabWidth",s.tabWidth),l.provide("theme",l.computed(()=>s.theme)),l.provide("highlight",l.computed(()=>{const a=X(X({},ct),n==null?void 0:n.css),r=s.codeStyleReverse&&s.codeStyleReverseList.includes(s.previewTheme)?"dark":s.theme;return{js:(n==null?void 0:n.js)||Wt,css:a[s.codeTheme]?a[s.codeTheme][r]:ct.atom[r]}})),l.provide("historyLength",s.historyLength),l.provide("previewOnly",t),l.provide("showCodeRowNumber",s.showCodeRowNumber);const i=l.computed(()=>{var r;const a=X(X({},at),(r=q==null?void 0:q.editorConfig)==null?void 0:r.languageUserDefined);return a[s.language]?a[s.language]:at["zh-CN"]});l.provide("usedLanguageText",i),l.provide("previewTheme",l.computed(()=>s.previewTheme))},an=s=>{var h,d,g,m,f,w;const{noPrettier:e,previewOnly:t,noIconfont:n,noUploadImg:i}=s,{editorExtensions:o}=q,a=e||!!((d=(h=q.editorExtensions)==null?void 0:h.prettier)!=null&&d.prettierInstance),r=e||!!((m=(g=q.editorExtensions)==null?void 0:g.prettier)!=null&&m.parserMarkdownInstance),u=i||!!((w=(f=q.editorExtensions)==null?void 0:f.cropper)!=null&&w.instance);l.onMounted(()=>{var E,V,D,C;const v=document.createElement("script");v.src=(o==null?void 0:o.iconfont)||qt,v.id=`${c}-icon`;const b=document.createElement("script"),k=document.createElement("script");b.src=((E=o==null?void 0:o.prettier)==null?void 0:E.standaloneJs)||st.main,b.id=`${c}-prettier`,k.src=((V=o==null?void 0:o.prettier)==null?void 0:V.parserMarkdownJs)||st.markdown,k.id=`${c}-prettierMD`;const x=document.createElement("link");x.rel="stylesheet",x.href=((D=o==null?void 0:o.cropper)==null?void 0:D.css)||lt.css,x.id=`${c}-cropperCss`;const $=document.createElement("script");$.src=((C=o==null?void 0:o.cropper)==null?void 0:C.js)||lt.js,$.id=`${c}-cropper`,n||Q(v),t||(u||(Q(x),Q($)),a||Q(b),r||Q(k))})},cn=(s,e)=>{const{editorId:t,previewOnly:n}=s,i=l.reactive({pageFullscreen:s.pageFullscreen,fullscreen:!1,preview:s.preview,htmlPreview:s.preview?!1:s.htmlPreview}),o=(u,h)=>{i[u]=h===void 0?!i[u]:h,u==="preview"&&i.preview?i.htmlPreview=!1:u==="htmlPreview"&&i.htmlPreview&&(i.preview=!1)};let a="";const r=()=>{i.pageFullscreen||i.fullscreen?document.body.style.overflow="hidden":document.body.style.overflow=a};return l.watch(()=>[i.pageFullscreen,i.fullscreen],r),l.onMounted(()=>{n||y.on(t,{name:"uploadImage",callback(u,h){const d=g=>{y.emit(t,"replace","image",{desc:"",urls:g}),h&&h()};s.onUploadImg?s.onUploadImg(u,d):e.emit("onUploadImg",u,d)}}),a=document.body.style.overflow,r()}),[i,o]},dn=s=>{const{editorId:e}=s,t=l.ref(!1);l.onMounted(()=>{y.on(e,{name:qe,callback:i=>{i===void 0?t.value=!t.value:t.value=i}})});const n=l.computed(()=>!s.toolbarsExclude.includes("catalog")&&s.toolbars.includes("catalog"));return[t,n]},un=(s,e,t,n,i)=>{const{editorId:o}=s;l.watch(()=>n.pageFullscreen,r=>{y.emit(o,mt,r)}),l.watch(()=>n.fullscreen,r=>{y.emit(o,gt,r)}),l.watch(()=>n.preview,r=>{y.emit(o,We,r)}),l.watch(()=>n.htmlPreview,r=>{y.emit(o,pt,r)}),l.watch(t,r=>{y.emit(o,bt,r)});const a={on(r,u){switch(r){case"pageFullscreen":{y.on(o,{name:mt,callback(h){u(h)}});break}case"fullscreen":{y.on(o,{name:gt,callback(h){u(h)}});break}case"preview":{y.on(o,{name:We,callback(h){u(h)}});break}case"htmlPreview":{y.on(o,{name:pt,callback(h){u(h)}});break}case"catalog":{y.on(o,{name:bt,callback(h){u(h)}});break}}},togglePageFullscreen(r){i("pageFullscreen",r)},toggleFullscreen(r){y.emit(o,ft,r)},togglePreview(r){i("preview",r)},toggleHtmlPreview(r){i("htmlPreview",r)},toggleCatalog(r){y.emit(o,qe,r)},triggerSave(){y.emit(o,Te)},insert(r){y.emit(o,"replace","universal",{generate:r})},focus(){y.emit(o,kt)}};e.expose(a)};var Oi="",hn=l.defineComponent({setup(){return()=>l.createVNode("div",{class:`${c}-divider`},null)}});const ee=({instance:s,ctx:e,props:t={}},n="default")=>{const i=(s==null?void 0:s.$slots[n])||(e==null?void 0:e.slots[n]);return(i?i(s):"")||t[n]};var Mi="";const fn=()=>({trigger:{type:String,default:"hover"},overlay:{type:[String,Object],default:""},visible:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}},relative:{type:String,default:"html"}});var ge=l.defineComponent({props:fn(),setup(s,e){const t=`${c}-dropdown-hidden`,n=l.reactive({overlayClass:[t],overlayStyle:{},triggerHover:!1,overlayHover:!1}),i=l.ref(),o=l.ref(),a=()=>{var $;s.trigger==="hover"&&(n.triggerHover=!0);const g=i.value,m=o.value,f=g.getBoundingClientRect(),w=g.offsetTop,v=g.offsetLeft,b=f.height,k=f.width,x=(($=document.querySelector(s.relative))==null?void 0:$.scrollLeft)||0;n.overlayStyle=me(X({},n.overlayStyle),{top:w+b+"px",left:v-m.offsetWidth/2+k/2-x+"px"}),s.onChange(!0)},r=()=>{n.overlayHover=!0};l.watch(()=>s.visible,g=>{g?n.overlayClass=n.overlayClass.filter(m=>m!==t):n.overlayClass.push(t)});const u=g=>{const m=i.value,f=o.value;!m.contains(g.target)&&!f.contains(g.target)&&s.onChange(!1)};let h=-1;const d=g=>{i.value===g.target?n.triggerHover=!1:n.overlayHover=!1,clearTimeout(h),h=window.setTimeout(()=>{!n.overlayHover&&!n.triggerHover&&s.onChange(!1)},10)};return l.onMounted(()=>{s.trigger==="click"?(i.value.addEventListener("click",a),document.addEventListener("click",u)):(i.value.addEventListener("mouseenter",a),i.value.addEventListener("mouseleave",d),o.value.addEventListener("mouseenter",r),o.value.addEventListener("mouseleave",d))}),l.onBeforeUnmount(()=>{s.trigger==="click"?(i.value.removeEventListener("click",a),document.removeEventListener("click",u)):(i.value.removeEventListener("mouseenter",a),i.value.removeEventListener("mouseleave",d),o.value.removeEventListener("mouseenter",r),o.value.removeEventListener("mouseleave",d))}),()=>{const g=ee({ctx:e}),m=ee({props:s,ctx:e},"overlay"),f=l.cloneVNode(g instanceof Array?g[0]:g,{ref:i}),w=l.createVNode("div",{class:[`${c}-dropdown`,n.overlayClass],style:n.overlayStyle,ref:o},[l.createVNode("div",{class:`${c}-dropdown-overlay`},[m instanceof Array?m[0]:m])]);return[f,w]}}}),Hi="";const mn=()=>({title:{type:String,default:""},visible:{type:Boolean,default:!1},width:{type:String,default:"auto"},height:{type:String,default:"auto"},onClose:{type:Function,default:()=>{}},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function,default:()=>{}},class:{type:String}});var Ke=l.defineComponent({props:mn(),setup(s,e){const t=l.ref(s.visible),n=l.ref([`${c}-modal`]),i=l.ref(),o=l.ref();let a=()=>{};const r=l.reactive({initPos:{left:"0px",top:"0px"},historyPos:{left:"0px",top:"0px"}}),u=l.computed(()=>s.isFullscreen?{width:"100%",height:"100%"}:{width:s.width,height:s.height});return l.onMounted(()=>{a=ht(o.value,(h,d)=>{r.initPos.left=h+"px",r.initPos.top=d+"px"})}),l.onBeforeUnmount(()=>{a()}),l.watch(()=>s.isFullscreen,h=>{h?a():a=ht(o.value,(d,g)=>{r.initPos.left=d+"px",r.initPos.top=g+"px"})}),l.watch(()=>s.visible,h=>{h?(n.value.push("zoom-in"),t.value=h,l.nextTick(()=>{const d=i.value.offsetWidth/2,g=i.value.offsetHeight/2,m=document.documentElement.clientWidth/2,f=document.documentElement.clientHeight/2;r.initPos.left=m-d+"px",r.initPos.top=f-g+"px"}),setTimeout(()=>{n.value=n.value.filter(d=>d!=="zoom-in")},140)):(n.value.push("zoom-out"),setTimeout(()=>{n.value=n.value.filter(d=>d!=="zoom-out"),t.value=h},130))}),()=>{const h=ee({ctx:e}),d=ee({props:s,ctx:e},"title");return l.createVNode("div",{class:[s.class],style:{display:t.value?"block":"none"}},[l.createVNode("div",{class:`${c}-modal-mask`,onClick:s.onClose},null),l.createVNode("div",{class:n.value,style:X(X({},r.initPos),u.value),ref:i},[l.createVNode("div",{class:`${c}-modal-header`,ref:o},[d||""]),l.createVNode("div",{class:`${c}-modal-body`},[h]),l.createVNode("div",{class:`${c}-modal-func`},[s.showAdjust&&l.createVNode("div",{class:`${c}-modal-adjust`,onClick:g=>{g.stopPropagation(),s.isFullscreen?r.initPos=r.historyPos:(r.historyPos=r.initPos,r.initPos={left:"0",top:"0"}),s.onAdjust(!s.isFullscreen)}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":`#md-editor-icon-${s.isFullscreen?"suoxiao":"fangda"}`},null)])]),l.createVNode("div",{class:`${c}-modal-close`,onClick:g=>{g.stopPropagation(),s.onClose&&s.onClose()}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-close"},null)])])])])])}}});const gn=()=>({type:{type:String,default:"link"},visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}});var pn=l.defineComponent({props:gn(),setup(s){const e=l.inject("usedLanguageText"),t=l.inject("editorId"),n=l.computed(()=>{var o,a;switch(s.type){case"link":return(o=e.value.linkModalTips)==null?void 0:o.linkTitle;case"image":return(a=e.value.linkModalTips)==null?void 0:a.imageTitle;default:return""}}),i=l.reactive({desc:"",url:""});return l.watch(()=>s.visible,o=>{o||setTimeout(()=>{i.desc="",i.url=""},200)}),()=>l.createVNode(Ke,{title:n.value,visible:s.visible,onClose:s.onCancel},{default:()=>{var o,a,r,u,h;return[l.createVNode("div",{class:`${c}-form-item`},[l.createVNode("label",{class:`${c}-label`,for:`link-desc-${t}`},[(o=e.value.linkModalTips)==null?void 0:o.descLabel]),l.createVNode("input",{placeholder:(a=e.value.linkModalTips)==null?void 0:a.descLabelPlaceHolder,class:`${c}-input`,id:`link-desc-${t}`,type:"text",value:i.desc,onChange:d=>{i.desc=d.target.value},autocomplete:"off"},null)]),l.createVNode("div",{class:`${c}-form-item`},[l.createVNode("label",{class:`${c}-label`,for:`link-url-${t}`},[(r=e.value.linkModalTips)==null?void 0:r.urlLabel]),l.createVNode("input",{placeholder:(u=e.value.linkModalTips)==null?void 0:u.urlLabelPlaceHolder,class:`${c}-input`,id:`link-url-${t}`,type:"text",value:i.url,onChange:d=>{i.url=d.target.value},autocomplete:"off"},null)]),l.createVNode("div",{class:`${c}-form-item`},[l.createVNode("button",{class:[`${c}-btn`,`${c}-btn-row`],type:"button",onClick:()=>{s.onOk(i),i.desc="",i.url=""}},[(h=e.value.linkModalTips)==null?void 0:h.buttonOK])])]}})}}),Pi="";const bn=()=>({visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}});var kn=l.defineComponent({props:bn(),setup(s){var d,g;const e=l.inject("usedLanguageText"),t=l.inject("editorId");let n=(g=(d=q==null?void 0:q.editorExtensions)==null?void 0:d.cropper)==null?void 0:g.instance;const i=l.ref(),o=l.ref(),a=l.ref(),r=l.reactive({cropperInited:!1,imgSelected:!1,imgSrc:"",isFullscreen:!1});let u=null;l.watch(()=>s.visible,()=>{s.visible&&!r.cropperInited&&(n=n||window.Cropper,i.value.onchange=()=>{if(!n){y.emit(t,"errorCatcher",{name:"Cropper",message:"Cropper is undefined"});return}const m=i.value.files||[];if(r.imgSelected=!0,(m==null?void 0:m.length)>0){const f=new FileReader;f.onload=w=>{r.imgSrc=w.target.result,l.nextTick(()=>{u=new n(o.value,{viewMode:2,preview:`.${c}-clip-preview-target`})})},f.readAsDataURL(m[0])}})}),l.watch(()=>[r.imgSelected],()=>{a.value.style=""}),l.watch(()=>r.isFullscreen,()=>{l.nextTick(()=>{u==null||u.destroy(),a.value.style="",o.value&&(u=new n(o.value,{viewMode:2,preview:`.${c}-clip-preview-target`}))})});const h=()=>{u.clear(),u.destroy(),u=null,i.value.value="",r.imgSelected=!1};return()=>{var m;return l.createVNode(Ke,{class:`${c}-modal-clip`,title:(m=e.value.clipModalTips)==null?void 0:m.title,visible:s.visible,onClose:s.onCancel,showAdjust:!0,isFullscreen:r.isFullscreen,onAdjust:f=>{r.isFullscreen=f},width:"668px",height:"421px"},{default:()=>{var f,w;return[l.createVNode("div",{class:`${c}-form-item ${c}-clip`},[l.createVNode("div",{class:`${c}-clip-main`},[r.imgSelected?l.createVNode("div",{class:`${c}-clip-cropper`},[l.createVNode("img",{src:r.imgSrc,ref:o,style:{display:"none"},alt:""},null),l.createVNode("div",{class:`${c}-clip-delete`,onClick:h},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-delete"},null)])])]):l.createVNode("div",{class:`${c}-clip-upload`,onClick:()=>{i.value.click()}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-upload"},null)])])]),l.createVNode("div",{class:`${c}-clip-preview`},[l.createVNode("div",{class:`${c}-clip-preview-target`,ref:a},null)])]),l.createVNode("div",{class:`${c}-form-item`},[l.createVNode("button",{class:`${c}-btn`,type:"button",onClick:()=>{if(u){const v=u.getCroppedCanvas();y.emit(t,"uploadImage",[Yt(v.toDataURL("image/png"))],s.onOk),h()}}},[((f=e.value.clipModalTips)==null?void 0:f.buttonUpload)||((w=e.value.linkModalTips)==null?void 0:w.buttonOK)])]),l.createVNode("input",{ref:i,accept:"image/*",type:"file",multiple:!1,style:{display:"none"}},null)]}})}}});const yn=()=>({type:{type:String,default:"link"},linkVisible:{type:Boolean,default:!1},clipVisible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}});var wn=l.defineComponent({props:yn(),setup(s){return()=>l.createVNode(l.Fragment,null,[l.createVNode(pn,{type:s.type,visible:s.linkVisible,onOk:s.onOk,onCancel:s.onCancel},null),l.createVNode(kn,{visible:s.clipVisible,onOk:s.onOk,onCancel:s.onCancel},null)])}});const vn=s=>{var u,h,d,g;const e=l.inject("editorId");let t=(h=(u=q.editorExtensions)==null?void 0:u.screenfull)==null?void 0:h.instance;const n=(g=(d=q.editorExtensions)==null?void 0:d.screenfull)==null?void 0:g.js,i=l.ref(!1),o=m=>{if(!t){y.emit(e,"errorCatcher",{name:"fullscreen",message:"fullscreen is undefined"});return}t.isEnabled?(i.value=!0,(m===void 0?!t.isFullscreen:m)?t.request():t.exit()):console.error("browser does not support screenfull!")},a=()=>{t&&t.isEnabled&&t.on("change",()=>{(i.value||s.setting.fullscreen)&&(i.value=!1,s.updateSetting("fullscreen"))})},r=()=>{t=window.screenfull,a()};return l.onMounted(()=>{if(a(),!t){const m=document.createElement("script");m.src=n||Kt,m.onload=r,m.id=`${c}-screenfull`,Q(m,"screenfull")}}),l.onMounted(()=>{y.on(e,{name:ft,callback:o})}),{fullscreenHandler:o}},xn=()=>({tableShape:{type:Array,default:()=>[6,4]},onSelected:{type:Function,default:()=>{}}}),$n=l.defineComponent({name:"TableShape",props:xn(),setup(s){const e=l.reactive({x:-1,y:-1});return()=>l.createVNode("div",{class:`${c}-table-shape`,onMouseleave:()=>{e.x=-1,e.y=-1}},[new Array(s.tableShape[1]).fill("").map((t,n)=>l.createVNode("div",{class:`${c}-table-shape-row`,key:`table-shape-row-${n}`},[new Array(s.tableShape[0]).fill("").map((i,o)=>l.createVNode("div",{class:`${c}-table-shape-col`,key:`table-shape-col-${o}`,onMouseenter:()=>{e.x=n,e.y=o},onClick:()=>{s.onSelected(e)}},[l.createVNode("div",{class:[`${c}-table-shape-col-default`,n<=e.x&&o<=e.y&&`${c}-table-shape-col-include`]},null)]))]))])}}),Cn=()=>({noPrettier:{type:Boolean},toolbars:{type:Array,default:()=>[]},toolbarsExclude:{type:Array,default:()=>[]},setting:{type:Object,default:()=>({})},screenfull:{type:Object,default:null},screenfullJs:{type:String,default:""},updateSetting:{type:Function,default:()=>{}},tableShape:{type:Array,default:()=>[6,4]},defToolbars:{type:Object},noUploadImg:{type:Boolean}});var Sn=l.defineComponent({name:"MDEditorToolbar",props:Cn(),setup(s){const e=l.inject("editorId"),t=l.inject("usedLanguageText"),{fullscreenHandler:n}=vn(s),i=`${e}-toolbar-wrapper`,o=l.reactive({title:!1,catalog:!1,image:!1,table:!1,mermaid:!1,katex:!1}),a=(f,w)=>{y.emit(e,"replace",f,w)},r=l.reactive({type:"link",linkVisible:!1,clipVisible:!1}),u=l.ref();l.onMounted(()=>{y.on(e,{name:"openModals",callback(f){r.type=f,r.linkVisible=!0}})});const h=l.computed(()=>{const f=s.toolbars.filter(k=>!s.toolbarsExclude.includes(k)),w=f.indexOf("="),v=w===-1?f:f.slice(0,w+1),b=w===-1?[]:f.slice(w,Number.MAX_SAFE_INTEGER);return[v,b]}),d=l.ref(),g=()=>{y.emit(e,"uploadImage",Array.from(d.value.files||[])),d.value.value=""};l.onMounted(()=>{d.value.addEventListener("change",g)});const m=f=>{var w,v,b,k,x,$,E,V,D,C,p,M,O,j,z,A,I,H,_,W,T,F,R,K,G,Y,ie,re,he,ce,fe,De,je,ke,ye,Oe,Me,we,He,Pe,Ce,Ht,Pt;if(ot.includes(f))switch(f){case"-":return l.createVNode(hn,null,null);case"bold":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(w=t.value.toolbarTips)==null?void 0:w.bold,onClick:()=>{a("bold")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-bold"},null)])]);case"underline":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(v=t.value.toolbarTips)==null?void 0:v.underline,onClick:()=>{a("underline")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-underline"},null)])]);case"italic":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(b=t.value.toolbarTips)==null?void 0:b.italic,onClick:()=>{a("italic")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-italic"},null)])]);case"strikeThrough":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(k=t.value.toolbarTips)==null?void 0:k.strikeThrough,onClick:()=>{a("strikeThrough")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-strike-through"},null)])]);case"title":return l.createVNode(ge,{relative:`#${i}`,visible:o.title,onChange:P=>{o.title=P},overlay:l.createVNode("ul",{class:`${c}-menu`,onClick:()=>{o.title=!1}},[l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h1")}},[(x=t.value.titleItem)==null?void 0:x.h1]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h2")}},[($=t.value.titleItem)==null?void 0:$.h2]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h3")}},[(E=t.value.titleItem)==null?void 0:E.h3]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h4")}},[(V=t.value.titleItem)==null?void 0:V.h4]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h5")}},[(D=t.value.titleItem)==null?void 0:D.h5]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("h6")}},[(C=t.value.titleItem)==null?void 0:C.h6])])},{default:()=>{var P;return[l.createVNode("div",{class:`${c}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.title},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-title"},null)])])]}});case"sub":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(p=t.value.toolbarTips)==null?void 0:p.sub,onClick:()=>{a("sub")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-sub"},null)])]);case"sup":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(M=t.value.toolbarTips)==null?void 0:M.sup,onClick:()=>{a("sup")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-sup"},null)])]);case"quote":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(O=t.value.toolbarTips)==null?void 0:O.quote,onClick:()=>{a("quote")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-quote"},null)])]);case"unorderedList":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(j=t.value.toolbarTips)==null?void 0:j.unorderedList,onClick:()=>{a("unorderedList")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-unordered-list"},null)])]);case"orderedList":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(z=t.value.toolbarTips)==null?void 0:z.orderedList,onClick:()=>{a("orderedList")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-ordered-list"},null)])]);case"task":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(A=t.value.toolbarTips)==null?void 0:A.task,onClick:()=>{a("task")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-task"},null)])]);case"codeRow":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(I=t.value.toolbarTips)==null?void 0:I.codeRow,onClick:()=>{a("codeRow")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-code-row"},null)])]);case"code":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(H=t.value.toolbarTips)==null?void 0:H.code,onClick:()=>{a("code")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-code"},null)])]);case"link":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(_=t.value.toolbarTips)==null?void 0:_.link,onClick:()=>{r.type="link",r.linkVisible=!0}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-link"},null)])]);case"image":return s.noUploadImg?l.createVNode("div",{class:`${c}-toolbar-item`,title:(W=t.value.toolbarTips)==null?void 0:W.image,onClick:()=>{r.type="image",r.linkVisible=!0}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-image"},null)])]):l.createVNode(ge,{relative:`#${i}`,visible:o.image,onChange:P=>{o.image=P},overlay:l.createVNode("ul",{class:`${c}-menu`,onClick:()=>{o.title=!1}},[l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{r.type="image",r.linkVisible=!0}},[(T=t.value.imgTitleItem)==null?void 0:T.link]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{d.value.click()}},[(F=t.value.imgTitleItem)==null?void 0:F.upload]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{r.clipVisible=!0}},[(R=t.value.imgTitleItem)==null?void 0:R.clip2upload])])},{default:()=>{var P;return[l.createVNode("div",{class:`${c}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.image},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-image"},null)])])]}});case"table":return l.createVNode(ge,{relative:`#${i}`,visible:o.table,onChange:P=>{o.table=P},key:"bar-table",overlay:l.createVNode($n,{tableShape:s.tableShape,onSelected:P=>{a("table",{selectedShape:P})}},null)},{default:()=>{var P;return[l.createVNode("div",{class:`${c}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.table},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-table"},null)])])]}});case"revoke":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(K=t.value.toolbarTips)==null?void 0:K.revoke,onClick:()=>{y.emit(e,"ctrlZ")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-revoke"},null)])]);case"next":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(G=t.value.toolbarTips)==null?void 0:G.next,onClick:()=>{y.emit(e,"ctrlShiftZ")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-next"},null)])]);case"save":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(Y=t.value.toolbarTips)==null?void 0:Y.save,onClick:()=>{y.emit(e,Te)}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-baocun"},null)])]);case"prettier":return s.noPrettier?"":l.createVNode("div",{class:`${c}-toolbar-item`,title:(ie=t.value.toolbarTips)==null?void 0:ie.prettier,onClick:()=>{a("prettier")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-prettier"},null)])]);case"pageFullscreen":return!s.setting.fullscreen&&l.createVNode("div",{class:`${c}-toolbar-item`,title:(re=t.value.toolbarTips)==null?void 0:re.pageFullscreen,onClick:()=>{s.updateSetting("pageFullscreen")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":`#md-editor-icon-${s.setting.pageFullscreen?"suoxiao":"fangda"}`},null)])]);case"fullscreen":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(he=t.value.toolbarTips)==null?void 0:he.fullscreen,onClick:()=>{n()}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":`#md-editor-icon-${s.setting.fullscreen?"fullscreen-exit":"fullscreen"}`},null)])]);case"preview":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(ce=t.value.toolbarTips)==null?void 0:ce.preview,onClick:()=>{s.updateSetting("preview")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-preview"},null)])]);case"htmlPreview":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(fe=t.value.toolbarTips)==null?void 0:fe.htmlPreview,onClick:()=>{s.updateSetting("htmlPreview")}},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-coding"},null)])]);case"catalog":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(De=t.value.toolbarTips)==null?void 0:De.catalog,onClick:()=>{y.emit(e,qe)},key:"bar-catalog"},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-catalog"},null)])]);case"github":return l.createVNode("div",{class:`${c}-toolbar-item`,title:(je=t.value.toolbarTips)==null?void 0:je.github,onClick:()=>Qt("https://github.com/imzbf/md-editor-v3")},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-github"},null)])]);case"mermaid":return l.createVNode(ge,{relative:`#${i}`,visible:o.mermaid,onChange:P=>{o.mermaid=P},overlay:l.createVNode("ul",{class:`${c}-menu`,onClick:()=>{o.mermaid=!1}},[l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("flow")}},[(ke=t.value.mermaid)==null?void 0:ke.flow]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("sequence")}},[(ye=t.value.mermaid)==null?void 0:ye.sequence]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("gantt")}},[(Oe=t.value.mermaid)==null?void 0:Oe.gantt]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("class")}},[(Me=t.value.mermaid)==null?void 0:Me.class]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("state")}},[(we=t.value.mermaid)==null?void 0:we.state]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("pie")}},[(He=t.value.mermaid)==null?void 0:He.pie]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("relationship")}},[(Pe=t.value.mermaid)==null?void 0:Pe.relationship]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("journey")}},[(Ce=t.value.mermaid)==null?void 0:Ce.journey])]),key:"bar-mermaid"},{default:()=>{var P;return[l.createVNode("div",{class:`${c}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.mermaid},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-mermaid"},null)])])]}});case"katex":return l.createVNode(ge,{relative:`#${i}`,visible:o.katex,onChange:P=>{o.katex=P},overlay:l.createVNode("ul",{class:`${c}-menu`,onClick:()=>{o.katex=!1}},[l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("katexInline")}},[(Ht=t.value.katex)==null?void 0:Ht.inline]),l.createVNode("li",{class:`${c}-menu-item`,onClick:()=>{a("katexBlock")}},[(Pt=t.value.katex)==null?void 0:Pt.block])]),key:"bar-katex"},{default:()=>{var P;return[l.createVNode("div",{class:`${c}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.katex},[l.createVNode("svg",{class:`${c}-icon`,"aria-hidden":"true"},[l.createVNode("use",{"xlink:href":"#md-editor-icon-formula"},null)])])]}})}else return s.defToolbars instanceof Array?s.defToolbars[f]||"":s.defToolbars&&s.defToolbars.children instanceof Array&&s.defToolbars.children[f]||""};return()=>{const f=h.value[0].map(v=>m(v)),w=h.value[1].map(v=>m(v));return l.createVNode(l.Fragment,null,[s.toolbars.length>0&&l.createVNode("div",{class:`${c}-toolbar-wrapper`,id:i},[l.createVNode("div",{class:`${c}-toolbar`},[l.createVNode("div",{class:`${c}-toolbar-left`,ref:u},[f]),l.createVNode("div",{class:`${c}-toolbar-right`},[w])])]),l.createVNode("input",{ref:d,accept:"image/*",type:"file",multiple:!0,style:{display:"none"}},null),l.createVNode(wn,{linkVisible:r.linkVisible,clipVisible:r.clipVisible,type:r.type,onCancel:()=>{r.linkVisible=!1,r.clipVisible=!1},onOk:v=>{v&&a(r.type,{desc:v.desc,url:v.url}),r.linkVisible=!1,r.clipVisible=!1}},null)])}}});function yt(){return{async:!1,baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let pe=yt();function En(s){pe=s}const wt=/[&<>"']/,Tn=new RegExp(wt.source,"g"),vt=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,zn=new RegExp(vt.source,"g"),Ln={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},xt=s=>Ln[s];function Z(s,e){if(e){if(wt.test(s))return s.replace(Tn,xt)}else if(vt.test(s))return s.replace(zn,xt);return s}const Nn=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function $t(s){return s.replace(Nn,(e,t)=>(t=t.toLowerCase(),t==="colon"?":":t.charAt(0)==="#"?t.charAt(1)==="x"?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const Fn=/(^|[^\[])\^/g;function B(s,e){s=typeof s=="string"?s:s.source,e=e||"";const t={replace:(n,i)=>(i=i.source||i,i=i.replace(Fn,"$1"),s=s.replace(n,i),t),getRegex:()=>new RegExp(s,e)};return t}const An=/[^\w:]/g,Vn=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function Ct(s,e,t){if(s){let n;try{n=decodeURIComponent($t(t)).replace(An,"").toLowerCase()}catch{return null}if(n.indexOf("javascript:")===0||n.indexOf("vbscript:")===0||n.indexOf("data:")===0)return null}e&&!Vn.test(t)&&(t=Dn(e,t));try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}const ze={},_n=/^[^:]+:\/*[^/]*$/,In=/^([^:]+:)[\s\S]*$/,Rn=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Dn(s,e){ze[" "+s]||(_n.test(s)?ze[" "+s]=s+"/":ze[" "+s]=Ne(s,"/",!0)),s=ze[" "+s];const t=s.indexOf(":")===-1;return e.substring(0,2)==="//"?t?e:s.replace(In,"$1")+e:e.charAt(0)==="/"?t?e:s.replace(Rn,"$1")+e:s+e}const Le={exec:function(){}};function te(s){let e=1,t,n;for(;e<arguments.length;e++){t=arguments[e];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s}function St(s,e){const t=s.replace(/\|/g,(o,a,r)=>{let u=!1,h=a;for(;--h>=0&&r[h]==="\\";)u=!u;return u?"|":" |"}),n=t.split(/ \|/);let i=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;i<n.length;i++)n[i]=n[i].trim().replace(/\\\|/g,"|");return n}function Ne(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const o=s.charAt(n-i-1);if(o===e&&!t)i++;else if(o!==e&&t)i++;else break}return s.slice(0,n-i)}function jn(s,e){if(s.indexOf(e[1])===-1)return-1;const t=s.length;let n=0,i=0;for(;i<t;i++)if(s[i]==="\\")i++;else if(s[i]===e[0])n++;else if(s[i]===e[1]&&(n--,n<0))return i;return-1}function Et(s){s&&s.sanitize&&!s.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function Tt(s,e){if(e<1)return"";let t="";for(;e>1;)e&1&&(t+=s),e>>=1,s+=s;return t+s}function zt(s,e,t,n){const i=e.href,o=e.title?Z(e.title):null,a=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const r={type:"link",raw:t,href:i,title:o,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,r}return{type:"image",raw:t,href:i,title:o,text:Z(a)}}function On(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
3
3
  `).map(i=>{const o=i.match(/^\s+/);if(o===null)return i;const[a]=o;return a.length>=n.length?i.slice(n.length):i}).join(`
4
- `)}class Ze{constructor(e){this.options=e||ge}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ne(n,`
5
- `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=On(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=Ne(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const n=t[0].replace(/^ *>[ \t]?/gm,"");return{type:"blockquote",raw:t[0],tokens:this.lexer.blockTokens(n,[]),text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,i,o,a,r,u,h,d,p,m,f,w,v=t[1].trim();const b=v.length>1,k={type:"list",raw:"",ordered:b,start:b?+v.slice(0,-1):"",loose:!1,items:[]};v=b?`\\d{1,9}\\${v.slice(-1)}`:`\\${v}`,this.options.pedantic&&(v=b?v:"[*+-]");const x=new RegExp(`^( {0,3}${v})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;e&&(w=!1,!(!(t=x.exec(e))||this.rules.block.hr.test(e)));){if(n=t[0],e=e.substring(n.length),d=t[2].split(`
6
- `,1)[0],p=e.split(`
7
- `,1)[0],this.options.pedantic?(a=2,f=d.trimLeft()):(a=t[2].search(/[^ ]/),a=a>4?1:a,f=d.slice(a),a+=t[1].length),u=!1,!d&&/^ *$/.test(p)&&(n+=p+`
8
- `,e=e.substring(p.length+1),w=!0),!w){const E=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))`),V=new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),D=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),C=new RegExp(`^ {0,${Math.min(3,a-1)}}#`);for(;e&&(m=e.split(`
4
+ `)}class Ze{constructor(e){this.options=e||pe}space(e){const t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){const t=this.rules.block.code.exec(e);if(t){const n=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?n:Ne(n,`
5
+ `)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=On(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim().replace(this.rules.inline._escapes,"$1"):t[2],text:i}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const i=Ne(n,"#");(this.options.pedantic||!i||/ $/.test(i))&&(n=i.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const n=t[0].replace(/^ *>[ \t]?/gm,"");return{type:"blockquote",raw:t[0],tokens:this.lexer.blockTokens(n,[]),text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,i,o,a,r,u,h,d,g,m,f,w,v=t[1].trim();const b=v.length>1,k={type:"list",raw:"",ordered:b,start:b?+v.slice(0,-1):"",loose:!1,items:[]};v=b?`\\d{1,9}\\${v.slice(-1)}`:`\\${v}`,this.options.pedantic&&(v=b?v:"[*+-]");const x=new RegExp(`^( {0,3}${v})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;e&&(w=!1,!(!(t=x.exec(e))||this.rules.block.hr.test(e)));){if(n=t[0],e=e.substring(n.length),d=t[2].split(`
6
+ `,1)[0],g=e.split(`
7
+ `,1)[0],this.options.pedantic?(a=2,f=d.trimLeft()):(a=t[2].search(/[^ ]/),a=a>4?1:a,f=d.slice(a),a+=t[1].length),u=!1,!d&&/^ *$/.test(g)&&(n+=g+`
8
+ `,e=e.substring(g.length+1),w=!0),!w){const E=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))`),V=new RegExp(`^ {0,${Math.min(3,a-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),D=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),C=new RegExp(`^ {0,${Math.min(3,a-1)}}#`);for(;e&&(m=e.split(`
9
9
  `,1)[0],d=m,this.options.pedantic&&(d=d.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(D.test(d)||C.test(d)||E.test(d)||V.test(e)));){if(d.search(/[^ ]/)>=a||!d.trim())f+=`
10
10
  `+d.slice(a);else if(!u)f+=`
11
11
  `+d;else break;!u&&!d.trim()&&(u=!0),n+=m+`
12
- `,e=e.substring(m.length+1)}}k.loose||(h?k.loose=!0:/\n *\n *$/.test(n)&&(h=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(f),i&&(o=i[0]!=="[ ] ",f=f.replace(/^\[[ xX]\] +/,""))),k.items.push({type:"list_item",raw:n,task:!!i,checked:o,loose:!1,text:f}),k.raw+=n}k.items[k.items.length-1].raw=n.trimRight(),k.items[k.items.length-1].text=f.trimRight(),k.raw=k.raw.trimRight();const $=k.items.length;for(r=0;r<$;r++){this.lexer.state.top=!1,k.items[r].tokens=this.lexer.blockTokens(k.items[r].text,[]);const E=k.items[r].tokens.filter(D=>D.type==="space"),V=E.every(D=>{const C=D.raw.split("");let g=0;for(const M of C)if(M===`
13
- `&&(g+=1),g>1)return!0;return!1});!k.loose&&E.length&&V&&(k.loose=!0,k.items[r].loose=!0)}return k}}html(e){const t=this.rules.block.html.exec(e);if(t){const n={type:"html",raw:t[0],pre:!this.options.sanitizer&&(t[1]==="pre"||t[1]==="script"||t[1]==="style"),text:t[0]};if(this.options.sanitize){const i=this.options.sanitizer?this.options.sanitizer(t[0]):Z(t[0]);n.type="paragraph",n.text=i,n.tokens=this.lexer.inline(i)}return n}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:o}}}table(e){const t=this.rules.block.table.exec(e);if(t){const n={type:"table",header:St(t[1]).map(i=>({text:i})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
12
+ `,e=e.substring(m.length+1)}}k.loose||(h?k.loose=!0:/\n *\n *$/.test(n)&&(h=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(f),i&&(o=i[0]!=="[ ] ",f=f.replace(/^\[[ xX]\] +/,""))),k.items.push({type:"list_item",raw:n,task:!!i,checked:o,loose:!1,text:f}),k.raw+=n}k.items[k.items.length-1].raw=n.trimRight(),k.items[k.items.length-1].text=f.trimRight(),k.raw=k.raw.trimRight();const $=k.items.length;for(r=0;r<$;r++){this.lexer.state.top=!1,k.items[r].tokens=this.lexer.blockTokens(k.items[r].text,[]);const E=k.items[r].tokens.filter(D=>D.type==="space"),V=E.every(D=>{const C=D.raw.split("");let p=0;for(const M of C)if(M===`
13
+ `&&(p+=1),p>1)return!0;return!1});!k.loose&&E.length&&V&&(k.loose=!0,k.items[r].loose=!0)}return k}}html(e){const t=this.rules.block.html.exec(e);if(t){const n={type:"html",raw:t[0],pre:!this.options.sanitizer&&(t[1]==="pre"||t[1]==="script"||t[1]==="style"),text:t[0]};if(this.options.sanitize){const i=this.options.sanitizer?this.options.sanitizer(t[0]):Z(t[0]);n.type="paragraph",n.text=i,n.tokens=this.lexer.inline(i)}return n}}def(e){const t=this.rules.block.def.exec(e);if(t){const n=t[1].toLowerCase().replace(/\s+/g," "),i=t[2]?t[2].replace(/^<(.*)>$/,"$1").replace(this.rules.inline._escapes,"$1"):"",o=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline._escapes,"$1"):t[3];return{type:"def",tag:n,raw:t[0],href:i,title:o}}}table(e){const t=this.rules.block.table.exec(e);if(t){const n={type:"table",header:St(t[1]).map(i=>({text:i})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
14
14
  `):[]};if(n.header.length===n.align.length){n.raw=t[0];let i=n.align.length,o,a,r,u;for(o=0;o<i;o++)/^ *-+: *$/.test(n.align[o])?n.align[o]="right":/^ *:-+: *$/.test(n.align[o])?n.align[o]="center":/^ *:-+ *$/.test(n.align[o])?n.align[o]="left":n.align[o]=null;for(i=n.rows.length,o=0;o<i;o++)n.rows[o]=St(n.rows[o],n.header.length).map(h=>({text:h}));for(i=n.header.length,a=0;a<i;a++)n.header[a].tokens=this.lexer.inline(n.header[a].text);for(i=n.rows.length,a=0;a<i;a++)for(u=n.rows[a],r=0;r<u.length;r++)u[r].tokens=this.lexer.inline(u[r].text);return n}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n=t[1].charAt(t[1].length-1)===`
15
- `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Z(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):Z(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const a=Ne(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{const a=jn(t[2],"()");if(a>-1){const u=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let i=t[2],o="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a&&(i=a[1],o=a[3])}else o=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),zt(t,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:o&&o.replace(this.rules.inline._escapes,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(/\s+/g," ");if(i=t[i.toLowerCase()],!i){const o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return zt(n,i,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrong.lDelim.exec(e);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;const o=i[1]||i[2]||"";if(!o||o&&(n===""||this.rules.inline.punctuation.exec(n))){const a=i[0].length-1;let r,u,h=a,d=0;const p=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+a);(i=p.exec(t))!=null;){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(u=r.length,i[3]||i[4]){h+=u;continue}else if((i[5]||i[6])&&a%3&&!((a+u)%3)){d+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h+d);const m=e.slice(0,a+i.index+(i[0].length-r.length)+u);if(Math.min(a,u)%2){const w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}const f=m.slice(2,-2);return{type:"strong",raw:m,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return i&&o&&(n=n.substring(1,n.length-1)),n=Z(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e,t){const n=this.rules.inline.autolink.exec(e);if(n){let i,o;return n[2]==="@"?(i=Z(this.options.mangle?t(n[1]):n[1]),o="mailto:"+i):(i=Z(n[1]),o=i),{type:"link",raw:n[0],text:i,href:o,tokens:[{type:"text",raw:i,text:i}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let i,o;if(n[2]==="@")i=Z(this.options.mangle?t(n[0]):n[0]),o="mailto:"+i;else{let a;do a=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0];while(a!==n[0]);i=Z(n[0]),n[1]==="www."?o="http://"+i:o=i}return{type:"link",raw:n[0],text:i,href:o,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let i;return this.lexer.state.inRawBlock?i=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):Z(n[0]):n[0]:i=Z(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:i}}}}const N={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Le,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};N._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/,N._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,N.def=B(N.def).replace("label",N._label).replace("title",N._title).getRegex(),N.bullet=/(?:[*+-]|\d{1,9}[.)])/,N.listItemStart=B(/^( *)(bull) */).replace("bull",N.bullet).getRegex(),N.list=B(N.list).replace(/bull/g,N.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+N.def.source+")").getRegex(),N._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",N._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,N.html=B(N.html,"i").replace("comment",N._comment).replace("tag",N._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),N.paragraph=B(N._paragraph).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.blockquote=B(N.blockquote).replace("paragraph",N.paragraph).getRegex(),N.normal=te({},N),N.gfm=te({},N.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),N.gfm.table=B(N.gfm.table).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.gfm.paragraph=B(N._paragraph).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",N.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.pedantic=te({},N.normal,{html:B(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",N._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Le,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:B(N.normal._paragraph).replace("hr",N.hr).replace("heading",` *#{1,6} *[^
16
- ]`).replace("lheading",N.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const S={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Le,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Le,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};S._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",S.punctuation=B(S.punctuation).replace(/punctuation/g,S._punctuation).getRegex(),S.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,S.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,S._comment=B(N._comment).replace("(?:-->|$)","-->").getRegex(),S.emStrong.lDelim=B(S.emStrong.lDelim).replace(/punct/g,S._punctuation).getRegex(),S.emStrong.rDelimAst=B(S.emStrong.rDelimAst,"g").replace(/punct/g,S._punctuation).getRegex(),S.emStrong.rDelimUnd=B(S.emStrong.rDelimUnd,"g").replace(/punct/g,S._punctuation).getRegex(),S._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,S._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,S._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,S.autolink=B(S.autolink).replace("scheme",S._scheme).replace("email",S._email).getRegex(),S._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,S.tag=B(S.tag).replace("comment",S._comment).replace("attribute",S._attribute).getRegex(),S._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,S._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,S._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,S.link=B(S.link).replace("label",S._label).replace("href",S._href).replace("title",S._title).getRegex(),S.reflink=B(S.reflink).replace("label",S._label).replace("ref",N._label).getRegex(),S.nolink=B(S.nolink).replace("ref",N._label).getRegex(),S.reflinkSearch=B(S.reflinkSearch,"g").replace("reflink",S.reflink).replace("nolink",S.nolink).getRegex(),S.normal=te({},S),S.pedantic=te({},S.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:B(/^!?\[(label)\]\((.*?)\)/).replace("label",S._label).getRegex(),reflink:B(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",S._label).getRegex()}),S.gfm=te({},S.normal,{escape:B(S.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),S.gfm.url=B(S.gfm.url,"i").replace("email",S.gfm._extended_email).getRegex(),S.breaks=te({},S.gfm,{br:B(S.br).replace("{2,}","*").getRegex(),text:B(S.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});function Mn(s){return s.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Lt(s){let e="",t,n;const i=s.length;for(t=0;t<i;t++)n=s.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),e+="&#"+n+";";return e}class le{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||ge,this.options.tokenizer=this.options.tokenizer||new Ze,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:N.normal,inline:S.normal};this.options.pedantic?(t.block=N.pedantic,t.inline=S.pedantic):this.options.gfm&&(t.block=N.gfm,this.options.breaks?t.inline=S.breaks:t.inline=S.gfm),this.tokenizer.rules=t}static get rules(){return{block:N,inline:S}}static lex(e,t){return new le(t).lex(e)}static lexInline(e,t){return new le(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
15
+ `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:n,tokens:this.lexer.inline(n)}}}text(e){const t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:Z(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):Z(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const n=t[2].trim();if(!this.options.pedantic&&/^</.test(n)){if(!/>$/.test(n))return;const a=Ne(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{const a=jn(t[2],"()");if(a>-1){const u=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,u).trim(),t[3]=""}}let i=t[2],o="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a&&(i=a[1],o=a[3])}else o=t[3]?t[3].slice(1,-1):"";return i=i.trim(),/^</.test(i)&&(this.options.pedantic&&!/>$/.test(n)?i=i.slice(1):i=i.slice(1,-1)),zt(t,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:o&&o.replace(this.rules.inline._escapes,"$1")},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let i=(n[2]||n[1]).replace(/\s+/g," ");if(i=t[i.toLowerCase()],!i){const o=n[0].charAt(0);return{type:"text",raw:o,text:o}}return zt(n,i,n[0],this.lexer)}}emStrong(e,t,n=""){let i=this.rules.inline.emStrong.lDelim.exec(e);if(!i||i[3]&&n.match(/[\p{L}\p{N}]/u))return;const o=i[1]||i[2]||"";if(!o||o&&(n===""||this.rules.inline.punctuation.exec(n))){const a=i[0].length-1;let r,u,h=a,d=0;const g=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(g.lastIndex=0,t=t.slice(-1*e.length+a);(i=g.exec(t))!=null;){if(r=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!r)continue;if(u=r.length,i[3]||i[4]){h+=u;continue}else if((i[5]||i[6])&&a%3&&!((a+u)%3)){d+=u;continue}if(h-=u,h>0)continue;u=Math.min(u,u+h+d);const m=e.slice(0,a+i.index+(i[0].length-r.length)+u);if(Math.min(a,u)%2){const w=m.slice(1,-1);return{type:"em",raw:m,text:w,tokens:this.lexer.inlineTokens(w)}}const f=m.slice(2,-2);return{type:"strong",raw:m,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),o=/^ /.test(n)&&/ $/.test(n);return i&&o&&(n=n.substring(1,n.length-1)),n=Z(n,!0),{type:"codespan",raw:t[0],text:n}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e,t){const n=this.rules.inline.autolink.exec(e);if(n){let i,o;return n[2]==="@"?(i=Z(this.options.mangle?t(n[1]):n[1]),o="mailto:"+i):(i=Z(n[1]),o=i),{type:"link",raw:n[0],text:i,href:o,tokens:[{type:"text",raw:i,text:i}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let i,o;if(n[2]==="@")i=Z(this.options.mangle?t(n[0]):n[0]),o="mailto:"+i;else{let a;do a=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0];while(a!==n[0]);i=Z(n[0]),n[1]==="www."?o="http://"+i:o=i}return{type:"link",raw:n[0],text:i,href:o,tokens:[{type:"text",raw:i,text:i}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let i;return this.lexer.state.inRawBlock?i=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):Z(n[0]):n[0]:i=Z(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:i}}}}const N={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,html:"^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))",def:/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,table:Le,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};N._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/,N._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,N.def=B(N.def).replace("label",N._label).replace("title",N._title).getRegex(),N.bullet=/(?:[*+-]|\d{1,9}[.)])/,N.listItemStart=B(/^( *)(bull) */).replace("bull",N.bullet).getRegex(),N.list=B(N.list).replace(/bull/g,N.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+N.def.source+")").getRegex(),N._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",N._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,N.html=B(N.html,"i").replace("comment",N._comment).replace("tag",N._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),N.paragraph=B(N._paragraph).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.blockquote=B(N.blockquote).replace("paragraph",N.paragraph).getRegex(),N.normal=te({},N),N.gfm=te({},N.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),N.gfm.table=B(N.gfm.table).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.gfm.paragraph=B(N._paragraph).replace("hr",N.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",N.gfm.table).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",N._tag).getRegex(),N.pedantic=te({},N.normal,{html:B(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",N._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Le,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:B(N.normal._paragraph).replace("hr",N.hr).replace("heading",` *#{1,6} *[^
16
+ ]`).replace("lheading",N.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const S={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:Le,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(ref)\]/,nolink:/^!?\[(ref)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^(?:[^_*\\]|\\.)*?\_\_(?:[^_*\\]|\\.)*?\*(?:[^_*\\]|\\.)*?(?=\_\_)|(?:[^*\\]|\\.)+(?=[^*])|[punct_](\*+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|(?:[^punct*_\s\\]|\\.)(\*+)(?=[^punct*_\s])/,rDelimUnd:/^(?:[^_*\\]|\\.)*?\*\*(?:[^_*\\]|\\.)*?\_(?:[^_*\\]|\\.)*?(?=\*\*)|(?:[^_\\]|\\.)+(?=[^_])|[punct*](\_+)(?=[\s]|$)|(?:[^punct*_\s\\]|\\.)(\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:Le,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};S._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",S.punctuation=B(S.punctuation).replace(/punctuation/g,S._punctuation).getRegex(),S.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,S.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g,S._comment=B(N._comment).replace("(?:-->|$)","-->").getRegex(),S.emStrong.lDelim=B(S.emStrong.lDelim).replace(/punct/g,S._punctuation).getRegex(),S.emStrong.rDelimAst=B(S.emStrong.rDelimAst,"g").replace(/punct/g,S._punctuation).getRegex(),S.emStrong.rDelimUnd=B(S.emStrong.rDelimUnd,"g").replace(/punct/g,S._punctuation).getRegex(),S._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,S._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,S._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,S.autolink=B(S.autolink).replace("scheme",S._scheme).replace("email",S._email).getRegex(),S._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,S.tag=B(S.tag).replace("comment",S._comment).replace("attribute",S._attribute).getRegex(),S._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,S._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,S._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,S.link=B(S.link).replace("label",S._label).replace("href",S._href).replace("title",S._title).getRegex(),S.reflink=B(S.reflink).replace("label",S._label).replace("ref",N._label).getRegex(),S.nolink=B(S.nolink).replace("ref",N._label).getRegex(),S.reflinkSearch=B(S.reflinkSearch,"g").replace("reflink",S.reflink).replace("nolink",S.nolink).getRegex(),S.normal=te({},S),S.pedantic=te({},S.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:B(/^!?\[(label)\]\((.*?)\)/).replace("label",S._label).getRegex(),reflink:B(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",S._label).getRegex()}),S.gfm=te({},S.normal,{escape:B(S.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),S.gfm.url=B(S.gfm.url,"i").replace("email",S.gfm._extended_email).getRegex(),S.breaks=te({},S.gfm,{br:B(S.br).replace("{2,}","*").getRegex(),text:B(S.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});function Mn(s){return s.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function Lt(s){let e="",t,n;const i=s.length;for(t=0;t<i;t++)n=s.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),e+="&#"+n+";";return e}class le{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||pe,this.options.tokenizer=this.options.tokenizer||new Ze,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:N.normal,inline:S.normal};this.options.pedantic?(t.block=N.pedantic,t.inline=S.pedantic):this.options.gfm&&(t.block=N.gfm,this.options.breaks?t.inline=S.breaks:t.inline=S.gfm),this.tokenizer.rules=t}static get rules(){return{block:N,inline:S}}static lex(e,t){return new le(t).lex(e)}static lexInline(e,t){return new le(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
17
17
  `),this.blockTokens(e,this.tokens);let t;for(;t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){this.options.pedantic?e=e.replace(/\t/g," ").replace(/^ +$/gm,""):e=e.replace(/^( *)(\t+)/gm,(r,u,h)=>u+" ".repeat(h.length));let n,i,o,a;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>(n=r.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
18
18
  `:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
19
19
  `+n.raw,i.text+=`
@@ -23,7 +23,7 @@
23
23
  `+n.raw,i.text+=`
24
24
  `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),a=o.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&i.type==="text"?(i.raw+=`
25
25
  `+n.raw,i.text+=`
26
- `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,o,a=e,r,u,h;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)d.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,r.index)+"["+Tt("a",r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,r.index)+"["+Tt("a",r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.escapedEmSt.exec(a))!=null;)a=a.slice(0,r.index+r[0].length-2)+"++"+a.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(u||(h=""),u=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(d=>(n=d.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,a,h)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e,Lt)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e,Lt))){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startInline){let d=1/0;const p=e.slice(1);let m;this.options.extensions.startInline.forEach(function(f){m=f.call({lexer:this},p),typeof m=="number"&&m>=0&&(d=Math.min(d,m))}),d<1/0&&d>=0&&(o=e.substring(0,d+1))}if(n=this.tokenizer.inlineText(o,Mn)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(h=n.raw.slice(-1)),u=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}}class Ge{constructor(e){this.options=e||ge}code(e,t,n){const i=(t||"").match(/\S*/)[0];if(this.options.highlight){const o=this.options.highlight(e,i);o!=null&&o!==e&&(n=!0,e=o)}return e=e.replace(/\n$/,"")+`
26
+ `+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const r="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(r);break}else throw new Error(r)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,o,a=e,r,u,h;if(this.tokens.links){const d=Object.keys(this.tokens.links);if(d.length>0)for(;(r=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)d.includes(r[0].slice(r[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,r.index)+"["+Tt("a",r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(r=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,r.index)+"["+Tt("a",r[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(r=this.tokenizer.rules.inline.escapedEmSt.exec(a))!=null;)a=a.slice(0,r.index+r[0].length-2)+"++"+a.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(u||(h=""),u=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(d=>(n=d.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),i=t[t.length-1],i&&n.type==="text"&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,a,h)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e,Lt)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e,Lt))){e=e.substring(n.raw.length),t.push(n);continue}if(o=e,this.options.extensions&&this.options.extensions.startInline){let d=1/0;const g=e.slice(1);let m;this.options.extensions.startInline.forEach(function(f){m=f.call({lexer:this},g),typeof m=="number"&&m>=0&&(d=Math.min(d,m))}),d<1/0&&d>=0&&(o=e.substring(0,d+1))}if(n=this.tokenizer.inlineText(o,Mn)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(h=n.raw.slice(-1)),u=!0,i=t[t.length-1],i&&i.type==="text"?(i.raw+=n.raw,i.text+=n.text):t.push(n);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return t}}class Ge{constructor(e){this.options=e||pe}code(e,t,n){const i=(t||"").match(/\S*/)[0];if(this.options.highlight){const o=this.options.highlight(e,i);o!=null&&o!==e&&(n=!0,e=o)}return e=e.replace(/\n$/,"")+`
27
27
  `,i?'<pre><code class="'+this.options.langPrefix+Z(i)+'">'+(n?e:Z(e,!0))+`</code></pre>
28
28
  `:"<pre><code>"+(n?e:Z(e,!0))+`</code></pre>
29
29
  `}blockquote(e){return`<blockquote>
@@ -43,14 +43,14 @@ ${e}</blockquote>
43
43
  `}tablerow(e){return`<tr>
44
44
  ${e}</tr>
45
45
  `}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
46
- `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){if(e=Ct(this.options.sanitize,this.options.baseUrl,e),e===null)return n;let i='<a href="'+e+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>",i}image(e,t,n){if(e=Ct(this.options.sanitize,this.options.baseUrl,e),e===null)return n;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${t}"`),i+=this.options.xhtml?"/>":">",i}text(e){return e}}class Nt{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Ft{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,i=0;if(this.seen.hasOwnProperty(n)){i=this.seen[e];do i++,n=e+"-"+i;while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=i,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class ne{constructor(e){this.options=e||ge,this.options.renderer=this.options.renderer||new Ge,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Nt,this.slugger=new Ft}static parse(e,t){return new ne(t).parse(e)}static parseInline(e,t){return new ne(t).parseInline(e)}parse(e,t=!0){let n="",i,o,a,r,u,h,d,p,m,f,w,v,b,k,x,$,E,V,D;const C=e.length;for(i=0;i<C;i++){if(f=e[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[f.type]&&(D=this.options.extensions.renderers[f.type].call({parser:this},f),D!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(f.type))){n+=D||"";continue}switch(f.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{n+=this.renderer.heading(this.parseInline(f.tokens),f.depth,$t(this.parseInline(f.tokens,this.textRenderer)),this.slugger);continue}case"code":{n+=this.renderer.code(f.text,f.lang,f.escaped);continue}case"table":{for(p="",d="",r=f.header.length,o=0;o<r;o++)d+=this.renderer.tablecell(this.parseInline(f.header[o].tokens),{header:!0,align:f.align[o]});for(p+=this.renderer.tablerow(d),m="",r=f.rows.length,o=0;o<r;o++){for(h=f.rows[o],d="",u=h.length,a=0;a<u;a++)d+=this.renderer.tablecell(this.parseInline(h[a].tokens),{header:!1,align:f.align[a]});m+=this.renderer.tablerow(d)}n+=this.renderer.table(p,m);continue}case"blockquote":{m=this.parse(f.tokens),n+=this.renderer.blockquote(m);continue}case"list":{for(w=f.ordered,v=f.start,b=f.loose,r=f.items.length,m="",o=0;o<r;o++)x=f.items[o],$=x.checked,E=x.task,k="",x.task&&(V=this.renderer.checkbox($),b?x.tokens.length>0&&x.tokens[0].type==="paragraph"?(x.tokens[0].text=V+" "+x.tokens[0].text,x.tokens[0].tokens&&x.tokens[0].tokens.length>0&&x.tokens[0].tokens[0].type==="text"&&(x.tokens[0].tokens[0].text=V+" "+x.tokens[0].tokens[0].text)):x.tokens.unshift({type:"text",text:V}):k+=V),k+=this.parse(x.tokens,b),m+=this.renderer.listitem(k,E,$);n+=this.renderer.list(m,w,v);continue}case"html":{n+=this.renderer.html(f.text);continue}case"paragraph":{n+=this.renderer.paragraph(this.parseInline(f.tokens));continue}case"text":{for(m=f.tokens?this.parseInline(f.tokens):f.text;i+1<C&&e[i+1].type==="text";)f=e[++i],m+=`
47
- `+(f.tokens?this.parseInline(f.tokens):f.text);n+=t?this.renderer.paragraph(m):m;continue}default:{const g='Token with "'+f.type+'" type was not found.';if(this.options.silent){console.error(g);return}else throw new Error(g)}}}return n}parseInline(e,t){t=t||this.renderer;let n="",i,o,a;const r=e.length;for(i=0;i<r;i++){if(o=e[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]&&(a=this.options.extensions.renderers[o.type].call({parser:this},o),a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type))){n+=a||"";continue}switch(o.type){case"escape":{n+=t.text(o.text);break}case"html":{n+=t.html(o.text);break}case"link":{n+=t.link(o.href,o.title,this.parseInline(o.tokens,t));break}case"image":{n+=t.image(o.href,o.title,o.text);break}case"strong":{n+=t.strong(this.parseInline(o.tokens,t));break}case"em":{n+=t.em(this.parseInline(o.tokens,t));break}case"codespan":{n+=t.codespan(o.text);break}case"br":{n+=t.br();break}case"del":{n+=t.del(this.parseInline(o.tokens,t));break}case"text":{n+=t.text(o.text);break}default:{const u='Token with "'+o.type+'" type was not found.';if(this.options.silent){console.error(u);return}else throw new Error(u)}}}return n}}function L(s,e,t){if(typeof s=="undefined"||s===null)throw new Error("marked(): input parameter is undefined or null");if(typeof s!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected");if(typeof e=="function"&&(t=e,e=null),e=te({},L.defaults,e||{}),Et(e),t){const i=e.highlight;let o;try{o=le.lex(s,e)}catch(u){return t(u)}const a=function(u){let h;if(!u)try{e.walkTokens&&L.walkTokens(o,e.walkTokens),h=ne.parse(o,e)}catch(d){u=d}return e.highlight=i,u?t(u):t(null,h)};if(!i||i.length<3||(delete e.highlight,!o.length))return a();let r=0;L.walkTokens(o,function(u){u.type==="code"&&(r++,setTimeout(()=>{i(u.text,u.lang,function(h,d){if(h)return a(h);d!=null&&d!==u.text&&(u.text=d,u.escaped=!0),r--,r===0&&a()})},0))}),r===0&&a();return}function n(i){if(i.message+=`
48
- Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+Z(i.message+"",!0)+"</pre>";throw i}try{const i=le.lex(s,e);if(e.walkTokens){if(e.async)return Promise.all(L.walkTokens(i,e.walkTokens)).then(()=>ne.parse(i,e)).catch(n);L.walkTokens(i,e.walkTokens)}return ne.parse(i,e)}catch(i){n(i)}}L.options=L.setOptions=function(s){return te(L.defaults,s),En(L.defaults),L},L.getDefaults=yt,L.defaults=ge,L.use=function(...s){const e=L.defaults.extensions||{renderers:{},childTokens:{}};s.forEach(t=>{const n=te({},t);if(n.async=L.defaults.async||n.async,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if(i.renderer){const o=e.renderers[i.name];o?e.renderers[i.name]=function(...a){let r=i.renderer.apply(this,a);return r===!1&&(r=o.apply(this,a)),r}:e.renderers[i.name]=i.renderer}if(i.tokenizer){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");e[i.level]?e[i.level].unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),n.extensions=e),t.renderer){const i=L.defaults.renderer||new Ge;for(const o in t.renderer){const a=i[o];i[o]=(...r)=>{let u=t.renderer[o].apply(i,r);return u===!1&&(u=a.apply(i,r)),u}}n.renderer=i}if(t.tokenizer){const i=L.defaults.tokenizer||new Ze;for(const o in t.tokenizer){const a=i[o];i[o]=(...r)=>{let u=t.tokenizer[o].apply(i,r);return u===!1&&(u=a.apply(i,r)),u}}n.tokenizer=i}if(t.walkTokens){const i=L.defaults.walkTokens;n.walkTokens=function(o){let a=[];return a.push(t.walkTokens.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}L.setOptions(n)})},L.walkTokens=function(s,e){let t=[];for(const n of s)switch(t=t.concat(e.call(L,n)),n.type){case"table":{for(const i of n.header)t=t.concat(L.walkTokens(i.tokens,e));for(const i of n.rows)for(const o of i)t=t.concat(L.walkTokens(o.tokens,e));break}case"list":{t=t.concat(L.walkTokens(n.items,e));break}default:L.defaults.extensions&&L.defaults.extensions.childTokens&&L.defaults.extensions.childTokens[n.type]?L.defaults.extensions.childTokens[n.type].forEach(function(i){t=t.concat(L.walkTokens(n[i],e))}):n.tokens&&(t=t.concat(L.walkTokens(n.tokens,e)))}return t},L.parseInline=function(s,e){if(typeof s=="undefined"||s===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof s!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected");e=te({},L.defaults,e||{}),Et(e);try{const t=le.lexInline(s,e);return e.walkTokens&&L.walkTokens(t,e.walkTokens),ne.parseInline(t,e)}catch(t){if(t.message+=`
49
- Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+Z(t.message+"",!0)+"</pre>";throw t}},L.Parser=ne,L.parser=ne.parse,L.Renderer=Ge,L.TextRenderer=Nt,L.Lexer=le,L.lexer=le.lex,L.Tokenizer=Ze,L.Slugger=Ft,L.parse=L,ne.parse,le.lex;var Hn=function(){var s=document.getSelection();if(!s.rangeCount)return function(){};for(var e=document.activeElement,t=[],n=0;n<s.rangeCount;n++)t.push(s.getRangeAt(n));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return s.removeAllRanges(),function(){s.type==="Caret"&&s.removeAllRanges(),s.rangeCount||t.forEach(function(i){s.addRange(i)}),e&&e.focus()}},Pn=Hn,At={"text/plain":"Text","text/html":"Url",default:"Text"},Bn="Copy to clipboard: #{key}, Enter";function Un(s){var e=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return s.replace(/#{\s*key\s*}/g,e)}function qn(s,e){var t,n,i,o,a,r,u=!1;e||(e={}),t=e.debug||!1;try{i=Pn(),o=document.createRange(),a=document.getSelection(),r=document.createElement("span"),r.textContent=s,r.style.all="unset",r.style.position="fixed",r.style.top=0,r.style.clip="rect(0, 0, 0, 0)",r.style.whiteSpace="pre",r.style.webkitUserSelect="text",r.style.MozUserSelect="text",r.style.msUserSelect="text",r.style.userSelect="text",r.addEventListener("copy",function(d){if(d.stopPropagation(),e.format)if(d.preventDefault(),typeof d.clipboardData=="undefined"){t&&console.warn("unable to use e.clipboardData"),t&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var p=At[e.format]||At.default;window.clipboardData.setData(p,s)}else d.clipboardData.clearData(),d.clipboardData.setData(e.format,s);e.onCopy&&(d.preventDefault(),e.onCopy(d.clipboardData))}),document.body.appendChild(r),o.selectNodeContents(r),a.addRange(o);var h=document.execCommand("copy");if(!h)throw new Error("copy command was unsuccessful");u=!0}catch(d){t&&console.error("unable to copy using execCommand: ",d),t&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",s),e.onCopy&&e.onCopy(window.clipboardData),u=!0}catch(p){t&&console.error("unable to copy using clipboardData: ",p),t&&console.error("falling back to prompt"),n=Un("message"in e?e.message:Bn),window.prompt(n,s)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(o):a.removeAllRanges()),r&&document.body.removeChild(r),i()}return u}var ve=qn;/*! medium-zoom 1.0.8 | MIT License | https://github.com/francoischalifour/medium-zoom */var de=Object.assign||function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},Fe=function(e){return e.tagName==="IMG"},Wn=function(e){return NodeList.prototype.isPrototypeOf(e)},Ae=function(e){return e&&e.nodeType===1},Vt=function(e){var t=e.currentSrc||e.src;return t.substr(-4).toLowerCase()===".svg"},_t=function(e){try{return Array.isArray(e)?e.filter(Fe):Wn(e)?[].slice.call(e).filter(Fe):Ae(e)?[e].filter(Fe):typeof e=="string"?[].slice.call(document.querySelectorAll(e)).filter(Fe):[]}catch{throw new TypeError(`The provided selector is invalid.
46
+ `}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return`<del>${e}</del>`}link(e,t,n){if(e=Ct(this.options.sanitize,this.options.baseUrl,e),e===null)return n;let i='<a href="'+e+'"';return t&&(i+=' title="'+t+'"'),i+=">"+n+"</a>",i}image(e,t,n){if(e=Ct(this.options.sanitize,this.options.baseUrl,e),e===null)return n;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${t}"`),i+=this.options.xhtml?"/>":">",i}text(e){return e}}class Nt{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class Ft{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/ig,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,i=0;if(this.seen.hasOwnProperty(n)){i=this.seen[e];do i++,n=e+"-"+i;while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=i,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class ne{constructor(e){this.options=e||pe,this.options.renderer=this.options.renderer||new Ge,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new Nt,this.slugger=new Ft}static parse(e,t){return new ne(t).parse(e)}static parseInline(e,t){return new ne(t).parseInline(e)}parse(e,t=!0){let n="",i,o,a,r,u,h,d,g,m,f,w,v,b,k,x,$,E,V,D;const C=e.length;for(i=0;i<C;i++){if(f=e[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[f.type]&&(D=this.options.extensions.renderers[f.type].call({parser:this},f),D!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(f.type))){n+=D||"";continue}switch(f.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{n+=this.renderer.heading(this.parseInline(f.tokens),f.depth,$t(this.parseInline(f.tokens,this.textRenderer)),this.slugger);continue}case"code":{n+=this.renderer.code(f.text,f.lang,f.escaped);continue}case"table":{for(g="",d="",r=f.header.length,o=0;o<r;o++)d+=this.renderer.tablecell(this.parseInline(f.header[o].tokens),{header:!0,align:f.align[o]});for(g+=this.renderer.tablerow(d),m="",r=f.rows.length,o=0;o<r;o++){for(h=f.rows[o],d="",u=h.length,a=0;a<u;a++)d+=this.renderer.tablecell(this.parseInline(h[a].tokens),{header:!1,align:f.align[a]});m+=this.renderer.tablerow(d)}n+=this.renderer.table(g,m);continue}case"blockquote":{m=this.parse(f.tokens),n+=this.renderer.blockquote(m);continue}case"list":{for(w=f.ordered,v=f.start,b=f.loose,r=f.items.length,m="",o=0;o<r;o++)x=f.items[o],$=x.checked,E=x.task,k="",x.task&&(V=this.renderer.checkbox($),b?x.tokens.length>0&&x.tokens[0].type==="paragraph"?(x.tokens[0].text=V+" "+x.tokens[0].text,x.tokens[0].tokens&&x.tokens[0].tokens.length>0&&x.tokens[0].tokens[0].type==="text"&&(x.tokens[0].tokens[0].text=V+" "+x.tokens[0].tokens[0].text)):x.tokens.unshift({type:"text",text:V}):k+=V),k+=this.parse(x.tokens,b),m+=this.renderer.listitem(k,E,$);n+=this.renderer.list(m,w,v);continue}case"html":{n+=this.renderer.html(f.text);continue}case"paragraph":{n+=this.renderer.paragraph(this.parseInline(f.tokens));continue}case"text":{for(m=f.tokens?this.parseInline(f.tokens):f.text;i+1<C&&e[i+1].type==="text";)f=e[++i],m+=`
47
+ `+(f.tokens?this.parseInline(f.tokens):f.text);n+=t?this.renderer.paragraph(m):m;continue}default:{const p='Token with "'+f.type+'" type was not found.';if(this.options.silent){console.error(p);return}else throw new Error(p)}}}return n}parseInline(e,t){t=t||this.renderer;let n="",i,o,a;const r=e.length;for(i=0;i<r;i++){if(o=e[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[o.type]&&(a=this.options.extensions.renderers[o.type].call({parser:this},o),a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type))){n+=a||"";continue}switch(o.type){case"escape":{n+=t.text(o.text);break}case"html":{n+=t.html(o.text);break}case"link":{n+=t.link(o.href,o.title,this.parseInline(o.tokens,t));break}case"image":{n+=t.image(o.href,o.title,o.text);break}case"strong":{n+=t.strong(this.parseInline(o.tokens,t));break}case"em":{n+=t.em(this.parseInline(o.tokens,t));break}case"codespan":{n+=t.codespan(o.text);break}case"br":{n+=t.br();break}case"del":{n+=t.del(this.parseInline(o.tokens,t));break}case"text":{n+=t.text(o.text);break}default:{const u='Token with "'+o.type+'" type was not found.';if(this.options.silent){console.error(u);return}else throw new Error(u)}}}return n}}function L(s,e,t){if(typeof s=="undefined"||s===null)throw new Error("marked(): input parameter is undefined or null");if(typeof s!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected");if(typeof e=="function"&&(t=e,e=null),e=te({},L.defaults,e||{}),Et(e),t){const i=e.highlight;let o;try{o=le.lex(s,e)}catch(u){return t(u)}const a=function(u){let h;if(!u)try{e.walkTokens&&L.walkTokens(o,e.walkTokens),h=ne.parse(o,e)}catch(d){u=d}return e.highlight=i,u?t(u):t(null,h)};if(!i||i.length<3||(delete e.highlight,!o.length))return a();let r=0;L.walkTokens(o,function(u){u.type==="code"&&(r++,setTimeout(()=>{i(u.text,u.lang,function(h,d){if(h)return a(h);d!=null&&d!==u.text&&(u.text=d,u.escaped=!0),r--,r===0&&a()})},0))}),r===0&&a();return}function n(i){if(i.message+=`
48
+ Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+Z(i.message+"",!0)+"</pre>";throw i}try{const i=le.lex(s,e);if(e.walkTokens){if(e.async)return Promise.all(L.walkTokens(i,e.walkTokens)).then(()=>ne.parse(i,e)).catch(n);L.walkTokens(i,e.walkTokens)}return ne.parse(i,e)}catch(i){n(i)}}L.options=L.setOptions=function(s){return te(L.defaults,s),En(L.defaults),L},L.getDefaults=yt,L.defaults=pe,L.use=function(...s){const e=L.defaults.extensions||{renderers:{},childTokens:{}};s.forEach(t=>{const n=te({},t);if(n.async=L.defaults.async||n.async,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if(i.renderer){const o=e.renderers[i.name];o?e.renderers[i.name]=function(...a){let r=i.renderer.apply(this,a);return r===!1&&(r=o.apply(this,a)),r}:e.renderers[i.name]=i.renderer}if(i.tokenizer){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");e[i.level]?e[i.level].unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),n.extensions=e),t.renderer){const i=L.defaults.renderer||new Ge;for(const o in t.renderer){const a=i[o];i[o]=(...r)=>{let u=t.renderer[o].apply(i,r);return u===!1&&(u=a.apply(i,r)),u}}n.renderer=i}if(t.tokenizer){const i=L.defaults.tokenizer||new Ze;for(const o in t.tokenizer){const a=i[o];i[o]=(...r)=>{let u=t.tokenizer[o].apply(i,r);return u===!1&&(u=a.apply(i,r)),u}}n.tokenizer=i}if(t.walkTokens){const i=L.defaults.walkTokens;n.walkTokens=function(o){let a=[];return a.push(t.walkTokens.call(this,o)),i&&(a=a.concat(i.call(this,o))),a}}L.setOptions(n)})},L.walkTokens=function(s,e){let t=[];for(const n of s)switch(t=t.concat(e.call(L,n)),n.type){case"table":{for(const i of n.header)t=t.concat(L.walkTokens(i.tokens,e));for(const i of n.rows)for(const o of i)t=t.concat(L.walkTokens(o.tokens,e));break}case"list":{t=t.concat(L.walkTokens(n.items,e));break}default:L.defaults.extensions&&L.defaults.extensions.childTokens&&L.defaults.extensions.childTokens[n.type]?L.defaults.extensions.childTokens[n.type].forEach(function(i){t=t.concat(L.walkTokens(n[i],e))}):n.tokens&&(t=t.concat(L.walkTokens(n.tokens,e)))}return t},L.parseInline=function(s,e){if(typeof s=="undefined"||s===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof s!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(s)+", string expected");e=te({},L.defaults,e||{}),Et(e);try{const t=le.lexInline(s,e);return e.walkTokens&&L.walkTokens(t,e.walkTokens),ne.parseInline(t,e)}catch(t){if(t.message+=`
49
+ Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+Z(t.message+"",!0)+"</pre>";throw t}},L.Parser=ne,L.parser=ne.parse,L.Renderer=Ge,L.TextRenderer=Nt,L.Lexer=le,L.lexer=le.lex,L.Tokenizer=Ze,L.Slugger=Ft,L.parse=L,ne.parse,le.lex;var Hn=function(){var s=document.getSelection();if(!s.rangeCount)return function(){};for(var e=document.activeElement,t=[],n=0;n<s.rangeCount;n++)t.push(s.getRangeAt(n));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return s.removeAllRanges(),function(){s.type==="Caret"&&s.removeAllRanges(),s.rangeCount||t.forEach(function(i){s.addRange(i)}),e&&e.focus()}},Pn=Hn,At={"text/plain":"Text","text/html":"Url",default:"Text"},Bn="Copy to clipboard: #{key}, Enter";function Un(s){var e=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return s.replace(/#{\s*key\s*}/g,e)}function qn(s,e){var t,n,i,o,a,r,u=!1;e||(e={}),t=e.debug||!1;try{i=Pn(),o=document.createRange(),a=document.getSelection(),r=document.createElement("span"),r.textContent=s,r.style.all="unset",r.style.position="fixed",r.style.top=0,r.style.clip="rect(0, 0, 0, 0)",r.style.whiteSpace="pre",r.style.webkitUserSelect="text",r.style.MozUserSelect="text",r.style.msUserSelect="text",r.style.userSelect="text",r.addEventListener("copy",function(d){if(d.stopPropagation(),e.format)if(d.preventDefault(),typeof d.clipboardData=="undefined"){t&&console.warn("unable to use e.clipboardData"),t&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var g=At[e.format]||At.default;window.clipboardData.setData(g,s)}else d.clipboardData.clearData(),d.clipboardData.setData(e.format,s);e.onCopy&&(d.preventDefault(),e.onCopy(d.clipboardData))}),document.body.appendChild(r),o.selectNodeContents(r),a.addRange(o);var h=document.execCommand("copy");if(!h)throw new Error("copy command was unsuccessful");u=!0}catch(d){t&&console.error("unable to copy using execCommand: ",d),t&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",s),e.onCopy&&e.onCopy(window.clipboardData),u=!0}catch(g){t&&console.error("unable to copy using clipboardData: ",g),t&&console.error("falling back to prompt"),n=Un("message"in e?e.message:Bn),window.prompt(n,s)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(o):a.removeAllRanges()),r&&document.body.removeChild(r),i()}return u}var ve=qn;/*! medium-zoom 1.0.8 | MIT License | https://github.com/francoischalifour/medium-zoom */var de=Object.assign||function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},Fe=function(e){return e.tagName==="IMG"},Wn=function(e){return NodeList.prototype.isPrototypeOf(e)},Ae=function(e){return e&&e.nodeType===1},Vt=function(e){var t=e.currentSrc||e.src;return t.substr(-4).toLowerCase()===".svg"},_t=function(e){try{return Array.isArray(e)?e.filter(Fe):Wn(e)?[].slice.call(e).filter(Fe):Ae(e)?[e].filter(Fe):typeof e=="string"?[].slice.call(document.querySelectorAll(e)).filter(Fe):[]}catch{throw new TypeError(`The provided selector is invalid.
50
50
  Expects a CSS selector, a Node element, a NodeList or an array.
51
- See: https://github.com/francoischalifour/medium-zoom`)}},Kn=function(e){var t=document.createElement("div");return t.classList.add("medium-zoom-overlay"),t.style.background=e,t},Zn=function(e){var t=e.getBoundingClientRect(),n=t.top,i=t.left,o=t.width,a=t.height,r=e.cloneNode(),u=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,h=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;return r.removeAttribute("id"),r.style.position="absolute",r.style.top=n+u+"px",r.style.left=i+h+"px",r.style.width=o+"px",r.style.height=a+"px",r.style.transform="",r},be=function(e,t){var n=de({bubbles:!1,cancelable:!1,detail:void 0},t);if(typeof window.CustomEvent=="function")return new CustomEvent(e,n);var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n.bubbles,n.cancelable,n.detail),i},Gn=function s(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=window.Promise||function(z){function A(){}z(A,A)},i=function(z){var A=z.target;if(A===M){w();return}$.indexOf(A)!==-1&&v({target:A})},o=function(){if(!(V||!g.original)){var z=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(D-z)>C.scrollOffset&&setTimeout(w,150)}},a=function(z){var A=z.key||z.keyCode;(A==="Escape"||A==="Esc"||A===27)&&w()},r=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},A=z;if(z.background&&(M.style.background=z.background),z.container&&z.container instanceof Object&&(A.container=de({},C.container,z.container)),z.template){var I=Ae(z.template)?z.template:document.querySelector(z.template);A.template=I}return C=de({},C,A),$.forEach(function(H){H.dispatchEvent(be("medium-zoom:update",{detail:{zoom:O}}))}),O},u=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return s(de({},C,z))},h=function(){for(var z=arguments.length,A=Array(z),I=0;I<z;I++)A[I]=arguments[I];var H=A.reduce(function(_,W){return[].concat(_,_t(W))},[]);return H.filter(function(_){return $.indexOf(_)===-1}).forEach(function(_){$.push(_),_.classList.add("medium-zoom-image")}),E.forEach(function(_){var W=_.type,T=_.listener,F=_.options;H.forEach(function(R){R.addEventListener(W,T,F)})}),O},d=function(){for(var z=arguments.length,A=Array(z),I=0;I<z;I++)A[I]=arguments[I];g.zoomed&&w();var H=A.length>0?A.reduce(function(_,W){return[].concat(_,_t(W))},[]):$;return H.forEach(function(_){_.classList.remove("medium-zoom-image"),_.dispatchEvent(be("medium-zoom:detach",{detail:{zoom:O}}))}),$=$.filter(function(_){return H.indexOf(_)===-1}),O},p=function(z,A){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $.forEach(function(H){H.addEventListener("medium-zoom:"+z,A,I)}),E.push({type:"medium-zoom:"+z,listener:A,options:I}),O},m=function(z,A){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $.forEach(function(H){H.removeEventListener("medium-zoom:"+z,A,I)}),E=E.filter(function(H){return!(H.type==="medium-zoom:"+z&&H.listener.toString()===A.toString())}),O},f=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},A=z.target,I=function(){var _={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},W=void 0,T=void 0;if(C.container)if(C.container instanceof Object)_=de({},_,C.container),W=_.width-_.left-_.right-C.margin*2,T=_.height-_.top-_.bottom-C.margin*2;else{var F=Ae(C.container)?C.container:document.querySelector(C.container),R=F.getBoundingClientRect(),K=R.width,G=R.height,Y=R.left,ie=R.top;_=de({},_,{width:K,height:G,left:Y,top:ie})}W=W||_.width-C.margin*2,T=T||_.height-C.margin*2;var re=g.zoomedHd||g.original,he=Vt(re)?W:re.naturalWidth||W,ce=Vt(re)?T:re.naturalHeight||T,fe=re.getBoundingClientRect(),De=fe.top,je=fe.left,ke=fe.width,ye=fe.height,Oe=Math.min(Math.max(ke,he),W)/ke,Me=Math.min(Math.max(ye,ce),T)/ye,we=Math.min(Oe,Me),He=(-je+(W-ke)/2+C.margin+_.left)/we,Pe=(-De+(T-ye)/2+C.margin+_.top)/we,Ce="scale("+we+") translate3d("+He+"px, "+Pe+"px, 0)";g.zoomed.style.transform=Ce,g.zoomedHd&&(g.zoomedHd.style.transform=Ce)};return new n(function(H){if(A&&$.indexOf(A)===-1){H(O);return}var _=function K(){V=!1,g.zoomed.removeEventListener("transitionend",K),g.original.dispatchEvent(be("medium-zoom:opened",{detail:{zoom:O}})),H(O)};if(g.zoomed){H(O);return}if(A)g.original=A;else if($.length>0){var W=$;g.original=W[0]}else{H(O);return}if(g.original.dispatchEvent(be("medium-zoom:open",{detail:{zoom:O}})),D=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,V=!0,g.zoomed=Zn(g.original),document.body.appendChild(M),C.template){var T=Ae(C.template)?C.template:document.querySelector(C.template);g.template=document.createElement("div"),g.template.appendChild(T.content.cloneNode(!0)),document.body.appendChild(g.template)}if(g.original.parentElement&&g.original.parentElement.tagName==="PICTURE"&&g.original.currentSrc&&(g.zoomed.src=g.original.currentSrc),document.body.appendChild(g.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),g.original.classList.add("medium-zoom-image--hidden"),g.zoomed.classList.add("medium-zoom-image--opened"),g.zoomed.addEventListener("click",w),g.zoomed.addEventListener("transitionend",_),g.original.getAttribute("data-zoom-src")){g.zoomedHd=g.zoomed.cloneNode(),g.zoomedHd.removeAttribute("srcset"),g.zoomedHd.removeAttribute("sizes"),g.zoomedHd.removeAttribute("loading"),g.zoomedHd.src=g.zoomed.getAttribute("data-zoom-src"),g.zoomedHd.onerror=function(){clearInterval(F),console.warn("Unable to reach the zoom image target "+g.zoomedHd.src),g.zoomedHd=null,I()};var F=setInterval(function(){g.zoomedHd.complete&&(clearInterval(F),g.zoomedHd.classList.add("medium-zoom-image--opened"),g.zoomedHd.addEventListener("click",w),document.body.appendChild(g.zoomedHd),I())},10)}else if(g.original.hasAttribute("srcset")){g.zoomedHd=g.zoomed.cloneNode(),g.zoomedHd.removeAttribute("sizes"),g.zoomedHd.removeAttribute("loading");var R=g.zoomedHd.addEventListener("load",function(){g.zoomedHd.removeEventListener("load",R),g.zoomedHd.classList.add("medium-zoom-image--opened"),g.zoomedHd.addEventListener("click",w),document.body.appendChild(g.zoomedHd),I()})}else I()})},w=function(){return new n(function(z){if(V||!g.original){z(O);return}var A=function I(){g.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(g.zoomed),g.zoomedHd&&document.body.removeChild(g.zoomedHd),document.body.removeChild(M),g.zoomed.classList.remove("medium-zoom-image--opened"),g.template&&document.body.removeChild(g.template),V=!1,g.zoomed.removeEventListener("transitionend",I),g.original.dispatchEvent(be("medium-zoom:closed",{detail:{zoom:O}})),g.original=null,g.zoomed=null,g.zoomedHd=null,g.template=null,z(O)};V=!0,document.body.classList.remove("medium-zoom--opened"),g.zoomed.style.transform="",g.zoomedHd&&(g.zoomedHd.style.transform=""),g.template&&(g.template.style.transition="opacity 150ms",g.template.style.opacity=0),g.original.dispatchEvent(be("medium-zoom:close",{detail:{zoom:O}})),g.zoomed.addEventListener("transitionend",A)})},v=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},A=z.target;return g.original?w():f({target:A})},b=function(){return C},k=function(){return $},x=function(){return g.original},$=[],E=[],V=!1,D=0,C=t,g={original:null,zoomed:null,zoomedHd:null,template:null};Object.prototype.toString.call(e)==="[object Object]"?C=e:(e||typeof e=="string")&&h(e),C=de({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},C);var M=Kn(C.background);document.addEventListener("click",i),document.addEventListener("keyup",a),document.addEventListener("scroll",o),window.addEventListener("resize",w);var O={open:f,close:w,toggle:v,update:r,clone:u,attach:h,detach:d,on:p,off:m,getOptions:b,getImages:k,getZoomedImage:x};return O};function Xn(s,e){e===void 0&&(e={});var t=e.insertAt;if(!(!s||typeof document=="undefined")){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",t==="top"&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=s:i.appendChild(document.createTextNode(s))}}var Qn=".medium-zoom-overlay{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s;will-change:opacity}.medium-zoom--opened .medium-zoom-overlay{cursor:pointer;cursor:zoom-out;opacity:1}.medium-zoom-image{cursor:pointer;cursor:zoom-in;transition:transform .3s cubic-bezier(.2,0,.2,1)!important}.medium-zoom-image--hidden{visibility:hidden}.medium-zoom-image--opened{position:relative;cursor:pointer;cursor:zoom-out;will-change:transform}";Xn(Qn);var Yn=Gn;const xe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ve=typeof AbortController=="function"?AbortController:class{constructor(){this.signal=new It}abort(e=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||e,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},Jn=typeof AbortSignal=="function",ei=typeof Ve.AbortSignal=="function",It=Jn?AbortSignal:ei?Ve.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,this.onabort(e),this._listeners.forEach(t=>t(e),this))}onabort(){}addEventListener(e,t){e==="abort"&&this._listeners.push(t)}removeEventListener(e,t){e==="abort"&&(this._listeners=this._listeners.filter(n=>n!==t))}},Xe=new Set,Qe=(s,e)=>{const t=`LRU_CACHE_OPTION_${s}`;_e(t)&&Je(t,`${s} option`,`options.${e}`,ue)},Ye=(s,e)=>{const t=`LRU_CACHE_METHOD_${s}`;if(_e(t)){const{prototype:n}=ue,{get:i}=Object.getOwnPropertyDescriptor(n,s);Je(t,`${s} method`,`cache.${e}()`,i)}},ti=(s,e)=>{const t=`LRU_CACHE_PROPERTY_${s}`;if(_e(t)){const{prototype:n}=ue,{get:i}=Object.getOwnPropertyDescriptor(n,s);Je(t,`${s} property`,`cache.${e}`,i)}},Rt=(...s)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...s):console.error(...s)},_e=s=>!Xe.has(s),Je=(s,e,t,n)=>{Xe.add(s);const i=`The ${e} is deprecated. Please use ${t} instead.`;Rt(i,"DeprecationWarning",s,n)},ae=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),Dt=s=>ae(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?Ie:null:null;class Ie extends Array{constructor(e){super(e),this.fill(0)}}class ni{constructor(e){if(e===0)return[];const t=Dt(e);this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class ue{constructor(e={}){const{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:r,allowStale:u,dispose:h,disposeAfter:d,noDisposeOnSet:p,noUpdateTTL:m,maxSize:f=0,maxEntrySize:w=0,sizeCalculation:v,fetchMethod:b,fetchContext:k,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:$,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:V,ignoreFetchAbort:D}=e,{length:C,maxAge:g,stale:M}=e instanceof ue?{}:e;if(t!==0&&!ae(t))throw new TypeError("max option must be a nonnegative integer");const O=t?Dt(t):Array;if(!O)throw new Error("invalid max value: "+t);if(this.max=t,this.maxSize=f,this.maxEntrySize=w||this.maxSize,this.sizeCalculation=v||C,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=b||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=k,!this.fetchMethod&&k!==void 0)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(t).fill(null),this.valList=new Array(t).fill(null),this.next=new O(t),this.prev=new O(t),this.head=0,this.tail=0,this.free=new ni(t),this.initialFill=1,this.size=0,typeof h=="function"&&(this.dispose=h),typeof d=="function"?(this.disposeAfter=d,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!p,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!V,this.ignoreFetchAbort=!!D,this.maxEntrySize!==0){if(this.maxSize!==0&&!ae(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!ae(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!u||!!M,this.noDeleteOnStaleGet=!!$,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!r,this.ttlResolution=ae(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=n||g||0,this.ttl){if(!ae(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){const j="LRU_CACHE_UNBOUNDED";_e(j)&&(Xe.add(j),Rt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",j,ue))}M&&Qe("stale","allowStale"),g&&Qe("maxAge","ttl"),C&&Qe("length","sizeCalculation")}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new Ie(this.max),this.starts=new Ie(this.max),this.setItemTTL=(n,i,o=xe.now())=>{if(this.starts[n]=i!==0?o:0,this.ttls[n]=i,i!==0&&this.ttlAutopurge){const a=setTimeout(()=>{this.isStale(n)&&this.delete(this.keyList[n])},i+1);a.unref&&a.unref()}},this.updateItemAge=n=>{this.starts[n]=this.ttls[n]!==0?xe.now():0},this.statusTTL=(n,i)=>{n&&(n.ttl=this.ttls[i],n.start=this.starts[i],n.now=e||t(),n.remainingTTL=n.now+n.ttl-n.start)};let e=0;const t=()=>{const n=xe.now();if(this.ttlResolution>0){e=n;const i=setTimeout(()=>e=0,this.ttlResolution);i.unref&&i.unref()}return n};this.getRemainingTTL=n=>{const i=this.keyMap.get(n);return i===void 0?0:this.ttls[i]===0||this.starts[i]===0?1/0:this.starts[i]+this.ttls[i]-(e||t())},this.isStale=n=>this.ttls[n]!==0&&this.starts[n]!==0&&(e||t())-this.starts[n]>this.ttls[n]}updateItemAge(e){}statusTTL(e,t){}setItemTTL(e,t,n){}isStale(e){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new Ie(this.max),this.removeItemSize=e=>{this.calculatedSize-=this.sizes[e],this.sizes[e]=0},this.requireSize=(e,t,n,i)=>{if(this.isBackgroundFetch(t))return 0;if(!ae(n))if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(n=i(t,e),!ae(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.addItemSize=(e,t,n)=>{if(this.sizes[e]=t,this.maxSize){const i=this.maxSize-this.sizes[e];for(;this.calculatedSize>i;)this.evict(!0)}this.calculatedSize+=this.sizes[e],n&&(n.entrySize=t,n.totalCalculatedSize=this.calculatedSize)}}removeItemSize(e){}addItemSize(e,t){}requireSize(e,t,n,i){if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:e=this.allowStale}={}){if(this.size)for(let t=this.tail;!(!this.isValidIndex(t)||((e||!this.isStale(t))&&(yield t),t===this.head));)t=this.prev[t]}*rindexes({allowStale:e=this.allowStale}={}){if(this.size)for(let t=this.head;!(!this.isValidIndex(t)||((e||!this.isStale(t))&&(yield t),t===this.tail));)t=this.next[t]}isValidIndex(e){return e!==void 0&&this.keyMap.get(this.keyList[e])===e}*entries(){for(const e of this.indexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*rentries(){for(const e of this.rindexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*keys(){for(const e of this.indexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*rkeys(){for(const e of this.rindexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*values(){for(const e of this.indexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}*rvalues(){for(const e of this.rindexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}[Symbol.iterator](){return this.entries()}find(e,t){for(const n of this.indexes()){const i=this.valList[n],o=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(o!==void 0&&e(o,this.keyList[n],this))return this.get(this.keyList[n],t)}}forEach(e,t=this){for(const n of this.indexes()){const i=this.valList[n],o=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(t,o,this.keyList[n],this)}}rforEach(e,t=this){for(const n of this.rindexes()){const i=this.valList[n],o=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(t,o,this.keyList[n],this)}}get prune(){return Ye("prune","purgeStale"),this.purgeStale}purgeStale(){let e=!1;for(const t of this.rindexes({allowStale:!0}))this.isStale(t)&&(this.delete(this.keyList[t]),e=!0);return e}dump(){const e=[];for(const t of this.indexes({allowStale:!0})){const n=this.keyList[t],i=this.valList[t],o=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(o===void 0)continue;const a={value:o};if(this.ttls){a.ttl=this.ttls[t];const r=xe.now()-this.starts[t];a.start=Math.floor(Date.now()-r)}this.sizes&&(a.size=this.sizes[t]),e.unshift([n,a])}return e}load(e){this.clear();for(const[t,n]of e){if(n.start){const i=Date.now()-n.start;n.start=xe.now()-i}this.set(t,n.value,n)}}dispose(e,t,n){}set(e,t,{ttl:n=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:r=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,status:h}={}){if(a=this.requireSize(e,t,a,r),this.maxEntrySize&&a>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.delete(e),this;let d=this.size===0?void 0:this.keyMap.get(e);if(d===void 0)d=this.newIndex(),this.keyList[d]=e,this.valList[d]=t,this.keyMap.set(e,d),this.next[this.tail]=d,this.prev[d]=this.tail,this.tail=d,this.size++,this.addItemSize(d,a,h),h&&(h.set="add"),u=!1;else{this.moveToTail(d);const p=this.valList[d];if(t!==p){if(this.isBackgroundFetch(p)?p.__abortController.abort(new Error("replaced")):o||(this.dispose(p,e,"set"),this.disposeAfter&&this.disposed.push([p,e,"set"])),this.removeItemSize(d),this.valList[d]=t,this.addItemSize(d,a,h),h){h.set="replace";const m=p&&this.isBackgroundFetch(p)?p.__staleWhileFetching:p;m!==void 0&&(h.oldValue=m)}}else h&&(h.set="update")}if(n!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),u||this.setItemTTL(d,n,i),this.statusTTL(h,d),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length!==0?this.free.pop():this.initialFill++}pop(){if(this.size){const e=this.valList[this.head];return this.evict(!0),e}}evict(e){const t=this.head,n=this.keyList[t],i=this.valList[t];return this.isBackgroundFetch(i)?i.__abortController.abort(new Error("evicted")):(this.dispose(i,n,"evict"),this.disposeAfter&&this.disposed.push([i,n,"evict"])),this.removeItemSize(t),e&&(this.keyList[t]=null,this.valList[t]=null,this.free.push(t)),this.head=this.next[t],this.keyMap.delete(n),this.size--,t}has(e,{updateAgeOnHas:t=this.updateAgeOnHas,status:n}={}){const i=this.keyMap.get(e);if(i!==void 0)if(this.isStale(i))n&&(n.has="stale",this.statusTTL(n,i));else return t&&this.updateItemAge(i),n&&(n.has="hit"),this.statusTTL(n,i),!0;else n&&(n.has="miss");return!1}peek(e,{allowStale:t=this.allowStale}={}){const n=this.keyMap.get(e);if(n!==void 0&&(t||!this.isStale(n))){const i=this.valList[n];return this.isBackgroundFetch(i)?i.__staleWhileFetching:i}}backgroundFetch(e,t,n,i){const o=t===void 0?void 0:this.valList[t];if(this.isBackgroundFetch(o))return o;const a=new Ve;n.signal&&n.signal.addEventListener("abort",()=>a.abort(n.signal.reason));const r={signal:a.signal,options:n,context:i},u=(f,w=!1)=>{const{aborted:v}=a.signal,b=n.ignoreFetchAbort&&f!==void 0;return n.status&&(v&&!w?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,b&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),v&&!b&&!w?d(a.signal.reason):(this.valList[t]===m&&(f===void 0?m.__staleWhileFetching?this.valList[t]=m.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,f,r.options))),f)},h=f=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=f),d(f)),d=f=>{const{aborted:w}=a.signal,v=w&&n.allowStaleOnFetchAbort,b=v||n.allowStaleOnFetchRejection,k=b||n.noDeleteOnFetchRejection;if(this.valList[t]===m&&(!k||m.__staleWhileFetching===void 0?this.delete(e):v||(this.valList[t]=m.__staleWhileFetching)),b)return n.status&&m.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),m.__staleWhileFetching;if(m.__returned===m)throw f},p=(f,w)=>{this.fetchMethod(e,o,r).then(v=>f(v),w),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(f(),n.allowStaleOnFetchAbort&&(f=v=>u(v,!0)))})};n.status&&(n.status.fetchDispatched=!0);const m=new Promise(p).then(u,h);return m.__abortController=a,m.__staleWhileFetching=o,m.__returned=null,t===void 0?(this.set(e,m,me(X({},r.options),{status:void 0})),t=this.keyMap.get(e)):this.valList[t]=m,m}isBackgroundFetch(e){return e&&typeof e=="object"&&typeof e.then=="function"&&Object.prototype.hasOwnProperty.call(e,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(e,"__returned")&&(e.__returned===e||e.__returned===null)}async fetch(e,{allowStale:t=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:r=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,fetchContext:w=this.fetchContext,forceRefresh:v=!1,status:b,signal:k}={}){if(!this.fetchMethod)return b&&(b.fetch="get"),this.get(e,{allowStale:t,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:b});const x={allowStale:t,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:a,size:r,sizeCalculation:u,noUpdateTTL:h,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:f,ignoreFetchAbort:m,status:b,signal:k};let $=this.keyMap.get(e);if($===void 0){b&&(b.fetch="miss");const E=this.backgroundFetch(e,$,x,w);return E.__returned=E}else{const E=this.valList[$];if(this.isBackgroundFetch(E)){const M=t&&E.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",M&&(b.returnedStale=!0)),M?E.__staleWhileFetching:E.__returned=E}const V=this.isStale($);if(!v&&!V)return b&&(b.fetch="hit"),this.moveToTail($),n&&this.updateItemAge($),this.statusTTL(b,$),E;const D=this.backgroundFetch(e,$,x,w),C=D.__staleWhileFetching!==void 0,g=C&&t;return b&&(b.fetch=C&&V?"stale":"refresh",g&&V&&(b.returnedStale=!0)),g?D.__staleWhileFetching:D.__returned=D}}get(e,{allowStale:t=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}={}){const a=this.keyMap.get(e);if(a!==void 0){const r=this.valList[a],u=this.isBackgroundFetch(r);return this.statusTTL(o,a),this.isStale(a)?(o&&(o.get="stale"),u?(o&&(o.returnedStale=t&&r.__staleWhileFetching!==void 0),t?r.__staleWhileFetching:void 0):(i||this.delete(e),o&&(o.returnedStale=t),t?r:void 0)):(o&&(o.get="hit"),u?r.__staleWhileFetching:(this.moveToTail(a),n&&this.updateItemAge(a),r))}else o&&(o.get="miss")}connect(e,t){this.prev[t]=e,this.next[e]=t}moveToTail(e){e!==this.tail&&(e===this.head?this.head=this.next[e]:this.connect(this.prev[e],this.next[e]),this.connect(this.tail,e),this.tail=e)}get del(){return Ye("del","delete"),this.delete}delete(e){let t=!1;if(this.size!==0){const n=this.keyMap.get(e);if(n!==void 0)if(t=!0,this.size===1)this.clear();else{this.removeItemSize(n);const i=this.valList[n];this.isBackgroundFetch(i)?i.__abortController.abort(new Error("deleted")):(this.dispose(i,e,"delete"),this.disposeAfter&&this.disposed.push([i,e,"delete"])),this.keyMap.delete(e),this.keyList[n]=null,this.valList[n]=null,n===this.tail?this.tail=this.prev[n]:n===this.head?this.head=this.next[n]:(this.next[this.prev[n]]=this.next[n],this.prev[this.next[n]]=this.prev[n]),this.size--,this.free.push(n)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return t}clear(){for(const e of this.rindexes({allowStale:!0})){const t=this.valList[e];if(this.isBackgroundFetch(t))t.__abortController.abort(new Error("deleted"));else{const n=this.keyList[e];this.dispose(t,n,"delete"),this.disposeAfter&&this.disposed.push([t,n,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return Ye("reset","clear"),this.clear}get length(){return ti("length","size"),this.size}static get AbortController(){return Ve}static get AbortSignal(){return It}}var ii=ue;const $e=s=>{const e=s.value,t=e.substring(0,s.selectionStart),n=e.substring(s.selectionEnd,e.length),i=t.lastIndexOf(`
51
+ See: https://github.com/francoischalifour/medium-zoom`)}},Kn=function(e){var t=document.createElement("div");return t.classList.add("medium-zoom-overlay"),t.style.background=e,t},Zn=function(e){var t=e.getBoundingClientRect(),n=t.top,i=t.left,o=t.width,a=t.height,r=e.cloneNode(),u=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,h=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;return r.removeAttribute("id"),r.style.position="absolute",r.style.top=n+u+"px",r.style.left=i+h+"px",r.style.width=o+"px",r.style.height=a+"px",r.style.transform="",r},be=function(e,t){var n=de({bubbles:!1,cancelable:!1,detail:void 0},t);if(typeof window.CustomEvent=="function")return new CustomEvent(e,n);var i=document.createEvent("CustomEvent");return i.initCustomEvent(e,n.bubbles,n.cancelable,n.detail),i},Gn=function s(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=window.Promise||function(z){function A(){}z(A,A)},i=function(z){var A=z.target;if(A===M){w();return}$.indexOf(A)!==-1&&v({target:A})},o=function(){if(!(V||!p.original)){var z=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(D-z)>C.scrollOffset&&setTimeout(w,150)}},a=function(z){var A=z.key||z.keyCode;(A==="Escape"||A==="Esc"||A===27)&&w()},r=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},A=z;if(z.background&&(M.style.background=z.background),z.container&&z.container instanceof Object&&(A.container=de({},C.container,z.container)),z.template){var I=Ae(z.template)?z.template:document.querySelector(z.template);A.template=I}return C=de({},C,A),$.forEach(function(H){H.dispatchEvent(be("medium-zoom:update",{detail:{zoom:O}}))}),O},u=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return s(de({},C,z))},h=function(){for(var z=arguments.length,A=Array(z),I=0;I<z;I++)A[I]=arguments[I];var H=A.reduce(function(_,W){return[].concat(_,_t(W))},[]);return H.filter(function(_){return $.indexOf(_)===-1}).forEach(function(_){$.push(_),_.classList.add("medium-zoom-image")}),E.forEach(function(_){var W=_.type,T=_.listener,F=_.options;H.forEach(function(R){R.addEventListener(W,T,F)})}),O},d=function(){for(var z=arguments.length,A=Array(z),I=0;I<z;I++)A[I]=arguments[I];p.zoomed&&w();var H=A.length>0?A.reduce(function(_,W){return[].concat(_,_t(W))},[]):$;return H.forEach(function(_){_.classList.remove("medium-zoom-image"),_.dispatchEvent(be("medium-zoom:detach",{detail:{zoom:O}}))}),$=$.filter(function(_){return H.indexOf(_)===-1}),O},g=function(z,A){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $.forEach(function(H){H.addEventListener("medium-zoom:"+z,A,I)}),E.push({type:"medium-zoom:"+z,listener:A,options:I}),O},m=function(z,A){var I=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $.forEach(function(H){H.removeEventListener("medium-zoom:"+z,A,I)}),E=E.filter(function(H){return!(H.type==="medium-zoom:"+z&&H.listener.toString()===A.toString())}),O},f=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},A=z.target,I=function(){var _={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},W=void 0,T=void 0;if(C.container)if(C.container instanceof Object)_=de({},_,C.container),W=_.width-_.left-_.right-C.margin*2,T=_.height-_.top-_.bottom-C.margin*2;else{var F=Ae(C.container)?C.container:document.querySelector(C.container),R=F.getBoundingClientRect(),K=R.width,G=R.height,Y=R.left,ie=R.top;_=de({},_,{width:K,height:G,left:Y,top:ie})}W=W||_.width-C.margin*2,T=T||_.height-C.margin*2;var re=p.zoomedHd||p.original,he=Vt(re)?W:re.naturalWidth||W,ce=Vt(re)?T:re.naturalHeight||T,fe=re.getBoundingClientRect(),De=fe.top,je=fe.left,ke=fe.width,ye=fe.height,Oe=Math.min(Math.max(ke,he),W)/ke,Me=Math.min(Math.max(ye,ce),T)/ye,we=Math.min(Oe,Me),He=(-je+(W-ke)/2+C.margin+_.left)/we,Pe=(-De+(T-ye)/2+C.margin+_.top)/we,Ce="scale("+we+") translate3d("+He+"px, "+Pe+"px, 0)";p.zoomed.style.transform=Ce,p.zoomedHd&&(p.zoomedHd.style.transform=Ce)};return new n(function(H){if(A&&$.indexOf(A)===-1){H(O);return}var _=function K(){V=!1,p.zoomed.removeEventListener("transitionend",K),p.original.dispatchEvent(be("medium-zoom:opened",{detail:{zoom:O}})),H(O)};if(p.zoomed){H(O);return}if(A)p.original=A;else if($.length>0){var W=$;p.original=W[0]}else{H(O);return}if(p.original.dispatchEvent(be("medium-zoom:open",{detail:{zoom:O}})),D=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,V=!0,p.zoomed=Zn(p.original),document.body.appendChild(M),C.template){var T=Ae(C.template)?C.template:document.querySelector(C.template);p.template=document.createElement("div"),p.template.appendChild(T.content.cloneNode(!0)),document.body.appendChild(p.template)}if(p.original.parentElement&&p.original.parentElement.tagName==="PICTURE"&&p.original.currentSrc&&(p.zoomed.src=p.original.currentSrc),document.body.appendChild(p.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),p.original.classList.add("medium-zoom-image--hidden"),p.zoomed.classList.add("medium-zoom-image--opened"),p.zoomed.addEventListener("click",w),p.zoomed.addEventListener("transitionend",_),p.original.getAttribute("data-zoom-src")){p.zoomedHd=p.zoomed.cloneNode(),p.zoomedHd.removeAttribute("srcset"),p.zoomedHd.removeAttribute("sizes"),p.zoomedHd.removeAttribute("loading"),p.zoomedHd.src=p.zoomed.getAttribute("data-zoom-src"),p.zoomedHd.onerror=function(){clearInterval(F),console.warn("Unable to reach the zoom image target "+p.zoomedHd.src),p.zoomedHd=null,I()};var F=setInterval(function(){p.zoomedHd.complete&&(clearInterval(F),p.zoomedHd.classList.add("medium-zoom-image--opened"),p.zoomedHd.addEventListener("click",w),document.body.appendChild(p.zoomedHd),I())},10)}else if(p.original.hasAttribute("srcset")){p.zoomedHd=p.zoomed.cloneNode(),p.zoomedHd.removeAttribute("sizes"),p.zoomedHd.removeAttribute("loading");var R=p.zoomedHd.addEventListener("load",function(){p.zoomedHd.removeEventListener("load",R),p.zoomedHd.classList.add("medium-zoom-image--opened"),p.zoomedHd.addEventListener("click",w),document.body.appendChild(p.zoomedHd),I()})}else I()})},w=function(){return new n(function(z){if(V||!p.original){z(O);return}var A=function I(){p.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(p.zoomed),p.zoomedHd&&document.body.removeChild(p.zoomedHd),document.body.removeChild(M),p.zoomed.classList.remove("medium-zoom-image--opened"),p.template&&document.body.removeChild(p.template),V=!1,p.zoomed.removeEventListener("transitionend",I),p.original.dispatchEvent(be("medium-zoom:closed",{detail:{zoom:O}})),p.original=null,p.zoomed=null,p.zoomedHd=null,p.template=null,z(O)};V=!0,document.body.classList.remove("medium-zoom--opened"),p.zoomed.style.transform="",p.zoomedHd&&(p.zoomedHd.style.transform=""),p.template&&(p.template.style.transition="opacity 150ms",p.template.style.opacity=0),p.original.dispatchEvent(be("medium-zoom:close",{detail:{zoom:O}})),p.zoomed.addEventListener("transitionend",A)})},v=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},A=z.target;return p.original?w():f({target:A})},b=function(){return C},k=function(){return $},x=function(){return p.original},$=[],E=[],V=!1,D=0,C=t,p={original:null,zoomed:null,zoomedHd:null,template:null};Object.prototype.toString.call(e)==="[object Object]"?C=e:(e||typeof e=="string")&&h(e),C=de({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},C);var M=Kn(C.background);document.addEventListener("click",i),document.addEventListener("keyup",a),document.addEventListener("scroll",o),window.addEventListener("resize",w);var O={open:f,close:w,toggle:v,update:r,clone:u,attach:h,detach:d,on:g,off:m,getOptions:b,getImages:k,getZoomedImage:x};return O};function Xn(s,e){e===void 0&&(e={});var t=e.insertAt;if(!(!s||typeof document=="undefined")){var n=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css",t==="top"&&n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i),i.styleSheet?i.styleSheet.cssText=s:i.appendChild(document.createTextNode(s))}}var Qn=".medium-zoom-overlay{position:fixed;top:0;right:0;bottom:0;left:0;opacity:0;transition:opacity .3s;will-change:opacity}.medium-zoom--opened .medium-zoom-overlay{cursor:pointer;cursor:zoom-out;opacity:1}.medium-zoom-image{cursor:pointer;cursor:zoom-in;transition:transform .3s cubic-bezier(.2,0,.2,1)!important}.medium-zoom-image--hidden{visibility:hidden}.medium-zoom-image--opened{position:relative;cursor:pointer;cursor:zoom-out;will-change:transform}";Xn(Qn);var Yn=Gn;const xe=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ve=typeof AbortController=="function"?AbortController:class{constructor(){this.signal=new It}abort(e=new Error("This operation was aborted")){this.signal.reason=this.signal.reason||e,this.signal.aborted=!0,this.signal.dispatchEvent({type:"abort",target:this.signal})}},Jn=typeof AbortSignal=="function",ei=typeof Ve.AbortSignal=="function",It=Jn?AbortSignal:ei?Ve.AbortController:class{constructor(){this.reason=void 0,this.aborted=!1,this._listeners=[]}dispatchEvent(e){e.type==="abort"&&(this.aborted=!0,this.onabort(e),this._listeners.forEach(t=>t(e),this))}onabort(){}addEventListener(e,t){e==="abort"&&this._listeners.push(t)}removeEventListener(e,t){e==="abort"&&(this._listeners=this._listeners.filter(n=>n!==t))}},Xe=new Set,Qe=(s,e)=>{const t=`LRU_CACHE_OPTION_${s}`;_e(t)&&Je(t,`${s} option`,`options.${e}`,ue)},Ye=(s,e)=>{const t=`LRU_CACHE_METHOD_${s}`;if(_e(t)){const{prototype:n}=ue,{get:i}=Object.getOwnPropertyDescriptor(n,s);Je(t,`${s} method`,`cache.${e}()`,i)}},ti=(s,e)=>{const t=`LRU_CACHE_PROPERTY_${s}`;if(_e(t)){const{prototype:n}=ue,{get:i}=Object.getOwnPropertyDescriptor(n,s);Je(t,`${s} property`,`cache.${e}`,i)}},Rt=(...s)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(...s):console.error(...s)},_e=s=>!Xe.has(s),Je=(s,e,t,n)=>{Xe.add(s);const i=`The ${e} is deprecated. Please use ${t} instead.`;Rt(i,"DeprecationWarning",s,n)},ae=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),Dt=s=>ae(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?Ie:null:null;class Ie extends Array{constructor(e){super(e),this.fill(0)}}class ni{constructor(e){if(e===0)return[];const t=Dt(e);this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class ue{constructor(e={}){const{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:o,updateAgeOnGet:a,updateAgeOnHas:r,allowStale:u,dispose:h,disposeAfter:d,noDisposeOnSet:g,noUpdateTTL:m,maxSize:f=0,maxEntrySize:w=0,sizeCalculation:v,fetchMethod:b,fetchContext:k,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:$,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:V,ignoreFetchAbort:D}=e,{length:C,maxAge:p,stale:M}=e instanceof ue?{}:e;if(t!==0&&!ae(t))throw new TypeError("max option must be a nonnegative integer");const O=t?Dt(t):Array;if(!O)throw new Error("invalid max value: "+t);if(this.max=t,this.maxSize=f,this.maxEntrySize=w||this.maxSize,this.sizeCalculation=v||C,this.sizeCalculation){if(!this.maxSize&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(this.fetchMethod=b||null,this.fetchMethod&&typeof this.fetchMethod!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.fetchContext=k,!this.fetchMethod&&k!==void 0)throw new TypeError("cannot set fetchContext without fetchMethod");if(this.keyMap=new Map,this.keyList=new Array(t).fill(null),this.valList=new Array(t).fill(null),this.next=new O(t),this.prev=new O(t),this.head=0,this.tail=0,this.free=new ni(t),this.initialFill=1,this.size=0,typeof h=="function"&&(this.dispose=h),typeof d=="function"?(this.disposeAfter=d,this.disposed=[]):(this.disposeAfter=null,this.disposed=null),this.noDisposeOnSet=!!g,this.noUpdateTTL=!!m,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!V,this.ignoreFetchAbort=!!D,this.maxEntrySize!==0){if(this.maxSize!==0&&!ae(this.maxSize))throw new TypeError("maxSize must be a positive integer if specified");if(!ae(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.initializeSizeTracking()}if(this.allowStale=!!u||!!M,this.noDeleteOnStaleGet=!!$,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!r,this.ttlResolution=ae(i)||i===0?i:1,this.ttlAutopurge=!!o,this.ttl=n||p||0,this.ttl){if(!ae(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.initializeTTLTracking()}if(this.max===0&&this.ttl===0&&this.maxSize===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.max&&!this.maxSize){const j="LRU_CACHE_UNBOUNDED";_e(j)&&(Xe.add(j),Rt("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",j,ue))}M&&Qe("stale","allowStale"),p&&Qe("maxAge","ttl"),C&&Qe("length","sizeCalculation")}getRemainingTTL(e){return this.has(e,{updateAgeOnHas:!1})?1/0:0}initializeTTLTracking(){this.ttls=new Ie(this.max),this.starts=new Ie(this.max),this.setItemTTL=(n,i,o=xe.now())=>{if(this.starts[n]=i!==0?o:0,this.ttls[n]=i,i!==0&&this.ttlAutopurge){const a=setTimeout(()=>{this.isStale(n)&&this.delete(this.keyList[n])},i+1);a.unref&&a.unref()}},this.updateItemAge=n=>{this.starts[n]=this.ttls[n]!==0?xe.now():0},this.statusTTL=(n,i)=>{n&&(n.ttl=this.ttls[i],n.start=this.starts[i],n.now=e||t(),n.remainingTTL=n.now+n.ttl-n.start)};let e=0;const t=()=>{const n=xe.now();if(this.ttlResolution>0){e=n;const i=setTimeout(()=>e=0,this.ttlResolution);i.unref&&i.unref()}return n};this.getRemainingTTL=n=>{const i=this.keyMap.get(n);return i===void 0?0:this.ttls[i]===0||this.starts[i]===0?1/0:this.starts[i]+this.ttls[i]-(e||t())},this.isStale=n=>this.ttls[n]!==0&&this.starts[n]!==0&&(e||t())-this.starts[n]>this.ttls[n]}updateItemAge(e){}statusTTL(e,t){}setItemTTL(e,t,n){}isStale(e){return!1}initializeSizeTracking(){this.calculatedSize=0,this.sizes=new Ie(this.max),this.removeItemSize=e=>{this.calculatedSize-=this.sizes[e],this.sizes[e]=0},this.requireSize=(e,t,n,i)=>{if(this.isBackgroundFetch(t))return 0;if(!ae(n))if(i){if(typeof i!="function")throw new TypeError("sizeCalculation must be a function");if(n=i(t,e),!ae(n))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.addItemSize=(e,t,n)=>{if(this.sizes[e]=t,this.maxSize){const i=this.maxSize-this.sizes[e];for(;this.calculatedSize>i;)this.evict(!0)}this.calculatedSize+=this.sizes[e],n&&(n.entrySize=t,n.totalCalculatedSize=this.calculatedSize)}}removeItemSize(e){}addItemSize(e,t){}requireSize(e,t,n,i){if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}*indexes({allowStale:e=this.allowStale}={}){if(this.size)for(let t=this.tail;!(!this.isValidIndex(t)||((e||!this.isStale(t))&&(yield t),t===this.head));)t=this.prev[t]}*rindexes({allowStale:e=this.allowStale}={}){if(this.size)for(let t=this.head;!(!this.isValidIndex(t)||((e||!this.isStale(t))&&(yield t),t===this.tail));)t=this.next[t]}isValidIndex(e){return e!==void 0&&this.keyMap.get(this.keyList[e])===e}*entries(){for(const e of this.indexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*rentries(){for(const e of this.rindexes())this.valList[e]!==void 0&&this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield[this.keyList[e],this.valList[e]])}*keys(){for(const e of this.indexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*rkeys(){for(const e of this.rindexes())this.keyList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.keyList[e])}*values(){for(const e of this.indexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}*rvalues(){for(const e of this.rindexes())this.valList[e]!==void 0&&!this.isBackgroundFetch(this.valList[e])&&(yield this.valList[e])}[Symbol.iterator](){return this.entries()}find(e,t){for(const n of this.indexes()){const i=this.valList[n],o=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(o!==void 0&&e(o,this.keyList[n],this))return this.get(this.keyList[n],t)}}forEach(e,t=this){for(const n of this.indexes()){const i=this.valList[n],o=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(t,o,this.keyList[n],this)}}rforEach(e,t=this){for(const n of this.rindexes()){const i=this.valList[n],o=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;o!==void 0&&e.call(t,o,this.keyList[n],this)}}get prune(){return Ye("prune","purgeStale"),this.purgeStale}purgeStale(){let e=!1;for(const t of this.rindexes({allowStale:!0}))this.isStale(t)&&(this.delete(this.keyList[t]),e=!0);return e}dump(){const e=[];for(const t of this.indexes({allowStale:!0})){const n=this.keyList[t],i=this.valList[t],o=this.isBackgroundFetch(i)?i.__staleWhileFetching:i;if(o===void 0)continue;const a={value:o};if(this.ttls){a.ttl=this.ttls[t];const r=xe.now()-this.starts[t];a.start=Math.floor(Date.now()-r)}this.sizes&&(a.size=this.sizes[t]),e.unshift([n,a])}return e}load(e){this.clear();for(const[t,n]of e){if(n.start){const i=Date.now()-n.start;n.start=xe.now()-i}this.set(t,n.value,n)}}dispose(e,t,n){}set(e,t,{ttl:n=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,size:a=0,sizeCalculation:r=this.sizeCalculation,noUpdateTTL:u=this.noUpdateTTL,status:h}={}){if(a=this.requireSize(e,t,a,r),this.maxEntrySize&&a>this.maxEntrySize)return h&&(h.set="miss",h.maxEntrySizeExceeded=!0),this.delete(e),this;let d=this.size===0?void 0:this.keyMap.get(e);if(d===void 0)d=this.newIndex(),this.keyList[d]=e,this.valList[d]=t,this.keyMap.set(e,d),this.next[this.tail]=d,this.prev[d]=this.tail,this.tail=d,this.size++,this.addItemSize(d,a,h),h&&(h.set="add"),u=!1;else{this.moveToTail(d);const g=this.valList[d];if(t!==g){if(this.isBackgroundFetch(g)?g.__abortController.abort(new Error("replaced")):o||(this.dispose(g,e,"set"),this.disposeAfter&&this.disposed.push([g,e,"set"])),this.removeItemSize(d),this.valList[d]=t,this.addItemSize(d,a,h),h){h.set="replace";const m=g&&this.isBackgroundFetch(g)?g.__staleWhileFetching:g;m!==void 0&&(h.oldValue=m)}}else h&&(h.set="update")}if(n!==0&&this.ttl===0&&!this.ttls&&this.initializeTTLTracking(),u||this.setItemTTL(d,n,i),this.statusTTL(h,d),this.disposeAfter)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return this}newIndex(){return this.size===0?this.tail:this.size===this.max&&this.max!==0?this.evict(!1):this.free.length!==0?this.free.pop():this.initialFill++}pop(){if(this.size){const e=this.valList[this.head];return this.evict(!0),e}}evict(e){const t=this.head,n=this.keyList[t],i=this.valList[t];return this.isBackgroundFetch(i)?i.__abortController.abort(new Error("evicted")):(this.dispose(i,n,"evict"),this.disposeAfter&&this.disposed.push([i,n,"evict"])),this.removeItemSize(t),e&&(this.keyList[t]=null,this.valList[t]=null,this.free.push(t)),this.head=this.next[t],this.keyMap.delete(n),this.size--,t}has(e,{updateAgeOnHas:t=this.updateAgeOnHas,status:n}={}){const i=this.keyMap.get(e);if(i!==void 0)if(this.isStale(i))n&&(n.has="stale",this.statusTTL(n,i));else return t&&this.updateItemAge(i),n&&(n.has="hit"),this.statusTTL(n,i),!0;else n&&(n.has="miss");return!1}peek(e,{allowStale:t=this.allowStale}={}){const n=this.keyMap.get(e);if(n!==void 0&&(t||!this.isStale(n))){const i=this.valList[n];return this.isBackgroundFetch(i)?i.__staleWhileFetching:i}}backgroundFetch(e,t,n,i){const o=t===void 0?void 0:this.valList[t];if(this.isBackgroundFetch(o))return o;const a=new Ve;n.signal&&n.signal.addEventListener("abort",()=>a.abort(n.signal.reason));const r={signal:a.signal,options:n,context:i},u=(f,w=!1)=>{const{aborted:v}=a.signal,b=n.ignoreFetchAbort&&f!==void 0;return n.status&&(v&&!w?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,b&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),v&&!b&&!w?d(a.signal.reason):(this.valList[t]===m&&(f===void 0?m.__staleWhileFetching?this.valList[t]=m.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,f,r.options))),f)},h=f=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=f),d(f)),d=f=>{const{aborted:w}=a.signal,v=w&&n.allowStaleOnFetchAbort,b=v||n.allowStaleOnFetchRejection,k=b||n.noDeleteOnFetchRejection;if(this.valList[t]===m&&(!k||m.__staleWhileFetching===void 0?this.delete(e):v||(this.valList[t]=m.__staleWhileFetching)),b)return n.status&&m.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),m.__staleWhileFetching;if(m.__returned===m)throw f},g=(f,w)=>{this.fetchMethod(e,o,r).then(v=>f(v),w),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(f(),n.allowStaleOnFetchAbort&&(f=v=>u(v,!0)))})};n.status&&(n.status.fetchDispatched=!0);const m=new Promise(g).then(u,h);return m.__abortController=a,m.__staleWhileFetching=o,m.__returned=null,t===void 0?(this.set(e,m,me(X({},r.options),{status:void 0})),t=this.keyMap.get(e)):this.valList[t]=m,m}isBackgroundFetch(e){return e&&typeof e=="object"&&typeof e.then=="function"&&Object.prototype.hasOwnProperty.call(e,"__staleWhileFetching")&&Object.prototype.hasOwnProperty.call(e,"__returned")&&(e.__returned===e||e.__returned===null)}async fetch(e,{allowStale:t=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:r=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:g=this.allowStaleOnFetchRejection,ignoreFetchAbort:m=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,fetchContext:w=this.fetchContext,forceRefresh:v=!1,status:b,signal:k}={}){if(!this.fetchMethod)return b&&(b.fetch="get"),this.get(e,{allowStale:t,updateAgeOnGet:n,noDeleteOnStaleGet:i,status:b});const x={allowStale:t,updateAgeOnGet:n,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:a,size:r,sizeCalculation:u,noUpdateTTL:h,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:g,allowStaleOnFetchAbort:f,ignoreFetchAbort:m,status:b,signal:k};let $=this.keyMap.get(e);if($===void 0){b&&(b.fetch="miss");const E=this.backgroundFetch(e,$,x,w);return E.__returned=E}else{const E=this.valList[$];if(this.isBackgroundFetch(E)){const M=t&&E.__staleWhileFetching!==void 0;return b&&(b.fetch="inflight",M&&(b.returnedStale=!0)),M?E.__staleWhileFetching:E.__returned=E}const V=this.isStale($);if(!v&&!V)return b&&(b.fetch="hit"),this.moveToTail($),n&&this.updateItemAge($),this.statusTTL(b,$),E;const D=this.backgroundFetch(e,$,x,w),C=D.__staleWhileFetching!==void 0,p=C&&t;return b&&(b.fetch=C&&V?"stale":"refresh",p&&V&&(b.returnedStale=!0)),p?D.__staleWhileFetching:D.__returned=D}}get(e,{allowStale:t=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}={}){const a=this.keyMap.get(e);if(a!==void 0){const r=this.valList[a],u=this.isBackgroundFetch(r);return this.statusTTL(o,a),this.isStale(a)?(o&&(o.get="stale"),u?(o&&(o.returnedStale=t&&r.__staleWhileFetching!==void 0),t?r.__staleWhileFetching:void 0):(i||this.delete(e),o&&(o.returnedStale=t),t?r:void 0)):(o&&(o.get="hit"),u?r.__staleWhileFetching:(this.moveToTail(a),n&&this.updateItemAge(a),r))}else o&&(o.get="miss")}connect(e,t){this.prev[t]=e,this.next[e]=t}moveToTail(e){e!==this.tail&&(e===this.head?this.head=this.next[e]:this.connect(this.prev[e],this.next[e]),this.connect(this.tail,e),this.tail=e)}get del(){return Ye("del","delete"),this.delete}delete(e){let t=!1;if(this.size!==0){const n=this.keyMap.get(e);if(n!==void 0)if(t=!0,this.size===1)this.clear();else{this.removeItemSize(n);const i=this.valList[n];this.isBackgroundFetch(i)?i.__abortController.abort(new Error("deleted")):(this.dispose(i,e,"delete"),this.disposeAfter&&this.disposed.push([i,e,"delete"])),this.keyMap.delete(e),this.keyList[n]=null,this.valList[n]=null,n===this.tail?this.tail=this.prev[n]:n===this.head?this.head=this.next[n]:(this.next[this.prev[n]]=this.next[n],this.prev[this.next[n]]=this.prev[n]),this.size--,this.free.push(n)}}if(this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift());return t}clear(){for(const e of this.rindexes({allowStale:!0})){const t=this.valList[e];if(this.isBackgroundFetch(t))t.__abortController.abort(new Error("deleted"));else{const n=this.keyList[e];this.dispose(t,n,"delete"),this.disposeAfter&&this.disposed.push([t,n,"delete"])}}if(this.keyMap.clear(),this.valList.fill(null),this.keyList.fill(null),this.ttls&&(this.ttls.fill(0),this.starts.fill(0)),this.sizes&&this.sizes.fill(0),this.head=0,this.tail=0,this.initialFill=1,this.free.length=0,this.calculatedSize=0,this.size=0,this.disposed)for(;this.disposed.length;)this.disposeAfter(...this.disposed.shift())}get reset(){return Ye("reset","clear"),this.clear}get length(){return ti("length","size"),this.size}static get AbortController(){return Ve}static get AbortSignal(){return It}}var ii=ue;const $e=s=>{const e=s.value,t=e.substring(0,s.selectionStart),n=e.substring(s.selectionEnd,e.length),i=t.lastIndexOf(`
52
52
  `),o=t.substring(0,i+1),a=n.indexOf(`
53
- `),r=n.substring(a===-1?n.length:a,n.length),u=t.substring(i+1,t.length),h=n.substring(0,a);return{prefixStr:t,subfixStr:n,prefixStrEndRow:o,subfixStrEndRow:r,prefixSupply:u,subfixSupply:h}},si=(s,e="",t,n)=>{var p,m,f,w,v,b;let i="",o=0,a=0,r=!1,u,h;const d=(p=q.editorConfig)==null?void 0:p.mermaidTemplate;if(/^h[1-6]{1}$/.test(s)){const k=s.replace(/^h(\d)/,(x,$)=>new Array(Number($)).fill("#",0,$).join(""));i=`${k} ${e}`,o=k.length+1}else if(s==="prettier"){const k=window.prettier||((f=(m=q.editorExtensions)==null?void 0:m.prettier)==null?void 0:f.prettierInstance),x=[((w=window.prettierPlugins)==null?void 0:w.markdown)||((b=(v=q.editorExtensions)==null?void 0:v.prettier)==null?void 0:b.parserMarkdownInstance)];return!k||x[0]===void 0?(y.emit(n.editorId,"errorCatcher",{name:"prettier",message:"prettier is undefined"}),t.value):k.format(t.value,{parser:"markdown",plugins:x})}else switch(s){case"bold":{i=`**${e}**`,o=2,a=-2;break}case"underline":{i=`<u>${e}</u>`,o=3,a=-4;break}case"italic":{i=`*${e}*`,o=1,a=-1;break}case"strikeThrough":{i=`~${e}~`,o=1,a=-1;break}case"sub":{i=`<sub>${e}</sub>`,o=5,a=-6;break}case"sup":{i=`<sup>${e}</sup>`,o=5,a=-6;break}case"codeRow":{i="`"+e+"`",o=1,a=-1;break}case"quote":{i=`> ${e}`,o=2;break}case"orderedList":{i=`1. ${e}`,o=3;break}case"unorderedList":{i=`- ${e}`,o=2;break}case"task":{i=`- [ ] ${e}`,o=6,r=!0;break}case"code":{const k=n.text||e||"",x=n.mode||"language";i=`\`\`\`${x}
53
+ `),r=n.substring(a===-1?n.length:a,n.length),u=t.substring(i+1,t.length),h=n.substring(0,a);return{prefixStr:t,subfixStr:n,prefixStrEndRow:o,subfixStrEndRow:r,prefixSupply:u,subfixSupply:h}},si=(s,e="",t,n)=>{var g,m,f,w,v,b;let i="",o=0,a=0,r=!1,u,h;const d=(g=q.editorConfig)==null?void 0:g.mermaidTemplate;if(/^h[1-6]{1}$/.test(s)){const k=s.replace(/^h(\d)/,(x,$)=>new Array(Number($)).fill("#",0,$).join(""));i=`${k} ${e}`,o=k.length+1}else if(s==="prettier"){const k=window.prettier||((f=(m=q.editorExtensions)==null?void 0:m.prettier)==null?void 0:f.prettierInstance),x=[((w=window.prettierPlugins)==null?void 0:w.markdown)||((b=(v=q.editorExtensions)==null?void 0:v.prettier)==null?void 0:b.parserMarkdownInstance)];return!k||x[0]===void 0?(y.emit(n.editorId,"errorCatcher",{name:"prettier",message:"prettier is undefined"}),t.value):k.format(t.value,{parser:"markdown",plugins:x})}else switch(s){case"bold":{i=`**${e}**`,o=2,a=-2;break}case"underline":{i=`<u>${e}</u>`,o=3,a=-4;break}case"italic":{i=`*${e}*`,o=1,a=-1;break}case"strikeThrough":{i=`~${e}~`,o=1,a=-1;break}case"sub":{i=`<sub>${e}</sub>`,o=5,a=-6;break}case"sup":{i=`<sup>${e}</sup>`,o=5,a=-6;break}case"codeRow":{i="`"+e+"`",o=1,a=-1;break}case"quote":{i=`> ${e}`,o=2;break}case"orderedList":{i=`1. ${e}`,o=3;break}case"unorderedList":{i=`- ${e}`,o=2;break}case"task":{i=`- [ ] ${e}`,o=6,r=!0;break}case"code":{const k=n.text||e||"",x=n.mode||"language";i=`\`\`\`${x}
54
54
  ${k}
55
55
  \`\`\`
56
56
  `,o=3,a=3+x.length-i.length,r=!0;break}case"table":{i="|";const{selectedShape:k={x:1,y:1}}=n,{x,y:$}=k;for(let E=0;E<=$;E++)i+=" col |";i+=`
@@ -59,9 +59,9 @@ ${k}
59
59
  `,""):i=`![${k}](${x})
60
60
  `;break}case"tab":{const{tabWidth:k=2}=n,x=new Array(k).fill(" ").join("");if(e==="")i=x;else if(/\n/.test(e)){const{prefixStr:$,subfixStr:E,prefixSupply:V,subfixSupply:D}=$e(t);i=`${V}${e}${D}`.split(`
61
61
  `).map(M=>`${x}${M}`).join(`
62
- `),u=$.substring(0,$.length-V.length),h=E.substring(D.length,E.length),r=!0,o=k,a=-V.length-D.length}else{const E=t.value.substring(0,t.selectionStart);/\n$/.test(E)||E===""?(i=`${x}${e}`,r=!0):i=x}break}case"shiftTab":{const{tabWidth:k=2}=n,{prefixStr:x,prefixStrEndRow:$,subfixStrEndRow:E,prefixSupply:V,subfixSupply:D}=$e(t),C=new RegExp(`^\\s{${k}}`),g=(M=!1,O=!1)=>{const j=`${V}${e}${D}`;if(C.test(j)){const z=x.length-(O?0:k),A=M?z+e.length-k:z;return se(t,z,A),`${$}${j.replace(C,"")}${E}`}else if(/^\s/.test(j)){const z=j.replace(/^\s/,""),A=j.length-z.length,I=t.selectionStart-(O?0:A),H=M?I+e.length-A:I;return se(t,I,H),`${$}${z}${E}`}else i=e};if(e===""){const M=g();if(M)return M}else if(/\n/.test(e)){const O=`${V}${e}${D}`.split(`
62
+ `),u=$.substring(0,$.length-V.length),h=E.substring(D.length,E.length),r=!0,o=k,a=-V.length-D.length}else{const E=t.value.substring(0,t.selectionStart);/\n$/.test(E)||E===""?(i=`${x}${e}`,r=!0):i=x}break}case"shiftTab":{const{tabWidth:k=2}=n,{prefixStr:x,prefixStrEndRow:$,subfixStrEndRow:E,prefixSupply:V,subfixSupply:D}=$e(t),C=new RegExp(`^\\s{${k}}`),p=(M=!1,O=!1)=>{const j=`${V}${e}${D}`;if(C.test(j)){const z=x.length-(O?0:k),A=M?z+e.length-k:z;return se(t,z,A),`${$}${j.replace(C,"")}${E}`}else if(/^\s/.test(j)){const z=j.replace(/^\s/,""),A=j.length-z.length,I=t.selectionStart-(O?0:A),H=M?I+e.length-A:I;return se(t,I,H),`${$}${z}${E}`}else i=e};if(e===""){const M=p();if(M)return M}else if(/\n/.test(e)){const O=`${V}${e}${D}`.split(`
63
63
  `);let[j,z]=[0,0];const A=O.map((I,H)=>{if(C.test(I))return H===0&&(j=k),z+=k,I.replace(C,"");if(/^\s/.test(I)){const _=I.replace(/^\s/,"");return z+=I.length-_.length,_}return I}).join(`
64
- `);return se(t,t.selectionStart-j,t.selectionEnd-z),`${$}${A}${E}`}else{const M=g(!0,!0);if(M)return M}break}case"ctrlC":{const{prefixSupply:k,subfixSupply:x}=$e(t);return ve(e===""?`${k}${x}`:e),t.value}case"ctrlX":{const{prefixStrEndRow:k,subfixStrEndRow:x,prefixStr:$,subfixStr:E,prefixSupply:V,subfixSupply:D}=$e(t);return e===""?(ve(`${V}${D}`),se(t,k.length),`${k}${x.replace(/^\n/,"")}`):(ve(e),se(t,$.length),`${$}${E}`)}case"ctrlD":{const{prefixStrEndRow:k,subfixStrEndRow:x}=$e(t);return se(t,k.length),`${k}${x.replace(/^\n/,"")}`}case"flow":{i=`\`\`\`mermaid
64
+ `);return se(t,t.selectionStart-j,t.selectionEnd-z),`${$}${A}${E}`}else{const M=p(!0,!0);if(M)return M}break}case"ctrlC":{const{prefixSupply:k,subfixSupply:x}=$e(t);return ve(e===""?`${k}${x}`:e),t.value}case"ctrlX":{const{prefixStrEndRow:k,subfixStrEndRow:x,prefixStr:$,subfixStr:E,prefixSupply:V,subfixSupply:D}=$e(t);return e===""?(ve(`${V}${D}`),se(t,k.length),`${k}${x.replace(/^\n/,"")}`):(ve(e),se(t,$.length),`${$}${E}`)}case"ctrlD":{const{prefixStrEndRow:k,subfixStrEndRow:x}=$e(t);return se(t,k.length),`${k}${x.replace(/^\n/,"")}`}case"flow":{i=`\`\`\`mermaid
65
65
  ${(d==null?void 0:d.flow)||`flowchart TD
66
66
  Start --> Stop`}
67
67
  \`\`\`
@@ -118,9 +118,9 @@ $$
118
118
  `),d={type:"alert",raw:h,icon:a,title:r,text:u,titleTokens:[],tokens:[],childTokens:["title","text"]};return this.lexer.inlineTokens(d.title,d.titleTokens),this.lexer.blockTokens(d.text,d.tokens),d}}},renderer(s){return`<div class="md-editor-alert md-editor-alert-${s.icon}">
119
119
  <p class="md-editor-alert-title">${this.parser.parseInline(s.titleTokens,null)}</p>
120
120
  ${this.parser.parse(s.tokens)}
121
- </div>`}},ri=typeof window=="undefined",ai=(s,e,t)=>{var f,w;const n=l.inject("previewOnly"),i=l.inject("historyLength"),o=l.inject("editorId");if(n)return;let a=-1;const r={list:[{content:s.value,startPos:((f=e.value)==null?void 0:f.selectionStart)||0,endPos:((w=e.value)==null?void 0:w.selectionEnd)||0}],userUpdated:!0,curr:0},u=[0,0];let h=u;const d=v=>{var $,E;const b=(($=e.value)==null?void 0:$.selectionStart)||0,k=((E=e.value)==null?void 0:E.selectionEnd)||0;r.list[r.curr].startPos=b,r.list[r.curr].endPos=k,r.userUpdated=!1,r.curr=v;const x=r.list[r.curr];h=[x.startPos,x.endPos],s.onChange(x.content),se(e.value,x.startPos,x.endPos).then(()=>{y.emit(o,"selectTextChange")})},p=v=>{var x,$;clearTimeout(a);const b=((x=e.value)==null?void 0:x.selectionStart)||0,k=(($=e.value)==null?void 0:$.selectionEnd)||0;a=setTimeout(()=>{if(r.userUpdated){r.curr<r.list.length-1&&(r.list=r.list.slice(0,r.curr+1)),r.list.length>i&&r.list.shift();const E=r.list.pop()||{startPos:0,endPos:0,content:v};E.startPos=h[0],E.endPos=h[1],h=u,Array.prototype.push.call(r.list,E,{content:v,startPos:b,endPos:k}),r.curr=r.list.length-1}else r.userUpdated=!0},150)},m=v=>{var b,k;(h===u||v)&&(h=[(b=e.value)==null?void 0:b.selectionStart,(k=e.value)==null?void 0:k.selectionEnd])};l.watch([l.toRef(s,"value"),t],()=>{t.value&&p(s.value)}),l.watch(()=>s.value,()=>{y.emit(o,"selectTextChange")},{flush:"post"}),l.onMounted(()=>{y.on(o,{name:"ctrlZ",callback(){d(r.curr-1<0?0:r.curr-1)}}),y.on(o,{name:"ctrlShiftZ",callback(){d(r.curr+1===r.list.length?r.curr:r.curr+1)}}),y.on(o,{name:"saveHistoryPos",callback:m})})},ci=(s,e)=>{var o;const t=(o=q.editorExtensions)==null?void 0:o.katex,n=t==null?void 0:t.instance,i=l.ref(!1);return s.noKatex||e.use({extensions:[jt.inline(c,n),jt.block(c,n)]}),l.onMounted(()=>{if(!s.noKatex&&!n){const a=document.createElement("script");a.src=(t==null?void 0:t.js)||Se.js,a.onload=()=>{i.value=!0},a.id=`${c}-katex`;const r=document.createElement("link");r.rel="stylesheet",r.href=(t==null?void 0:t.css)||Se.css,r.id=`${c}-katexCss`,Q(a,"katex"),Q(r)}}),i},di=s=>{var H,_,W;const{markedRenderer:e,markedExtensions:t,markedOptions:n,editorExtensions:i,editorConfig:o}=q,a=l.inject("showCodeRowNumber"),r=l.inject("editorId"),u=l.inject("highlight"),h=l.inject("previewOnly"),d=l.inject("theme"),p=(H=i==null?void 0:i.highlight)==null?void 0:H.instance,m=(_=i==null?void 0:i.mermaid)==null?void 0:_.instance,f=(W=i==null?void 0:i.katex)==null?void 0:W.instance,w=i==null?void 0:i.katex,v=l.ref(!1),b=l.ref([]);let k=[],x=[];const $=new ii({max:1e3,ttl:6e5}),E=fi(s),V=ci(s,L),D=l.computed(()=>E.mermaidInited&&v.value&&V.value);let C=new L.Renderer;C.image=(T,F,R)=>`<span class="figure"><img src="${T}" title="${F||""}" alt="${R||""}" zoom><span class="figcaption">${R||""}</span></span>`,C.listitem=(T,F)=>F?`<li class="li-task">${T}</li>`:`<li>${T}</li>`,e instanceof Function&&(C=e(C));const g=C.code;C.code=(T,F,R)=>{if(!s.noMermaid&&F==="mermaid"){const K=sn();try{if(ri)return`<p class="${c}-mermaid">${T}</p>`;{const Y=$.get(T);if(Y)return`<p class="${c}-mermaid" data-processed>${Y}</p>`;const ie=m||window.mermaid;if(E.mermaidInited){const he=(ie.renderAsync||ie.render)(K,T);he.then(ce=>{$.set(T,typeof ce=="string"?ce:ce.svg)}),k.push(he)}else return`<p class="${c}-mermaid">${T}</p>`}const G=`<script type="text/tmplate">${K}<\/script>`;return x.push(G),G}catch(G){return`<p class="${c}-mermaid-error">Error: ${(G==null?void 0:G.message)||""}</p>`}}return g.call(C,T,F,R).replace(/^<pre><code\sclass="language-([^>]*)">/,'<pre><code class="language-$1" language="$1">')};const M=C.heading,O=M!==new L.Renderer().heading;C.heading=(T,F,R,K)=>{b.value.push({text:R,level:F});const G=s.markedHeadingId(R,F,b.value.length);return O?M.call(C,T,F,R,K,b.value.length,G):T!==R?`<h${F} id="${G}">${T}</h${F}>`:`<h${F} id="${G}"><a href="#${G}">${R}</a></h${F}>`},p&&L.setOptions({highlight:(T,F)=>{let R;const K=p.getLanguage(F);return F&&K?R=p.highlight(T,{language:F,ignoreIllegals:!0}).value:R=p.highlightAuto(T).value,a?Ue(R):`<span class="code-block">${R}</span>`}}),L.setOptions(X({breaks:!0},n)),t instanceof Array&&t.length>0&&L.use({extensions:t}),L.use({extensions:[oi]}),p&&L.setOptions({highlight:(T,F)=>{let R;const K=p.getLanguage(F);return F&&K?R=p.highlight(T,{language:F,ignoreIllegals:!0}).value:R=p.highlightAuto(T).value,a?Ue(R):`<span class="code-block">${R}</span>`}});const j=l.ref(s.sanitize(L(s.value||"",{renderer:C}))),z=async T=>{let F=s.sanitize(L(T,{renderer:C}));const R=[...k],K=[...x];return x=[],k=[],(await Promise.allSettled(R)).forEach((Y,ie)=>{Y.status==="fulfilled"?F=F.replace(K[ie],`<p class="${c}-mermaid" data-processed>${typeof Y.value=="string"?Y.value:Y.value.svg}</p>`):F=F.replace(K[ie],`<p class="${c}-mermaid-error">${Y.reason||""}</p>`)}),F},A=Ee(async()=>{b.value=[];const T=await z(s.value||"");j.value=T,y.emit(r,"buildFinished",j.value),s.onHtmlChanged(j.value)},(o==null?void 0:o.renderDelay)!==void 0?o==null?void 0:o.renderDelay:h?0:500);l.watch([D,l.toRef(E,"reRender"),l.toRef(s,"value")],A),l.watch([d],()=>{$.clear()});const I=()=>{L.setOptions({highlight:(T,F)=>{let R;const K=window.hljs.getLanguage(F);return F&&K?R=window.hljs.highlight(T,{language:F,ignoreIllegals:!0}).value:R=window.hljs.highlightAuto(T).value,a?Ue(R):`<span class="code-block">${R}</span>`}}),v.value=!0};return l.watch(()=>b.value,T=>{s.onGetCatalog(T),y.emit(r,"catalogChanged",T)}),l.onMounted(()=>{if(!s.noKatex&&!f){const T=document.createElement("script");T.src=(w==null?void 0:w.js)||Se.js,T.onload=()=>{V.value=!0},T.id=`${c}-katex`;const F=document.createElement("link");F.rel="stylesheet",F.href=(w==null?void 0:w.css)||Se.css,F.id=`${c}-katexCss`,Q(T,"katex"),Q(F)}if(!p){const T=document.createElement("link");T.rel="stylesheet",T.href=u.value.css,T.id=`${c}-hlCss`;const F=document.createElement("script");F.src=u.value.js,F.onload=I,F.id=`${c}-hljs`,Q(T),Q(F,"hljs")}}),l.watch(()=>u.value.css,T=>{ln(`${c}-hlCss`,"href",T)}),l.onMounted(()=>{y.on(r,{name:"pushCatalog",callback(){y.emit(r,"catalogChanged",b.value)}})}),j},ui=(s,e,t,n,i)=>{const o=l.inject("previewOnly"),a=l.inject("usedLanguageText"),r=l.inject("editorId");let u=()=>{},h=()=>{};const d=()=>{document.querySelectorAll(`#${r}-preview pre`).forEach(f=>{var k,x;let w=-1;(k=f.querySelector(".copy-button"))==null||k.remove();const v=((x=a.value.copyCode)==null?void 0:x.text)||"\u590D\u5236\u4EE3\u7801",b=document.createElement("span");b.setAttribute("class","copy-button"),b.dataset.tips=v,b.innerHTML=`<svg class="${c}-icon" aria-hidden="true"><use xlink:href="#${c}-icon-copy"></use></svg>`,b.addEventListener("click",()=>{var C,g;clearTimeout(w);const $=f.querySelector("code").innerText,E=ve(s.formatCopiedText($)),V=((C=a.value.copyCode)==null?void 0:C.successTips)||"\u5DF2\u590D\u5236\uFF01",D=((g=a.value.copyCode)==null?void 0:g.failTips)||"\u5DF2\u590D\u5236\uFF01";b.dataset.tips=E?V:D,w=window.setTimeout(()=>{b.dataset.tips=v},1500)}),f.appendChild(b)})},p=()=>{l.nextTick(()=>{s.setting.preview&&!o&&s.scrollAuto&&(u(),h()),d()})},m=f=>{f&&!o&&l.nextTick(()=>{u(),[h,u]=dt(t.value,n.value||i.value),h(),d()})};l.watch(()=>e.value,p),l.watch(()=>a.value,d),l.watch(()=>s.setting.preview,m),l.watch(()=>s.setting.htmlPreview,m),l.watch(()=>s.scrollAuto,f=>{f?h():u()}),l.onMounted(()=>{d(),!o&&(n.value||i.value)&&([h,u]=dt(t.value,n.value||i.value)),s.scrollAuto&&h()})},hi=(s,e)=>{const t=l.inject("previewOnly"),n=l.inject("tabWidth"),i=l.inject("editorId"),o=l.ref("");l.onMounted(()=>{var a;t||((a=e.value)==null||a.addEventListener("keypress",r=>{var u,h,d;if(r.key==="Enter"){const p=(u=e.value)==null?void 0:u.selectionStart,m=(h=e.value)==null?void 0:h.value.substring(0,p),f=(d=e.value)==null?void 0:d.value.substring(p),w=m==null?void 0:m.lastIndexOf(`
122
- `),v=m==null?void 0:m.substring(w+1,p);if(/^\d+\.\s|^-\s/.test(v))if(r.cancelBubble=!0,r.preventDefault(),r.stopPropagation(),/^(\d+\.|-)\s+(\[[x\s]\]\s+)?$/.test(v)){const b=m==null?void 0:m.replace(/(\d+\.|-)\s+(\[[x\s]\]\s+)?$/,"");s.onChange(b+f),se(e.value,b==null?void 0:b.length)}else if(/^-\s+.+/.test(v)){const b=/^-\s+\[[x\s]\]/.test(v)?`
121
+ </div>`}},ri=typeof window=="undefined",ai=(s,e,t)=>{var f,w;const n=l.inject("previewOnly"),i=l.inject("historyLength"),o=l.inject("editorId");if(n)return;let a=-1;const r={list:[{content:s.value,startPos:((f=e.value)==null?void 0:f.selectionStart)||0,endPos:((w=e.value)==null?void 0:w.selectionEnd)||0}],userUpdated:!0,curr:0},u=[0,0];let h=u;const d=v=>{var $,E;const b=(($=e.value)==null?void 0:$.selectionStart)||0,k=((E=e.value)==null?void 0:E.selectionEnd)||0;r.list[r.curr].startPos=b,r.list[r.curr].endPos=k,r.userUpdated=!1,r.curr=v;const x=r.list[r.curr];h=[x.startPos,x.endPos],s.onChange(x.content),se(e.value,x.startPos,x.endPos).then(()=>{y.emit(o,"selectTextChange")})},g=v=>{var x,$;clearTimeout(a);const b=((x=e.value)==null?void 0:x.selectionStart)||0,k=(($=e.value)==null?void 0:$.selectionEnd)||0;a=setTimeout(()=>{if(r.userUpdated){r.curr<r.list.length-1&&(r.list=r.list.slice(0,r.curr+1)),r.list.length>i&&r.list.shift();const E=r.list.pop()||{startPos:0,endPos:0,content:v};E.startPos=h[0],E.endPos=h[1],h=u,Array.prototype.push.call(r.list,E,{content:v,startPos:b,endPos:k}),r.curr=r.list.length-1}else r.userUpdated=!0},150)},m=v=>{var b,k;(h===u||v)&&(h=[(b=e.value)==null?void 0:b.selectionStart,(k=e.value)==null?void 0:k.selectionEnd])};l.watch([l.toRef(s,"value"),t],()=>{t.value&&g(s.value)}),l.watch(()=>s.value,()=>{y.emit(o,"selectTextChange")},{flush:"post"}),l.onMounted(()=>{y.on(o,{name:"ctrlZ",callback(){d(r.curr-1<0?0:r.curr-1)}}),y.on(o,{name:"ctrlShiftZ",callback(){d(r.curr+1===r.list.length?r.curr:r.curr+1)}}),y.on(o,{name:"saveHistoryPos",callback:m})})},ci=(s,e)=>{var o;const t=(o=q.editorExtensions)==null?void 0:o.katex,n=t==null?void 0:t.instance,i=l.ref(!1);return s.noKatex||e.use({extensions:[jt.inline(c,n),jt.block(c,n)]}),l.onMounted(()=>{if(!s.noKatex&&!n){const a=document.createElement("script");a.src=(t==null?void 0:t.js)||Se.js,a.onload=()=>{i.value=!0},a.id=`${c}-katex`;const r=document.createElement("link");r.rel="stylesheet",r.href=(t==null?void 0:t.css)||Se.css,r.id=`${c}-katexCss`,Q(a,"katex"),Q(r)}}),i},di=s=>{var H,_,W;const{markedRenderer:e,markedExtensions:t,markedOptions:n,editorExtensions:i,editorConfig:o}=q,a=l.inject("showCodeRowNumber"),r=l.inject("editorId"),u=l.inject("highlight"),h=l.inject("previewOnly"),d=l.inject("theme"),g=(H=i==null?void 0:i.highlight)==null?void 0:H.instance,m=(_=i==null?void 0:i.mermaid)==null?void 0:_.instance,f=(W=i==null?void 0:i.katex)==null?void 0:W.instance,w=i==null?void 0:i.katex,v=l.ref(!1),b=l.ref([]);let k=[],x=[];const $=new ii({max:1e3,ttl:6e5}),E=fi(s),V=ci(s,L),D=l.computed(()=>(s.noMermaid||E.mermaidInited)&&v.value&&(s.noKatex||V.value));let C=new L.Renderer;C.image=(T,F,R)=>`<span class="figure"><img src="${T}" title="${F||""}" alt="${R||""}" zoom><span class="figcaption">${R||""}</span></span>`,C.listitem=(T,F)=>F?`<li class="li-task">${T}</li>`:`<li>${T}</li>`,e instanceof Function&&(C=e(C));const p=C.code;C.code=(T,F,R)=>{if(!s.noMermaid&&F==="mermaid"){const K=sn();try{if(ri)return`<p class="${c}-mermaid">${T}</p>`;{const Y=$.get(T);if(Y)return`<p class="${c}-mermaid" data-processed>${Y}</p>`;const ie=m||window.mermaid;if(E.mermaidInited){const he=(ie.renderAsync||ie.render)(K,T);he.then(ce=>{$.set(T,typeof ce=="string"?ce:ce.svg)}),k.push(he)}else return`<p class="${c}-mermaid">${T}</p>`}const G=`<script type="text/tmplate">${K}<\/script>`;return x.push(G),G}catch(G){return`<p class="${c}-mermaid-error">Error: ${(G==null?void 0:G.message)||""}</p>`}}return p.call(C,T,F,R).replace(/^<pre><code\sclass="language-([^>]*)">/,'<pre><code class="language-$1" language="$1">')};const M=C.heading,O=M!==new L.Renderer().heading;C.heading=(T,F,R,K)=>{b.value.push({text:R,level:F});const G=s.markedHeadingId(R,F,b.value.length);return O?M.call(C,T,F,R,K,b.value.length,G):T!==R?`<h${F} id="${G}">${T}</h${F}>`:`<h${F} id="${G}"><a href="#${G}">${R}</a></h${F}>`},g&&L.setOptions({highlight:(T,F)=>{let R;const K=g.getLanguage(F);return F&&K?R=g.highlight(T,{language:F,ignoreIllegals:!0}).value:R=g.highlightAuto(T).value,a?Ue(R):`<span class="code-block">${R}</span>`}}),L.setOptions(X({breaks:!0},n)),t instanceof Array&&t.length>0&&L.use({extensions:t}),L.use({extensions:[oi]}),g&&L.setOptions({highlight:(T,F)=>{let R;const K=g.getLanguage(F);return F&&K?R=g.highlight(T,{language:F,ignoreIllegals:!0}).value:R=g.highlightAuto(T).value,a?Ue(R):`<span class="code-block">${R}</span>`}});const j=l.ref(s.sanitize(L(s.value||"",{renderer:C}))),z=async T=>{let F=s.sanitize(L(T,{renderer:C}));const R=[...k],K=[...x];return x=[],k=[],(await Promise.allSettled(R)).forEach((Y,ie)=>{Y.status==="fulfilled"?F=F.replace(K[ie],`<p class="${c}-mermaid" data-processed>${typeof Y.value=="string"?Y.value:Y.value.svg}</p>`):F=F.replace(K[ie],`<p class="${c}-mermaid-error">${Y.reason||""}</p>`)}),F},A=Ee(async()=>{b.value=[];const T=await z(s.value||"");j.value=T,y.emit(r,"buildFinished",j.value),s.onHtmlChanged(j.value)},(o==null?void 0:o.renderDelay)!==void 0?o==null?void 0:o.renderDelay:h?0:500);l.watch([D,l.toRef(E,"reRender"),l.toRef(s,"value")],A),l.watch([d],()=>{$.clear()});const I=()=>{L.setOptions({highlight:(T,F)=>{let R;const K=window.hljs.getLanguage(F);return F&&K?R=window.hljs.highlight(T,{language:F,ignoreIllegals:!0}).value:R=window.hljs.highlightAuto(T).value,a?Ue(R):`<span class="code-block">${R}</span>`}}),v.value=!0};return l.watch(()=>b.value,T=>{s.onGetCatalog(T),y.emit(r,"catalogChanged",T)}),l.onMounted(()=>{if(!s.noKatex&&!f){const T=document.createElement("script");T.src=(w==null?void 0:w.js)||Se.js,T.onload=()=>{V.value=!0},T.id=`${c}-katex`;const F=document.createElement("link");F.rel="stylesheet",F.href=(w==null?void 0:w.css)||Se.css,F.id=`${c}-katexCss`,Q(T,"katex"),Q(F)}if(!g){const T=document.createElement("link");T.rel="stylesheet",T.href=u.value.css,T.id=`${c}-hlCss`;const F=document.createElement("script");F.src=u.value.js,F.onload=I,F.id=`${c}-hljs`,Q(T),Q(F,"hljs")}}),l.watch(()=>u.value.css,T=>{ln(`${c}-hlCss`,"href",T)}),l.onMounted(()=>{y.on(r,{name:"pushCatalog",callback(){y.emit(r,"catalogChanged",b.value)}})}),j},ui=(s,e,t,n,i)=>{const o=l.inject("previewOnly"),a=l.inject("usedLanguageText"),r=l.inject("editorId");let u=()=>{},h=()=>{};const d=()=>{document.querySelectorAll(`#${r}-preview pre`).forEach(f=>{var k,x;let w=-1;(k=f.querySelector(".copy-button"))==null||k.remove();const v=((x=a.value.copyCode)==null?void 0:x.text)||"\u590D\u5236\u4EE3\u7801",b=document.createElement("span");b.setAttribute("class","copy-button"),b.dataset.tips=v,b.innerHTML=`<svg class="${c}-icon" aria-hidden="true"><use xlink:href="#${c}-icon-copy"></use></svg>`,b.addEventListener("click",()=>{var C,p;clearTimeout(w);const $=f.querySelector("code").innerText,E=ve(s.formatCopiedText($)),V=((C=a.value.copyCode)==null?void 0:C.successTips)||"\u5DF2\u590D\u5236\uFF01",D=((p=a.value.copyCode)==null?void 0:p.failTips)||"\u5DF2\u590D\u5236\uFF01";b.dataset.tips=E?V:D,w=window.setTimeout(()=>{b.dataset.tips=v},1500)}),f.appendChild(b)})},g=()=>{l.nextTick(()=>{s.setting.preview&&!o&&s.scrollAuto&&(u(),h()),d()})},m=f=>{f&&!o&&l.nextTick(()=>{u(),[h,u]=dt(t.value,n.value||i.value),h(),d()})};l.watch(()=>e.value,g),l.watch(()=>a.value,d),l.watch(()=>s.setting.preview,m),l.watch(()=>s.setting.htmlPreview,m),l.watch(()=>s.scrollAuto,f=>{f?h():u()}),l.onMounted(()=>{d(),!o&&(n.value||i.value)&&([h,u]=dt(t.value,n.value||i.value)),s.scrollAuto&&h()})},hi=(s,e)=>{const t=l.inject("previewOnly"),n=l.inject("tabWidth"),i=l.inject("editorId"),o=l.ref("");l.onMounted(()=>{var a;t||((a=e.value)==null||a.addEventListener("keypress",r=>{var u,h,d;if(r.key==="Enter"){const g=(u=e.value)==null?void 0:u.selectionStart,m=(h=e.value)==null?void 0:h.value.substring(0,g),f=(d=e.value)==null?void 0:d.value.substring(g),w=m==null?void 0:m.lastIndexOf(`
122
+ `),v=m==null?void 0:m.substring(w+1,g);if(/^\d+\.\s|^-\s/.test(v))if(r.cancelBubble=!0,r.preventDefault(),r.stopPropagation(),/^(\d+\.|-)\s+(\[[x\s]\]\s+)?$/.test(v)){const b=m==null?void 0:m.replace(/(\d+\.|-)\s+(\[[x\s]\]\s+)?$/,"");s.onChange(b+f),se(e.value,b==null?void 0:b.length)}else if(/^-\s+.+/.test(v)){const b=/^-\s+\[[x\s]\]/.test(v)?`
123
123
  - [ ] `:`
124
124
  - `;s.onChange(Be(e.value,b,{}))}else{const b=v==null?void 0:v.match(/\d+(?=\.)/),k=b&&Number(b[0])+1||1,x=/^\d\.\s+\[[x\s]\]/.test(v)?`
125
125
  ${k}. [ ] `:`
126
- ${k}. `;s.onChange(Be(e.value,x,{}))}}}),y.on(i,{name:"replace",callback(r,u={}){s.onChange(si(r,o.value,e.value,me(X({},u),{tabWidth:n,editorId:i})))}}),y.on(i,{name:"selectTextChange",callback(){o.value=en(e.value)}}))}),l.watch(()=>s.value,()=>{o.value=""})},fi=s=>{const e=l.inject("theme"),{editorExtensions:t}=q,n=t==null?void 0:t.mermaid,i=l.reactive({reRender:!1,mermaidInited:!1}),o=()=>{s.noMermaid||(((n==null?void 0:n.instance)||window.mermaid).initialize({startOnLoad:!1,theme:e.value==="dark"?"dark":"default"}),i.reRender=!i.reRender)};return l.watch(()=>e.value,o),l.onMounted(()=>{if(!s.noMermaid)if(n!=null&&n.instance)o(),i.mermaidInited=!0;else{const a=document.createElement("script");a.id=`${c}-mermaid`;const r=(n==null?void 0:n.js)||Zt;/\.mjs/.test(r)?(a.setAttribute("type","module"),a.innerHTML=`import mermaid from "${r}";window.mermaid=mermaid;document.getElementById('${c}-mermaid').dispatchEvent(new Event('load'));`):a.src=r,a.onload=()=>{o(),i.mermaidInited=!0},Q(a,"mermaid")}}),i},mi=(s,e)=>{const t=l.inject("editorId"),n=l.inject("previewOnly"),i=o=>{if(!!o.clipboardData){if(o.clipboardData.files.length>0){const{files:a}=o.clipboardData;y.emit(t,"uploadImage",Array.from(a).filter(r=>/image\/.*/.test(r.type))),o.preventDefault()}if(s.autoDetectCode&&o.clipboardData.types.includes("vscode-editor-data")){const a=JSON.parse(o.clipboardData.getData("vscode-editor-data"));y.emit(t,"replace","code",{mode:a.mode,text:o.clipboardData.getData("text/plain")}),o.preventDefault()}}};l.onMounted(()=>{n||e.value.addEventListener("paste",i)}),l.onBeforeUnmount(()=>{n||e.value.removeEventListener("paste",i)})},pi=(s,e)=>{const t=l.inject("editorId"),n=Ee(()=>{const i=document.querySelectorAll(`#${t}-preview img[zoom]`);i.length!==0&&Yn(i,{background:"#00000073"})});l.onMounted(n),l.watch([e,l.toRef(s.setting,"preview")],n)},gi=s=>{const e=l.inject("editorId");l.onMounted(()=>{y.on(e,{name:kt,callback(){var t;(t=s.value)==null||t.focus()}})})},bi=()=>({value:{type:String,default:""},onChange:{type:Function,default:()=>{}},setting:{type:Object,default:()=>({})},onHtmlChanged:{type:Function,default:()=>{}},onGetCatalog:{type:Function,default:()=>{}},markedHeadingId:{type:Function,default:()=>""},noMermaid:{type:Boolean,default:!1},sanitize:{type:Function,default:s=>s},placeholder:{type:String,default:""},noKatex:{type:Boolean,default:!1},scrollAuto:{type:Boolean},formatCopiedText:{type:Function,default:s=>s},autofocus:{type:Boolean},disabled:{type:Boolean},readonly:{type:Boolean},maxlength:{type:Number},autoDetectCode:{type:Boolean},onBlur:{type:Function,default:()=>{}},onFocus:{type:Function,default:()=>{}}});var ki=l.defineComponent({name:"MDEditorContent",props:bi(),setup(s){const e=l.ref(!0),t=l.inject("previewOnly"),n=l.inject("showCodeRowNumber"),i=l.inject("previewTheme"),o=l.inject("editorId"),a=l.ref(),r=l.ref(),u=l.ref(),h=di(s);return ui(s,h,a,r,u),hi(s,a),ai(s,a,e),mi(s,a),pi(s,h),gi(a),()=>{const d=nn(s,["formatCopiedText","markedHeadingId","noKatex","noMermaid","onChange","onGetCatalog","onHtmlChanged","sanitize","scrollAuto","setting","autoDetectCode","onBlur","onFocus"]);return l.createVNode(l.Fragment,null,[l.createVNode("div",{class:`${c}-content`},[!t&&l.createVNode("div",{class:`${c}-input-wrapper`},[l.createVNode("textarea",l.mergeProps(d,{id:`${o}-textarea`,class:[s.setting.preview||s.setting.htmlPreview?"":"textarea-only"],ref:a,onBlur:p=>{y.emit(o,"selectTextChange"),s.onBlur(p)},onFocus:s.onFocus,onKeydown:()=>{y.emit(o,"saveHistoryPos",!0)},onCompositionstart:()=>{e.value=!1},onInput:p=>{s.onChange(p.target.value)},onCompositionend:()=>{e.value=!0}}),null)]),s.setting.preview&&l.createVNode("div",{id:`${o}-preview-wrapper`,class:`${c}-preview-wrapper`,ref:r,key:"content-preview-wrapper"},[l.createVNode("article",{id:`${o}-preview`,class:[`${c}-preview`,`${i==null?void 0:i.value}-theme`,n&&`${c}-scrn`],innerHTML:h.value},null)]),s.setting.htmlPreview&&l.createVNode("div",{class:`${c}-preview-wrapper`,ref:u,key:"html-preview-wrapper"},[l.createVNode("div",{class:`${c}-html`},[h.value])])])])}}}),yi=l.defineComponent({props:{modelValue:{type:String,default:""}},setup(s){const e=l.inject("usedLanguageText");return()=>{var t,n;return l.createVNode("div",{class:`${c}-footer-item`},[l.createVNode("label",{class:`${c}-footer-label`},[`${(t=e.value.footer)==null?void 0:t.markdownTotal}:`]),l.createVNode("span",null,[((n=s.modelValue)==null?void 0:n.length)||0])])}}}),Ui="";const wi=()=>({checked:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}}});var vi=l.defineComponent({props:wi(),setup(s){return()=>l.createVNode("div",{class:[`${c}-checkbox`,s.checked&&`${c}-checkbox-checked`],onClick:()=>{s.onChange(!s.checked)}},null)}});const xi=()=>({scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}}});var $i=l.defineComponent({props:xi(),setup(s){const e=l.inject("usedLanguageText");return()=>{var t;return l.createVNode("div",{class:`${c}-footer-item`},[l.createVNode("label",{class:`${c}-footer-label`,onClick:()=>{s.onScrollAutoChange(!s.scrollAuto)}},[(t=e.value.footer)==null?void 0:t.scrollAuto]),l.createVNode(vi,{checked:s.scrollAuto,onChange:s.onScrollAutoChange},null)])}}});const Ci=()=>({modelValue:{type:String,default:""},footers:{type:Array,default:[]},scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}},defFooters:{type:Object}});var Si=l.defineComponent({name:"MDEditorFooter",props:Ci(),setup(s){const e=l.computed(()=>{const n=s.footers.indexOf("="),i=n===-1?s.footers:s.footers.slice(0,n),o=n===-1?[]:s.footers.slice(n,Number.MAX_SAFE_INTEGER);return[i,o]}),t=n=>{if(rt.includes(n))switch(n){case"markdownTotal":return l.createVNode(yi,{modelValue:s.modelValue},null);case"scrollSwitch":return l.createVNode($i,{scrollAuto:s.scrollAuto,onScrollAutoChange:s.onScrollAutoChange},null)}else return s.defFooters instanceof Array?s.defFooters[n]||"":s.defFooters&&s.defFooters.children instanceof Array&&s.defFooters.children[n]||""};return()=>{const n=e.value[0].map(o=>t(o)),i=e.value[1].map(o=>t(o));return l.createVNode("div",{class:`${c}-footer`},[l.createVNode("div",{class:`${c}-footer-left`},[n]),l.createVNode("div",{class:`${c}-footer-right`},[i])])}}});const Ei=()=>({tocItem:{type:Object,default:()=>({})},markedHeadingId:{type:Function,default:()=>{}},scrollElement:{type:[String,Object],default:""},onClick:{type:Function,default:()=>{}},scrollElementOffsetTop:{type:Number,default:0}}),Mt=l.defineComponent({props:Ei(),setup(s){return()=>{const{tocItem:e,markedHeadingId:t,scrollElement:n,onClick:i,scrollElementOffsetTop:o}=s;return l.createVNode("div",{class:[`${c}-catalog-link`,e.active&&`${c}-catalog-active`],onClick:a=>{i(a,e),a.stopPropagation();const r=t(e.text,e.level,e.index),u=document.getElementById(r),h=n instanceof Element?n:document.querySelector(n);if(u&&h){let d=u.offsetParent,p=u.offsetTop;if(h.contains(d))for(;d&&h!=d;)p+=d==null?void 0:d.offsetTop,d=d==null?void 0:d.offsetParent;h==null||h.scrollTo({top:p-o,behavior:"smooth"})}}},[l.createVNode("span",{title:e.text},[e.text]),l.createVNode("div",{class:`${c}-catalog-wrapper`},[e.children&&e.children.map(a=>l.createVNode(Mt,{markedHeadingId:t,key:`${e.text}-link-${a.level}-${a.text}`,tocItem:a,scrollElement:n,onClick:i,scrollElementOffsetTop:o},null))])])}}});var qi="";const Ti=()=>({editorId:{type:String},class:{type:String,default:""},markedHeadingId:{type:Function,default:s=>s},scrollElement:{type:[String,Object]},theme:{type:String,default:"light"},offsetTop:{type:Number,default:20},scrollElementOffsetTop:{type:Number,default:0},onClick:{type:Function}}),Re=l.defineComponent({name:"MdCatalog",props:Ti(),emits:["onClick"],setup(s,e){const t=s.editorId,n=l.reactive({list:[],show:!1,scrollElement:s.scrollElement||`#${t}-preview-wrapper`}),i=l.computed(()=>{const a=[];return n.list.forEach(({text:r,level:u,active:h},d)=>{const p={level:u,text:r,index:d+1,active:!!h};if(a.length===0)a.push(p);else{let m=a[a.length-1];if(p.level>m.level)for(let f=m.level+1;f<=6;f++){const{children:w}=m;if(!w){m.children=[p];break}if(m=w[w.length-1],p.level<=m.level){w.push(p);break}}else a.push(p)}}),a});l.onMounted(()=>{y.on(t,{name:"catalogChanged",callback:a=>{n.list=a.map((r,u)=>u===0?me(X({},r),{active:!0}):X({},r))}}),y.emit(t,"pushCatalog")});const o=()=>{var r;const a=n.scrollElement instanceof HTMLElement?n.scrollElement:document.querySelector(n.scrollElement);(r=a===document.documentElement?window:a)==null||r.addEventListener("scroll",Jt(()=>{if(n.list.length===0)return!1;const{activeHead:u}=n.list.reduce((h,d,p)=>{const m=document.getElementById(s.markedHeadingId(d.text,d.level,p+1));if(m instanceof HTMLElement){const f=tn(m,a);if(f<s.offsetTop&&f>h.minTop)return{activeHead:d,minTop:f}}return h},{activeHead:n.list[0],minTop:Number.MIN_SAFE_INTEGER});n.list=n.list.map(h=>h===u?me(X({},h),{active:!0}):me(X({},h),{active:!1}))}))};return l.onMounted(()=>{o(),y.on(t,{name:We,callback(a){a&&l.nextTick(o)}})}),()=>l.createVNode("div",{class:`${c}-catalog${s.theme==="dark"?"-dark":""} ${s.class}`},[i.value.map(a=>l.createVNode(Mt,{markedHeadingId:s.markedHeadingId,tocItem:a,key:`link-${a.level}-${a.text}`,scrollElement:n.scrollElement,onClick:(r,u)=>{s.onClick?s.onClick(r,u):e.emit("onClick",r,u)},scrollElementOffsetTop:s.scrollElementOffsetTop},null))])}}),zi=()=>({modelValue:{type:String,default:""},theme:{type:String,default:"light"},class:{type:String,default:""},historyLength:{type:Number,default:10},onChange:{type:Function},onSave:{type:Function},onUploadImg:{type:Function},pageFullscreen:{type:Boolean,default:!1},preview:{type:Boolean,default:!0},htmlPreview:{type:Boolean,default:!1},previewOnly:{type:Boolean,default:!1},language:{type:String,default:"zh-CN"},toolbars:{type:Array,default:ot},toolbarsExclude:{type:Array,default:[]},noPrettier:{type:Boolean,default:!1},onHtmlChanged:{type:Function},onGetCatalog:{type:Function},editorId:{type:String,default:J},tabWidth:{type:Number,default:2},showCodeRowNumber:{type:Boolean,default:!1},previewTheme:{type:String,default:"default"},style:{type:Object,default:()=>({})},markedHeadingId:{type:Function,default:Li},tableShape:{type:Array,default:()=>[6,4]},noMermaid:{type:Boolean,default:!1},sanitize:{type:Function,default:s=>s},placeholder:{type:String,default:""},noKatex:{type:Boolean,default:!1},defToolbars:{type:[String,Object]},onError:{type:Function},codeTheme:{type:String,default:"atom"},footers:{type:Array,default:rt},scrollAuto:{type:Boolean,default:!0},defFooters:{type:[String,Object]},noIconfont:{type:Boolean},formatCopiedText:{type:Function,default:s=>s},noUploadImg:{type:Boolean},codeStyleReverse:{type:Boolean,default:!0},codeStyleReverseList:{type:Array,default:["default","mk-cute"]},autoFocus:{type:Boolean},disabled:{type:Boolean},readOnly:{type:Boolean},maxLength:{type:Number},autoDetectCode:{type:Boolean},onBlur:{type:Function},onFocus:{type:Function}}),Li=s=>s;var Wi="",Ki="";const oe=l.defineComponent({name:"MdEditorV3",props:zi(),emits:["onChange","onSave","onUploadImg","onHtmlChanged","onGetCatalog","onError","update:modelValue","onBlur","onFocus"],setup(s,e){const{editorId:t,previewOnly:n,noKatex:i,noMermaid:o,noPrettier:a,noUploadImg:r}=s,u=l.reactive({scrollAuto:s.scrollAuto});on(s,e),rn(s),an(s);const[h,d]=cn(s,e),[p,m]=dn(s);return l.onBeforeUnmount(()=>{y.clear(t)}),un(s,e,p,h,d),()=>{var v;const f=ee({props:s,ctx:e},"defToolbars"),w=ee({props:s,ctx:e},"defFooters");return l.createVNode("div",{id:t,class:[c,s.class,s.theme==="dark"&&`${c}-dark`,h.fullscreen||h.pageFullscreen?`${c}-fullscreen`:"",n&&`${c}-previewOnly`],style:s.style},[!n&&l.createVNode(Sn,{noPrettier:a,toolbars:s.toolbars,toolbarsExclude:s.toolbarsExclude,setting:h,updateSetting:d,tableShape:s.tableShape,defToolbars:f,noUploadImg:r},null),l.createVNode(ki,{value:s.modelValue,setting:h,markedHeadingId:s.markedHeadingId,noMermaid:o,sanitize:s.sanitize,placeholder:s.placeholder,noKatex:i,scrollAuto:u.scrollAuto,formatCopiedText:s.formatCopiedText,autofocus:s.autoFocus,disabled:s.disabled,readonly:s.readOnly,maxlength:s.maxLength,autoDetectCode:s.autoDetectCode,onChange:b=>{y.emit(t,"saveHistoryPos"),s.onChange?s.onChange(b):(e.emit("update:modelValue",b),e.emit("onChange",b))},onHtmlChanged:b=>{s.onHtmlChanged?s.onHtmlChanged(b):e.emit("onHtmlChanged",b)},onGetCatalog:b=>{s.onGetCatalog?s.onGetCatalog(b):e.emit("onGetCatalog",b)},onBlur:b=>{s.onBlur?s.onBlur(b):e.emit("onBlur",b)},onFocus:b=>{s.onFocus?s.onFocus(b):e.emit("onFocus",b)}},null),!n&&((v=s.footers)==null?void 0:v.length)>0&&l.createVNode(Si,{modelValue:s.modelValue,footers:s.footers,defFooters:w,scrollAuto:u.scrollAuto,onScrollAutoChange:b=>u.scrollAuto=b},null),m.value&&!n&&l.createVNode(Re,{theme:s.theme,style:{display:p.value?"block":"none"},class:`${c}-catalog-editor`,editorId:t,markedHeadingId:s.markedHeadingId},null)])}}}),Ni=()=>({title:{type:String,default:""},trigger:{type:[String,Object]},onClick:{type:Function}});var tt=l.defineComponent({name:"NormalToolbar",props:Ni(),emits:["onClick"],setup(s,e){return()=>{const t=ee({props:s,ctx:e},"trigger");return l.createVNode("div",{class:`${c}-toolbar-item`,title:s.title,onClick:n=>{s.onClick instanceof Function?s.onClick(n):e.emit("onClick",n)}},[t])}}});const Fi=()=>({title:{type:String,default:""},visible:{type:Boolean},trigger:{type:[String,Object]},onChange:{type:Function},overlay:{type:[String,Object]}});var nt=l.defineComponent({name:"DropdownToolbar",props:Fi(),emits:["onChange"],setup(s,e){const t=l.inject("editorId");return()=>{const n=ee({props:s,ctx:e},"trigger"),i=ee({props:s,ctx:e},"overlay");return l.createVNode(pe,{relative:`#${t}-toolbar-wrapper`,visible:s.visible,onChange:o=>{s.onChange instanceof Function?s.onChange(o):e.emit("onChange",o)},overlay:i},{default:()=>[l.createVNode("div",{class:`${c}-toolbar-item`,title:s.title||""},[n])]})}}});function Ai(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!l.isVNode(s)}const Vi=()=>({title:{type:String,default:""},modalTitle:{type:String,default:""},visible:{type:Boolean},width:{type:String,default:"auto"},height:{type:String,default:"auto"},trigger:{type:[String,Object]},onClick:{type:Function},onClose:{type:Function},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function}});var it=l.defineComponent({name:"ModalToolbar",props:Vi(),emits:["onClick","onClose","onAdjust"],setup(s,e){return()=>{const t=ee({props:s,ctx:e},"trigger"),n=ee({props:s,ctx:e},"default");return l.createVNode(l.Fragment,null,[l.createVNode("div",{class:`${c}-toolbar-item`,title:s.title,onClick:()=>{s.onClick instanceof Function?s.onClick():e.emit("onClick")}},[t]),l.createVNode(Ke,{width:s.width,height:s.height,title:s.modalTitle,visible:s.visible,onClose:()=>{s.onClose instanceof Function?s.onClose():e.emit("onClose")},showAdjust:s.showAdjust,isFullscreen:s.isFullscreen,onAdjust:i=>{s.onAdjust instanceof Function?s.onAdjust(i):e.emit("onAdjust",i)}},Ai(n)?n:{default:()=>[n]})])}}});return oe.install=s=>(s.component(oe.name,oe),s.component(tt.name,tt),s.component(nt.name,nt),s.component(Re.name,Re),s.component(it.name,it),s),oe.NormalToolbar=tt,oe.DropdownToolbar=nt,oe.MdCatalog=Re,oe.ModalToolbar=it,oe.config=Gt,oe});
126
+ ${k}. `;s.onChange(Be(e.value,x,{}))}}}),y.on(i,{name:"replace",callback(r,u={}){s.onChange(si(r,o.value,e.value,me(X({},u),{tabWidth:n,editorId:i})))}}),y.on(i,{name:"selectTextChange",callback(){o.value=en(e.value)}}))}),l.watch(()=>s.value,()=>{o.value=""})},fi=s=>{const e=l.inject("theme"),{editorExtensions:t}=q,n=t==null?void 0:t.mermaid,i=l.reactive({reRender:!1,mermaidInited:!1}),o=()=>{s.noMermaid||(((n==null?void 0:n.instance)||window.mermaid).initialize({startOnLoad:!1,theme:e.value==="dark"?"dark":"default"}),i.reRender=!i.reRender)};return l.watch(()=>e.value,o),l.onMounted(()=>{if(!s.noMermaid)if(n!=null&&n.instance)o(),i.mermaidInited=!0;else{const a=document.createElement("script");a.id=`${c}-mermaid`;const r=(n==null?void 0:n.js)||Zt;/\.mjs/.test(r)?(a.setAttribute("type","module"),a.innerHTML=`import mermaid from "${r}";window.mermaid=mermaid;document.getElementById('${c}-mermaid').dispatchEvent(new Event('load'));`):a.src=r,a.onload=()=>{o(),i.mermaidInited=!0},Q(a,"mermaid")}}),i},mi=(s,e)=>{const t=l.inject("editorId"),n=l.inject("previewOnly"),i=o=>{if(!!o.clipboardData){if(o.clipboardData.files.length>0){const{files:a}=o.clipboardData;y.emit(t,"uploadImage",Array.from(a).filter(r=>/image\/.*/.test(r.type))),o.preventDefault()}if(s.autoDetectCode&&o.clipboardData.types.includes("vscode-editor-data")){const a=JSON.parse(o.clipboardData.getData("vscode-editor-data"));y.emit(t,"replace","code",{mode:a.mode,text:o.clipboardData.getData("text/plain")}),o.preventDefault()}}};l.onMounted(()=>{n||e.value.addEventListener("paste",i)}),l.onBeforeUnmount(()=>{n||e.value.removeEventListener("paste",i)})},gi=(s,e)=>{const t=l.inject("editorId"),n=Ee(()=>{const i=document.querySelectorAll(`#${t}-preview img[zoom]`);i.length!==0&&Yn(i,{background:"#00000073"})});l.onMounted(n),l.watch([e,l.toRef(s.setting,"preview")],n)},pi=s=>{const e=l.inject("editorId");l.onMounted(()=>{y.on(e,{name:kt,callback(){var t;(t=s.value)==null||t.focus()}})})},bi=()=>({value:{type:String,default:""},onChange:{type:Function,default:()=>{}},setting:{type:Object,default:()=>({})},onHtmlChanged:{type:Function,default:()=>{}},onGetCatalog:{type:Function,default:()=>{}},markedHeadingId:{type:Function,default:()=>""},noMermaid:{type:Boolean,default:!1},sanitize:{type:Function,default:s=>s},placeholder:{type:String,default:""},noKatex:{type:Boolean,default:!1},scrollAuto:{type:Boolean},formatCopiedText:{type:Function,default:s=>s},autofocus:{type:Boolean},disabled:{type:Boolean},readonly:{type:Boolean},maxlength:{type:Number},autoDetectCode:{type:Boolean},onBlur:{type:Function,default:()=>{}},onFocus:{type:Function,default:()=>{}}});var ki=l.defineComponent({name:"MDEditorContent",props:bi(),setup(s){const e=l.ref(!0),t=l.inject("previewOnly"),n=l.inject("showCodeRowNumber"),i=l.inject("previewTheme"),o=l.inject("editorId"),a=l.ref(),r=l.ref(),u=l.ref(),h=di(s);return ui(s,h,a,r,u),hi(s,a),ai(s,a,e),mi(s,a),gi(s,h),pi(a),()=>{const d=nn(s,["formatCopiedText","markedHeadingId","noKatex","noMermaid","onChange","onGetCatalog","onHtmlChanged","sanitize","scrollAuto","setting","autoDetectCode","onBlur","onFocus"]);return l.createVNode(l.Fragment,null,[l.createVNode("div",{class:`${c}-content`},[!t&&l.createVNode("div",{class:`${c}-input-wrapper`},[l.createVNode("textarea",l.mergeProps(d,{id:`${o}-textarea`,class:[s.setting.preview||s.setting.htmlPreview?"":"textarea-only"],ref:a,onBlur:g=>{y.emit(o,"selectTextChange"),s.onBlur(g)},onFocus:s.onFocus,onKeydown:()=>{y.emit(o,"saveHistoryPos",!0)},onCompositionstart:()=>{e.value=!1},onInput:g=>{s.onChange(g.target.value)},onCompositionend:()=>{e.value=!0}}),null)]),s.setting.preview&&l.createVNode("div",{id:`${o}-preview-wrapper`,class:`${c}-preview-wrapper`,ref:r,key:"content-preview-wrapper"},[l.createVNode("article",{id:`${o}-preview`,class:[`${c}-preview`,`${i==null?void 0:i.value}-theme`,n&&`${c}-scrn`],innerHTML:h.value},null)]),s.setting.htmlPreview&&l.createVNode("div",{class:`${c}-preview-wrapper`,ref:u,key:"html-preview-wrapper"},[l.createVNode("div",{class:`${c}-html`},[h.value])])])])}}}),yi=l.defineComponent({props:{modelValue:{type:String,default:""}},setup(s){const e=l.inject("usedLanguageText");return()=>{var t,n;return l.createVNode("div",{class:`${c}-footer-item`},[l.createVNode("label",{class:`${c}-footer-label`},[`${(t=e.value.footer)==null?void 0:t.markdownTotal}:`]),l.createVNode("span",null,[((n=s.modelValue)==null?void 0:n.length)||0])])}}}),Ui="";const wi=()=>({checked:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}}});var vi=l.defineComponent({props:wi(),setup(s){return()=>l.createVNode("div",{class:[`${c}-checkbox`,s.checked&&`${c}-checkbox-checked`],onClick:()=>{s.onChange(!s.checked)}},null)}});const xi=()=>({scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}}});var $i=l.defineComponent({props:xi(),setup(s){const e=l.inject("usedLanguageText");return()=>{var t;return l.createVNode("div",{class:`${c}-footer-item`},[l.createVNode("label",{class:`${c}-footer-label`,onClick:()=>{s.onScrollAutoChange(!s.scrollAuto)}},[(t=e.value.footer)==null?void 0:t.scrollAuto]),l.createVNode(vi,{checked:s.scrollAuto,onChange:s.onScrollAutoChange},null)])}}});const Ci=()=>({modelValue:{type:String,default:""},footers:{type:Array,default:[]},scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}},defFooters:{type:Object}});var Si=l.defineComponent({name:"MDEditorFooter",props:Ci(),setup(s){const e=l.computed(()=>{const n=s.footers.indexOf("="),i=n===-1?s.footers:s.footers.slice(0,n),o=n===-1?[]:s.footers.slice(n,Number.MAX_SAFE_INTEGER);return[i,o]}),t=n=>{if(rt.includes(n))switch(n){case"markdownTotal":return l.createVNode(yi,{modelValue:s.modelValue},null);case"scrollSwitch":return l.createVNode($i,{scrollAuto:s.scrollAuto,onScrollAutoChange:s.onScrollAutoChange},null)}else return s.defFooters instanceof Array?s.defFooters[n]||"":s.defFooters&&s.defFooters.children instanceof Array&&s.defFooters.children[n]||""};return()=>{const n=e.value[0].map(o=>t(o)),i=e.value[1].map(o=>t(o));return l.createVNode("div",{class:`${c}-footer`},[l.createVNode("div",{class:`${c}-footer-left`},[n]),l.createVNode("div",{class:`${c}-footer-right`},[i])])}}});const Ei=()=>({tocItem:{type:Object,default:()=>({})},markedHeadingId:{type:Function,default:()=>{}},scrollElement:{type:[String,Object],default:""},onClick:{type:Function,default:()=>{}},scrollElementOffsetTop:{type:Number,default:0}}),Mt=l.defineComponent({props:Ei(),setup(s){return()=>{const{tocItem:e,markedHeadingId:t,scrollElement:n,onClick:i,scrollElementOffsetTop:o}=s;return l.createVNode("div",{class:[`${c}-catalog-link`,e.active&&`${c}-catalog-active`],onClick:a=>{i(a,e),a.stopPropagation();const r=t(e.text,e.level,e.index),u=document.getElementById(r),h=n instanceof Element?n:document.querySelector(n);if(u&&h){let d=u.offsetParent,g=u.offsetTop;if(h.contains(d))for(;d&&h!=d;)g+=d==null?void 0:d.offsetTop,d=d==null?void 0:d.offsetParent;h==null||h.scrollTo({top:g-o,behavior:"smooth"})}}},[l.createVNode("span",{title:e.text},[e.text]),l.createVNode("div",{class:`${c}-catalog-wrapper`},[e.children&&e.children.map(a=>l.createVNode(Mt,{markedHeadingId:t,key:`${e.text}-link-${a.level}-${a.text}`,tocItem:a,scrollElement:n,onClick:i,scrollElementOffsetTop:o},null))])])}}});var qi="";const Ti=()=>({editorId:{type:String},class:{type:String,default:""},markedHeadingId:{type:Function,default:s=>s},scrollElement:{type:[String,Object]},theme:{type:String,default:"light"},offsetTop:{type:Number,default:20},scrollElementOffsetTop:{type:Number,default:0},onClick:{type:Function}}),Re=l.defineComponent({name:"MdCatalog",props:Ti(),emits:["onClick"],setup(s,e){const t=s.editorId,n=l.reactive({list:[],show:!1,scrollElement:s.scrollElement||`#${t}-preview-wrapper`}),i=l.computed(()=>{const a=[];return n.list.forEach(({text:r,level:u,active:h},d)=>{const g={level:u,text:r,index:d+1,active:!!h};if(a.length===0)a.push(g);else{let m=a[a.length-1];if(g.level>m.level)for(let f=m.level+1;f<=6;f++){const{children:w}=m;if(!w){m.children=[g];break}if(m=w[w.length-1],g.level<=m.level){w.push(g);break}}else a.push(g)}}),a});l.onMounted(()=>{y.on(t,{name:"catalogChanged",callback:a=>{n.list=a.map((r,u)=>u===0?me(X({},r),{active:!0}):X({},r))}}),y.emit(t,"pushCatalog")});const o=()=>{var r;const a=n.scrollElement instanceof HTMLElement?n.scrollElement:document.querySelector(n.scrollElement);(r=a===document.documentElement?window:a)==null||r.addEventListener("scroll",Jt(()=>{if(n.list.length===0)return!1;const{activeHead:u}=n.list.reduce((h,d,g)=>{const m=document.getElementById(s.markedHeadingId(d.text,d.level,g+1));if(m instanceof HTMLElement){const f=tn(m,a);if(f<s.offsetTop&&f>h.minTop)return{activeHead:d,minTop:f}}return h},{activeHead:n.list[0],minTop:Number.MIN_SAFE_INTEGER});n.list=n.list.map(h=>h===u?me(X({},h),{active:!0}):me(X({},h),{active:!1}))}))};return l.onMounted(()=>{o(),y.on(t,{name:We,callback(a){a&&l.nextTick(o)}})}),()=>l.createVNode("div",{class:`${c}-catalog${s.theme==="dark"?"-dark":""} ${s.class}`},[i.value.map(a=>l.createVNode(Mt,{markedHeadingId:s.markedHeadingId,tocItem:a,key:`link-${a.level}-${a.text}`,scrollElement:n.scrollElement,onClick:(r,u)=>{s.onClick?s.onClick(r,u):e.emit("onClick",r,u)},scrollElementOffsetTop:s.scrollElementOffsetTop},null))])}}),zi=()=>({modelValue:{type:String,default:""},theme:{type:String,default:"light"},class:{type:String,default:""},historyLength:{type:Number,default:10},onChange:{type:Function},onSave:{type:Function},onUploadImg:{type:Function},pageFullscreen:{type:Boolean,default:!1},preview:{type:Boolean,default:!0},htmlPreview:{type:Boolean,default:!1},previewOnly:{type:Boolean,default:!1},language:{type:String,default:"zh-CN"},toolbars:{type:Array,default:ot},toolbarsExclude:{type:Array,default:[]},noPrettier:{type:Boolean,default:!1},onHtmlChanged:{type:Function},onGetCatalog:{type:Function},editorId:{type:String,default:J},tabWidth:{type:Number,default:2},showCodeRowNumber:{type:Boolean,default:!1},previewTheme:{type:String,default:"default"},style:{type:Object,default:()=>({})},markedHeadingId:{type:Function,default:Li},tableShape:{type:Array,default:()=>[6,4]},noMermaid:{type:Boolean,default:!1},sanitize:{type:Function,default:s=>s},placeholder:{type:String,default:""},noKatex:{type:Boolean,default:!1},defToolbars:{type:[String,Object]},onError:{type:Function},codeTheme:{type:String,default:"atom"},footers:{type:Array,default:rt},scrollAuto:{type:Boolean,default:!0},defFooters:{type:[String,Object]},noIconfont:{type:Boolean},formatCopiedText:{type:Function,default:s=>s},noUploadImg:{type:Boolean},codeStyleReverse:{type:Boolean,default:!0},codeStyleReverseList:{type:Array,default:["default","mk-cute"]},autoFocus:{type:Boolean},disabled:{type:Boolean},readOnly:{type:Boolean},maxLength:{type:Number},autoDetectCode:{type:Boolean},onBlur:{type:Function},onFocus:{type:Function}}),Li=s=>s;var Wi="",Ki="";const oe=l.defineComponent({name:"MdEditorV3",props:zi(),emits:["onChange","onSave","onUploadImg","onHtmlChanged","onGetCatalog","onError","update:modelValue","onBlur","onFocus"],setup(s,e){const{editorId:t,previewOnly:n,noKatex:i,noMermaid:o,noPrettier:a,noUploadImg:r}=s,u=l.reactive({scrollAuto:s.scrollAuto});on(s,e),rn(s),an(s);const[h,d]=cn(s,e),[g,m]=dn(s);return l.onBeforeUnmount(()=>{y.clear(t)}),un(s,e,g,h,d),()=>{var v;const f=ee({props:s,ctx:e},"defToolbars"),w=ee({props:s,ctx:e},"defFooters");return l.createVNode("div",{id:t,class:[c,s.class,s.theme==="dark"&&`${c}-dark`,h.fullscreen||h.pageFullscreen?`${c}-fullscreen`:"",n&&`${c}-previewOnly`],style:s.style},[!n&&l.createVNode(Sn,{noPrettier:a,toolbars:s.toolbars,toolbarsExclude:s.toolbarsExclude,setting:h,updateSetting:d,tableShape:s.tableShape,defToolbars:f,noUploadImg:r},null),l.createVNode(ki,{value:s.modelValue,setting:h,markedHeadingId:s.markedHeadingId,noMermaid:o,sanitize:s.sanitize,placeholder:s.placeholder,noKatex:i,scrollAuto:u.scrollAuto,formatCopiedText:s.formatCopiedText,autofocus:s.autoFocus,disabled:s.disabled,readonly:s.readOnly,maxlength:s.maxLength,autoDetectCode:s.autoDetectCode,onChange:b=>{y.emit(t,"saveHistoryPos"),s.onChange?s.onChange(b):(e.emit("update:modelValue",b),e.emit("onChange",b))},onHtmlChanged:b=>{s.onHtmlChanged?s.onHtmlChanged(b):e.emit("onHtmlChanged",b)},onGetCatalog:b=>{s.onGetCatalog?s.onGetCatalog(b):e.emit("onGetCatalog",b)},onBlur:b=>{s.onBlur?s.onBlur(b):e.emit("onBlur",b)},onFocus:b=>{s.onFocus?s.onFocus(b):e.emit("onFocus",b)}},null),!n&&((v=s.footers)==null?void 0:v.length)>0&&l.createVNode(Si,{modelValue:s.modelValue,footers:s.footers,defFooters:w,scrollAuto:u.scrollAuto,onScrollAutoChange:b=>u.scrollAuto=b},null),m.value&&!n&&l.createVNode(Re,{theme:s.theme,style:{display:g.value?"block":"none"},class:`${c}-catalog-editor`,editorId:t,markedHeadingId:s.markedHeadingId},null)])}}}),Ni=()=>({title:{type:String,default:""},trigger:{type:[String,Object]},onClick:{type:Function}});var tt=l.defineComponent({name:"NormalToolbar",props:Ni(),emits:["onClick"],setup(s,e){return()=>{const t=ee({props:s,ctx:e},"trigger");return l.createVNode("div",{class:`${c}-toolbar-item`,title:s.title,onClick:n=>{s.onClick instanceof Function?s.onClick(n):e.emit("onClick",n)}},[t])}}});const Fi=()=>({title:{type:String,default:""},visible:{type:Boolean},trigger:{type:[String,Object]},onChange:{type:Function},overlay:{type:[String,Object]}});var nt=l.defineComponent({name:"DropdownToolbar",props:Fi(),emits:["onChange"],setup(s,e){const t=l.inject("editorId");return()=>{const n=ee({props:s,ctx:e},"trigger"),i=ee({props:s,ctx:e},"overlay");return l.createVNode(ge,{relative:`#${t}-toolbar-wrapper`,visible:s.visible,onChange:o=>{s.onChange instanceof Function?s.onChange(o):e.emit("onChange",o)},overlay:i},{default:()=>[l.createVNode("div",{class:`${c}-toolbar-item`,title:s.title||""},[n])]})}}});function Ai(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!l.isVNode(s)}const Vi=()=>({title:{type:String,default:""},modalTitle:{type:String,default:""},visible:{type:Boolean},width:{type:String,default:"auto"},height:{type:String,default:"auto"},trigger:{type:[String,Object]},onClick:{type:Function},onClose:{type:Function},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function}});var it=l.defineComponent({name:"ModalToolbar",props:Vi(),emits:["onClick","onClose","onAdjust"],setup(s,e){return()=>{const t=ee({props:s,ctx:e},"trigger"),n=ee({props:s,ctx:e},"default");return l.createVNode(l.Fragment,null,[l.createVNode("div",{class:`${c}-toolbar-item`,title:s.title,onClick:()=>{s.onClick instanceof Function?s.onClick():e.emit("onClick")}},[t]),l.createVNode(Ke,{width:s.width,height:s.height,title:s.modalTitle,visible:s.visible,onClose:()=>{s.onClose instanceof Function?s.onClose():e.emit("onClose")},showAdjust:s.showAdjust,isFullscreen:s.isFullscreen,onAdjust:i=>{s.onAdjust instanceof Function?s.onAdjust(i):e.emit("onAdjust",i)}},Ai(n)?n:{default:()=>[n]})])}}});return oe.install=s=>(s.component(oe.name,oe),s.component(tt.name,tt),s.component(nt.name,nt),s.component(Re.name,Re),s.component(it.name,it),s),oe.NormalToolbar=tt,oe.DropdownToolbar=nt,oe.MdCatalog=Re,oe.ModalToolbar=it,oe.config=Gt,oe});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "md-editor-v3",
3
- "version": "2.9.1",
3
+ "version": "2.9.3",
4
4
  "keywords": [
5
5
  "vue",
6
6
  "vue3",