md-editor-v3 2.10.0 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/md-editor-v3.cjs +125 -0
- package/lib/{md-editor-v3.js → md-editor-v3.mjs} +371 -380
- package/lib/md-editor-v3.umd.js +125 -0
- package/package.json +6 -5
- package/lib/md-editor-v3.umd.cjs +0 -125
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";var Hn=Object.defineProperty;var Pn=(s,e,t)=>e in s?Hn(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var te=(s,e,t)=>(Pn(s,typeof e!="symbol"?e+"":e,t),t),jt=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)};var c=(s,e,t)=>(jt(s,e,"read from private field"),t?t.call(s):e.get(s)),D=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},L=(s,e,t,n)=>(jt(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t),xt=(s,e,t,n)=>({set _(i){L(s,e,i,t)},get _(){return c(s,e,n)}}),_=(s,e,t)=>(jt(s,e,"access private method"),t);const r=require("vue"),d="md-editor",Mn="md-editor-v3",Bn="https://at.alicdn.com/t/c/font_2605852_u82y61ve02.js",Q="https://cdnjs.cloudflare.com/ajax/libs",Un=`${Q}/highlight.js/11.7.0/highlight.min.js`,tn={main:`${Q}/prettier/2.8.0/standalone.js`,markdown:`${Q}/prettier/2.8.0/parser-markdown.js`},nn={css:`${Q}/cropperjs/1.5.13/cropper.min.css`,js:`${Q}/cropperjs/1.5.13/cropper.min.js`},qn=`${Q}/screenfull.js/5.2.0/screenfull.min.js`,Sn=["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"],Cn=["markdownTotal","=","scrollSwitch"],sn={"zh-CN":{toolbarTips:{bold:"加粗",underline:"下划线",italic:"斜体",strikeThrough:"删除线",title:"标题",sub:"下标",sup:"上标",quote:"引用",unorderedList:"无序列表",orderedList:"有序列表",task:"任务列表",codeRow:"行内代码",code:"块级代码",link:"链接",image:"图片",table:"表格",mermaid:"mermaid图",katex:"katex公式",revoke:"后退",next:"前进",save:"保存",prettier:"美化",pageFullscreen:"浏览器全屏",fullscreen:"屏幕全屏",preview:"预览",htmlPreview:"html代码预览",catalog:"目录",github:"源码地址"},titleItem:{h1:"一级标题",h2:"二级标题",h3:"三级标题",h4:"四级标题",h5:"五级标题",h6:"六级标题"},imgTitleItem:{link:"添加链接",upload:"上传图片",clip2upload:"裁剪上传"},linkModalTips:{linkTitle:"添加链接",imageTitle:"添加图片",descLabel:"链接描述:",descLabelPlaceHolder:"请输入描述...",urlLabel:"链接地址:",urlLabelPlaceHolder:"请输入链接...",buttonOK:"确定"},clipModalTips:{title:"裁剪图片上传",buttonUpload:"上传"},copyCode:{text:"复制代码",successTips:"已复制!",failTips:"复制失败!"},mermaid:{flow:"流程图",sequence:"时序图",gantt:"甘特图",class:"类图",state:"状态图",pie:"饼图",relationship:"关系图",journey:"旅程图"},katex:{inline:"行内公式",block:"块级公式"},footer:{markdownTotal:"字数",scrollAuto:"同步滚动"}},"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"}}},Wn=`${Q}/mermaid/9.4.0/mermaid.min.js`,_t={js:`${Q}/KaTeX/0.16.3/katex.min.js`,css:`${Q}/KaTeX/0.16.3/katex.min.css`},ln={a11y:{light:`${Q}/highlight.js/11.7.0/styles/a11y-light.min.css`,dark:`${Q}/highlight.js/11.7.0/styles/a11y-dark.min.css`},atom:{light:`${Q}/highlight.js/11.7.0/styles/atom-one-light.min.css`,dark:`${Q}/highlight.js/11.7.0/styles/atom-one-dark.min.css`},github:{light:`${Q}/highlight.js/11.7.0/styles/github.min.css`,dark:`${Q}/highlight.js/11.7.0/styles/github-dark.min.css`},gradient:{light:`${Q}/highlight.js/11.7.0/styles/gradient-light.min.css`,dark:`${Q}/highlight.js/11.7.0/styles/gradient-dark.min.css`},kimbie:{light:`${Q}/highlight.js/11.7.0/styles/kimbie-light.min.css`,dark:`${Q}/highlight.js/11.7.0/styles/kimbie-dark.min.css`},paraiso:{light:`${Q}/highlight.js/11.7.0/styles/paraiso-light.min.css`,dark:`${Q}/highlight.js/11.7.0/styles/paraiso-dark.min.css`},qtcreator:{light:`${Q}/highlight.js/11.7.0/styles/qtcreator-light.min.css`,dark:`${Q}/highlight.js/11.7.0/styles/qtcreator-dark.min.css`},stackoverflow:{light:`${Q}/highlight.js/11.7.0/styles/stackoverflow-light.min.css`,dark:`${Q}/highlight.js/11.7.0/styles/stackoverflow-dark.min.css`}},J={markedRenderer:s=>s,markedExtensions:[],markedOptions:{},editorExtensions:{},editorConfig:{}},Kn=s=>{if(s)for(const e in s){const t=s[e];t&&(J[e]=t)}};class Gn{constructor(){te(this,"pools",{})}remove(e,t,n){const l=this.pools[e]&&this.pools[e][t];l&&(this.pools[e][t]=l.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 l=this.pools[e][t];l&&l.forEach(a=>{try{a(...n)}catch(o){console.error(`${t} monitor event exception!`,o)}})}}const x=new Gn,_e=(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())}),Dt=(s,e,t)=>{const{deviationStart:n=0,deviationEnd:i=0,direct:l=!1,select:a=!1}=t;let o="";if(s.selectionStart||s.selectionStart===0){const u=s.selectionStart,f=s.selectionEnd||0,{prefixVal:h=s.value.substring(0,u),subfixVal:m=s.value.substring(f,s.value.length)}=t;o=h+e+m,_e(s,a?u+n:u+e.length+i,u+e.length+i)}else o+=e;return l&&(s.value=o),o},Zn=(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)},on=(s,e)=>{const t=Rt(()=>{s.removeEventListener("scroll",n),s.addEventListener("scroll",n),e.removeEventListener("scroll",n),e.addEventListener("scroll",n)},50),n=i=>{const l=s.clientHeight,a=e.clientHeight,o=s.scrollHeight,u=e.scrollHeight,f=(o-l)/(u-a);i.target===s?(e.removeEventListener("scroll",n),e.scrollTo({top:s.scrollTop/f}),t()):(s.removeEventListener("scroll",n),s.scrollTo({top:e.scrollTop*f}),t())};return[()=>{t().finally(()=>{s.dispatchEvent(new Event("scroll"))})},()=>{s.removeEventListener("scroll",n),e.removeEventListener("scroll",n)}]},Xn=(s,e="image.png")=>{const t=s.split(","),n=t[0].match(/:(.*?);/);if(n){const i=n[1],l=atob(t[1]);let a=l.length;const o=new Uint8Array(a);for(;a--;)o[a]=l.charCodeAt(a);return new File([o],e,{type:i})}return null},rn=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("")}`},Rt=(s,e=200)=>{let t=0;return(...n)=>new Promise(i=>{t&&(clearTimeout(t),i("cancel")),t=window.setTimeout(()=>{s.apply(void 0,n),t=0,i("done")},e)})},Qn=(s,e=200)=>{let t=0,n=null;return(...i)=>{const l=a=>{t===0&&(t=a),a-t>=e?(s.apply(void 0,n),n=null,t=0):window.requestAnimationFrame(l)};n===null&&window.requestAnimationFrame(l),n=i}},an=(s,e="$")=>{const t=s.split(e);let n=e,i="";for(let l=1;l<t.length;l++)if(/\\$/.test(t[l]))n+=t[l]+"$",i+=t[l]+"$";else{n+=t[l]+e,i+=t[l];break}return[n,i]},Yn=s=>{var t;return navigator.userAgent.indexOf("Firefox")>-1?s.value.substring(s.selectionStart,s.selectionEnd):((t=window.getSelection())==null?void 0:t.toString())||""},Jn=(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},ei=(s,e)=>{const t={...s};return e.forEach(n=>{Reflect.deleteProperty(t,n)}),t},ti=()=>`${Date.now().toString(36)}${Math.random().toString(36).substring(2)}`,cn=(s,e)=>{const t=n=>{const i=s.parentElement||document.body,l=i.offsetWidth,a=i.offsetHeight,{clientWidth:o}=document.documentElement,{clientHeight:u}=document.documentElement,f=n.offsetX,h=n.offsetY,m=g=>{let $=g.x+document.body.scrollLeft-document.body.clientLeft-f,b=g.y+document.body.scrollTop-document.body.clientTop-h;$=$<1?1:$<o-l-1?$:o-l-1,b=b<1?1:b<u-a-1?b:u-a-1,e?e($,b):(i.style.left=`${$}px`,i.style.top=`${b}px`)};document.addEventListener("mousemove",m);const v=()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",v)};document.addEventListener("mouseup",v)};return s.addEventListener("mousedown",t),()=>{s.removeEventListener("mousedown",t)}},pe=(s,e="")=>{const t=document.getElementById(s.id),n=i=>{typeof s.onload=="function"&&s.onload(i),s.removeEventListener("load",n)};t?e!==""&&typeof s.onload=="function"&&(Reflect.get(window,e)?s.dispatchEvent(new Event("load")):t.addEventListener("load",n)):(s.addEventListener("load",n),document.head.appendChild(s))},ni=Rt((s,e,t)=>{const n=document.getElementById(s);n&&n.setAttribute(e,t)},10),At="onSave",Gt="changeCatalogVisible",Tn="changeFullscreen",un="pageFullscreenChanged",dn="fullscreenChanged",Ht="previewChanged",hn="htmlPreviewChanged",fn="catalogVisibleChanged",En="textareaFocus",ii=(s,e)=>{const{editorId:t,noPrettier:n,previewOnly:i}=s,l=r.reactive({buildFinished:!1,html:""}),a=o=>{if(o.target===document.querySelector(`#${s.editorId}-textarea`))if(x.emit(t,"selectTextChange"),o.ctrlKey||o.metaKey)switch(o.code){case"KeyS":{o.shiftKey?x.emit(t,"replace","strikeThrough"):(x.emit(t,At,s.modelValue),o.preventDefault());break}case"KeyB":{x.emit(t,"replace","bold"),o.preventDefault();break}case"KeyU":{o.shiftKey?(x.emit(t,"replace","unorderedList"),o.preventDefault()):(x.emit(t,"replace","underline"),o.preventDefault());break}case"KeyI":{o.shiftKey?(x.emit(t,"openModals","image"),o.preventDefault()):(x.emit(t,"replace","italic"),o.preventDefault());break}case"Digit1":{x.emit(t,"replace","h1"),o.preventDefault();break}case"Digit2":{x.emit(t,"replace","h2"),o.preventDefault();break}case"Digit3":{x.emit(t,"replace","h3"),o.preventDefault();break}case"Digit4":{x.emit(t,"replace","h4"),o.preventDefault();break}case"Digit5":{x.emit(t,"replace","h5"),o.preventDefault();break}case"Digit6":{x.emit(t,"replace","h6"),o.preventDefault();break}case"ArrowUp":{x.emit(t,"replace","sup"),o.preventDefault();break}case"ArrowDown":{x.emit(t,"replace","sub"),o.preventDefault();break}case"KeyQ":{if(o.key==="a"){o.target.select();return}x.emit(t,"replace","quote"),o.preventDefault();break}case"KeyA":if(o.key==="q"){x.emit(t,"replace","quote"),o.preventDefault();break}else return;case"KeyO":{x.emit(t,"replace","orderedList"),o.preventDefault();break}case"KeyC":{if(o.shiftKey)x.emit(t,"replace","code"),o.preventDefault();else if(o.altKey)x.emit(t,"replace","codeRow"),o.preventDefault();else{o.preventDefault(),x.emit(t,"replace","ctrlC");break}break}case"KeyL":{x.emit(t,"openModals","link"),o.preventDefault();break}case"KeyZ":{if(o.key==="w")return;o.shiftKey?(x.emit(t,"ctrlShiftZ"),o.preventDefault()):(x.emit(t,"ctrlZ"),o.preventDefault());break}case"KeyW":if(o.key==="z"){o.shiftKey?(x.emit(t,"ctrlShiftZ"),o.preventDefault()):(x.emit(t,"ctrlZ"),o.preventDefault());break}else return;case"KeyF":{o.shiftKey&&(n||(x.emit(t,"replace","prettier"),o.preventDefault()));break}case"KeyT":{o.altKey&&o.shiftKey&&(x.emit(t,"replace","table"),o.preventDefault());break}case"KeyX":{x.emit(t,"replace","ctrlX"),o.preventDefault();break}case"KeyD":{o.preventDefault(),x.emit(t,"replace","ctrlD");break}}else o.code==="Tab"&&(o.preventDefault(),o.shiftKey?x.emit(t,"replace","shiftTab"):x.emit(t,"replace","tab"))};r.watch(()=>s.modelValue,()=>{l.buildFinished=!1}),r.onMounted(()=>{i||(window.addEventListener("keydown",a),x.on(t,{name:"buildFinished",callback(o){l.buildFinished=!0,l.html=o}}),x.on(t,{name:At,callback(){const o=new Promise(u=>{if(l.buildFinished)u(l.html);else{const f=h=>{u(h),x.remove(t,"buildFinished",f)};x.on(t,{name:"buildFinished",callback:f})}});s.onSave?s.onSave(s.modelValue,o):e.emit("onSave",s.modelValue,o)}}))}),r.onBeforeUnmount(()=>{i||window.removeEventListener("keydown",a)})},si=s=>{var l;const{editorId:e,previewOnly:t}=s,n=(l=J==null?void 0:J.editorExtensions)==null?void 0:l.highlight;r.provide("editorId",e),r.provide("tabWidth",s.tabWidth),r.provide("theme",r.computed(()=>s.theme)),r.provide("highlight",r.computed(()=>{const a={...ln,...n==null?void 0:n.css},o=s.codeStyleReverse&&s.codeStyleReverseList.includes(s.previewTheme)?"dark":s.theme;return{js:(n==null?void 0:n.js)||Un,css:a[s.codeTheme]?a[s.codeTheme][o]:ln.atom[o]}})),r.provide("historyLength",s.historyLength),r.provide("previewOnly",t),r.provide("showCodeRowNumber",s.showCodeRowNumber);const i=r.computed(()=>{var o;const a={...sn,...(o=J==null?void 0:J.editorConfig)==null?void 0:o.languageUserDefined};return a[s.language]?a[s.language]:sn["zh-CN"]});r.provide("usedLanguageText",i),r.provide("previewTheme",r.computed(()=>s.previewTheme))},li=s=>{var f,h,m,v,g,$;const{noPrettier:e,previewOnly:t,noIconfont:n,noUploadImg:i}=s,{editorExtensions:l}=J,a=e||!!((h=(f=J.editorExtensions)==null?void 0:f.prettier)!=null&&h.prettierInstance),o=e||!!((v=(m=J.editorExtensions)==null?void 0:m.prettier)!=null&&v.parserMarkdownInstance),u=i||!!(($=(g=J.editorExtensions)==null?void 0:g.cropper)!=null&&$.instance);r.onMounted(()=>{var C,V,H,T;const b=document.createElement("script");b.src=(l==null?void 0:l.iconfont)||Bn,b.id=`${d}-icon`;const k=document.createElement("script"),p=document.createElement("script");k.src=((C=l==null?void 0:l.prettier)==null?void 0:C.standaloneJs)||tn.main,k.id=`${d}-prettier`,p.src=((V=l==null?void 0:l.prettier)==null?void 0:V.parserMarkdownJs)||tn.markdown,p.id=`${d}-prettierMD`;const w=document.createElement("link");w.rel="stylesheet",w.href=((H=l==null?void 0:l.cropper)==null?void 0:H.css)||nn.css,w.id=`${d}-cropperCss`;const S=document.createElement("script");S.src=((T=l==null?void 0:l.cropper)==null?void 0:T.js)||nn.js,S.id=`${d}-cropper`,n||pe(b),t||(u||(pe(w),pe(S)),a||pe(k),o||pe(p))})},oi=(s,e)=>{const{editorId:t,previewOnly:n}=s,i=r.reactive({pageFullscreen:s.pageFullscreen,fullscreen:!1,preview:s.preview,htmlPreview:s.preview?!1:s.htmlPreview}),l=(u,f)=>{i[u]=f===void 0?!i[u]:f,u==="preview"&&i.preview?i.htmlPreview=!1:u==="htmlPreview"&&i.htmlPreview&&(i.preview=!1)};let a="";const o=()=>{i.pageFullscreen||i.fullscreen?document.body.style.overflow="hidden":document.body.style.overflow=a};return r.watch(()=>[i.pageFullscreen,i.fullscreen],o),r.onMounted(()=>{n||x.on(t,{name:"uploadImage",callback(u,f){const h=m=>{x.emit(t,"replace","image",{desc:"",urls:m}),f&&f()};s.onUploadImg?s.onUploadImg(u,h):e.emit("onUploadImg",u,h)}}),a=document.body.style.overflow,o()}),[i,l]},ri=s=>{const{editorId:e}=s,t=r.ref(!1);r.onMounted(()=>{x.on(e,{name:Gt,callback:i=>{i===void 0?t.value=!t.value:t.value=i}})});const n=r.computed(()=>!s.toolbarsExclude.includes("catalog")&&s.toolbars.includes("catalog"));return[t,n]},ai=(s,e,t,n,i)=>{const{editorId:l}=s;r.watch(()=>n.pageFullscreen,o=>{x.emit(l,un,o)}),r.watch(()=>n.fullscreen,o=>{x.emit(l,dn,o)}),r.watch(()=>n.preview,o=>{x.emit(l,Ht,o)}),r.watch(()=>n.htmlPreview,o=>{x.emit(l,hn,o)}),r.watch(t,o=>{x.emit(l,fn,o)});const a={on(o,u){switch(o){case"pageFullscreen":{x.on(l,{name:un,callback(f){u(f)}});break}case"fullscreen":{x.on(l,{name:dn,callback(f){u(f)}});break}case"preview":{x.on(l,{name:Ht,callback(f){u(f)}});break}case"htmlPreview":{x.on(l,{name:hn,callback(f){u(f)}});break}case"catalog":{x.on(l,{name:fn,callback(f){u(f)}});break}}},togglePageFullscreen(o){i("pageFullscreen",o)},toggleFullscreen(o){x.emit(l,Tn,o)},togglePreview(o){i("preview",o)},toggleHtmlPreview(o){i("htmlPreview",o)},toggleCatalog(o){x.emit(l,Gt,o)},triggerSave(){x.emit(l,At)},insert(o){x.emit(l,"replace","universal",{generate:o})},focus(){x.emit(l,En)}};e.expose(a)};const ci=r.defineComponent({setup(){return()=>r.createVNode("div",{class:`${d}-divider`},null)}}),xe=({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]};const ui=()=>({trigger:{type:String,default:"hover"},overlay:{type:[String,Object],default:""},visible:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}},relative:{type:String,default:"html"}}),Ye=r.defineComponent({props:ui(),setup(s,e){const t=`${d}-dropdown-hidden`,n=r.reactive({overlayClass:[t],overlayStyle:{},triggerHover:!1,overlayHover:!1}),i=r.ref(),l=r.ref(),a=()=>{var S;s.trigger==="hover"&&(n.triggerHover=!0);const m=i.value,v=l.value,g=m.getBoundingClientRect(),$=m.offsetTop,b=m.offsetLeft,k=g.height,p=g.width,w=((S=document.querySelector(s.relative))==null?void 0:S.scrollLeft)||0;n.overlayStyle={...n.overlayStyle,top:$+k+"px",left:b-v.offsetWidth/2+p/2-w+"px"},s.onChange(!0)},o=()=>{n.overlayHover=!0};r.watch(()=>s.visible,m=>{m?n.overlayClass=n.overlayClass.filter(v=>v!==t):n.overlayClass.push(t)});const u=m=>{const v=i.value,g=l.value;!v.contains(m.target)&&!g.contains(m.target)&&s.onChange(!1)};let f=-1;const h=m=>{i.value===m.target?n.triggerHover=!1:n.overlayHover=!1,clearTimeout(f),f=window.setTimeout(()=>{!n.overlayHover&&!n.triggerHover&&s.onChange(!1)},10)};return r.onMounted(()=>{s.trigger==="click"?(i.value.addEventListener("click",a),document.addEventListener("click",u)):(i.value.addEventListener("mouseenter",a),i.value.addEventListener("mouseleave",h),l.value.addEventListener("mouseenter",o),l.value.addEventListener("mouseleave",h))}),r.onBeforeUnmount(()=>{s.trigger==="click"?(i.value.removeEventListener("click",a),document.removeEventListener("click",u)):(i.value.removeEventListener("mouseenter",a),i.value.removeEventListener("mouseleave",h),l.value.removeEventListener("mouseenter",o),l.value.removeEventListener("mouseleave",h))}),()=>{const m=xe({ctx:e}),v=xe({props:s,ctx:e},"overlay"),g=r.cloneVNode(m instanceof Array?m[0]:m,{ref:i}),$=r.createVNode("div",{class:[`${d}-dropdown`,n.overlayClass],style:n.overlayStyle,ref:l},[r.createVNode("div",{class:`${d}-dropdown-overlay`},[v instanceof Array?v[0]:v])]);return[g,$]}}});const di=()=>({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}}),Zt=r.defineComponent({props:di(),setup(s,e){const t=r.ref(s.visible),n=r.ref([`${d}-modal`]),i=r.ref(),l=r.ref();let a=()=>{};const o=r.reactive({initPos:{left:"0px",top:"0px"},historyPos:{left:"0px",top:"0px"}}),u=r.computed(()=>s.isFullscreen?{width:"100%",height:"100%"}:{width:s.width,height:s.height});return r.onMounted(()=>{a=cn(l.value,(f,h)=>{o.initPos.left=f+"px",o.initPos.top=h+"px"})}),r.onBeforeUnmount(()=>{a()}),r.watch(()=>s.isFullscreen,f=>{f?a():a=cn(l.value,(h,m)=>{o.initPos.left=h+"px",o.initPos.top=m+"px"})}),r.watch(()=>s.visible,f=>{f?(n.value.push("zoom-in"),t.value=f,r.nextTick(()=>{const h=i.value.offsetWidth/2,m=i.value.offsetHeight/2,v=document.documentElement.clientWidth/2,g=document.documentElement.clientHeight/2;o.initPos.left=v-h+"px",o.initPos.top=g-m+"px"}),setTimeout(()=>{n.value=n.value.filter(h=>h!=="zoom-in")},140)):(n.value.push("zoom-out"),setTimeout(()=>{n.value=n.value.filter(h=>h!=="zoom-out"),t.value=f},130))}),()=>{const f=xe({ctx:e}),h=xe({props:s,ctx:e},"title");return r.createVNode("div",{class:[s.class],style:{display:t.value?"block":"none"}},[r.createVNode("div",{class:`${d}-modal-mask`,onClick:s.onClose},null),r.createVNode("div",{class:n.value,style:{...o.initPos,...u.value},ref:i},[r.createVNode("div",{class:`${d}-modal-header`,ref:l},[h||""]),r.createVNode("div",{class:`${d}-modal-body`},[f]),r.createVNode("div",{class:`${d}-modal-func`},[s.showAdjust&&r.createVNode("div",{class:`${d}-modal-adjust`,onClick:m=>{m.stopPropagation(),s.isFullscreen?o.initPos=o.historyPos:(o.historyPos=o.initPos,o.initPos={left:"0",top:"0"}),s.onAdjust(!s.isFullscreen)}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":`#md-editor-icon-${s.isFullscreen?"suoxiao":"fangda"}`},null)])]),r.createVNode("div",{class:`${d}-modal-close`,onClick:m=>{m.stopPropagation(),s.onClose&&s.onClose()}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-close"},null)])])])])])}}}),hi=()=>({type:{type:String,default:"link"},visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}}),fi=r.defineComponent({props:hi(),setup(s){const e=r.inject("usedLanguageText"),t=r.inject("editorId"),n=r.computed(()=>{var l,a;switch(s.type){case"link":return(l=e.value.linkModalTips)==null?void 0:l.linkTitle;case"image":return(a=e.value.linkModalTips)==null?void 0:a.imageTitle;default:return""}}),i=r.reactive({desc:"",url:""});return r.watch(()=>s.visible,l=>{l||setTimeout(()=>{i.desc="",i.url=""},200)}),()=>r.createVNode(Zt,{title:n.value,visible:s.visible,onClose:s.onCancel},{default:()=>{var l,a,o,u,f;return[r.createVNode("div",{class:`${d}-form-item`},[r.createVNode("label",{class:`${d}-label`,for:`link-desc-${t}`},[(l=e.value.linkModalTips)==null?void 0:l.descLabel]),r.createVNode("input",{placeholder:(a=e.value.linkModalTips)==null?void 0:a.descLabelPlaceHolder,class:`${d}-input`,id:`link-desc-${t}`,type:"text",value:i.desc,onChange:h=>{i.desc=h.target.value},autocomplete:"off"},null)]),r.createVNode("div",{class:`${d}-form-item`},[r.createVNode("label",{class:`${d}-label`,for:`link-url-${t}`},[(o=e.value.linkModalTips)==null?void 0:o.urlLabel]),r.createVNode("input",{placeholder:(u=e.value.linkModalTips)==null?void 0:u.urlLabelPlaceHolder,class:`${d}-input`,id:`link-url-${t}`,type:"text",value:i.url,onChange:h=>{i.url=h.target.value},autocomplete:"off"},null)]),r.createVNode("div",{class:`${d}-form-item`},[r.createVNode("button",{class:[`${d}-btn`,`${d}-btn-row`],type:"button",onClick:()=>{s.onOk(i),i.desc="",i.url=""}},[(f=e.value.linkModalTips)==null?void 0:f.buttonOK])])]}})}});const mi=()=>({visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}}),gi=r.defineComponent({props:mi(),setup(s){var h,m;const e=r.inject("usedLanguageText"),t=r.inject("editorId");let n=(m=(h=J==null?void 0:J.editorExtensions)==null?void 0:h.cropper)==null?void 0:m.instance;const i=r.ref(),l=r.ref(),a=r.ref(),o=r.reactive({cropperInited:!1,imgSelected:!1,imgSrc:"",isFullscreen:!1});let u=null;r.watch(()=>s.visible,()=>{s.visible&&!o.cropperInited&&(n=n||window.Cropper,i.value.onchange=()=>{if(!n){x.emit(t,"errorCatcher",{name:"Cropper",message:"Cropper is undefined"});return}const v=i.value.files||[];if(o.imgSelected=!0,(v==null?void 0:v.length)>0){const g=new FileReader;g.onload=$=>{o.imgSrc=$.target.result,r.nextTick(()=>{u=new n(l.value,{viewMode:2,preview:`.${d}-clip-preview-target`})})},g.readAsDataURL(v[0])}})}),r.watch(()=>[o.imgSelected],()=>{a.value.style=""}),r.watch(()=>o.isFullscreen,()=>{r.nextTick(()=>{u==null||u.destroy(),a.value.style="",l.value&&(u=new n(l.value,{viewMode:2,preview:`.${d}-clip-preview-target`}))})});const f=()=>{u.clear(),u.destroy(),u=null,i.value.value="",o.imgSelected=!1};return()=>{var v;return r.createVNode(Zt,{class:`${d}-modal-clip`,title:(v=e.value.clipModalTips)==null?void 0:v.title,visible:s.visible,onClose:s.onCancel,showAdjust:!0,isFullscreen:o.isFullscreen,onAdjust:g=>{o.isFullscreen=g},width:"668px",height:"421px"},{default:()=>{var g,$;return[r.createVNode("div",{class:`${d}-form-item ${d}-clip`},[r.createVNode("div",{class:`${d}-clip-main`},[o.imgSelected?r.createVNode("div",{class:`${d}-clip-cropper`},[r.createVNode("img",{src:o.imgSrc,ref:l,style:{display:"none"},alt:""},null),r.createVNode("div",{class:`${d}-clip-delete`,onClick:f},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-delete"},null)])])]):r.createVNode("div",{class:`${d}-clip-upload`,onClick:()=>{i.value.click()}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-upload"},null)])])]),r.createVNode("div",{class:`${d}-clip-preview`},[r.createVNode("div",{class:`${d}-clip-preview-target`,ref:a},null)])]),r.createVNode("div",{class:`${d}-form-item`},[r.createVNode("button",{class:`${d}-btn`,type:"button",onClick:()=>{if(u){const b=u.getCroppedCanvas();x.emit(t,"uploadImage",[Xn(b.toDataURL("image/png"))],s.onOk),f()}}},[((g=e.value.clipModalTips)==null?void 0:g.buttonUpload)||(($=e.value.linkModalTips)==null?void 0:$.buttonOK)])]),r.createVNode("input",{ref:i,accept:"image/*",type:"file",multiple:!1,style:{display:"none"}},null)]}})}}}),pi=()=>({type:{type:String,default:"link"},linkVisible:{type:Boolean,default:!1},clipVisible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>{}},onOk:{type:Function,default:()=>{}}}),vi=r.defineComponent({props:pi(),setup(s){return()=>r.createVNode(r.Fragment,null,[r.createVNode(fi,{type:s.type,visible:s.linkVisible,onOk:s.onOk,onCancel:s.onCancel},null),r.createVNode(gi,{visible:s.clipVisible,onOk:s.onOk,onCancel:s.onCancel},null)])}}),bi=s=>{var u,f,h,m;const e=r.inject("editorId");let t=(f=(u=J.editorExtensions)==null?void 0:u.screenfull)==null?void 0:f.instance;const n=(m=(h=J.editorExtensions)==null?void 0:h.screenfull)==null?void 0:m.js,i=r.ref(!1),l=v=>{if(!t){x.emit(e,"errorCatcher",{name:"fullscreen",message:"fullscreen is undefined"});return}t.isEnabled?(i.value=!0,(v===void 0?!t.isFullscreen:v)?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"))})},o=()=>{t=window.screenfull,a()};return r.onMounted(()=>{if(a(),!t){const v=document.createElement("script");v.src=n||qn,v.onload=o,v.id=`${d}-screenfull`,pe(v,"screenfull")}}),r.onMounted(()=>{x.on(e,{name:Tn,callback:l})}),{fullscreenHandler:l}},ki=()=>({tableShape:{type:Array,default:()=>[6,4]},onSelected:{type:Function,default:()=>{}}}),yi=r.defineComponent({name:"TableShape",props:ki(),setup(s){const e=r.reactive({x:-1,y:-1});return()=>r.createVNode("div",{class:`${d}-table-shape`,onMouseleave:()=>{e.x=-1,e.y=-1}},[new Array(s.tableShape[1]).fill("").map((t,n)=>r.createVNode("div",{class:`${d}-table-shape-row`,key:`table-shape-row-${n}`},[new Array(s.tableShape[0]).fill("").map((i,l)=>r.createVNode("div",{class:`${d}-table-shape-col`,key:`table-shape-col-${l}`,onMouseenter:()=>{e.x=n,e.y=l},onClick:()=>{s.onSelected(e)}},[r.createVNode("div",{class:[`${d}-table-shape-col-default`,n<=e.x&&l<=e.y&&`${d}-table-shape-col-include`]},null)]))]))])}}),wi=()=>({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}}),xi=r.defineComponent({name:"MDEditorToolbar",props:wi(),setup(s){const e=r.inject("editorId"),t=r.inject("usedLanguageText"),{fullscreenHandler:n}=bi(s),i=`${e}-toolbar-wrapper`,l=r.reactive({title:!1,catalog:!1,image:!1,table:!1,mermaid:!1,katex:!1}),a=(g,$)=>{x.emit(e,"replace",g,$)},o=r.reactive({type:"link",linkVisible:!1,clipVisible:!1}),u=r.ref();r.onMounted(()=>{x.on(e,{name:"openModals",callback(g){o.type=g,o.linkVisible=!0}})});const f=r.computed(()=>{const g=s.toolbars.filter(p=>!s.toolbarsExclude.includes(p)),$=g.indexOf("="),b=$===-1?g:g.slice(0,$+1),k=$===-1?[]:g.slice($,Number.MAX_SAFE_INTEGER);return[b,k]}),h=r.ref(),m=()=>{x.emit(e,"uploadImage",Array.from(h.value.files||[])),h.value.value=""};r.onMounted(()=>{h.value.addEventListener("change",m)});const v=g=>{var $,b,k,p,w,S,C,V,H,T,y,G,U,B,z,F,P,q,j,ee,I,R,M,se,oe,he,Se,Ve,Me,je,Be,pt,vt,Ge,Ze,bt,kt,Xe,yt,wt,ot,Jt,en;if(Sn.includes(g))switch(g){case"-":return r.createVNode(ci,null,null);case"bold":return r.createVNode("div",{class:`${d}-toolbar-item`,title:($=t.value.toolbarTips)==null?void 0:$.bold,onClick:()=>{a("bold")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-bold"},null)])]);case"underline":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(b=t.value.toolbarTips)==null?void 0:b.underline,onClick:()=>{a("underline")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-underline"},null)])]);case"italic":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(k=t.value.toolbarTips)==null?void 0:k.italic,onClick:()=>{a("italic")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-italic"},null)])]);case"strikeThrough":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(p=t.value.toolbarTips)==null?void 0:p.strikeThrough,onClick:()=>{a("strikeThrough")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-strike-through"},null)])]);case"title":return r.createVNode(Ye,{relative:`#${i}`,visible:l.title,onChange:W=>{l.title=W},overlay:r.createVNode("ul",{class:`${d}-menu`,onClick:()=>{l.title=!1}},[r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("h1")}},[(w=t.value.titleItem)==null?void 0:w.h1]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("h2")}},[(S=t.value.titleItem)==null?void 0:S.h2]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("h3")}},[(C=t.value.titleItem)==null?void 0:C.h3]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("h4")}},[(V=t.value.titleItem)==null?void 0:V.h4]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("h5")}},[(H=t.value.titleItem)==null?void 0:H.h5]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("h6")}},[(T=t.value.titleItem)==null?void 0:T.h6])])},{default:()=>{var W;return[r.createVNode("div",{class:`${d}-toolbar-item`,title:(W=t.value.toolbarTips)==null?void 0:W.title},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-title"},null)])])]}});case"sub":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(y=t.value.toolbarTips)==null?void 0:y.sub,onClick:()=>{a("sub")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-sub"},null)])]);case"sup":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(G=t.value.toolbarTips)==null?void 0:G.sup,onClick:()=>{a("sup")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-sup"},null)])]);case"quote":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(U=t.value.toolbarTips)==null?void 0:U.quote,onClick:()=>{a("quote")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-quote"},null)])]);case"unorderedList":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(B=t.value.toolbarTips)==null?void 0:B.unorderedList,onClick:()=>{a("unorderedList")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-unordered-list"},null)])]);case"orderedList":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(z=t.value.toolbarTips)==null?void 0:z.orderedList,onClick:()=>{a("orderedList")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-ordered-list"},null)])]);case"task":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(F=t.value.toolbarTips)==null?void 0:F.task,onClick:()=>{a("task")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-task"},null)])]);case"codeRow":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(P=t.value.toolbarTips)==null?void 0:P.codeRow,onClick:()=>{a("codeRow")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-code-row"},null)])]);case"code":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(q=t.value.toolbarTips)==null?void 0:q.code,onClick:()=>{a("code")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-code"},null)])]);case"link":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(j=t.value.toolbarTips)==null?void 0:j.link,onClick:()=>{o.type="link",o.linkVisible=!0}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-link"},null)])]);case"image":return s.noUploadImg?r.createVNode("div",{class:`${d}-toolbar-item`,title:(ee=t.value.toolbarTips)==null?void 0:ee.image,onClick:()=>{o.type="image",o.linkVisible=!0}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-image"},null)])]):r.createVNode(Ye,{relative:`#${i}`,visible:l.image,onChange:W=>{l.image=W},overlay:r.createVNode("ul",{class:`${d}-menu`,onClick:()=>{l.title=!1}},[r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o.type="image",o.linkVisible=!0}},[(I=t.value.imgTitleItem)==null?void 0:I.link]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{h.value.click()}},[(R=t.value.imgTitleItem)==null?void 0:R.upload]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o.clipVisible=!0}},[(M=t.value.imgTitleItem)==null?void 0:M.clip2upload])])},{default:()=>{var W;return[r.createVNode("div",{class:`${d}-toolbar-item`,title:(W=t.value.toolbarTips)==null?void 0:W.image},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-image"},null)])])]}});case"table":return r.createVNode(Ye,{relative:`#${i}`,visible:l.table,onChange:W=>{l.table=W},key:"bar-table",overlay:r.createVNode(yi,{tableShape:s.tableShape,onSelected:W=>{a("table",{selectedShape:W})}},null)},{default:()=>{var W;return[r.createVNode("div",{class:`${d}-toolbar-item`,title:(W=t.value.toolbarTips)==null?void 0:W.table},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-table"},null)])])]}});case"revoke":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(se=t.value.toolbarTips)==null?void 0:se.revoke,onClick:()=>{x.emit(e,"ctrlZ")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-revoke"},null)])]);case"next":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(oe=t.value.toolbarTips)==null?void 0:oe.next,onClick:()=>{x.emit(e,"ctrlShiftZ")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-next"},null)])]);case"save":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(he=t.value.toolbarTips)==null?void 0:he.save,onClick:()=>{x.emit(e,At)}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-baocun"},null)])]);case"prettier":return s.noPrettier?"":r.createVNode("div",{class:`${d}-toolbar-item`,title:(Se=t.value.toolbarTips)==null?void 0:Se.prettier,onClick:()=>{a("prettier")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-prettier"},null)])]);case"pageFullscreen":return!s.setting.fullscreen&&r.createVNode("div",{class:`${d}-toolbar-item`,title:(Ve=t.value.toolbarTips)==null?void 0:Ve.pageFullscreen,onClick:()=>{s.updateSetting("pageFullscreen")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":`#md-editor-icon-${s.setting.pageFullscreen?"suoxiao":"fangda"}`},null)])]);case"fullscreen":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Me=t.value.toolbarTips)==null?void 0:Me.fullscreen,onClick:()=>{n()}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":`#md-editor-icon-${s.setting.fullscreen?"fullscreen-exit":"fullscreen"}`},null)])]);case"preview":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(je=t.value.toolbarTips)==null?void 0:je.preview,onClick:()=>{s.updateSetting("preview")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-preview"},null)])]);case"htmlPreview":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Be=t.value.toolbarTips)==null?void 0:Be.htmlPreview,onClick:()=>{s.updateSetting("htmlPreview")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-coding"},null)])]);case"catalog":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(pt=t.value.toolbarTips)==null?void 0:pt.catalog,onClick:()=>{x.emit(e,Gt)},key:"bar-catalog"},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-catalog"},null)])]);case"github":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(vt=t.value.toolbarTips)==null?void 0:vt.github,onClick:()=>Zn("https://github.com/imzbf/md-editor-v3")},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-github"},null)])]);case"mermaid":return r.createVNode(Ye,{relative:`#${i}`,visible:l.mermaid,onChange:W=>{l.mermaid=W},overlay:r.createVNode("ul",{class:`${d}-menu`,onClick:()=>{l.mermaid=!1}},[r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("flow")}},[(Ge=t.value.mermaid)==null?void 0:Ge.flow]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("sequence")}},[(Ze=t.value.mermaid)==null?void 0:Ze.sequence]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("gantt")}},[(bt=t.value.mermaid)==null?void 0:bt.gantt]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("class")}},[(kt=t.value.mermaid)==null?void 0:kt.class]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("state")}},[(Xe=t.value.mermaid)==null?void 0:Xe.state]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("pie")}},[(yt=t.value.mermaid)==null?void 0:yt.pie]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("relationship")}},[(wt=t.value.mermaid)==null?void 0:wt.relationship]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("journey")}},[(ot=t.value.mermaid)==null?void 0:ot.journey])]),key:"bar-mermaid"},{default:()=>{var W;return[r.createVNode("div",{class:`${d}-toolbar-item`,title:(W=t.value.toolbarTips)==null?void 0:W.mermaid},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-mermaid"},null)])])]}});case"katex":return r.createVNode(Ye,{relative:`#${i}`,visible:l.katex,onChange:W=>{l.katex=W},overlay:r.createVNode("ul",{class:`${d}-menu`,onClick:()=>{l.katex=!1}},[r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("katexInline")}},[(Jt=t.value.katex)==null?void 0:Jt.inline]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{a("katexBlock")}},[(en=t.value.katex)==null?void 0:en.block])]),key:"bar-katex"},{default:()=>{var W;return[r.createVNode("div",{class:`${d}-toolbar-item`,title:(W=t.value.toolbarTips)==null?void 0:W.katex},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#md-editor-icon-formula"},null)])])]}})}else return s.defToolbars instanceof Array?s.defToolbars[g]||"":s.defToolbars&&s.defToolbars.children instanceof Array&&s.defToolbars.children[g]||""};return()=>{const g=f.value[0].map(b=>v(b)),$=f.value[1].map(b=>v(b));return r.createVNode(r.Fragment,null,[s.toolbars.length>0&&r.createVNode("div",{class:`${d}-toolbar-wrapper`,id:i},[r.createVNode("div",{class:`${d}-toolbar`},[r.createVNode("div",{class:`${d}-toolbar-left`,ref:u},[g]),r.createVNode("div",{class:`${d}-toolbar-right`},[$])])]),r.createVNode("input",{ref:h,accept:"image/*",type:"file",multiple:!0,style:{display:"none"}},null),r.createVNode(vi,{linkVisible:o.linkVisible,clipVisible:o.clipVisible,type:o.type,onCancel:()=>{o.linkVisible=!1,o.clipVisible=!1},onOk:b=>{b&&a(o.type,{desc:b.desc,url:b.url}),o.linkVisible=!1,o.clipVisible=!1}},null)])}}});function Nn(){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 lt=Nn();function $i(s){lt=s}const zn=/[&<>"']/,Si=new RegExp(zn.source,"g"),Vn=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,Ci=new RegExp(Vn.source,"g"),Ti={"&":"&","<":"<",">":">",'"':""","'":"'"},mn=s=>Ti[s];function ae(s,e){if(e){if(zn.test(s))return s.replace(Si,mn)}else if(Vn.test(s))return s.replace(Ci,mn);return s}const Ei=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function _n(s){return s.replace(Ei,(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 Ni=/(^|[^\[])\^/g;function K(s,e){s=typeof s=="string"?s:s.source,e=e||"";const t={replace:(n,i)=>(i=i.source||i,i=i.replace(Ni,"$1"),s=s.replace(n,i),t),getRegex:()=>new RegExp(s,e)};return t}const zi=/[^\w:]/g,Vi=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function gn(s,e,t){if(s){let n;try{n=decodeURIComponent(_n(t)).replace(zi,"").toLowerCase()}catch{return null}if(n.indexOf("javascript:")===0||n.indexOf("vbscript:")===0||n.indexOf("data:")===0)return null}e&&!Vi.test(t)&&(t=Li(e,t));try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}const $t={},_i=/^[^:]+:\/*[^/]*$/,Ai=/^([^:]+:)[\s\S]*$/,Ii=/^([^:]+:\/*[^/]*)[\s\S]*$/;function Li(s,e){$t[" "+s]||(_i.test(s)?$t[" "+s]=s+"/":$t[" "+s]=Ct(s,"/",!0)),s=$t[" "+s];const t=s.indexOf(":")===-1;return e.substring(0,2)==="//"?t?e:s.replace(Ai,"$1")+e:e.charAt(0)==="/"?t?e:s.replace(Ii,"$1")+e:s+e}const It={exec:function(){}};function $e(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 pn(s,e){const t=s.replace(/\|/g,(l,a,o)=>{let u=!1,f=a;for(;--f>=0&&o[f]==="\\";)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 Ct(s,e,t){const n=s.length;if(n===0)return"";let i=0;for(;i<n;){const l=s.charAt(n-i-1);if(l===e&&!t)i++;else if(l!==e&&t)i++;else break}return s.slice(0,n-i)}function Fi(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 An(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 vn(s,e){if(e<1)return"";let t="";for(;e>1;)e&1&&(t+=s),e>>=1,s+=s;return t+s}function bn(s,e,t,n){const i=e.href,l=e.title?ae(e.title):null,a=s[1].replace(/\\([\[\]])/g,"$1");if(s[0].charAt(0)!=="!"){n.state.inLink=!0;const o={type:"link",raw:t,href:i,title:l,text:a,tokens:n.inlineTokens(a)};return n.state.inLink=!1,o}return{type:"image",raw:t,href:i,title:l,text:ae(a)}}function Ri(s,e){const t=s.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
|
|
3
|
+
`).map(i=>{const l=i.match(/^\s+/);if(l===null)return i;const[a]=l;return a.length>=n.length?i.slice(n.length):i}).join(`
|
|
4
|
+
`)}class Xt{constructor(e){this.options=e||lt}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:Ct(n,`
|
|
5
|
+
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],i=Ri(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=Ct(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,""),i=this.lexer.state.top;this.lexer.state.top=!0;const l=this.lexer.blockTokens(n);return this.lexer.state.top=i,{type:"blockquote",raw:t[0],tokens:l,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,i,l,a,o,u,f,h,m,v,g,$,b=t[1].trim();const k=b.length>1,p={type:"list",raw:"",ordered:k,start:k?+b.slice(0,-1):"",loose:!1,items:[]};b=k?`\\d{1,9}\\${b.slice(-1)}`:`\\${b}`,this.options.pedantic&&(b=k?b:"[*+-]");const w=new RegExp(`^( {0,3}${b})((?:[ ][^\\n]*)?(?:\\n|$))`);for(;e&&($=!1,!(!(t=w.exec(e))||this.rules.block.hr.test(e)));){if(n=t[0],e=e.substring(n.length),h=t[2].split(`
|
|
6
|
+
`,1)[0].replace(/^\t+/,C=>" ".repeat(3*C.length)),m=e.split(`
|
|
7
|
+
`,1)[0],this.options.pedantic?(a=2,g=h.trimLeft()):(a=t[2].search(/[^ ]/),a=a>4?1:a,g=h.slice(a),a+=t[1].length),u=!1,!h&&/^ *$/.test(m)&&(n+=m+`
|
|
8
|
+
`,e=e.substring(m.length+1),$=!0),!$){const C=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+|$)`),H=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:\`\`\`|~~~)`),T=new RegExp(`^ {0,${Math.min(3,a-1)}}#`);for(;e&&(v=e.split(`
|
|
9
|
+
`,1)[0],m=v,this.options.pedantic&&(m=m.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!(H.test(m)||T.test(m)||C.test(m)||V.test(e)));){if(m.search(/[^ ]/)>=a||!m.trim())g+=`
|
|
10
|
+
`+m.slice(a);else{if(u||h.search(/[^ ]/)>=4||H.test(h)||T.test(h)||V.test(h))break;g+=`
|
|
11
|
+
`+m}!u&&!m.trim()&&(u=!0),n+=v+`
|
|
12
|
+
`,e=e.substring(v.length+1),h=m.slice(a)}}p.loose||(f?p.loose=!0:/\n *\n *$/.test(n)&&(f=!0)),this.options.gfm&&(i=/^\[[ xX]\] /.exec(g),i&&(l=i[0]!=="[ ] ",g=g.replace(/^\[[ xX]\] +/,""))),p.items.push({type:"list_item",raw:n,task:!!i,checked:l,loose:!1,text:g}),p.raw+=n}p.items[p.items.length-1].raw=n.trimRight(),p.items[p.items.length-1].text=g.trimRight(),p.raw=p.raw.trimRight();const S=p.items.length;for(o=0;o<S;o++)if(this.lexer.state.top=!1,p.items[o].tokens=this.lexer.blockTokens(p.items[o].text,[]),!p.loose){const C=p.items[o].tokens.filter(H=>H.type==="space"),V=C.length>0&&C.some(H=>/\n.*\n/.test(H.raw));p.loose=V}if(p.loose)for(o=0;o<S;o++)p.items[o].loose=!0;return p}}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]):ae(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"):"",l=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:l}}}table(e){const t=this.rules.block.table.exec(e);if(t){const n={type:"table",header:pn(t[1]).map(i=>({text:i})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,"").split(`
|
|
13
|
+
`):[]};if(n.header.length===n.align.length){n.raw=t[0];let i=n.align.length,l,a,o,u;for(l=0;l<i;l++)/^ *-+: *$/.test(n.align[l])?n.align[l]="right":/^ *:-+: *$/.test(n.align[l])?n.align[l]="center":/^ *:-+ *$/.test(n.align[l])?n.align[l]="left":n.align[l]=null;for(i=n.rows.length,l=0;l<i;l++)n.rows[l]=pn(n.rows[l],n.header.length).map(f=>({text:f}));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],o=0;o<u.length;o++)u[o].tokens=this.lexer.inline(u[o].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)===`
|
|
14
|
+
`?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:ae(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]):ae(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=Ct(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{const a=Fi(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],l="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a&&(i=a[1],l=a[3])}else l=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)),bn(t,{href:i&&i.replace(this.rules.inline._escapes,"$1"),title:l&&l.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 l=n[0].charAt(0);return{type:"text",raw:l,text:l}}return bn(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 l=i[1]||i[2]||"";if(!l||l&&(n===""||this.rules.inline.punctuation.exec(n))){const a=i[0].length-1;let o,u,f=a,h=0;const m=i[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+a);(i=m.exec(t))!=null;){if(o=i[1]||i[2]||i[3]||i[4]||i[5]||i[6],!o)continue;if(u=o.length,i[3]||i[4]){f+=u;continue}else if((i[5]||i[6])&&a%3&&!((a+u)%3)){h+=u;continue}if(f-=u,f>0)continue;u=Math.min(u,u+f+h);const v=e.slice(0,a+i.index+(i[0].length-o.length)+u);if(Math.min(a,u)%2){const $=v.slice(1,-1);return{type:"em",raw:v,text:$,tokens:this.lexer.inlineTokens($)}}const g=v.slice(2,-2);return{type:"strong",raw:v,text:g,tokens:this.lexer.inlineTokens(g)}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const i=/[^ ]/.test(n),l=/^ /.test(n)&&/ $/.test(n);return i&&l&&(n=n.substring(1,n.length-1)),n=ae(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,l;return n[2]==="@"?(i=ae(this.options.mangle?t(n[1]):n[1]),l="mailto:"+i):(i=ae(n[1]),l=i),{type:"link",raw:n[0],text:i,href:l,tokens:[{type:"text",raw:i,text:i}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let i,l;if(n[2]==="@")i=ae(this.options.mangle?t(n[0]):n[0]),l="mailto:"+i;else{let a;do a=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0];while(a!==n[0]);i=ae(n[0]),n[1]==="www."?l="http://"+n[0]:l=n[0]}return{type:"link",raw:n[0],text:i,href:l,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]):ae(n[0]):n[0]:i=ae(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:i}}}}const A={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:It,lheading:/^((?:.|\n(?!\n))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};A._label=/(?!\s*\])(?:\\.|[^\[\]\\])+/;A._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;A.def=K(A.def).replace("label",A._label).replace("title",A._title).getRegex();A.bullet=/(?:[*+-]|\d{1,9}[.)])/;A.listItemStart=K(/^( *)(bull) */).replace("bull",A.bullet).getRegex();A.list=K(A.list).replace(/bull/g,A.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+A.def.source+")").getRegex();A._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";A._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/;A.html=K(A.html,"i").replace("comment",A._comment).replace("tag",A._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();A.paragraph=K(A._paragraph).replace("hr",A.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",A._tag).getRegex();A.blockquote=K(A.blockquote).replace("paragraph",A.paragraph).getRegex();A.normal=$e({},A);A.gfm=$e({},A.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"});A.gfm.table=K(A.gfm.table).replace("hr",A.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",A._tag).getRegex();A.gfm.paragraph=K(A._paragraph).replace("hr",A.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",A.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",A._tag).getRegex();A.pedantic=$e({},A.normal,{html:K(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",A._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:It,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:K(A.normal._paragraph).replace("hr",A.hr).replace("heading",` *#{1,6} *[^
|
|
15
|
+
]`).replace("lheading",A.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const E={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:It,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:It,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};E._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~";E.punctuation=K(E.punctuation).replace(/punctuation/g,E._punctuation).getRegex();E.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;E.escapedEmSt=/(?:^|[^\\])(?:\\\\)*\\[*_]/g;E._comment=K(A._comment).replace("(?:-->|$)","-->").getRegex();E.emStrong.lDelim=K(E.emStrong.lDelim).replace(/punct/g,E._punctuation).getRegex();E.emStrong.rDelimAst=K(E.emStrong.rDelimAst,"g").replace(/punct/g,E._punctuation).getRegex();E.emStrong.rDelimUnd=K(E.emStrong.rDelimUnd,"g").replace(/punct/g,E._punctuation).getRegex();E._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;E._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;E._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])?)+(?![-_])/;E.autolink=K(E.autolink).replace("scheme",E._scheme).replace("email",E._email).getRegex();E._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;E.tag=K(E.tag).replace("comment",E._comment).replace("attribute",E._attribute).getRegex();E._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;E._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;E._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;E.link=K(E.link).replace("label",E._label).replace("href",E._href).replace("title",E._title).getRegex();E.reflink=K(E.reflink).replace("label",E._label).replace("ref",A._label).getRegex();E.nolink=K(E.nolink).replace("ref",A._label).getRegex();E.reflinkSearch=K(E.reflinkSearch,"g").replace("reflink",E.reflink).replace("nolink",E.nolink).getRegex();E.normal=$e({},E);E.pedantic=$e({},E.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:K(/^!?\[(label)\]\((.*?)\)/).replace("label",E._label).getRegex(),reflink:K(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",E._label).getRegex()});E.gfm=$e({},E.normal,{escape:K(E.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.!#$%&'*+\/=?_`{\|}~-]+@)))/});E.gfm.url=K(E.gfm.url,"i").replace("email",E.gfm._extended_email).getRegex();E.breaks=$e({},E.gfm,{br:K(E.br).replace("{2,}","*").getRegex(),text:K(E.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});function ji(s){return s.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function kn(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 Re{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||lt,this.options.tokenizer=this.options.tokenizer||new Xt,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:A.normal,inline:E.normal};this.options.pedantic?(t.block=A.pedantic,t.inline=E.pedantic):this.options.gfm&&(t.block=A.gfm,this.options.breaks?t.inline=E.breaks:t.inline=E.gfm),this.tokenizer.rules=t}static get rules(){return{block:A,inline:E}}static lex(e,t){return new Re(t).lex(e)}static lexInline(e,t){return new Re(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
|
|
16
|
+
`),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,(o,u,f)=>u+" ".repeat(f.length));let n,i,l,a;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(o=>(n=o.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+=`
|
|
17
|
+
`: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+=`
|
|
18
|
+
`+n.raw,i.text+=`
|
|
19
|
+
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(n=this.tokenizer.fences(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.heading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.hr(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.blockquote(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.list(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.html(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.def(e)){e=e.substring(n.raw.length),i=t[t.length-1],i&&(i.type==="paragraph"||i.type==="text")?(i.raw+=`
|
|
20
|
+
`+n.raw,i.text+=`
|
|
21
|
+
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=i.text):this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title});continue}if(n=this.tokenizer.table(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.lheading(e)){e=e.substring(n.raw.length),t.push(n);continue}if(l=e,this.options.extensions&&this.options.extensions.startBlock){let o=1/0;const u=e.slice(1);let f;this.options.extensions.startBlock.forEach(function(h){f=h.call({lexer:this},u),typeof f=="number"&&f>=0&&(o=Math.min(o,f))}),o<1/0&&o>=0&&(l=e.substring(0,o+1))}if(this.state.top&&(n=this.tokenizer.paragraph(l))){i=t[t.length-1],a&&i.type==="paragraph"?(i.raw+=`
|
|
22
|
+
`+n.raw,i.text+=`
|
|
23
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n),a=l.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+=`
|
|
24
|
+
`+n.raw,i.text+=`
|
|
25
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=i.text):t.push(n);continue}if(e){const o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,i,l,a=e,o,u,f;if(this.tokens.links){const h=Object.keys(this.tokens.links);if(h.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)h.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+vn("a",o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,o.index)+"["+vn("a",o[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(o=this.tokenizer.rules.inline.escapedEmSt.exec(a))!=null;)a=a.slice(0,o.index+o[0].length-2)+"++"+a.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex),this.tokenizer.rules.inline.escapedEmSt.lastIndex--;for(;e;)if(u||(f=""),u=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(h=>(n=h.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,f)){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,kn)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e,kn))){e=e.substring(n.raw.length),t.push(n);continue}if(l=e,this.options.extensions&&this.options.extensions.startInline){let h=1/0;const m=e.slice(1);let v;this.options.extensions.startInline.forEach(function(g){v=g.call({lexer:this},m),typeof v=="number"&&v>=0&&(h=Math.min(h,v))}),h<1/0&&h>=0&&(l=e.substring(0,h+1))}if(n=this.tokenizer.inlineText(l,ji)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(f=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 h="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return t}}class Qt{constructor(e){this.options=e||lt}code(e,t,n){const i=(t||"").match(/\S*/)[0];if(this.options.highlight){const l=this.options.highlight(e,i);l!=null&&l!==e&&(n=!0,e=l)}return e=e.replace(/\n$/,"")+`
|
|
26
|
+
`,i?'<pre><code class="'+this.options.langPrefix+ae(i)+'">'+(n?e:ae(e,!0))+`</code></pre>
|
|
27
|
+
`:"<pre><code>"+(n?e:ae(e,!0))+`</code></pre>
|
|
28
|
+
`}blockquote(e){return`<blockquote>
|
|
29
|
+
${e}</blockquote>
|
|
30
|
+
`}html(e){return e}heading(e,t,n,i){if(this.options.headerIds){const l=this.options.headerPrefix+i.slug(n);return`<h${t} id="${l}">${e}</h${t}>
|
|
31
|
+
`}return`<h${t}>${e}</h${t}>
|
|
32
|
+
`}hr(){return this.options.xhtml?`<hr/>
|
|
33
|
+
`:`<hr>
|
|
34
|
+
`}list(e,t,n){const i=t?"ol":"ul",l=t&&n!==1?' start="'+n+'"':"";return"<"+i+l+`>
|
|
35
|
+
`+e+"</"+i+`>
|
|
36
|
+
`}listitem(e){return`<li>${e}</li>
|
|
37
|
+
`}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(e){return`<p>${e}</p>
|
|
38
|
+
`}table(e,t){return t&&(t=`<tbody>${t}</tbody>`),`<table>
|
|
39
|
+
<thead>
|
|
40
|
+
`+e+`</thead>
|
|
41
|
+
`+t+`</table>
|
|
42
|
+
`}tablerow(e){return`<tr>
|
|
43
|
+
${e}</tr>
|
|
44
|
+
`}tablecell(e,t){const n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
|
|
45
|
+
`}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=gn(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=gn(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 In{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 Ln{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 ze{constructor(e){this.options=e||lt,this.options.renderer=this.options.renderer||new Qt,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new In,this.slugger=new Ln}static parse(e,t){return new ze(t).parse(e)}static parseInline(e,t){return new ze(t).parseInline(e)}parse(e,t=!0){let n="",i,l,a,o,u,f,h,m,v,g,$,b,k,p,w,S,C,V,H;const T=e.length;for(i=0;i<T;i++){if(g=e[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[g.type]&&(H=this.options.extensions.renderers[g.type].call({parser:this},g),H!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(g.type))){n+=H||"";continue}switch(g.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{n+=this.renderer.heading(this.parseInline(g.tokens),g.depth,_n(this.parseInline(g.tokens,this.textRenderer)),this.slugger);continue}case"code":{n+=this.renderer.code(g.text,g.lang,g.escaped);continue}case"table":{for(m="",h="",o=g.header.length,l=0;l<o;l++)h+=this.renderer.tablecell(this.parseInline(g.header[l].tokens),{header:!0,align:g.align[l]});for(m+=this.renderer.tablerow(h),v="",o=g.rows.length,l=0;l<o;l++){for(f=g.rows[l],h="",u=f.length,a=0;a<u;a++)h+=this.renderer.tablecell(this.parseInline(f[a].tokens),{header:!1,align:g.align[a]});v+=this.renderer.tablerow(h)}n+=this.renderer.table(m,v);continue}case"blockquote":{v=this.parse(g.tokens),n+=this.renderer.blockquote(v);continue}case"list":{for($=g.ordered,b=g.start,k=g.loose,o=g.items.length,v="",l=0;l<o;l++)w=g.items[l],S=w.checked,C=w.task,p="",w.task&&(V=this.renderer.checkbox(S),k?w.tokens.length>0&&w.tokens[0].type==="paragraph"?(w.tokens[0].text=V+" "+w.tokens[0].text,w.tokens[0].tokens&&w.tokens[0].tokens.length>0&&w.tokens[0].tokens[0].type==="text"&&(w.tokens[0].tokens[0].text=V+" "+w.tokens[0].tokens[0].text)):w.tokens.unshift({type:"text",text:V}):p+=V),p+=this.parse(w.tokens,k),v+=this.renderer.listitem(p,C,S);n+=this.renderer.list(v,$,b);continue}case"html":{n+=this.renderer.html(g.text);continue}case"paragraph":{n+=this.renderer.paragraph(this.parseInline(g.tokens));continue}case"text":{for(v=g.tokens?this.parseInline(g.tokens):g.text;i+1<T&&e[i+1].type==="text";)g=e[++i],v+=`
|
|
46
|
+
`+(g.tokens?this.parseInline(g.tokens):g.text);n+=t?this.renderer.paragraph(v):v;continue}default:{const y='Token with "'+g.type+'" type was not found.';if(this.options.silent){console.error(y);return}else throw new Error(y)}}}return n}parseInline(e,t){t=t||this.renderer;let n="",i,l,a;const o=e.length;for(i=0;i<o;i++){if(l=e[i],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[l.type]&&(a=this.options.extensions.renderers[l.type].call({parser:this},l),a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type))){n+=a||"";continue}switch(l.type){case"escape":{n+=t.text(l.text);break}case"html":{n+=t.html(l.text);break}case"link":{n+=t.link(l.href,l.title,this.parseInline(l.tokens,t));break}case"image":{n+=t.image(l.href,l.title,l.text);break}case"strong":{n+=t.strong(this.parseInline(l.tokens,t));break}case"em":{n+=t.em(this.parseInline(l.tokens,t));break}case"codespan":{n+=t.codespan(l.text);break}case"br":{n+=t.br();break}case"del":{n+=t.del(this.parseInline(l.tokens,t));break}case"text":{n+=t.text(l.text);break}default:{const u='Token with "'+l.type+'" type was not found.';if(this.options.silent){console.error(u);return}else throw new Error(u)}}}return n}}function N(s,e,t){if(typeof s>"u"||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=$e({},N.defaults,e||{}),An(e),t){const i=e.highlight;let l;try{l=Re.lex(s,e)}catch(u){return t(u)}const a=function(u){let f;if(!u)try{e.walkTokens&&N.walkTokens(l,e.walkTokens),f=ze.parse(l,e)}catch(h){u=h}return e.highlight=i,u?t(u):t(null,f)};if(!i||i.length<3||(delete e.highlight,!l.length))return a();let o=0;N.walkTokens(l,function(u){u.type==="code"&&(o++,setTimeout(()=>{i(u.text,u.lang,function(f,h){if(f)return a(f);h!=null&&h!==u.text&&(u.text=h,u.escaped=!0),o--,o===0&&a()})},0))}),o===0&&a();return}function n(i){if(i.message+=`
|
|
47
|
+
Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+ae(i.message+"",!0)+"</pre>";throw i}try{const i=Re.lex(s,e);if(e.walkTokens){if(e.async)return Promise.all(N.walkTokens(i,e.walkTokens)).then(()=>ze.parse(i,e)).catch(n);N.walkTokens(i,e.walkTokens)}return ze.parse(i,e)}catch(i){n(i)}}N.options=N.setOptions=function(s){return $e(N.defaults,s),$i(N.defaults),N};N.getDefaults=Nn;N.defaults=lt;N.use=function(...s){const e=N.defaults.extensions||{renderers:{},childTokens:{}};s.forEach(t=>{const n=$e({},t);if(n.async=N.defaults.async||n.async,t.extensions&&(t.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if(i.renderer){const l=e.renderers[i.name];l?e.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===!1&&(o=l.apply(this,a)),o}: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=N.defaults.renderer||new Qt;for(const l in t.renderer){const a=i[l];i[l]=(...o)=>{let u=t.renderer[l].apply(i,o);return u===!1&&(u=a.apply(i,o)),u}}n.renderer=i}if(t.tokenizer){const i=N.defaults.tokenizer||new Xt;for(const l in t.tokenizer){const a=i[l];i[l]=(...o)=>{let u=t.tokenizer[l].apply(i,o);return u===!1&&(u=a.apply(i,o)),u}}n.tokenizer=i}if(t.walkTokens){const i=N.defaults.walkTokens;n.walkTokens=function(l){let a=[];return a.push(t.walkTokens.call(this,l)),i&&(a=a.concat(i.call(this,l))),a}}N.setOptions(n)})};N.walkTokens=function(s,e){let t=[];for(const n of s)switch(t=t.concat(e.call(N,n)),n.type){case"table":{for(const i of n.header)t=t.concat(N.walkTokens(i.tokens,e));for(const i of n.rows)for(const l of i)t=t.concat(N.walkTokens(l.tokens,e));break}case"list":{t=t.concat(N.walkTokens(n.items,e));break}default:N.defaults.extensions&&N.defaults.extensions.childTokens&&N.defaults.extensions.childTokens[n.type]?N.defaults.extensions.childTokens[n.type].forEach(function(i){t=t.concat(N.walkTokens(n[i],e))}):n.tokens&&(t=t.concat(N.walkTokens(n.tokens,e)))}return t};N.parseInline=function(s,e){if(typeof s>"u"||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=$e({},N.defaults,e||{}),An(e);try{const t=Re.lexInline(s,e);return e.walkTokens&&N.walkTokens(t,e.walkTokens),ze.parseInline(t,e)}catch(t){if(t.message+=`
|
|
48
|
+
Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+ae(t.message+"",!0)+"</pre>";throw t}};N.Parser=ze;N.parser=ze.parse;N.Renderer=Qt;N.TextRenderer=In;N.Lexer=Re;N.lexer=Re.lex;N.Tokenizer=Xt;N.Slugger=Ln;N.parse=N;N.options;N.setOptions;N.use;N.walkTokens;N.parseInline;ze.parse;Re.lex;var Oi=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()}},Di=Oi,yn={"text/plain":"Text","text/html":"Url",default:"Text"},Hi="Copy to clipboard: #{key}, Enter";function Pi(s){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return s.replace(/#{\s*key\s*}/g,e)}function Mi(s,e){var t,n,i,l,a,o,u=!1;e||(e={}),t=e.debug||!1;try{i=Di(),l=document.createRange(),a=document.getSelection(),o=document.createElement("span"),o.textContent=s,o.ariaHidden="true",o.style.all="unset",o.style.position="fixed",o.style.top=0,o.style.clip="rect(0, 0, 0, 0)",o.style.whiteSpace="pre",o.style.webkitUserSelect="text",o.style.MozUserSelect="text",o.style.msUserSelect="text",o.style.userSelect="text",o.addEventListener("copy",function(h){if(h.stopPropagation(),e.format)if(h.preventDefault(),typeof h.clipboardData>"u"){t&&console.warn("unable to use e.clipboardData"),t&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=yn[e.format]||yn.default;window.clipboardData.setData(m,s)}else h.clipboardData.clearData(),h.clipboardData.setData(e.format,s);e.onCopy&&(h.preventDefault(),e.onCopy(h.clipboardData))}),document.body.appendChild(o),l.selectNodeContents(o),a.addRange(l);var f=document.execCommand("copy");if(!f)throw new Error("copy command was unsuccessful");u=!0}catch(h){t&&console.error("unable to copy using execCommand: ",h),t&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",s),e.onCopy&&e.onCopy(window.clipboardData),u=!0}catch(m){t&&console.error("unable to copy using clipboardData: ",m),t&&console.error("falling back to prompt"),n=Pi("message"in e?e.message:Hi),window.prompt(n,s)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(l):a.removeAllRanges()),o&&document.body.removeChild(o),i()}return u}var ct=Mi;/*! medium-zoom 1.0.8 | MIT License | https://github.com/francoischalifour/medium-zoom */var Ue=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},St=function(e){return e.tagName==="IMG"},Bi=function(e){return NodeList.prototype.isPrototypeOf(e)},Tt=function(e){return e&&e.nodeType===1},wn=function(e){var t=e.currentSrc||e.src;return t.substr(-4).toLowerCase()===".svg"},xn=function(e){try{return Array.isArray(e)?e.filter(St):Bi(e)?[].slice.call(e).filter(St):Tt(e)?[e].filter(St):typeof e=="string"?[].slice.call(document.querySelectorAll(e)).filter(St):[]}catch{throw new TypeError(`The provided selector is invalid.
|
|
49
|
+
Expects a CSS selector, a Node element, a NodeList or an array.
|
|
50
|
+
See: https://github.com/francoischalifour/medium-zoom`)}},Ui=function(e){var t=document.createElement("div");return t.classList.add("medium-zoom-overlay"),t.style.background=e,t},qi=function(e){var t=e.getBoundingClientRect(),n=t.top,i=t.left,l=t.width,a=t.height,o=e.cloneNode(),u=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,f=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;return o.removeAttribute("id"),o.style.position="absolute",o.style.top=n+u+"px",o.style.left=i+f+"px",o.style.width=l+"px",o.style.height=a+"px",o.style.transform="",o},Qe=function(e,t){var n=Ue({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},Wi=function s(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=window.Promise||function(z){function F(){}z(F,F)},i=function(z){var F=z.target;if(F===G){$();return}S.indexOf(F)!==-1&&b({target:F})},l=function(){if(!(V||!y.original)){var z=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;Math.abs(H-z)>T.scrollOffset&&setTimeout($,150)}},a=function(z){var F=z.key||z.keyCode;(F==="Escape"||F==="Esc"||F===27)&&$()},o=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},F=z;if(z.background&&(G.style.background=z.background),z.container&&z.container instanceof Object&&(F.container=Ue({},T.container,z.container)),z.template){var P=Tt(z.template)?z.template:document.querySelector(z.template);F.template=P}return T=Ue({},T,F),S.forEach(function(q){q.dispatchEvent(Qe("medium-zoom:update",{detail:{zoom:U}}))}),U},u=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return s(Ue({},T,z))},f=function(){for(var z=arguments.length,F=Array(z),P=0;P<z;P++)F[P]=arguments[P];var q=F.reduce(function(j,ee){return[].concat(j,xn(ee))},[]);return q.filter(function(j){return S.indexOf(j)===-1}).forEach(function(j){S.push(j),j.classList.add("medium-zoom-image")}),C.forEach(function(j){var ee=j.type,I=j.listener,R=j.options;q.forEach(function(M){M.addEventListener(ee,I,R)})}),U},h=function(){for(var z=arguments.length,F=Array(z),P=0;P<z;P++)F[P]=arguments[P];y.zoomed&&$();var q=F.length>0?F.reduce(function(j,ee){return[].concat(j,xn(ee))},[]):S;return q.forEach(function(j){j.classList.remove("medium-zoom-image"),j.dispatchEvent(Qe("medium-zoom:detach",{detail:{zoom:U}}))}),S=S.filter(function(j){return q.indexOf(j)===-1}),U},m=function(z,F){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return S.forEach(function(q){q.addEventListener("medium-zoom:"+z,F,P)}),C.push({type:"medium-zoom:"+z,listener:F,options:P}),U},v=function(z,F){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return S.forEach(function(q){q.removeEventListener("medium-zoom:"+z,F,P)}),C=C.filter(function(q){return!(q.type==="medium-zoom:"+z&&q.listener.toString()===F.toString())}),U},g=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},F=z.target,P=function(){var j={width:document.documentElement.clientWidth,height:document.documentElement.clientHeight,left:0,top:0,right:0,bottom:0},ee=void 0,I=void 0;if(T.container)if(T.container instanceof Object)j=Ue({},j,T.container),ee=j.width-j.left-j.right-T.margin*2,I=j.height-j.top-j.bottom-T.margin*2;else{var R=Tt(T.container)?T.container:document.querySelector(T.container),M=R.getBoundingClientRect(),se=M.width,oe=M.height,he=M.left,Se=M.top;j=Ue({},j,{width:se,height:oe,left:he,top:Se})}ee=ee||j.width-T.margin*2,I=I||j.height-T.margin*2;var Ve=y.zoomedHd||y.original,Me=wn(Ve)?ee:Ve.naturalWidth||ee,je=wn(Ve)?I:Ve.naturalHeight||I,Be=Ve.getBoundingClientRect(),pt=Be.top,vt=Be.left,Ge=Be.width,Ze=Be.height,bt=Math.min(Math.max(Ge,Me),ee)/Ge,kt=Math.min(Math.max(Ze,je),I)/Ze,Xe=Math.min(bt,kt),yt=(-vt+(ee-Ge)/2+T.margin+j.left)/Xe,wt=(-pt+(I-Ze)/2+T.margin+j.top)/Xe,ot="scale("+Xe+") translate3d("+yt+"px, "+wt+"px, 0)";y.zoomed.style.transform=ot,y.zoomedHd&&(y.zoomedHd.style.transform=ot)};return new n(function(q){if(F&&S.indexOf(F)===-1){q(U);return}var j=function se(){V=!1,y.zoomed.removeEventListener("transitionend",se),y.original.dispatchEvent(Qe("medium-zoom:opened",{detail:{zoom:U}})),q(U)};if(y.zoomed){q(U);return}if(F)y.original=F;else if(S.length>0){var ee=S;y.original=ee[0]}else{q(U);return}if(y.original.dispatchEvent(Qe("medium-zoom:open",{detail:{zoom:U}})),H=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,V=!0,y.zoomed=qi(y.original),document.body.appendChild(G),T.template){var I=Tt(T.template)?T.template:document.querySelector(T.template);y.template=document.createElement("div"),y.template.appendChild(I.content.cloneNode(!0)),document.body.appendChild(y.template)}if(y.original.parentElement&&y.original.parentElement.tagName==="PICTURE"&&y.original.currentSrc&&(y.zoomed.src=y.original.currentSrc),document.body.appendChild(y.zoomed),window.requestAnimationFrame(function(){document.body.classList.add("medium-zoom--opened")}),y.original.classList.add("medium-zoom-image--hidden"),y.zoomed.classList.add("medium-zoom-image--opened"),y.zoomed.addEventListener("click",$),y.zoomed.addEventListener("transitionend",j),y.original.getAttribute("data-zoom-src")){y.zoomedHd=y.zoomed.cloneNode(),y.zoomedHd.removeAttribute("srcset"),y.zoomedHd.removeAttribute("sizes"),y.zoomedHd.removeAttribute("loading"),y.zoomedHd.src=y.zoomed.getAttribute("data-zoom-src"),y.zoomedHd.onerror=function(){clearInterval(R),console.warn("Unable to reach the zoom image target "+y.zoomedHd.src),y.zoomedHd=null,P()};var R=setInterval(function(){y.zoomedHd.complete&&(clearInterval(R),y.zoomedHd.classList.add("medium-zoom-image--opened"),y.zoomedHd.addEventListener("click",$),document.body.appendChild(y.zoomedHd),P())},10)}else if(y.original.hasAttribute("srcset")){y.zoomedHd=y.zoomed.cloneNode(),y.zoomedHd.removeAttribute("sizes"),y.zoomedHd.removeAttribute("loading");var M=y.zoomedHd.addEventListener("load",function(){y.zoomedHd.removeEventListener("load",M),y.zoomedHd.classList.add("medium-zoom-image--opened"),y.zoomedHd.addEventListener("click",$),document.body.appendChild(y.zoomedHd),P()})}else P()})},$=function(){return new n(function(z){if(V||!y.original){z(U);return}var F=function P(){y.original.classList.remove("medium-zoom-image--hidden"),document.body.removeChild(y.zoomed),y.zoomedHd&&document.body.removeChild(y.zoomedHd),document.body.removeChild(G),y.zoomed.classList.remove("medium-zoom-image--opened"),y.template&&document.body.removeChild(y.template),V=!1,y.zoomed.removeEventListener("transitionend",P),y.original.dispatchEvent(Qe("medium-zoom:closed",{detail:{zoom:U}})),y.original=null,y.zoomed=null,y.zoomedHd=null,y.template=null,z(U)};V=!0,document.body.classList.remove("medium-zoom--opened"),y.zoomed.style.transform="",y.zoomedHd&&(y.zoomedHd.style.transform=""),y.template&&(y.template.style.transition="opacity 150ms",y.template.style.opacity=0),y.original.dispatchEvent(Qe("medium-zoom:close",{detail:{zoom:U}})),y.zoomed.addEventListener("transitionend",F)})},b=function(){var z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},F=z.target;return y.original?$():g({target:F})},k=function(){return T},p=function(){return S},w=function(){return y.original},S=[],C=[],V=!1,H=0,T=t,y={original:null,zoomed:null,zoomedHd:null,template:null};Object.prototype.toString.call(e)==="[object Object]"?T=e:(e||typeof e=="string")&&f(e),T=Ue({margin:0,background:"#fff",scrollOffset:40,container:null,template:null},T);var G=Ui(T.background);document.addEventListener("click",i),document.addEventListener("keyup",a),document.addEventListener("scroll",l),window.addEventListener("resize",$);var U={open:g,close:$,toggle:b,update:o,clone:u,attach:f,detach:h,on:m,off:v,getOptions:k,getImages:p,getZoomedImage:w};return U};function Ki(s,e){e===void 0&&(e={});var t=e.insertAt;if(!(!s||typeof document>"u")){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 Gi=".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}";Ki(Gi);const Zi=Wi,rt=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Fn=new Set,Xi=(s,e,t,n)=>{typeof process=="object"&&process&&typeof process.emitWarning=="function"?process.emitWarning(s,e,t,n):console.error(`[${t}] ${e}: ${s}`)},Qi=s=>!Fn.has(s),Oe=s=>s&&s===Math.floor(s)&&s>0&&isFinite(s),Rn=s=>Oe(s)?s<=Math.pow(2,8)?Uint8Array:s<=Math.pow(2,16)?Uint16Array:s<=Math.pow(2,32)?Uint32Array:s<=Number.MAX_SAFE_INTEGER?Et:null:null;class Et extends Array{constructor(e){super(e),this.fill(0)}}var et;const Je=class{constructor(e,t){te(this,"heap");te(this,"length");if(!c(Je,et))throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}static create(e){const t=Rn(e);if(!t)return[];L(Je,et,!0);const n=new Je(e,t);return L(Je,et,!1),n}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}};let Nt=Je;et=new WeakMap,D(Nt,et,!1);var ve,fe,Ce,be,tt,ne,ke,ie,Z,O,ue,me,ce,le,ye,re,Ae,Ie,we,Te,Pe,de,dt,Mt,qe,Le,ht,ge,Ft,jn,We,nt,ft,Ee,De,Ne,He,mt,Bt,it,zt,st,Vt,X,Y,gt,Ut,Ke,ut;const Yt=class{constructor(e){D(this,dt);D(this,Ft);D(this,Ee);D(this,Ne);D(this,mt);D(this,it);D(this,st);D(this,X);D(this,gt);D(this,Ke);D(this,ve,void 0);D(this,fe,void 0);D(this,Ce,void 0);D(this,be,void 0);D(this,tt,void 0);te(this,"ttl");te(this,"ttlResolution");te(this,"ttlAutopurge");te(this,"updateAgeOnGet");te(this,"updateAgeOnHas");te(this,"allowStale");te(this,"noDisposeOnSet");te(this,"noUpdateTTL");te(this,"maxEntrySize");te(this,"sizeCalculation");te(this,"noDeleteOnFetchRejection");te(this,"noDeleteOnStaleGet");te(this,"allowStaleOnFetchAbort");te(this,"allowStaleOnFetchRejection");te(this,"ignoreFetchAbort");D(this,ne,void 0);D(this,ke,void 0);D(this,ie,void 0);D(this,Z,void 0);D(this,O,void 0);D(this,ue,void 0);D(this,me,void 0);D(this,ce,void 0);D(this,le,void 0);D(this,ye,void 0);D(this,re,void 0);D(this,Ae,void 0);D(this,Ie,void 0);D(this,we,void 0);D(this,Te,void 0);D(this,Pe,void 0);D(this,de,void 0);D(this,qe,()=>{});D(this,Le,()=>{});D(this,ht,()=>{});D(this,ge,()=>!1);D(this,We,e=>{});D(this,nt,(e,t,n)=>{});D(this,ft,(e,t,n,i)=>{if(n||i)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0});const{max:t=0,ttl:n,ttlResolution:i=1,ttlAutopurge:l,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:u,dispose:f,disposeAfter:h,noDisposeOnSet:m,noUpdateTTL:v,maxSize:g=0,maxEntrySize:$=0,sizeCalculation:b,fetchMethod:k,noDeleteOnFetchRejection:p,noDeleteOnStaleGet:w,allowStaleOnFetchRejection:S,allowStaleOnFetchAbort:C,ignoreFetchAbort:V}=e;if(t!==0&&!Oe(t))throw new TypeError("max option must be a nonnegative integer");const H=t?Rn(t):Array;if(!H)throw new Error("invalid max value: "+t);if(L(this,ve,t),L(this,fe,g),this.maxEntrySize=$||c(this,fe),this.sizeCalculation=b,this.sizeCalculation){if(!c(this,fe)&&!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(k!==void 0&&typeof k!="function")throw new TypeError("fetchMethod must be a function if specified");if(L(this,tt,k),L(this,Pe,!!k),L(this,ie,new Map),L(this,Z,new Array(t).fill(void 0)),L(this,O,new Array(t).fill(void 0)),L(this,ue,new H(t)),L(this,me,new H(t)),L(this,ce,0),L(this,le,0),L(this,ye,Nt.create(t)),L(this,ne,0),L(this,ke,0),typeof f=="function"&&L(this,Ce,f),typeof h=="function"?(L(this,be,h),L(this,re,[])):(L(this,be,void 0),L(this,re,void 0)),L(this,Te,!!c(this,Ce)),L(this,de,!!c(this,be)),this.noDisposeOnSet=!!m,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!p,this.allowStaleOnFetchRejection=!!S,this.allowStaleOnFetchAbort=!!C,this.ignoreFetchAbort=!!V,this.maxEntrySize!==0){if(c(this,fe)!==0&&!Oe(c(this,fe)))throw new TypeError("maxSize must be a positive integer if specified");if(!Oe(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");_(this,Ft,jn).call(this)}if(this.allowStale=!!u,this.noDeleteOnStaleGet=!!w,this.updateAgeOnGet=!!a,this.updateAgeOnHas=!!o,this.ttlResolution=Oe(i)||i===0?i:1,this.ttlAutopurge=!!l,this.ttl=n||0,this.ttl){if(!Oe(this.ttl))throw new TypeError("ttl must be a positive integer if specified");_(this,dt,Mt).call(this)}if(c(this,ve)===0&&this.ttl===0&&c(this,fe)===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!c(this,ve)&&!c(this,fe)){const T="LRU_CACHE_UNBOUNDED";Qi(T)&&(Fn.add(T),Xi("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",T,Yt))}}static unsafeExposeInternals(e){return{starts:c(e,Ie),ttls:c(e,we),sizes:c(e,Ae),keyMap:c(e,ie),keyList:c(e,Z),valList:c(e,O),next:c(e,ue),prev:c(e,me),get head(){return c(e,ce)},get tail(){return c(e,le)},free:c(e,ye),isBackgroundFetch:t=>{var n;return _(n=e,X,Y).call(n,t)},backgroundFetch:(t,n,i,l)=>{var a;return _(a=e,st,Vt).call(a,t,n,i,l)},moveToTail:t=>{var n;return _(n=e,Ke,ut).call(n,t)},indexes:t=>{var n;return _(n=e,Ee,De).call(n,t)},rindexes:t=>{var n;return _(n=e,Ne,He).call(n,t)},isStale:t=>{var n;return c(n=e,ge).call(n,t)}}}get max(){return c(this,ve)}get maxSize(){return c(this,fe)}get calculatedSize(){return c(this,ke)}get size(){return c(this,ne)}get fetchMethod(){return c(this,tt)}get dispose(){return c(this,Ce)}get disposeAfter(){return c(this,be)}getRemainingTTL(e){return c(this,ie).has(e)?1/0:0}*entries(){for(const e of _(this,Ee,De).call(this))c(this,O)[e]!==void 0&&c(this,Z)[e]!==void 0&&!_(this,X,Y).call(this,c(this,O)[e])&&(yield[c(this,Z)[e],c(this,O)[e]])}*rentries(){for(const e of _(this,Ne,He).call(this))c(this,O)[e]!==void 0&&c(this,Z)[e]!==void 0&&!_(this,X,Y).call(this,c(this,O)[e])&&(yield[c(this,Z)[e],c(this,O)[e]])}*keys(){for(const e of _(this,Ee,De).call(this)){const t=c(this,Z)[e];t!==void 0&&!_(this,X,Y).call(this,c(this,O)[e])&&(yield t)}}*rkeys(){for(const e of _(this,Ne,He).call(this)){const t=c(this,Z)[e];t!==void 0&&!_(this,X,Y).call(this,c(this,O)[e])&&(yield t)}}*values(){for(const e of _(this,Ee,De).call(this))c(this,O)[e]!==void 0&&!_(this,X,Y).call(this,c(this,O)[e])&&(yield c(this,O)[e])}*rvalues(){for(const e of _(this,Ne,He).call(this))c(this,O)[e]!==void 0&&!_(this,X,Y).call(this,c(this,O)[e])&&(yield c(this,O)[e])}[Symbol.iterator](){return this.entries()}find(e,t={}){for(const n of _(this,Ee,De).call(this)){const i=c(this,O)[n],l=_(this,X,Y).call(this,i)?i.__staleWhileFetching:i;if(l!==void 0&&e(l,c(this,Z)[n],this))return this.get(c(this,Z)[n],t)}}forEach(e,t=this){for(const n of _(this,Ee,De).call(this)){const i=c(this,O)[n],l=_(this,X,Y).call(this,i)?i.__staleWhileFetching:i;l!==void 0&&e.call(t,l,c(this,Z)[n],this)}}rforEach(e,t=this){for(const n of _(this,Ne,He).call(this)){const i=c(this,O)[n],l=_(this,X,Y).call(this,i)?i.__staleWhileFetching:i;l!==void 0&&e.call(t,l,c(this,Z)[n],this)}}purgeStale(){let e=!1;for(const t of _(this,Ne,He).call(this,{allowStale:!0}))c(this,ge).call(this,t)&&(this.delete(c(this,Z)[t]),e=!0);return e}dump(){const e=[];for(const t of _(this,Ee,De).call(this,{allowStale:!0})){const n=c(this,Z)[t],i=c(this,O)[t],l=_(this,X,Y).call(this,i)?i.__staleWhileFetching:i;if(l===void 0||n===void 0)continue;const a={value:l};if(c(this,we)&&c(this,Ie)){a.ttl=c(this,we)[t];const o=rt.now()-c(this,Ie)[t];a.start=Math.floor(Date.now()-o)}c(this,Ae)&&(a.size=c(this,Ae)[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=rt.now()-i}this.set(t,n.value,n)}}set(e,t,n={}){var v,g,$;const{ttl:i=this.ttl,start:l,noDisposeOnSet:a=this.noDisposeOnSet,sizeCalculation:o=this.sizeCalculation,status:u}=n;let{noUpdateTTL:f=this.noUpdateTTL}=n;const h=c(this,ft).call(this,e,t,n.size||0,o);if(this.maxEntrySize&&h>this.maxEntrySize)return u&&(u.set="miss",u.maxEntrySizeExceeded=!0),this.delete(e),this;let m=c(this,ne)===0?void 0:c(this,ie).get(e);if(m===void 0)m=c(this,ne)===0?c(this,le):c(this,ye).length!==0?c(this,ye).pop():c(this,ne)===c(this,ve)?_(this,it,zt).call(this,!1):c(this,ne),c(this,Z)[m]=e,c(this,O)[m]=t,c(this,ie).set(e,m),c(this,ue)[c(this,le)]=m,c(this,me)[m]=c(this,le),L(this,le,m),xt(this,ne)._++,c(this,nt).call(this,m,h,u),u&&(u.set="add"),f=!1;else{_(this,Ke,ut).call(this,m);const b=c(this,O)[m];if(t!==b){if(c(this,Pe)&&_(this,X,Y).call(this,b)?b.__abortController.abort(new Error("replaced")):a||(c(this,Te)&&((v=c(this,Ce))==null||v.call(this,b,e,"set")),c(this,de)&&((g=c(this,re))==null||g.push([b,e,"set"]))),c(this,We).call(this,m),c(this,nt).call(this,m,h,u),c(this,O)[m]=t,u){u.set="replace";const k=b&&_(this,X,Y).call(this,b)?b.__staleWhileFetching:b;k!==void 0&&(u.oldValue=k)}}else u&&(u.set="update")}if(i!==0&&!c(this,we)&&_(this,dt,Mt).call(this),c(this,we)&&(f||c(this,ht).call(this,m,i,l),u&&c(this,Le).call(this,u,m)),!a&&c(this,de)&&c(this,re)){const b=c(this,re);let k;for(;k=b==null?void 0:b.shift();)($=c(this,be))==null||$.call(this,...k)}return this}pop(){var e;try{for(;c(this,ne);){const t=c(this,O)[c(this,ce)];if(_(this,it,zt).call(this,!0),_(this,X,Y).call(this,t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(c(this,de)&&c(this,re)){const t=c(this,re);let n;for(;n=t==null?void 0:t.shift();)(e=c(this,be))==null||e.call(this,...n)}}}has(e,t={}){const{updateAgeOnHas:n=this.updateAgeOnHas,status:i}=t,l=c(this,ie).get(e);if(l!==void 0)if(c(this,ge).call(this,l))i&&(i.has="stale",c(this,Le).call(this,i,l));else return n&&c(this,qe).call(this,l),i&&(i.has="hit",c(this,Le).call(this,i,l)),!0;else i&&(i.has="miss");return!1}peek(e,t={}){const{allowStale:n=this.allowStale}=t,i=c(this,ie).get(e);if(i!==void 0&&(n||!c(this,ge).call(this,i))){const l=c(this,O)[i];return _(this,X,Y).call(this,l)?l.__staleWhileFetching:l}}async fetch(e,t={}){const{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:l=this.noDeleteOnStaleGet,ttl:a=this.ttl,noDisposeOnSet:o=this.noDisposeOnSet,size:u=0,sizeCalculation:f=this.sizeCalculation,noUpdateTTL:h=this.noUpdateTTL,noDeleteOnFetchRejection:m=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:v=this.allowStaleOnFetchRejection,ignoreFetchAbort:g=this.ignoreFetchAbort,allowStaleOnFetchAbort:$=this.allowStaleOnFetchAbort,context:b,forceRefresh:k=!1,status:p,signal:w}=t;if(!c(this,Pe))return p&&(p.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:l,status:p});const S={allowStale:n,updateAgeOnGet:i,noDeleteOnStaleGet:l,ttl:a,noDisposeOnSet:o,size:u,sizeCalculation:f,noUpdateTTL:h,noDeleteOnFetchRejection:m,allowStaleOnFetchRejection:v,allowStaleOnFetchAbort:$,ignoreFetchAbort:g,status:p,signal:w};let C=c(this,ie).get(e);if(C===void 0){p&&(p.fetch="miss");const V=_(this,st,Vt).call(this,e,C,S,b);return V.__returned=V}else{const V=c(this,O)[C];if(_(this,X,Y).call(this,V)){const U=n&&V.__staleWhileFetching!==void 0;return p&&(p.fetch="inflight",U&&(p.returnedStale=!0)),U?V.__staleWhileFetching:V.__returned=V}const H=c(this,ge).call(this,C);if(!k&&!H)return p&&(p.fetch="hit"),_(this,Ke,ut).call(this,C),i&&c(this,qe).call(this,C),p&&c(this,Le).call(this,p,C),V;const T=_(this,st,Vt).call(this,e,C,S,b),G=T.__staleWhileFetching!==void 0&&n;return p&&(p.fetch=H?"stale":"refresh",G&&H&&(p.returnedStale=!0)),G?T.__staleWhileFetching:T.__returned=T}}get(e,t={}){const{allowStale:n=this.allowStale,updateAgeOnGet:i=this.updateAgeOnGet,noDeleteOnStaleGet:l=this.noDeleteOnStaleGet,status:a}=t,o=c(this,ie).get(e);if(o!==void 0){const u=c(this,O)[o],f=_(this,X,Y).call(this,u);return a&&c(this,Le).call(this,a,o),c(this,ge).call(this,o)?(a&&(a.get="stale"),f?(a&&n&&u.__staleWhileFetching!==void 0&&(a.returnedStale=!0),n?u.__staleWhileFetching:void 0):(l||this.delete(e),a&&n&&(a.returnedStale=!0),n?u:void 0)):(a&&(a.get="hit"),f?u.__staleWhileFetching:(_(this,Ke,ut).call(this,o),i&&c(this,qe).call(this,o),u))}else a&&(a.get="miss")}delete(e){var n,i,l,a;let t=!1;if(c(this,ne)!==0){const o=c(this,ie).get(e);if(o!==void 0)if(t=!0,c(this,ne)===1)this.clear();else{c(this,We).call(this,o);const u=c(this,O)[o];_(this,X,Y).call(this,u)?u.__abortController.abort(new Error("deleted")):(c(this,Te)||c(this,de))&&(c(this,Te)&&((n=c(this,Ce))==null||n.call(this,u,e,"delete")),c(this,de)&&((i=c(this,re))==null||i.push([u,e,"delete"]))),c(this,ie).delete(e),c(this,Z)[o]=void 0,c(this,O)[o]=void 0,o===c(this,le)?L(this,le,c(this,me)[o]):o===c(this,ce)?L(this,ce,c(this,ue)[o]):(c(this,ue)[c(this,me)[o]]=c(this,ue)[o],c(this,me)[c(this,ue)[o]]=c(this,me)[o]),xt(this,ne)._--,c(this,ye).push(o)}}if(c(this,de)&&((l=c(this,re))!=null&&l.length)){const o=c(this,re);let u;for(;u=o==null?void 0:o.shift();)(a=c(this,be))==null||a.call(this,...u)}return t}clear(){var e,t,n;for(const i of _(this,Ne,He).call(this,{allowStale:!0})){const l=c(this,O)[i];if(_(this,X,Y).call(this,l))l.__abortController.abort(new Error("deleted"));else{const a=c(this,Z)[i];c(this,Te)&&((e=c(this,Ce))==null||e.call(this,l,a,"delete")),c(this,de)&&((t=c(this,re))==null||t.push([l,a,"delete"]))}}if(c(this,ie).clear(),c(this,O).fill(void 0),c(this,Z).fill(void 0),c(this,we)&&c(this,Ie)&&(c(this,we).fill(0),c(this,Ie).fill(0)),c(this,Ae)&&c(this,Ae).fill(0),L(this,ce,0),L(this,le,0),c(this,ye).length=0,L(this,ke,0),L(this,ne,0),c(this,de)&&c(this,re)){const i=c(this,re);let l;for(;l=i==null?void 0:i.shift();)(n=c(this,be))==null||n.call(this,...l)}}};let Pt=Yt;ve=new WeakMap,fe=new WeakMap,Ce=new WeakMap,be=new WeakMap,tt=new WeakMap,ne=new WeakMap,ke=new WeakMap,ie=new WeakMap,Z=new WeakMap,O=new WeakMap,ue=new WeakMap,me=new WeakMap,ce=new WeakMap,le=new WeakMap,ye=new WeakMap,re=new WeakMap,Ae=new WeakMap,Ie=new WeakMap,we=new WeakMap,Te=new WeakMap,Pe=new WeakMap,de=new WeakMap,dt=new WeakSet,Mt=function(){const e=new Et(c(this,ve)),t=new Et(c(this,ve));L(this,we,e),L(this,Ie,t),L(this,ht,(l,a,o=rt.now())=>{if(t[l]=a!==0?o:0,e[l]=a,a!==0&&this.ttlAutopurge){const u=setTimeout(()=>{c(this,ge).call(this,l)&&this.delete(c(this,Z)[l])},a+1);u.unref&&u.unref()}}),L(this,qe,l=>{t[l]=e[l]!==0?rt.now():0}),L(this,Le,(l,a)=>{if(e[a]){const o=e[a],u=t[a];l.ttl=o,l.start=u,l.now=n||i(),l.remainingTTL=l.now+o-u}});let n=0;const i=()=>{const l=rt.now();if(this.ttlResolution>0){n=l;const a=setTimeout(()=>n=0,this.ttlResolution);a.unref&&a.unref()}return l};this.getRemainingTTL=l=>{const a=c(this,ie).get(l);return a===void 0?0:e[a]===0||t[a]===0?1/0:t[a]+e[a]-(n||i())},L(this,ge,l=>e[l]!==0&&t[l]!==0&&(n||i())-t[l]>e[l])},qe=new WeakMap,Le=new WeakMap,ht=new WeakMap,ge=new WeakMap,Ft=new WeakSet,jn=function(){const e=new Et(c(this,ve));L(this,ke,0),L(this,Ae,e),L(this,We,t=>{L(this,ke,c(this,ke)-e[t]),e[t]=0}),L(this,ft,(t,n,i,l)=>{if(_(this,X,Y).call(this,n))return 0;if(!Oe(i))if(l){if(typeof l!="function")throw new TypeError("sizeCalculation must be a function");if(i=l(n,t),!Oe(i))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 i}),L(this,nt,(t,n,i)=>{if(e[t]=n,c(this,fe)){const l=c(this,fe)-e[t];for(;c(this,ke)>l;)_(this,it,zt).call(this,!0)}L(this,ke,c(this,ke)+e[t]),i&&(i.entrySize=n,i.totalCalculatedSize=c(this,ke))})},We=new WeakMap,nt=new WeakMap,ft=new WeakMap,Ee=new WeakSet,De=function*({allowStale:e=this.allowStale}={}){if(c(this,ne))for(let t=c(this,le);!(!_(this,mt,Bt).call(this,t)||((e||!c(this,ge).call(this,t))&&(yield t),t===c(this,ce)));)t=c(this,me)[t]},Ne=new WeakSet,He=function*({allowStale:e=this.allowStale}={}){if(c(this,ne))for(let t=c(this,ce);!(!_(this,mt,Bt).call(this,t)||((e||!c(this,ge).call(this,t))&&(yield t),t===c(this,le)));)t=c(this,ue)[t]},mt=new WeakSet,Bt=function(e){return e!==void 0&&c(this,ie).get(c(this,Z)[e])===e},it=new WeakSet,zt=function(e){var l,a;const t=c(this,ce),n=c(this,Z)[t],i=c(this,O)[t];return c(this,Pe)&&_(this,X,Y).call(this,i)?i.__abortController.abort(new Error("evicted")):(c(this,Te)||c(this,de))&&(c(this,Te)&&((l=c(this,Ce))==null||l.call(this,i,n,"evict")),c(this,de)&&((a=c(this,re))==null||a.push([i,n,"evict"]))),c(this,We).call(this,t),e&&(c(this,Z)[t]=void 0,c(this,O)[t]=void 0,c(this,ye).push(t)),c(this,ne)===1?(L(this,ce,L(this,le,0)),c(this,ye).length=0):L(this,ce,c(this,ue)[t]),c(this,ie).delete(n),xt(this,ne)._--,t},st=new WeakSet,Vt=function(e,t,n,i){const l=t===void 0?void 0:c(this,O)[t];if(_(this,X,Y).call(this,l))return l;const a=new AbortController,{signal:o}=n;o==null||o.addEventListener("abort",()=>a.abort(o.reason),{signal:a.signal});const u={signal:a.signal,options:n,context:i},f=(b,k=!1)=>{const{aborted:p}=a.signal,w=n.ignoreFetchAbort&&b!==void 0;if(n.status&&(p&&!k?(n.status.fetchAborted=!0,n.status.fetchError=a.signal.reason,w&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),p&&!w&&!k)return m(a.signal.reason);const S=g;return c(this,O)[t]===g&&(b===void 0?S.__staleWhileFetching?c(this,O)[t]=S.__staleWhileFetching:this.delete(e):(n.status&&(n.status.fetchUpdated=!0),this.set(e,b,u.options))),b},h=b=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=b),m(b)),m=b=>{const{aborted:k}=a.signal,p=k&&n.allowStaleOnFetchAbort,w=p||n.allowStaleOnFetchRejection,S=w||n.noDeleteOnFetchRejection,C=g;if(c(this,O)[t]===g&&(!S||C.__staleWhileFetching===void 0?this.delete(e):p||(c(this,O)[t]=C.__staleWhileFetching)),w)return n.status&&C.__staleWhileFetching!==void 0&&(n.status.returnedStale=!0),C.__staleWhileFetching;if(C.__returned===C)throw b},v=(b,k)=>{var w;const p=(w=c(this,tt))==null?void 0:w.call(this,e,l,u);p&&p instanceof Promise&&p.then(S=>b(S),k),a.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(b(),n.allowStaleOnFetchAbort&&(b=S=>f(S,!0)))})};n.status&&(n.status.fetchDispatched=!0);const g=new Promise(v).then(f,h),$=Object.assign(g,{__abortController:a,__staleWhileFetching:l,__returned:void 0});return t===void 0?(this.set(e,$,{...u.options,status:void 0}),t=c(this,ie).get(e)):c(this,O)[t]=$,$},X=new WeakSet,Y=function(e){if(!c(this,Pe))return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof AbortController},gt=new WeakSet,Ut=function(e,t){c(this,me)[t]=e,c(this,ue)[e]=t},Ke=new WeakSet,ut=function(e){e!==c(this,le)&&(e===c(this,ce)?L(this,ce,c(this,ue)[e]):_(this,gt,Ut).call(this,c(this,me)[e],c(this,ue)[e]),_(this,gt,Ut).call(this,c(this,le),e),L(this,le,e))};const Yi=Pt,at=s=>{const e=s.value,t=e.substring(0,s.selectionStart),n=e.substring(s.selectionEnd,e.length),i=t.lastIndexOf(`
|
|
51
|
+
`),l=t.substring(0,i+1),a=n.indexOf(`
|
|
52
|
+
`),o=n.substring(a===-1?n.length:a,n.length),u=t.substring(i+1,t.length),f=n.substring(0,a);return{prefixStr:t,subfixStr:n,prefixStrEndRow:l,subfixStrEndRow:o,prefixSupply:u,subfixSupply:f}},Ji=(s,e="",t,n)=>{var m,v,g,$,b,k;let i="",l=0,a=0,o=!1,u,f;const h=(m=J.editorConfig)==null?void 0:m.mermaidTemplate;if(/^h[1-6]{1}$/.test(s)){const p=s.replace(/^h(\d)/,(w,S)=>new Array(Number(S)).fill("#",0,S).join(""));i=`${p} ${e}`,l=p.length+1}else if(s==="prettier"){const p=window.prettier||((g=(v=J.editorExtensions)==null?void 0:v.prettier)==null?void 0:g.prettierInstance),w=[(($=window.prettierPlugins)==null?void 0:$.markdown)||((k=(b=J.editorExtensions)==null?void 0:b.prettier)==null?void 0:k.parserMarkdownInstance)];return!p||w[0]===void 0?(x.emit(n.editorId,"errorCatcher",{name:"prettier",message:"prettier is undefined"}),t.value):p.format(t.value,{parser:"markdown",plugins:w})}else switch(s){case"bold":{i=`**${e}**`,l=2,a=-2;break}case"underline":{i=`<u>${e}</u>`,l=3,a=-4;break}case"italic":{i=`*${e}*`,l=1,a=-1;break}case"strikeThrough":{i=`~${e}~`,l=1,a=-1;break}case"sub":{i=`<sub>${e}</sub>`,l=5,a=-6;break}case"sup":{i=`<sup>${e}</sup>`,l=5,a=-6;break}case"codeRow":{i="`"+e+"`",l=1,a=-1;break}case"quote":{i=`> ${e}`,l=2;break}case"orderedList":{i=`1. ${e}`,l=3;break}case"unorderedList":{i=`- ${e}`,l=2;break}case"task":{i=`- [ ] ${e}`,l=6,o=!0;break}case"code":{const p=n.text||e||"",w=n.mode||"language";i=`\`\`\`${w}
|
|
53
|
+
${p}
|
|
54
|
+
\`\`\`
|
|
55
|
+
`,l=3,a=3+w.length-i.length,o=!0;break}case"table":{i="|";const{selectedShape:p={x:1,y:1}}=n,{x:w,y:S}=p;for(let C=0;C<=S;C++)i+=" col |";i+=`
|
|
56
|
+
|`;for(let C=0;C<=S;C++)i+=" - |";for(let C=0;C<=w;C++){i+=`
|
|
57
|
+
|`;for(let V=0;V<=S;V++)i+=" content |"}l=2,a=5-i.length,o=!0;break}case"link":{const{desc:p,url:w}=n;i=`[${p}](${w})`;break}case"image":{const{desc:p,url:w,urls:S}=n;S instanceof Array?i=S.reduce((C,V)=>C+`
|
|
58
|
+
`,""):i=`
|
|
59
|
+
`;break}case"tab":{const{tabWidth:p=2}=n,w=new Array(p).fill(" ").join("");if(e==="")i=w;else if(/\n/.test(e)){const{prefixStr:S,subfixStr:C,prefixSupply:V,subfixSupply:H}=at(t);i=`${V}${e}${H}`.split(`
|
|
60
|
+
`).map(G=>`${w}${G}`).join(`
|
|
61
|
+
`),u=S.substring(0,S.length-V.length),f=C.substring(H.length,C.length),o=!0,l=p,a=-V.length-H.length}else{const C=t.value.substring(0,t.selectionStart);/\n$/.test(C)||C===""?(i=`${w}${e}`,o=!0):i=w}break}case"shiftTab":{const{tabWidth:p=2}=n,{prefixStr:w,prefixStrEndRow:S,subfixStrEndRow:C,prefixSupply:V,subfixSupply:H}=at(t),T=new RegExp(`^\\s{${p}}`),y=(G=!1,U=!1)=>{const B=`${V}${e}${H}`;if(T.test(B)){const z=w.length-(U?0:p),F=G?z+e.length-p:z;return _e(t,z,F),`${S}${B.replace(T,"")}${C}`}else if(/^\s/.test(B)){const z=B.replace(/^\s/,""),F=B.length-z.length,P=t.selectionStart-(U?0:F),q=G?P+e.length-F:P;return _e(t,P,q),`${S}${z}${C}`}else i=e};if(e===""){const G=y();if(G)return G}else if(/\n/.test(e)){const U=`${V}${e}${H}`.split(`
|
|
62
|
+
`);let[B,z]=[0,0];const F=U.map((P,q)=>{if(T.test(P))return q===0&&(B=p),z+=p,P.replace(T,"");if(/^\s/.test(P)){const j=P.replace(/^\s/,"");return z+=P.length-j.length,j}return P}).join(`
|
|
63
|
+
`);return _e(t,t.selectionStart-B,t.selectionEnd-z),`${S}${F}${C}`}else{const G=y(!0,!0);if(G)return G}break}case"ctrlC":{const{prefixSupply:p,subfixSupply:w}=at(t);return ct(e===""?`${p}${w}`:e),t.value}case"ctrlX":{const{prefixStrEndRow:p,subfixStrEndRow:w,prefixStr:S,subfixStr:C,prefixSupply:V,subfixSupply:H}=at(t);return e===""?(ct(`${V}${H}`),_e(t,p.length),`${p}${w.replace(/^\n/,"")}`):(ct(e),_e(t,S.length),`${S}${C}`)}case"ctrlD":{const{prefixStrEndRow:p,subfixStrEndRow:w}=at(t);return _e(t,p.length),`${p}${w.replace(/^\n/,"")}`}case"flow":{i=`\`\`\`mermaid
|
|
64
|
+
${(h==null?void 0:h.flow)||`flowchart TD
|
|
65
|
+
Start --> Stop`}
|
|
66
|
+
\`\`\`
|
|
67
|
+
`,l=2;break}case"sequence":{i=`\`\`\`mermaid
|
|
68
|
+
${(h==null?void 0:h.sequence)||`sequenceDiagram
|
|
69
|
+
A->>B: hello!
|
|
70
|
+
B-->>A: hi!
|
|
71
|
+
A-)B: bye!`}
|
|
72
|
+
\`\`\`
|
|
73
|
+
`,l=2;break}case"gantt":{i=`\`\`\`mermaid
|
|
74
|
+
${(h==null?void 0:h.gantt)||`gantt
|
|
75
|
+
title A Gantt Diagram
|
|
76
|
+
dateFormat YYYY-MM-DD
|
|
77
|
+
section Section
|
|
78
|
+
A task :a1, 2014-01-01, 30d
|
|
79
|
+
Another task :after a1, 20d`}
|
|
80
|
+
\`\`\`
|
|
81
|
+
`,l=2;break}case"class":{i=`\`\`\`mermaid
|
|
82
|
+
${(h==null?void 0:h.class)||`classDiagram
|
|
83
|
+
class Animal
|
|
84
|
+
Vehicle <|-- Car`}
|
|
85
|
+
\`\`\`
|
|
86
|
+
`,l=2;break}case"state":{i=`\`\`\`mermaid
|
|
87
|
+
${(h==null?void 0:h.state)||`stateDiagram-v2
|
|
88
|
+
s1 --> s2`}
|
|
89
|
+
\`\`\`
|
|
90
|
+
`,l=2;break}case"pie":{i=`\`\`\`mermaid
|
|
91
|
+
${(h==null?void 0:h.pie)||`pie title Pets adopted by volunteers
|
|
92
|
+
"Dogs" : 386
|
|
93
|
+
"Cats" : 85
|
|
94
|
+
"Rats" : 15`}
|
|
95
|
+
\`\`\`
|
|
96
|
+
`,l=2;break}case"relationship":{i=`\`\`\`mermaid
|
|
97
|
+
${(h==null?void 0:h.relationship)||`erDiagram
|
|
98
|
+
CAR ||--o{ NAMED-DRIVER : allows
|
|
99
|
+
PERSON ||--o{ NAMED-DRIVER : is`}
|
|
100
|
+
\`\`\`
|
|
101
|
+
`,l=2;break}case"journey":{i=`\`\`\`mermaid
|
|
102
|
+
${(h==null?void 0:h.journey)||`journey
|
|
103
|
+
title My working day
|
|
104
|
+
section Go to work
|
|
105
|
+
Make tea: 5: Me
|
|
106
|
+
Go upstairs: 3: Me
|
|
107
|
+
Do work: 1: Me, Cat
|
|
108
|
+
section Go home
|
|
109
|
+
Go downstairs: 5: Me
|
|
110
|
+
Sit down: 5: Me`}
|
|
111
|
+
\`\`\`
|
|
112
|
+
`,l=2;break}case"katexInline":{i="$$",l=1,a=-1;break}case"katexBlock":{i=`$$
|
|
113
|
+
|
|
114
|
+
$$
|
|
115
|
+
`,l=1,a=-4;break}case"universal":{const{generate:p}=n,w=p(e);i=w.targetValue,o=w.select,l=w.deviationStart,a=w.deviationEnd}}return Dt(t,i,{deviationStart:l,deviationEnd:a,select:o,prefixVal:u,subfixVal:f})},$n={block(s,e){return{name:"KaTexBlockExtension",level:"block",start:t=>{var n;return(n=t.match(/\n\$\$/))==null?void 0:n.index},tokenizer(t){if(/^\$\$/.test(t)&&t.split("$$").length>2){const n=an(t,"$$");return{type:"KaTexBlockExtension",raw:n[0],text:n[1].trim(),tokens:[]}}},renderer(t){const n=e||typeof window<"u"&&window.katex;if(n){const i=n.renderToString(t.text,{throwOnError:!1,displayMode:!0});return`<p class="${s}-katex-block" data-processed>${i}</p>`}else return`<p class="${s}-katex-block">${t.text}</p>`}}},inline(s,e){return{name:"KaTexInlineExtension",level:"inline",start:t=>{var n;return(n=t.match(/\$[^\n]*/))==null?void 0:n.index},tokenizer(t){if(/^\$[^\n]*\$/.test(t)){const n=an(t);return{type:"KaTexInlineExtension",raw:n[0],text:n[1].trim(),tokens:[]}}},renderer(t){const n=e||typeof window<"u"&&window.katex;if(n){const i=n.renderToString(t.text,{throwOnError:!1});return`<span class="${s}-katex-inline" data-processed>${i}</span>`}else return`<span class="${s}-katex-inline">${t.text}</span>`}}}},On=["abstract","attention","bug","caution","danger","error","example","failure","hint","info","note","question","quote","success","tip","warning"],Ot=new RegExp(`^!!!\\s*(${On.join("|")})\\s*(.*)$`),es=/^!!!\s*$/,ts={name:"alert",level:"block",start(s){var t;return(t=s.match(new RegExp(`(^|[\\r\\n])!!!\\s*(${On.join("|")})\\s*(.*)`)))==null?void 0:t.index},tokenizer(s){const e=s.split(/\n/);if(Ot.test(e[0])){const t={x:-1,y:-1},n=[];for(let i=0,l=e.length;i<l;i++)Ot.test(e[i])?t.x=i:es.test(e[i])&&(t.y=i,t.x>=0&&(n.push({...t}),t.x=-1,t.y=-1));if(n.length){const i=n[0],[l,a,o]=Ot.exec(e[i.x])||[],u=e.slice(i.x+1,i.y).join(`
|
|
116
|
+
`),h={type:"alert",raw:e.slice(i.x,i.y+1).join(`
|
|
117
|
+
`),icon:a,title:o,text:u,titleTokens:[],tokens:[],childTokens:["title","text"]};return this.lexer.inlineTokens(h.title,h.titleTokens),this.lexer.blockTokens(h.text,h.tokens),h}}},renderer(s){return`<div class="md-editor-alert md-editor-alert-${s.icon}">
|
|
118
|
+
<p class="md-editor-alert-title">${this.parser.parseInline(s.titleTokens,null)}</p>
|
|
119
|
+
${this.parser.parse(s.tokens)}
|
|
120
|
+
</div>`}},ns=typeof window>"u",is=(s,e,t)=>{var g,$;const n=r.inject("previewOnly"),i=r.inject("historyLength"),l=r.inject("editorId");if(n)return;let a=-1;const o={list:[{content:s.value,startPos:((g=e.value)==null?void 0:g.selectionStart)||0,endPos:(($=e.value)==null?void 0:$.selectionEnd)||0}],userUpdated:!0,curr:0},u=[0,0];let f=u;const h=b=>{var S,C;const k=((S=e.value)==null?void 0:S.selectionStart)||0,p=((C=e.value)==null?void 0:C.selectionEnd)||0;o.list[o.curr].startPos=k,o.list[o.curr].endPos=p,o.userUpdated=!1,o.curr=b;const w=o.list[o.curr];f=[w.startPos,w.endPos],s.onChange(w.content),_e(e.value,w.startPos,w.endPos).then(()=>{x.emit(l,"selectTextChange")})},m=b=>{var w,S;clearTimeout(a);const k=((w=e.value)==null?void 0:w.selectionStart)||0,p=((S=e.value)==null?void 0:S.selectionEnd)||0;a=setTimeout(()=>{if(o.userUpdated){o.curr<o.list.length-1&&(o.list=o.list.slice(0,o.curr+1)),o.list.length>i&&o.list.shift();const C=o.list.pop()||{startPos:0,endPos:0,content:b};C.startPos=f[0],C.endPos=f[1],f=u,Array.prototype.push.call(o.list,C,{content:b,startPos:k,endPos:p}),o.curr=o.list.length-1}else o.userUpdated=!0},150)},v=b=>{var k,p;(f===u||b)&&(f=[(k=e.value)==null?void 0:k.selectionStart,(p=e.value)==null?void 0:p.selectionEnd])};r.watch([r.toRef(s,"value"),t],()=>{t.value&&m(s.value)}),r.watch(()=>s.value,()=>{x.emit(l,"selectTextChange")},{flush:"post"}),r.onMounted(()=>{x.on(l,{name:"ctrlZ",callback(){h(o.curr-1<0?0:o.curr-1)}}),x.on(l,{name:"ctrlShiftZ",callback(){h(o.curr+1===o.list.length?o.curr:o.curr+1)}}),x.on(l,{name:"saveHistoryPos",callback:v})})},ss=(s,e)=>{var l;const t=(l=J.editorExtensions)==null?void 0:l.katex,n=t==null?void 0:t.instance,i=r.ref(!1);return s.noKatex||e.use({extensions:[$n.inline(d,n),$n.block(d,n)]}),r.onMounted(()=>{if(!s.noKatex&&!n){const a=document.createElement("script");a.src=(t==null?void 0:t.js)||_t.js,a.onload=()=>{i.value=!0},a.id=`${d}-katex`;const o=document.createElement("link");o.rel="stylesheet",o.href=(t==null?void 0:t.css)||_t.css,o.id=`${d}-katexCss`,pe(a,"katex"),pe(o)}}),i},ls=s=>{var q,j,ee;const{markedRenderer:e,markedExtensions:t,markedOptions:n,editorExtensions:i,editorConfig:l}=J,a=r.inject("showCodeRowNumber"),o=r.inject("editorId"),u=r.inject("highlight"),f=r.inject("previewOnly"),h=r.inject("theme"),m=(q=i==null?void 0:i.highlight)==null?void 0:q.instance,v=(j=i==null?void 0:i.mermaid)==null?void 0:j.instance,g=(ee=i==null?void 0:i.katex)==null?void 0:ee.instance,$=i==null?void 0:i.katex,b=r.ref(!1),k=r.ref([]);let p=[],w=[];const S=new Yi({max:1e3,ttl:6e5}),C=as(s),V=ss(s,N),H=r.computed(()=>(s.noMermaid||C.mermaidInited)&&b.value&&(s.noKatex||V.value));let T=new N.Renderer;T.image=(I,R,M)=>`<span class="figure"><img src="${I}" title="${R||""}" alt="${M||""}" zoom><span class="figcaption">${M||""}</span></span>`,T.listitem=(I,R)=>R?`<li class="li-task">${I}</li>`:`<li>${I}</li>`,e instanceof Function&&(T=e(T));const y=T.code;T.code=(I,R,M)=>{if(!s.noMermaid&&R==="mermaid"){const se=ti();try{if(ns)return`<p class="${d}-mermaid">${I}</p>`;{const he=S.get(I);if(he)return`<p class="${d}-mermaid" data-processed>${he}</p>`;const Se=v||window.mermaid;if(C.mermaidInited){const Me=(Se.renderAsync||Se.render)(se,I);Me.then(je=>{S.set(I,typeof je=="string"?je:je.svg)}),p.push(Me)}else return`<p class="${d}-mermaid">${I}</p>`}const oe=`<script type="text/tmplate">${se}<\/script>`;return w.push(oe),oe}catch(oe){return`<p class="${d}-mermaid-error">Error: ${(oe==null?void 0:oe.message)||""}</p>`}}return y.call(T,I,R,M).replace(/^<pre><code\sclass="language-([^>]*)">/,'<pre><code class="language-$1" language="$1">')};const G=T.heading,U=G!==new N.Renderer().heading;T.heading=(I,R,M,se)=>{k.value.push({text:M,level:R});const oe=s.markedHeadingId(M,R,k.value.length);return U?G.call(T,I,R,M,se,k.value.length,oe):I!==M?`<h${R} id="${oe}">${I}</h${R}>`:`<h${R} id="${oe}"><a href="#${oe}">${M}</a></h${R}>`},m&&N.setOptions({highlight:(I,R)=>{let M;const se=m.getLanguage(R);return R&&se?M=m.highlight(I,{language:R,ignoreIllegals:!0}).value:M=m.highlightAuto(I).value,a?rn(M):`<span class="code-block">${M}</span>`}}),N.setOptions({breaks:!0,...n}),t instanceof Array&&t.length>0&&N.use({extensions:t}),N.use({extensions:[ts]});const B=r.ref(s.sanitize(N(s.value||"",{renderer:T}))),z=async I=>{let R=s.sanitize(N(I,{renderer:T}));const M=[...p],se=[...w];return w=[],p=[],(await Promise.allSettled(M)).forEach((he,Se)=>{he.status==="fulfilled"?R=R.replace(se[Se],`<p class="${d}-mermaid" data-processed>${typeof he.value=="string"?he.value:he.value.svg}</p>`):R=R.replace(se[Se],`<p class="${d}-mermaid-error">${he.reason||""}</p>`)}),R},F=Rt(async()=>{k.value=[];const I=await z(s.value||"");B.value=I,x.emit(o,"buildFinished",B.value),s.onHtmlChanged(B.value)},(l==null?void 0:l.renderDelay)!==void 0?l==null?void 0:l.renderDelay:f?0:500);r.watch([H,r.toRef(C,"reRender"),r.toRef(s,"value")],F),r.watch([h],()=>{S.clear()});const P=()=>{N.setOptions({highlight:(I,R)=>{let M;const se=window.hljs.getLanguage(R);return R&&se?M=window.hljs.highlight(I,{language:R,ignoreIllegals:!0}).value:M=window.hljs.highlightAuto(I).value,a?rn(M):`<span class="code-block">${M}</span>`}}),b.value=!0};return r.watch(()=>k.value,I=>{s.onGetCatalog(I),x.emit(o,"catalogChanged",I)}),r.onMounted(()=>{if(!s.noKatex&&!g){const R=document.createElement("script");R.src=($==null?void 0:$.js)||_t.js,R.onload=()=>{V.value=!0},R.id=`${d}-katex`;const M=document.createElement("link");M.rel="stylesheet",M.href=($==null?void 0:$.css)||_t.css,M.id=`${d}-katexCss`,pe(R,"katex"),pe(M)}const I=document.createElement("link");if(I.rel="stylesheet",I.href=u.value.css,I.id=`${d}-hlCss`,pe(I),!m){const R=document.createElement("script");R.src=u.value.js,R.onload=P,R.id=`${d}-hljs`,pe(R,"hljs")}}),r.watch(()=>u.value.css,I=>{ni(`${d}-hlCss`,"href",I)}),r.onMounted(()=>{x.on(o,{name:"pushCatalog",callback(){x.emit(o,"catalogChanged",k.value)}})}),B},os=(s,e,t,n,i)=>{const l=r.inject("previewOnly"),a=r.inject("usedLanguageText"),o=r.inject("editorId");let u=()=>{},f=()=>{};const h=()=>{document.querySelectorAll(`#${o}-preview pre`).forEach(g=>{var p,w;let $=-1;(p=g.querySelector(".copy-button"))==null||p.remove();const b=((w=a.value.copyCode)==null?void 0:w.text)||"复制代码",k=document.createElement("span");k.setAttribute("class","copy-button"),k.dataset.tips=b,k.innerHTML=`<svg class="${d}-icon" aria-hidden="true"><use xlink:href="#${d}-icon-copy"></use></svg>`,k.addEventListener("click",()=>{var T,y;clearTimeout($);const S=g.querySelector("code").innerText,C=ct(s.formatCopiedText(S)),V=((T=a.value.copyCode)==null?void 0:T.successTips)||"已复制!",H=((y=a.value.copyCode)==null?void 0:y.failTips)||"已复制!";k.dataset.tips=C?V:H,$=window.setTimeout(()=>{k.dataset.tips=b},1500)}),g.appendChild(k)})},m=()=>{r.nextTick(()=>{s.setting.preview&&!l&&s.scrollAuto&&(u(),f()),h()})},v=g=>{g&&!l&&r.nextTick(()=>{u(),[f,u]=on(t.value,n.value||i.value),f(),h()})};r.watch(()=>e.value,m),r.watch(()=>a.value,h),r.watch(()=>s.setting.preview,v),r.watch(()=>s.setting.htmlPreview,v),r.watch(()=>s.scrollAuto,g=>{g?f():u()}),r.onMounted(()=>{h(),!l&&(n.value||i.value)&&([f,u]=on(t.value,n.value||i.value)),s.scrollAuto&&f()})},rs=(s,e)=>{const t=r.inject("previewOnly"),n=r.inject("tabWidth"),i=r.inject("editorId"),l=r.ref("");r.onMounted(()=>{var a;t||((a=e.value)==null||a.addEventListener("keypress",o=>{var u,f,h;if(o.key==="Enter"){const m=(u=e.value)==null?void 0:u.selectionStart,v=(f=e.value)==null?void 0:f.value.substring(0,m),g=(h=e.value)==null?void 0:h.value.substring(m),$=v==null?void 0:v.lastIndexOf(`
|
|
121
|
+
`),b=v==null?void 0:v.substring($+1,m);if(/^\d+\.\s|^-\s/.test(b))if(o.cancelBubble=!0,o.preventDefault(),o.stopPropagation(),/^(\d+\.|-)\s+(\[[x\s]\]\s+)?$/.test(b)){const k=v==null?void 0:v.replace(/(\d+\.|-)\s+(\[[x\s]\]\s+)?$/,"");s.onChange(k+g),_e(e.value,k==null?void 0:k.length)}else if(/^-\s+.+/.test(b)){const k=/^-\s+\[[x\s]\]/.test(b)?`
|
|
122
|
+
- [ ] `:`
|
|
123
|
+
- `;s.onChange(Dt(e.value,k,{}))}else{const k=b==null?void 0:b.match(/\d+(?=\.)/),p=k&&Number(k[0])+1||1,w=/^\d\.\s+\[[x\s]\]/.test(b)?`
|
|
124
|
+
${p}. [ ] `:`
|
|
125
|
+
${p}. `;s.onChange(Dt(e.value,w,{}))}}}),x.on(i,{name:"replace",callback(o,u={}){s.onChange(Ji(o,l.value,e.value,{...u,tabWidth:n,editorId:i}))}}),x.on(i,{name:"selectTextChange",callback(){l.value=Yn(e.value)}}))}),r.watch(()=>s.value,()=>{l.value=""})},as=s=>{const e=r.inject("theme"),{editorExtensions:t}=J,n=t==null?void 0:t.mermaid,i=r.reactive({reRender:!1,mermaidInited:!1}),l=()=>{const a=(n==null?void 0:n.instance)||window.mermaid;!s.noMermaid&&a&&(a.initialize({startOnLoad:!1,theme:e.value==="dark"?"dark":"default"}),i.reRender=!i.reRender)};return r.watch(()=>e.value,l),r.onMounted(()=>{if(!s.noMermaid)if(n!=null&&n.instance)l(),i.mermaidInited=!0;else{const a=document.createElement("script");a.id=`${d}-mermaid`;const o=(n==null?void 0:n.js)||Wn;/\.mjs/.test(o)?(a.setAttribute("type","module"),a.innerHTML=`import mermaid from "${o}";window.mermaid=mermaid;document.getElementById('${d}-mermaid').dispatchEvent(new Event('load'));`):a.src=o,a.onload=()=>{l(),i.mermaidInited=!0},pe(a,"mermaid")}}),i},cs=(s,e)=>{const t=r.inject("editorId"),n=r.inject("previewOnly"),i=l=>{if(l.clipboardData){if(l.clipboardData.files.length>0){const{files:a}=l.clipboardData;x.emit(t,"uploadImage",Array.from(a).filter(o=>/image\/.*/.test(o.type))),l.preventDefault()}if(s.autoDetectCode&&l.clipboardData.types.includes("vscode-editor-data")){const a=JSON.parse(l.clipboardData.getData("vscode-editor-data"));x.emit(t,"replace","code",{mode:a.mode,text:l.clipboardData.getData("text/plain")}),l.preventDefault()}}};r.onMounted(()=>{n||e.value.addEventListener("paste",i)}),r.onBeforeUnmount(()=>{n||e.value.removeEventListener("paste",i)})},us=(s,e)=>{const t=r.inject("editorId"),n=Rt(()=>{const i=document.querySelectorAll(`#${t}-preview img[zoom]`);i.length!==0&&Zi(i,{background:"#00000073"})});r.onMounted(n),r.watch([e,r.toRef(s.setting,"preview")],n)},ds=s=>{const e=r.inject("editorId");r.onMounted(()=>{x.on(e,{name:En,callback(){var t;(t=s.value)==null||t.focus()}})})},hs=()=>({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:()=>{}}}),fs=r.defineComponent({name:"MDEditorContent",props:hs(),setup(s){const e=r.ref(!0),t=r.inject("previewOnly"),n=r.inject("showCodeRowNumber"),i=r.inject("previewTheme"),l=r.inject("editorId"),a=r.ref(),o=r.ref(),u=r.ref(),f=ls(s);return os(s,f,a,o,u),rs(s,a),is(s,a,e),cs(s,a),us(s,f),ds(a),()=>{const h=ei(s,["formatCopiedText","markedHeadingId","noKatex","noMermaid","onChange","onGetCatalog","onHtmlChanged","sanitize","scrollAuto","setting","autoDetectCode","onBlur","onFocus"]);return r.createVNode(r.Fragment,null,[r.createVNode("div",{class:`${d}-content`},[!t&&r.createVNode("div",{class:`${d}-input-wrapper`},[r.createVNode("textarea",r.mergeProps(h,{id:`${l}-textarea`,class:[s.setting.preview||s.setting.htmlPreview?"":"textarea-only"],ref:a,onBlur:m=>{x.emit(l,"selectTextChange"),s.onBlur(m)},onFocus:s.onFocus,onKeydown:()=>{x.emit(l,"saveHistoryPos",!0)},onCompositionstart:()=>{e.value=!1},onInput:m=>{s.onChange(m.target.value)},onCompositionend:()=>{e.value=!0}}),null)]),s.setting.preview&&r.createVNode("div",{id:`${l}-preview-wrapper`,class:`${d}-preview-wrapper`,ref:o,key:"content-preview-wrapper"},[r.createVNode("article",{id:`${l}-preview`,class:[`${d}-preview`,`${i==null?void 0:i.value}-theme`,n&&`${d}-scrn`],innerHTML:f.value},null)]),s.setting.htmlPreview&&r.createVNode("div",{class:`${d}-preview-wrapper`,ref:u,key:"html-preview-wrapper"},[r.createVNode("div",{class:`${d}-html`},[f.value])])])])}}}),ms=r.defineComponent({props:{modelValue:{type:String,default:""}},setup(s){const e=r.inject("usedLanguageText");return()=>{var t,n;return r.createVNode("div",{class:`${d}-footer-item`},[r.createVNode("label",{class:`${d}-footer-label`},[`${(t=e.value.footer)==null?void 0:t.markdownTotal}:`]),r.createVNode("span",null,[((n=s.modelValue)==null?void 0:n.length)||0])])}}});const gs=()=>({checked:{type:Boolean,default:!1},onChange:{type:Function,default:()=>{}}}),ps=r.defineComponent({props:gs(),setup(s){return()=>r.createVNode("div",{class:[`${d}-checkbox`,s.checked&&`${d}-checkbox-checked`],onClick:()=>{s.onChange(!s.checked)}},null)}}),vs=()=>({scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}}}),bs=r.defineComponent({props:vs(),setup(s){const e=r.inject("usedLanguageText");return()=>{var t;return r.createVNode("div",{class:`${d}-footer-item`},[r.createVNode("label",{class:`${d}-footer-label`,onClick:()=>{s.onScrollAutoChange(!s.scrollAuto)}},[(t=e.value.footer)==null?void 0:t.scrollAuto]),r.createVNode(ps,{checked:s.scrollAuto,onChange:s.onScrollAutoChange},null)])}}}),ks=()=>({modelValue:{type:String,default:""},footers:{type:Array,default:[]},scrollAuto:{type:Boolean},onScrollAutoChange:{type:Function,default:()=>{}},defFooters:{type:Object}}),ys=r.defineComponent({name:"MDEditorFooter",props:ks(),setup(s){const e=r.computed(()=>{const n=s.footers.indexOf("="),i=n===-1?s.footers:s.footers.slice(0,n),l=n===-1?[]:s.footers.slice(n,Number.MAX_SAFE_INTEGER);return[i,l]}),t=n=>{if(Cn.includes(n))switch(n){case"markdownTotal":return r.createVNode(ms,{modelValue:s.modelValue},null);case"scrollSwitch":return r.createVNode(bs,{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(l=>t(l)),i=e.value[1].map(l=>t(l));return r.createVNode("div",{class:`${d}-footer`},[r.createVNode("div",{class:`${d}-footer-left`},[n]),r.createVNode("div",{class:`${d}-footer-right`},[i])])}}}),ws=()=>({tocItem:{type:Object,default:()=>({})},markedHeadingId:{type:Function,default:()=>{}},scrollElement:{type:[String,Object],default:""},onClick:{type:Function,default:()=>{}},scrollElementOffsetTop:{type:Number,default:0}}),Dn=r.defineComponent({props:ws(),setup(s){return()=>{const{tocItem:e,markedHeadingId:t,scrollElement:n,onClick:i,scrollElementOffsetTop:l}=s;return r.createVNode("div",{class:[`${d}-catalog-link`,e.active&&`${d}-catalog-active`],onClick:a=>{i(a,e),a.stopPropagation();const o=t(e.text,e.level,e.index),u=document.getElementById(o),f=n instanceof Element?n:document.querySelector(n);if(u&&f){let h=u.offsetParent,m=u.offsetTop;if(f.contains(h))for(;h&&f!=h;)m+=h==null?void 0:h.offsetTop,h=h==null?void 0:h.offsetParent;f==null||f.scrollTo({top:m-l,behavior:"smooth"})}}},[r.createVNode("span",{title:e.text},[e.text]),r.createVNode("div",{class:`${d}-catalog-wrapper`},[e.children&&e.children.map(a=>r.createVNode(Dn,{markedHeadingId:t,key:`${e.text}-link-${a.level}-${a.text}`,tocItem:a,scrollElement:n,onClick:i,scrollElementOffsetTop:l},null))])])}}});const xs=()=>({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}}),Lt=r.defineComponent({name:"MdCatalog",props:xs(),emits:["onClick"],setup(s,e){const t=s.editorId,n=r.reactive({list:[],show:!1,scrollElement:s.scrollElement||`#${t}-preview-wrapper`}),i=r.computed(()=>{const a=[];return n.list.forEach(({text:o,level:u,active:f},h)=>{const m={level:u,text:o,index:h+1,active:!!f};if(a.length===0)a.push(m);else{let v=a[a.length-1];if(m.level>v.level)for(let g=v.level+1;g<=6;g++){const{children:$}=v;if(!$){v.children=[m];break}if(v=$[$.length-1],m.level<=v.level){$.push(m);break}}else a.push(m)}}),a});r.onMounted(()=>{x.on(t,{name:"catalogChanged",callback:a=>{n.list=a.map((o,u)=>u===0?{...o,active:!0}:{...o})}}),x.emit(t,"pushCatalog")});const l=()=>{var o;const a=n.scrollElement instanceof HTMLElement?n.scrollElement:document.querySelector(n.scrollElement);(o=a===document.documentElement?window:a)==null||o.addEventListener("scroll",Qn(()=>{if(n.list.length===0)return!1;const{activeHead:u}=n.list.reduce((f,h,m)=>{const v=document.getElementById(s.markedHeadingId(h.text,h.level,m+1));if(v instanceof HTMLElement){const g=Jn(v,a);if(g<s.offsetTop&&g>f.minTop)return{activeHead:h,minTop:g}}return f},{activeHead:n.list[0],minTop:Number.MIN_SAFE_INTEGER});n.list=n.list.map(f=>f===u?{...f,active:!0}:{...f,active:!1})}))};return r.onMounted(()=>{l(),x.on(t,{name:Ht,callback(a){a&&r.nextTick(l)}})}),()=>r.createVNode("div",{class:`${d}-catalog${s.theme==="dark"?"-dark":""} ${s.class}`},[i.value.map(a=>r.createVNode(Dn,{markedHeadingId:s.markedHeadingId,tocItem:a,key:`link-${a.level}-${a.text}`,scrollElement:n.scrollElement,onClick:(o,u)=>{s.onClick?s.onClick(o,u):e.emit("onClick",o,u)},scrollElementOffsetTop:s.scrollElementOffsetTop},null))])}}),$s=s=>s,Ss={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:Sn},toolbarsExclude:{type:Array,default:[]},noPrettier:{type:Boolean,default:!1},onHtmlChanged:{type:Function},onGetCatalog:{type:Function},editorId:{type:String,default:Mn},tabWidth:{type:Number,default:2},showCodeRowNumber:{type:Boolean,default:!1},previewTheme:{type:String,default:"default"},style:{type:Object,default:()=>({})},markedHeadingId:{type:Function,default:$s},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:Cn},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}},Cs=["onChange","onSave","onUploadImg","onHtmlChanged","onGetCatalog","onError","update:modelValue","onBlur","onFocus"];const Fe=r.defineComponent({name:"MdEditorV3",props:Ss,emits:Cs,setup(s,e){const{editorId:t,previewOnly:n,noKatex:i,noMermaid:l,noPrettier:a,noUploadImg:o}=s,u=r.reactive({scrollAuto:s.scrollAuto});ii(s,e),si(s),li(s);const[f,h]=oi(s,e),[m,v]=ri(s);return r.onBeforeUnmount(()=>{x.clear(t)}),ai(s,e,m,f,h),()=>{var b;const g=xe({props:s,ctx:e},"defToolbars"),$=xe({props:s,ctx:e},"defFooters");return r.createVNode("div",{id:t,class:[d,s.class,s.theme==="dark"&&`${d}-dark`,f.fullscreen||f.pageFullscreen?`${d}-fullscreen`:"",n&&`${d}-previewOnly`],style:s.style},[!n&&r.createVNode(xi,{noPrettier:a,toolbars:s.toolbars,toolbarsExclude:s.toolbarsExclude,setting:f,updateSetting:h,tableShape:s.tableShape,defToolbars:g,noUploadImg:o},null),r.createVNode(fs,{value:s.modelValue,setting:f,markedHeadingId:s.markedHeadingId,noMermaid:l,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:k=>{x.emit(t,"saveHistoryPos"),s.onChange?s.onChange(k):(e.emit("update:modelValue",k),e.emit("onChange",k))},onHtmlChanged:k=>{s.onHtmlChanged?s.onHtmlChanged(k):e.emit("onHtmlChanged",k)},onGetCatalog:k=>{s.onGetCatalog?s.onGetCatalog(k):e.emit("onGetCatalog",k)},onBlur:k=>{s.onBlur?s.onBlur(k):e.emit("onBlur",k)},onFocus:k=>{s.onFocus?s.onFocus(k):e.emit("onFocus",k)}},null),!n&&((b=s.footers)==null?void 0:b.length)>0&&r.createVNode(ys,{modelValue:s.modelValue,footers:s.footers,defFooters:$,scrollAuto:u.scrollAuto,onScrollAutoChange:k=>u.scrollAuto=k},null),v.value&&!n&&r.createVNode(Lt,{theme:s.theme,style:{display:m.value?"block":"none"},class:`${d}-catalog-editor`,editorId:t,markedHeadingId:s.markedHeadingId},null)])}}}),Ts=()=>({title:{type:String,default:""},trigger:{type:[String,Object]},onClick:{type:Function}}),qt=r.defineComponent({name:"NormalToolbar",props:Ts(),emits:["onClick"],setup(s,e){return()=>{const t=xe({props:s,ctx:e},"trigger");return r.createVNode("div",{class:`${d}-toolbar-item`,title:s.title,onClick:n=>{s.onClick instanceof Function?s.onClick(n):e.emit("onClick",n)}},[t])}}}),Es=()=>({title:{type:String,default:""},visible:{type:Boolean},trigger:{type:[String,Object]},onChange:{type:Function},overlay:{type:[String,Object]}}),Wt=r.defineComponent({name:"DropdownToolbar",props:Es(),emits:["onChange"],setup(s,e){const t=r.inject("editorId");return()=>{const n=xe({props:s,ctx:e},"trigger"),i=xe({props:s,ctx:e},"overlay");return r.createVNode(Ye,{relative:`#${t}-toolbar-wrapper`,visible:s.visible,onChange:l=>{s.onChange instanceof Function?s.onChange(l):e.emit("onChange",l)},overlay:i},{default:()=>[r.createVNode("div",{class:`${d}-toolbar-item`,title:s.title||""},[n])]})}}});function Ns(s){return typeof s=="function"||Object.prototype.toString.call(s)==="[object Object]"&&!r.isVNode(s)}const zs=()=>({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}}),Kt=r.defineComponent({name:"ModalToolbar",props:zs(),emits:["onClick","onClose","onAdjust"],setup(s,e){return()=>{const t=xe({props:s,ctx:e},"trigger"),n=xe({props:s,ctx:e},"default");return r.createVNode(r.Fragment,null,[r.createVNode("div",{class:`${d}-toolbar-item`,title:s.title,onClick:()=>{s.onClick instanceof Function?s.onClick():e.emit("onClick")}},[t]),r.createVNode(Zt,{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)}},Ns(n)?n:{default:()=>[n]})])}}});Fe.install=s=>(s.component(Fe.name,Fe),s.component(qt.name,qt),s.component(Wt.name,Wt),s.component(Lt.name,Lt),s.component(Kt.name,Kt),s);Fe.NormalToolbar=qt;Fe.DropdownToolbar=Wt;Fe.MdCatalog=Lt;Fe.ModalToolbar=Kt;Fe.config=Kn;module.exports=Fe;
|