md-editor-v3 1.7.3 → 1.9.2
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/README.md +66 -2
- package/lib/MdEditor/Editor.d.ts +85 -2
- package/lib/md-editor-v3.es.js +2475 -2077
- package/lib/md-editor-v3.umd.js +77 -57
- package/lib/style.css +1 -1
- package/package.json +6 -3
package/lib/md-editor-v3.umd.js
CHANGED
|
@@ -1,62 +1,82 @@
|
|
|
1
|
-
var sn=Object.defineProperty,on=Object.defineProperties;var cn=Object.getOwnPropertyDescriptors;var ht=Object.getOwnPropertySymbols;var dn=Object.prototype.hasOwnProperty,fn=Object.prototype.propertyIsEnumerable;var Oe=(t,M,W)=>M in t?sn(t,M,{enumerable:!0,configurable:!0,writable:!0,value:W}):t[M]=W,fe=(t,M)=>{for(var W in M||(M={}))dn.call(M,W)&&Oe(t,W,M[W]);if(ht)for(var W of ht(M))fn.call(M,W)&&Oe(t,W,M[W]);return t},Re=(t,M)=>on(t,cn(M));var gt=(t,M,W)=>(Oe(t,typeof M!="symbol"?M+"":M,W),W);(function(t,M){typeof exports=="object"&&typeof module!="undefined"?module.exports=M(require("vue")):typeof define=="function"&&define.amd?define(["vue"],M):(t=typeof globalThis!="undefined"?globalThis:t||self,t.MdEditorV3=M(t.Vue))})(this,function(t){"use strict";const M="https://at.alicdn.com/t/font_2605852_khjf435c7th.js",W={atom:"https://cdn.jsdelivr.net/npm/highlight.js@11.2.0/styles/atom-one-dark.css",github:"https://cdn.jsdelivr.net/npm/highlight.js@11.2.0/styles/github.css",githubDark:"https://cdn.jsdelivr.net/npm/highlight.js@11.2.0/styles/github-dark.css",js:"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.2.0/build/highlight.min.js"},Pe={main:"https://cdn.jsdelivr.net/npm/prettier@2.4.0/standalone.js",markdown:"https://cdn.jsdelivr.net/npm/prettier@2.4.0/parser-markdown.js"},Ue={css:"https://cdn.jsdelivr.net/npm/cropperjs@1.5.12/dist/cropper.min.css",js:"https://cdn.jsdelivr.net/npm/cropperjs@1.5.12/dist/cropper.min.js"},Dt="https://cdn.jsdelivr.net/npm/screenfull@5.1.0/dist/screenfull.js",mt=["bold","underline","italic","strikeThrough","-","title","sub","sup","quote","unorderedList","orderedList","-","codeRow","code","link","image","table","-","revoke","next","save","=","prettier","pageFullscreen","fullscreen","preview","htmlPreview","catalog","github"],qe={"zh-CN":{toolbarTips:{bold:"\u52A0\u7C97",underline:"\u4E0B\u5212\u7EBF",italic:"\u659C\u4F53",strikeThrough:"\u5220\u9664\u7EBF",title:"\u6807\u9898",sub:"\u4E0B\u6807",sup:"\u4E0A\u6807",quote:"\u5F15\u7528",unorderedList:"\u65E0\u5E8F\u5217\u8868",orderedList:"\u6709\u5E8F\u5217\u8868",codeRow:"\u884C\u5185\u4EE3\u7801",code:"\u5757\u7EA7\u4EE3\u7801",link:"\u94FE\u63A5",image:"\u56FE\u7247",table:"\u8868\u683C",revoke:"\u540E\u9000",next:"\u524D\u8FDB",save:"\u4FDD\u5B58",prettier:"\u7F8E\u5316",pageFullscreen:"\u6D4F\u89C8\u5668\u5168\u5C4F",fullscreen:"\u5C4F\u5E55\u5168\u5C4F",preview:"\u9884\u89C8",htmlPreview:"html\u4EE3\u7801\u9884\u89C8",catalog:"\u76EE\u5F55",github:"\u6E90\u7801\u5730\u5740"},titleItem:{h1:"\u4E00\u7EA7\u6807\u9898",h2:"\u4E8C\u7EA7\u6807\u9898",h3:"\u4E09\u7EA7\u6807\u9898",h4:"\u56DB\u7EA7\u6807\u9898",h5:"\u4E94\u7EA7\u6807\u9898",h6:"\u516D\u7EA7\u6807\u9898"},imgTitleItem:{link:"\u6DFB\u52A0\u94FE\u63A5",upload:"\u4E0A\u4F20\u56FE\u7247",clip2upload:"\u88C1\u526A\u4E0A\u4F20"},linkModalTips:{title:"\u6DFB\u52A0",descLable:"\u94FE\u63A5\u63CF\u8FF0\uFF1A",descLablePlaceHolder:"\u8BF7\u8F93\u5165\u63CF\u8FF0...",urlLable:"\u94FE\u63A5\u5730\u5740\uFF1A",UrlLablePlaceHolder:"\u8BF7\u8F93\u5165\u94FE\u63A5...",buttonOK:"\u786E\u5B9A"},clipModalTips:{title:"\u88C1\u526A\u56FE\u7247\u4E0A\u4F20",buttonUpload:"\u4E0A\u4F20"},copyCode:{text:"\u590D\u5236\u4EE3\u7801",tips:"\u5DF2\u590D\u5236\uFF01"}},"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",codeRow:"inline code",code:"block-level code",link:"link",image:"image",table:"table",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:{title:"Add ",descLable:"Desc:",descLablePlaceHolder:"Enter a description...",urlLable:"Link:",UrlLablePlaceHolder:"Enter a link...",buttonOK:"OK"},clipModalTips:{title:"Crop Image",buttonUpload:"Upload"},copyCode:{text:"Copy",tips:"Copied!"}}};class bt{constructor(){gt(this,"pools",{})}remove(i,u,h){const F=this.pools[i]&&this.pools[i][u];F&&(this.pools[i][u]=F.filter(s=>s===h))}clear(i){this.pools[i]={}}on(i,u){return this.pools[i]||(this.pools[i]={}),this.pools[i][u.name]||(this.pools[i][u.name]=[]),this.pools[i][u.name].push(u.callback),this.pools[i][u.name].includes(u.callback)}emit(i,u,...h){this.pools[i]||(this.pools[i]={});const F=this.pools[i][u];F&&F.forEach(s=>{try{s(...h)}catch(p){console.error(`${u}\u76D1\u542C\u4E8B\u4EF6\u6267\u884C\u5F02\u5E38\uFF01`,p)}})}}var N=new bt;const Ct=(r,i)=>{const{editorId:u}=r,h=s=>{var p,D;return((p=r.toolbars)==null?void 0:p.includes(s))&&!((D=r.toolbarsExclude)==null?void 0:D.includes(s))},m=s=>{if(s.target===document.querySelector(`#${r.editorId}-textarea`))if(s.ctrlKey||s.metaKey)switch(s.code){case"KeyS":{s.shiftKey?h("strikeThrough")&&N.emit(u,"replace","strikeThrough"):h("save")&&(N.emit(u,"onSave",r.modelValue),s.preventDefault());break}case"KeyB":{h("bold")&&(N.emit(u,"replace","bold"),s.preventDefault());break}case"KeyU":{s.shiftKey?h("unorderedList")&&(N.emit(u,"replace","unorderedList"),s.preventDefault()):h("underline")&&(N.emit(u,"replace","underline"),s.preventDefault());break}case"KeyI":{s.shiftKey?h("image")&&(N.emit(u,"openModals","image"),s.preventDefault()):h("italic")&&(N.emit(u,"replace","italic"),s.preventDefault());break}case"Digit1":{h("title")&&(N.emit(u,"replace","h1"),s.preventDefault());break}case"Digit2":{h("title")&&(N.emit(u,"replace","h2"),s.preventDefault());break}case"Digit3":{h("title")&&(N.emit(u,"replace","h3"),s.preventDefault());break}case"Digit4":{h("title")&&(N.emit(u,"replace","h4"),s.preventDefault());break}case"Digit5":{h("title")&&(N.emit(u,"replace","h5"),s.preventDefault());break}case"Digit6":{h("title")&&(N.emit(u,"replace","h6"),s.preventDefault());break}case"ArrowUp":{h("sup")&&(N.emit(u,"replace","sup"),s.preventDefault());break}case"ArrowDown":{h("sub")&&(N.emit(u,"replace","sub"),s.preventDefault());break}case"KeyQ":{N.emit(u,"replace","quote"),s.preventDefault();break}case"KeyO":{h("orderedList")&&(N.emit(u,"replace","orderedList"),s.preventDefault());break}case"KeyC":{if(s.shiftKey)h("code")&&(N.emit(u,"replace","code"),s.preventDefault());else if(s.altKey)h("codeRow")&&(N.emit(u,"replace","codeRow"),s.preventDefault());else{s.preventDefault(),N.emit(u,"replace","ctrlC");break}break}case"KeyL":{h("link")&&(N.emit(u,"openModals","link"),s.preventDefault());break}case"KeyZ":{s.shiftKey?h("next")&&(N.emit(u,"ctrlShiftZ"),s.preventDefault()):h("revoke")&&(N.emit(u,"ctrlZ"),s.preventDefault());break}case"KeyF":{s.shiftKey&&h("prettier")&&(N.emit(u,"replace","prettier"),s.preventDefault());break}case"KeyT":{s.altKey&&s.shiftKey&&h("table")&&(N.emit(u,"replace","table"),s.preventDefault());break}case"KeyX":{N.emit(u,"replace","ctrlX"),s.preventDefault();break}case"KeyD":{s.preventDefault(),N.emit(u,"replace","ctrlD");break}}else s.code==="Tab"&&(s.preventDefault(),s.shiftKey?N.emit(u,"replace","shiftTab"):N.emit(u,"replace","tab"))},F=s=>{if(s.clipboardData&&s.clipboardData.files.length>0){const p=s.clipboardData.files[0];/image\/.*/.test(p.type)&&(N.emit(u,"uploadImage",[p]),s.preventDefault())}};t.onMounted(()=>{r.previewOnly||(window.addEventListener("keydown",m),document.addEventListener("paste",F),N.on(u,{name:"onSave",callback(){r.onSave?r.onSave(r.modelValue):i.emit("onSave",r.modelValue)}}))}),t.onBeforeUnmount(()=>{r.previewOnly||(window.removeEventListener("keydown",m),document.removeEventListener("paste",F))})},Ft=r=>{const{previewOnly:i,editorId:u,tabWidth:h,showCodeRowNumber:m,Cropper:F}=r;t.provide("editorId",u),t.provide("tabWidth",h);const s=t.computed(()=>{let D=W.atom;if(r.highlightCss)D=r.highlightCss;else switch(r.previewTheme){case"github":{r.theme==="dark"?D=W.githubDark:D=W.github;break}}return{js:r.highlightJs,css:D}});t.provide("highlight",s),t.provide("historyLength",r.historyLength),t.provide("previewOnly",i),t.provide("showCodeRowNumber",m);const p=t.computed(()=>{const D=fe(fe({},qe),r.languageUserDefined);return D[r.language]?D[r.language]:qe["zh-CN"]});t.provide("usedLanguageText",p),t.provide("Cropper",F),t.provide("previewTheme",t.computed(()=>r.previewTheme))};var pn="",kt=t.defineComponent({setup(){return()=>t.createVNode("div",{class:`${C}-divider`},null)}});const ye=({instance:r,ctx:i,props:u={}},h="default")=>{const m=(r==null?void 0:r.$slots[h])||(i==null?void 0:i.slots[h]);return(m?m(r):"")||u[h]};var hn="",Me=t.defineComponent({props:{trigger:{type:String,default:"hover"},overlay:{type:[String,Object],default:""},visible:{type:Boolean,default:!1},onChange:{type:Function,default:()=>()=>{}}},setup(r,i){const u=`${C}-dropdown-hidden`,h=t.reactive({overlayClass:[u],overlayStyle:{},triggerHover:!1,overlayHover:!1}),m=t.ref(),F=t.ref(),s=()=>{r.trigger==="hover"&&(h.triggerHover=!0);const x=m.value,E=F.value,B=x.getBoundingClientRect(),w=x.offsetTop,T=x.offsetLeft,j=B.height,H=B.width;h.overlayStyle=Re(fe({},h.overlayStyle),{top:w+j+"px",left:T-E.offsetWidth/2+H/2+"px"}),r.onChange(!0)},p=()=>{h.overlayHover=!0};t.watch(()=>r.visible,x=>{x?h.overlayClass=h.overlayClass.filter(E=>E!==u):h.overlayClass.push(u)});const D=x=>{const E=m.value,B=F.value;!E.contains(x.target)&&!B.contains(x.target)&&r.onChange(!1)};let v=-1;const A=x=>{m.value===x.target?h.triggerHover=!1:h.overlayHover=!1,clearTimeout(v),v=window.setTimeout(()=>{!h.overlayHover&&!h.triggerHover&&r.onChange(!1)},10)};return t.onMounted(()=>{r.trigger==="click"?(m.value.addEventListener("click",s),document.addEventListener("click",D)):(m.value.addEventListener("mouseenter",s),m.value.addEventListener("mouseleave",A),F.value.addEventListener("mouseenter",p),F.value.addEventListener("mouseleave",A))}),t.onBeforeUnmount(()=>{r.trigger==="click"?(m.value.removeEventListener("click",s),document.removeEventListener("click",D)):(m.value.removeEventListener("mouseenter",s),m.value.removeEventListener("mouseleave",A),F.value.removeEventListener("mouseenter",p),F.value.removeEventListener("mouseleave",A))}),()=>{const x=ye({ctx:i}),E=ye({props:r,ctx:i},"overlay"),B=t.cloneVNode(x instanceof Array?x[0]:x,{ref:m}),w=t.createVNode("div",{class:[`${C}-dropdown`,h.overlayClass],style:h.overlayStyle,ref:F},[t.createVNode("div",{class:`${C}-dropdown-overlay`},[E instanceof Array?E[0]:E])]);return[B,w]}}});const ue=(r,i=0,u=i)=>{r.setSelectionRange?setTimeout(()=>{r.setSelectionRange(i,u),r.focus()},0):console.log("\u65E0\u6CD5\u91CD\u7F6E\u5149\u6807\u4F4D\u7F6E\uFF01")},Le=(r,i,u)=>{const{deviationStart:h=0,deviationEnd:m=0,direct:F=!1,select:s=!1}=u;let p="";if(r.selectionStart||r.selectionStart===0){const D=r.selectionStart,v=r.selectionEnd||0,{prefixVal:A=r.value.substring(0,D),subfixVal:x=r.value.substring(v,r.value.length)}=u;p=A+i+x,ue(r,s?D+h:D+i.length+m,D+i.length+m)}else p+=i;return F&&(r.value=p),p},vt=(r,i={newWindow:!0,nofollow:!0})=>{r||console.warn("\u65E0\u6548\u7684\u94FE\u63A5\uFF01");const u=document.createElement("a");u.href=r,u.style.display="none",i.newWindow&&(u.target="_blank"),i.nofollow&&(u.rel="noopener noreferrer"),document.body.appendChild(u),u.click(),document.body.removeChild(u)},Ke=(r,i)=>{const u=r.clientHeight,h=i.clientHeight,m=r.scrollHeight,F=i.scrollHeight,s=(m-u)/(F-h),p=yt(()=>{r.removeEventListener("scroll",D),r.addEventListener("scroll",D),i.removeEventListener("scroll",D),i.addEventListener("scroll",D)},50),D=v=>{v.target===r?(i.removeEventListener("scroll",D),i.scrollTo({top:r.scrollTop/s}),p()):(r.removeEventListener("scroll",D),r.scrollTo({top:i.scrollTop*s}),p())};return p(),()=>{r.removeEventListener("scroll",D),i.removeEventListener("scroll",D)}},Et=(r,i="image.png")=>{const u=r.split(","),h=u[0].match(/:(.*?);/);if(h){const m=h[1],F=atob(u[1]);let s=F.length;const p=new Uint8Array(s);for(;s--;)p[s]=F.charCodeAt(s);return new File([p],i,{type:m})}return null},Ze=r=>{if(!r.trim())return r;const i=r.split(`
|
|
2
|
-
`),u=['<span rn-wrapper aria-hidden="true">'];return i.forEach(()=>{u.push("<span></span>")}),u.push("</span>"),`<span class="code-block">${r}</span>${u.join("")}`},yt=(r,i=200)=>{let u=0;return(...h)=>{u&&clearTimeout(u),u=window.setTimeout(()=>{r.apply(globalThis,h),u=0},i)}},We=(r,i)=>{const u=h=>{const m=r.parentElement||document.body,F=m.offsetWidth,s=m.offsetHeight,{clientWidth:p}=document.documentElement,{clientHeight:D}=document.documentElement,v=h.offsetX,A=h.offsetY,x=B=>{let w=B.x+document.body.scrollLeft-document.body.clientLeft-v,T=B.y+document.body.scrollTop-document.body.clientTop-A;w=w<1?1:w<p-F-1?w:p-F-1,T=T<1?1:T<D-s-1?T:D-s-1,i?i(w,T):(m.style.left=`${w}px`,m.style.top=`${T}px`)};document.addEventListener("mousemove",x);const E=()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E)};document.addEventListener("mouseup",E)};return r.addEventListener("mousedown",u),()=>{r.removeEventListener("mousedown",u)}};var gn="",Ge=t.defineComponent({props:{title:{type:String,default:""},visible:{type:Boolean,default:!1},width:{type:String,default:"auto"},height:{type:String,default:"auto"},onClosed:{type:Function,default:()=>()=>{}},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function,default:()=>()=>{}}},setup(r,i){const u=t.ref(r.visible),h=t.ref([`${C}-modal`]),m=t.ref(),F=t.ref();let s=()=>{};const p=t.reactive({initPos:{left:"0px",top:"0px"},historyPos:{left:"0px",top:"0px"}});return t.onMounted(()=>{s=We(F.value,(D,v)=>{p.initPos.left=D+"px",p.initPos.top=v+"px"})}),t.onBeforeUnmount(()=>{s()}),t.watch(()=>r.isFullscreen,D=>{console.log(123),D?s():s=We(F.value,(v,A)=>{p.initPos.left=v+"px",p.initPos.top=A+"px"})}),t.watch(()=>r.visible,D=>{D?(h.value.push("zoom-in"),u.value=D,t.nextTick(()=>{const v=m.value.offsetWidth/2,A=m.value.offsetHeight/2,x=document.documentElement.clientWidth/2,E=document.documentElement.clientHeight/2;p.initPos.left=x-v+"px",p.initPos.top=E-A+"px"}),setTimeout(()=>{h.value=h.value.filter(v=>v!=="zoom-in")},140)):(h.value.push("zoom-out"),setTimeout(()=>{h.value=h.value.filter(v=>v!=="zoom-out"),u.value=D},130))}),()=>{const D=ye({ctx:i}),v=ye({props:r,ctx:i},"title");return t.createVNode("div",{style:{display:u.value?"block":"none"}},[t.createVNode("div",{class:`${C}-modal-mask`,onClick:r.onClosed},null),t.createVNode("div",{class:h.value,style:Re(fe({},p.initPos),{width:r.width,height:r.height}),ref:m},[t.createVNode("div",{class:`${C}-modal-header`,ref:F},[v||""]),t.createVNode("div",{class:`${C}-modal-body`},[D]),t.createVNode("div",{class:`${C}-modal-func`},[r.showAdjust&&t.createVNode("div",{class:`${C}-modal-adjust`,onClick:A=>{A.stopPropagation(),r.isFullscreen?p.initPos=p.historyPos:(p.historyPos=p.initPos,p.initPos={left:"0",top:"0"}),r.onAdjust(!r.isFullscreen)}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":`#icon-${r.isFullscreen?"suoxiao":"fangda"}`},null)])]),t.createVNode("div",{class:`${C}-modal-close`,onClick:A=>{A.stopPropagation(),r.onClosed&&r.onClosed()}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-close"},null)])])])])])}}}),At=t.defineComponent({props:{type:{type:String,default:"link"},visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>()=>{}},onOk:{type:Function,default:()=>()=>{}}},setup(r){const i=t.inject("usedLanguageText"),u=t.inject("editorId"),h=t.computed(()=>{var F,s,p,D;switch(r.type){case"link":return`${(F=i.value.linkModalTips)==null?void 0:F.title}${(s=i.value.toolbarTips)==null?void 0:s.link}`;case"image":return`${(p=i.value.linkModalTips)==null?void 0:p.title}${(D=i.value.toolbarTips)==null?void 0:D.image}`;default:return""}}),m=t.reactive({desc:"",url:""});return t.watch(()=>r.visible,F=>{F||setTimeout(()=>{m.desc="",m.url=""},200)}),()=>t.createVNode(Ge,{title:h.value,visible:r.visible,onClosed:r.onCancel},{default:()=>{var F,s,p,D,v;return[t.createVNode("div",{class:`${C}-form-item`},[t.createVNode("label",{class:`${C}-lable`,for:`link-desc-${u}`},[(F=i.value.linkModalTips)==null?void 0:F.descLable]),t.createVNode("input",{placeholder:(s=i.value.linkModalTips)==null?void 0:s.descLablePlaceHolder,class:`${C}-input`,id:`link-desc-${u}`,type:"text",value:m.desc,onChange:A=>{m.desc=A.target.value},autocomplete:"off"},null)]),t.createVNode("div",{class:`${C}-form-item`},[t.createVNode("label",{class:`${C}-lable`,for:`link-url-${u}`},[(p=i.value.linkModalTips)==null?void 0:p.urlLable]),t.createVNode("input",{placeholder:(D=i.value.linkModalTips)==null?void 0:D.UrlLablePlaceHolder,class:`${C}-input`,id:`link-url-${u}`,type:"text",value:m.url,onChange:A=>{m.url=A.target.value},autocomplete:"off"},null)]),t.createVNode("div",{class:`${C}-form-item`},[t.createVNode("button",{class:[`${C}-btn`,`${C}-btn-row`],type:"button",onClick:()=>{r.onOk(m),m.desc="",m.url=""}},[(v=i.value.linkModalTips)==null?void 0:v.buttonOK])])]}})}}),Dn="",wt=t.defineComponent({props:{visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>()=>{}},onOk:{type:Function,default:()=>()=>{}}},setup(r){const i=t.inject("usedLanguageText"),u=t.inject("editorId");let h=t.inject("Cropper");const m=t.ref(),F=t.ref(),s=t.ref(),p=t.reactive({cropperInited:!1,imgSelected:!1,imgSrc:"",isFullscreen:!1});let D=null;t.watch(()=>r.visible,()=>{r.visible&&!p.cropperInited&&(h=h||window.Cropper,m.value.onchange=()=>{const x=m.value.files||[];if(p.imgSelected=!0,(x==null?void 0:x.length)>0){const E=new FileReader;E.onload=B=>{p.imgSrc=B.target.result,t.nextTick(()=>{D=new h(F.value,{viewMode:2,preview:`.${C}-clip-preview-target`})})},E.readAsDataURL(x[0])}})}),t.watch(()=>[p.imgSelected],()=>{s.value.style=""}),t.watch(()=>p.isFullscreen,()=>{t.nextTick(()=>{D==null||D.destroy(),s.value.style="",F.value&&(D=new h(F.value,{viewMode:2,preview:`.${C}-clip-preview-target`}))})});const v=t.computed(()=>p.isFullscreen?{width:"100%",height:"100%"}:{width:"668px",height:"421px"}),A=()=>{D.destroy(),m.value.value="",p.imgSelected=!1};return()=>{var x;return t.createVNode(Ge,t.mergeProps({title:(x=i.value.clipModalTips)==null?void 0:x.title,visible:r.visible,onClosed:r.onCancel,showAdjust:!0,isFullscreen:p.isFullscreen,onAdjust:E=>{p.isFullscreen=E}},v.value),{default:()=>{var E;return[t.createVNode("div",{class:`${C}-form-item ${C}-clip`},[t.createVNode("div",{class:`${C}-clip-main`},[p.imgSelected?t.createVNode("div",{class:`${C}-clip-cropper`},[t.createVNode("img",{src:p.imgSrc,ref:F,style:{display:"none"}},null),t.createVNode("div",{class:`${C}-clip-delete`,onClick:A},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-delete"},null)])])]):t.createVNode("div",{class:`${C}-clip-upload`,onClick:()=>{m.value.click()}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-upload"},null)])])]),t.createVNode("div",{class:`${C}-clip-preview`},[t.createVNode("div",{class:`${C}-clip-preview-target`,ref:s},null)])]),t.createVNode("div",{class:`${C}-form-item`},[t.createVNode("button",{class:`${C}-btn`,type:"button",onClick:()=>{const B=D.getCroppedCanvas();N.emit(u,"uploadImage",[Et(B.toDataURL("image/png"))],r.onOk),A()}},[(E=i.value.linkModalTips)==null?void 0:E.buttonOK])]),t.createVNode("input",{ref:m,accept:"image/*",type:"file",multiple:!1,style:{display:"none"}},null)]}})}}}),xt=t.defineComponent({props:{type:{type:String,default:"link"},linkVisible:{type:Boolean,default:!1},clipVisible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>()=>{}},onOk:{type:Function,default:()=>()=>{}}},setup(r){return()=>t.createVNode(t.Fragment,null,[t.createVNode(At,{type:r.type,visible:r.linkVisible,onOk:r.onOk,onCancel:r.onCancel},null),t.createVNode(wt,{visible:r.clipVisible,onOk:r.onOk,onCancel:r.onCancel},null)])}});const $t=r=>{let{screenfull:i}=r;const u=()=>{i.isEnabled?i.isFullscreen?i.exit():i.request():console.error("browser does not support screenfull!")},h=()=>{i=window.screenfull,i&&i.isEnabled&&i.on("change",()=>{r.updateSetting(!r.setting.fullscreen,"fullscreen")})};return t.onMounted(()=>{i&&i.isEnabled&&i.on("change",()=>{r.updateSetting(!r.setting.fullscreen,"fullscreen")})}),{fullScreenHandler:u,screenfullLoad:h}};var Bt=t.defineComponent({name:"MDEditorToolbar",props:{prettier:{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:()=>()=>{}}},setup(r){const i=t.inject("editorId"),u=t.inject("usedLanguageText"),h=t.inject("previewOnly"),{fullScreenHandler:m,screenfullLoad:F}=$t(r),s=t.reactive({title:!1,catalog:!1,image:!1}),p=(w,T)=>{N.emit(i,"replace",w,T)},D=t.reactive({type:"link",linkVisible:!1,clipVisible:!1}),v=t.ref();t.onMounted(()=>{var w;N.on(i,{name:"openModals",callback(T){D.type=T,D.linkVisible=!0}}),(w=v.value)==null||w.addEventListener("mouseover",()=>{var T;((T=window.getSelection())==null?void 0:T.toString())||N.emit(i,"selectTextChange","")})});const A=t.computed(()=>{const w=r.toolbars.filter(G=>!r.toolbarsExclude.includes(G)),T=w.indexOf("="),j=T===-1?w:w.slice(0,T+1),H=T===-1?[]:w.slice(T,Number.MAX_SAFE_INTEGER);return[j,H]}),x=t.ref(),E=()=>{N.emit(i,"uploadImage",x.value.files),x.value.value=""};t.onMounted(()=>{x.value.addEventListener("change",E)});const B=w=>{var T,j,H,G,K,q,ie,ee,J,le,te,ae,oe,De,we,xe,$e,me,Be,Se,Ne,X,Ve,ce,de,ne,Te,be,Ie,Ce,se,L;switch(w){case"-":return t.createVNode(kt,null,null);case"bold":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(T=u.value.toolbarTips)==null?void 0:T.bold,onClick:()=>{p("bold")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-bold"},null)])]);case"underline":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(j=u.value.toolbarTips)==null?void 0:j.underline,onClick:()=>{p("underline")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-underline"},null)])]);case"italic":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(H=u.value.toolbarTips)==null?void 0:H.italic,onClick:()=>{p("italic")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-italic"},null)])]);case"strikeThrough":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(G=u.value.toolbarTips)==null?void 0:G.strikeThrough,onClick:()=>{p("strikeThrough")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-strike-through"},null)])]);case"title":return t.createVNode(Me,{visible:s.title,onChange:Q=>{s.title=Q},overlay:t.createVNode("ul",{class:`${C}-menu`,onClick:()=>{s.title=!1}},[t.createVNode("li",{class:`${C}-menu-item`,onClick:()=>{p("h1")}},[(K=u.value.titleItem)==null?void 0:K.h1]),t.createVNode("li",{class:`${C}-menu-item`,onClick:()=>{p("h2")}},[(q=u.value.titleItem)==null?void 0:q.h2]),t.createVNode("li",{class:`${C}-menu-item`,onClick:()=>{p("h3")}},[(ie=u.value.titleItem)==null?void 0:ie.h3]),t.createVNode("li",{class:`${C}-menu-item`,onClick:()=>{p("h4")}},[(ee=u.value.titleItem)==null?void 0:ee.h4]),t.createVNode("li",{class:`${C}-menu-item`,onClick:()=>{p("h5")}},[(J=u.value.titleItem)==null?void 0:J.h5]),t.createVNode("li",{class:`${C}-menu-item`,onClick:()=>{p("h6")}},[(le=u.value.titleItem)==null?void 0:le.h6])])},{default:()=>{var Q;return[t.createVNode("div",{class:`${C}-toolbar-item`,title:(Q=u.value.toolbarTips)==null?void 0:Q.title},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-title"},null)])])]}});case"sub":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(te=u.value.toolbarTips)==null?void 0:te.sub,onClick:()=>{p("sub")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-sub"},null)])]);case"sup":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(ae=u.value.toolbarTips)==null?void 0:ae.sup,onClick:()=>{p("sup")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-sup"},null)])]);case"quote":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(oe=u.value.toolbarTips)==null?void 0:oe.quote,onClick:()=>{p("quote")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-quote"},null)])]);case"unorderedList":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(De=u.value.toolbarTips)==null?void 0:De.unorderedList,onClick:()=>{p("unorderedList")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-unordered-list"},null)])]);case"orderedList":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(we=u.value.toolbarTips)==null?void 0:we.orderedList,onClick:()=>{p("orderedList")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-ordered-list"},null)])]);case"codeRow":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(xe=u.value.toolbarTips)==null?void 0:xe.codeRow,onClick:()=>{p("codeRow")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-code-row"},null)])]);case"code":return t.createVNode("div",{class:`${C}-toolbar-item`,title:($e=u.value.toolbarTips)==null?void 0:$e.code,onClick:()=>{p("code")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-code"},null)])]);case"link":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(me=u.value.toolbarTips)==null?void 0:me.link,onClick:()=>{D.type="link",D.linkVisible=!0}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-link"},null)])]);case"image":return t.createVNode(Me,{visible:s.image,onChange:Q=>{s.image=Q},overlay:t.createVNode("ul",{class:`${C}-menu`,onClick:()=>{s.title=!1}},[t.createVNode("li",{class:`${C}-menu-item`,onClick:()=>{D.type="image",D.linkVisible=!0}},[(Be=u.value.imgTitleItem)==null?void 0:Be.link]),t.createVNode("li",{class:`${C}-menu-item`,onClick:()=>{x.value.click()}},[(Se=u.value.imgTitleItem)==null?void 0:Se.upload]),t.createVNode("li",{class:`${C}-menu-item`,onClick:()=>{D.clipVisible=!0}},[(Ne=u.value.imgTitleItem)==null?void 0:Ne.clip2upload])])},{default:()=>{var Q;return[t.createVNode("div",{class:`${C}-toolbar-item`,title:(Q=u.value.toolbarTips)==null?void 0:Q.image},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-image"},null)])])]}});case"table":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(X=u.value.toolbarTips)==null?void 0:X.table,onClick:()=>{p("table")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-table"},null)])]);case"revoke":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(Ve=u.value.toolbarTips)==null?void 0:Ve.revoke,onClick:()=>{N.emit(i,"ctrlZ")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-revoke"},null)])]);case"next":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(ce=u.value.toolbarTips)==null?void 0:ce.next,onClick:()=>{N.emit(i,"ctrlShiftZ")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-next"},null)])]);case"save":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(de=u.value.toolbarTips)==null?void 0:de.save,onClick:()=>{N.emit(i,"onSave")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-baocun"},null)])]);case"prettier":return r.prettier?t.createVNode("div",{class:`${C}-toolbar-item`,title:(ne=u.value.toolbarTips)==null?void 0:ne.prettier,onClick:()=>{p("prettier")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-prettier"},null)])]):"";case"pageFullscreen":return!r.setting.fullscreen&&t.createVNode("div",{class:`${C}-toolbar-item`,title:(Te=u.value.toolbarTips)==null?void 0:Te.pageFullscreen,onClick:()=>{r.updateSetting(!r.setting.pageFullScreen,"pageFullScreen")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":`#icon-${r.setting.pageFullScreen?"suoxiao":"fangda"}`},null)])]);case"fullscreen":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(be=u.value.toolbarTips)==null?void 0:be.fullscreen,onClick:m},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":`#icon-${r.setting.fullscreen?"fullScreen-exit":"fullScreen"}`},null)])]);case"preview":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(Ie=u.value.toolbarTips)==null?void 0:Ie.preview,onClick:()=>{r.updateSetting(!r.setting.preview,"preview")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-preview"},null)])]);case"htmlPreview":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(Ce=u.value.toolbarTips)==null?void 0:Ce.htmlPreview,onClick:()=>{r.updateSetting(!r.setting.htmlPreview,"htmlPreview")}},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-coding"},null)])]);case"catalog":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(se=u.value.toolbarTips)==null?void 0:se.catalog,onClick:()=>{N.emit(i,"catalogShow")},key:"bar-catalog"},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-catalog"},null)])]);case"github":return t.createVNode("div",{class:`${C}-toolbar-item`,title:(L=u.value.toolbarTips)==null?void 0:L.github,onClick:()=>vt("https://github.com/imzbf/md-editor-v3")},[t.createVNode("svg",{class:`${C}-icon`,"aria-hidden":"true"},[t.createVNode("use",{"xlink:href":"#icon-github"},null)])])}};return()=>{const w=A.value[0].map(j=>B(j)),T=A.value[1].map(j=>B(j));return t.createVNode("div",{class:`${C}-toolbar-wrapper`},[t.createVNode("div",{class:`${C}-toolbar`},[t.createVNode("div",{class:`${C}-toolbar-left`,ref:v},[w]),t.createVNode("div",{class:`${C}-toolbar-right`},[T])]),t.createVNode("input",{ref:x,accept:"image/*",type:"file",multiple:!0,style:{display:"none"}},null),t.createVNode(xt,{linkVisible:D.linkVisible,clipVisible:D.clipVisible,type:D.type,onCancel:()=>{D.linkVisible=!1,D.clipVisible=!1},onOk:j=>{j&&p(D.type,{desc:j.desc,url:j.url}),D.linkVisible=!1,D.clipVisible=!1}},null),!h&&r.screenfull===null&&t.createVNode(t.Teleport,{to:"head"},{default:()=>[t.createVNode("script",{src:r.screenfullJs,onLoad:F},null)]})])}}}),St=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{},Je={exports:{}};(function(r,i){(function(u,h){r.exports=h()})(St,function(){function u(f,o){for(var d=0;d<o.length;d++){var e=o[d];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(f,e.key,e)}}function h(f,o,d){return o&&u(f.prototype,o),d&&u(f,d),f}function m(f,o){if(!!f){if(typeof f=="string")return F(f,o);var d=Object.prototype.toString.call(f).slice(8,-1);if(d==="Object"&&f.constructor&&(d=f.constructor.name),d==="Map"||d==="Set")return Array.from(f);if(d==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(d))return F(f,o)}}function F(f,o){(o==null||o>f.length)&&(o=f.length);for(var d=0,e=new Array(o);d<o;d++)e[d]=f[d];return e}function s(f,o){var d=typeof Symbol!="undefined"&&f[Symbol.iterator]||f["@@iterator"];if(d)return(d=d.call(f)).next.bind(d);if(Array.isArray(f)||(d=m(f))||o&&f&&typeof f.length=="number"){d&&(f=d);var e=0;return function(){return e>=f.length?{done:!0}:{done:!1,value:f[e++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
3
|
-
|
|
4
|
-
`).
|
|
5
|
-
`
|
|
6
|
-
`}}
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
`),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
`)
|
|
18
|
-
`?n[1].slice(0,-1):n[1]}},o.text=function(e){var n=this.rules.block.text.exec(e);if(n)return{type:"text",raw:n[0],text:n[0]}},o.escape=function(e){var n=this.rules.inline.escape.exec(e);if(n)return{type:"escape",raw:n[0],text:ne(n[1])}},o.tag=function(e,n,l){var c=this.rules.inline.tag.exec(e);if(c)return!n&&/^<a /i.test(c[0])?n=!0:n&&/^<\/a>/i.test(c[0])&&(n=!1),!l&&/^<(pre|code|kbd|script)(\s|>)/i.test(c[0])?l=!0:l&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(c[0])&&(l=!1),{type:this.options.sanitize?"text":"html",raw:c[0],inLink:n,inRawBlock:l,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(c[0]):ne(c[0]):c[0]}},o.link=function(e){var n=this.rules.inline.link.exec(e);if(n){var l=n[2].trim();if(!this.options.pedantic&&/^</.test(l)){if(!/>$/.test(l))return;var c=ce(l.slice(0,-1),"\\");if((l.length-c.length)%2==0)return}else{var a=Te(n[2],"()");if(a>-1){var g=n[0].indexOf("!")===0?5:4,b=g+n[1].length+a;n[2]=n[2].substring(0,a),n[0]=n[0].substring(0,b).trim(),n[3]=""}}var k=n[2],y="";if(this.options.pedantic){var z=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(k);z&&(k=z[1],y=z[3])}else y=n[3]?n[3].slice(1,-1):"";return k=k.trim(),/^</.test(k)&&(this.options.pedantic&&!/>$/.test(l)?k=k.slice(1):k=k.slice(1,-1)),be(n,{href:k&&k.replace(this.rules.inline._escapes,"$1"),title:y&&y.replace(this.rules.inline._escapes,"$1")},n[0])}},o.reflink=function(e,n){var l;if((l=this.rules.inline.reflink.exec(e))||(l=this.rules.inline.nolink.exec(e))){var c=(l[2]||l[1]).replace(/\s+/g," ");if(c=n[c.toLowerCase()],!c||!c.href){var a=l[0].charAt(0);return{type:"text",raw:a,text:a}}return be(l,c,l[0])}},o.emStrong=function(e,n,l){l===void 0&&(l="");var c=this.rules.inline.emStrong.lDelim.exec(e);if(!!c&&!(c[3]&&l.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/))){var a=c[1]||c[2]||"";if(!a||a&&(l===""||this.rules.inline.punctuation.exec(l))){var g=c[0].length-1,b,k,y=g,z=0,R=c[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(R.lastIndex=0,n=n.slice(-1*e.length+g);(c=R.exec(n))!=null;)if(b=c[1]||c[2]||c[3]||c[4]||c[5]||c[6],!!b){if(k=b.length,c[3]||c[4]){y+=k;continue}else if((c[5]||c[6])&&g%3&&!((g+k)%3)){z+=k;continue}if(y-=k,!(y>0))return k=Math.min(k,k+y+z),Math.min(g,k)%2?{type:"em",raw:e.slice(0,g+c.index+k+1),text:e.slice(1,g+c.index+k)}:{type:"strong",raw:e.slice(0,g+c.index+k+1),text:e.slice(2,g+c.index+k-1)}}}}},o.codespan=function(e){var n=this.rules.inline.code.exec(e);if(n){var l=n[2].replace(/\n/g," "),c=/[^ ]/.test(l),a=/^ /.test(l)&&/ $/.test(l);return c&&a&&(l=l.substring(1,l.length-1)),l=ne(l,!0),{type:"codespan",raw:n[0],text:l}}},o.br=function(e){var n=this.rules.inline.br.exec(e);if(n)return{type:"br",raw:n[0]}},o.del=function(e){var n=this.rules.inline.del.exec(e);if(n)return{type:"del",raw:n[0],text:n[2]}},o.autolink=function(e,n){var l=this.rules.inline.autolink.exec(e);if(l){var c,a;return l[2]==="@"?(c=ne(this.options.mangle?n(l[1]):l[1]),a="mailto:"+c):(c=ne(l[1]),a=c),{type:"link",raw:l[0],text:c,href:a,tokens:[{type:"text",raw:c,text:c}]}}},o.url=function(e,n){var l;if(l=this.rules.inline.url.exec(e)){var c,a;if(l[2]==="@")c=ne(this.options.mangle?n(l[0]):l[0]),a="mailto:"+c;else{var g;do g=l[0],l[0]=this.rules.inline._backpedal.exec(l[0])[0];while(g!==l[0]);c=ne(l[0]),l[1]==="www."?a="http://"+c:a=c}return{type:"link",raw:l[0],text:c,href:a,tokens:[{type:"text",raw:c,text:c}]}}},o.inlineText=function(e,n,l){var c=this.rules.inline.text.exec(e);if(c){var a;return n?a=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(c[0]):ne(c[0]):c[0]:a=ne(this.options.smartypants?l(c[0]):c[0]),{type:"text",raw:c[0],text:a}}},f}(),se=X.noopTest,L=X.edit,Q=X.merge,V={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}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?! {0,3}bull )\n*|\s*$)/,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>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:se,table:se,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/};V._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,V._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,V.def=L(V.def).replace("label",V._label).replace("title",V._title).getRegex(),V.bullet=/(?:[*+-]|\d{1,9}[.)])/,V.item=/^( *)(bull) ?[^\n]*(?:\n(?! *bull ?)[^\n]*)*/,V.item=L(V.item,"gm").replace(/bull/g,V.bullet).getRegex(),V.listItemStart=L(/^( *)(bull) */).replace("bull",V.bullet).getRegex(),V.list=L(V.list).replace(/bull/g,V.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+V.def.source+")").getRegex(),V._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",V._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,V.html=L(V.html,"i").replace("comment",V._comment).replace("tag",V._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),V.paragraph=L(V._paragraph).replace("hr",V.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").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",V._tag).getRegex(),V.blockquote=L(V.blockquote).replace("paragraph",V.paragraph).getRegex(),V.normal=Q({},V),V.gfm=Q({},V.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n {0,3}([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n {0,3}\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),V.gfm.nptable=L(V.gfm.nptable).replace("hr",V.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",V._tag).getRegex(),V.gfm.table=L(V.gfm.table).replace("hr",V.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",V._tag).getRegex(),V.pedantic=Q({},V.normal,{html:L(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",V._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:se,paragraph:L(V.normal._paragraph).replace("hr",V.hr).replace("heading",` *#{1,6} *[^
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
`+
|
|
22
|
-
`+
|
|
23
|
-
`+a.raw,
|
|
24
|
-
`+
|
|
25
|
-
`+a.raw,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
`},o.blockquote=function(e){return`<blockquote>
|
|
1
|
+
var Xt=Object.defineProperty,Yt=Object.defineProperties;var en=Object.getOwnPropertyDescriptors;var tt=Object.getOwnPropertySymbols;var tn=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var le=(r,T,I)=>T in r?Xt(r,T,{enumerable:!0,configurable:!0,writable:!0,value:I}):r[T]=I,P=(r,T)=>{for(var I in T||(T={}))tn.call(T,I)&&le(r,I,T[I]);if(tt)for(var I of tt(T))nn.call(T,I)&&le(r,I,T[I]);return r},Y=(r,T)=>Yt(r,en(T));var nt=(r,T,I)=>(le(r,typeof T!="symbol"?T+"":T,I),I);(function(r,T){typeof exports=="object"&&typeof module!="undefined"?module.exports=T(require("vue")):typeof define=="function"&&define.amd?define(["vue"],T):(r=typeof globalThis!="undefined"?globalThis:r||self,r.MdEditorV3=T(r.Vue))})(this,function(r){"use strict";const T="//at.alicdn.com/t/font_2605852_pqekijay2ij.js",I={atom:"https://cdn.jsdelivr.net/npm/highlight.js@11.2.0/styles/atom-one-dark.css",github:"https://cdn.jsdelivr.net/npm/highlight.js@11.2.0/styles/github.css",githubDark:"https://cdn.jsdelivr.net/npm/highlight.js@11.2.0/styles/github-dark.css",js:"https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.2.0/build/highlight.min.js"},re={main:"https://cdn.jsdelivr.net/npm/prettier@2.4.0/standalone.js",markdown:"https://cdn.jsdelivr.net/npm/prettier@2.4.0/parser-markdown.js"},ae={css:"https://cdn.jsdelivr.net/npm/cropperjs@1.5.12/dist/cropper.min.css",js:"https://cdn.jsdelivr.net/npm/cropperjs@1.5.12/dist/cropper.min.js"},it="https://cdn.jsdelivr.net/npm/screenfull@5.1.0/dist/screenfull.js",lt=["bold","underline","italic","strikeThrough","-","title","sub","sup","quote","unorderedList","orderedList","-","codeRow","code","link","image","table","mermaid","katex","-","revoke","next","save","=","prettier","pageFullscreen","fullscreen","preview","htmlPreview","catalog","github"],se={"zh-CN":{toolbarTips:{bold:"\u52A0\u7C97",underline:"\u4E0B\u5212\u7EBF",italic:"\u659C\u4F53",strikeThrough:"\u5220\u9664\u7EBF",title:"\u6807\u9898",sub:"\u4E0B\u6807",sup:"\u4E0A\u6807",quote:"\u5F15\u7528",unorderedList:"\u65E0\u5E8F\u5217\u8868",orderedList:"\u6709\u5E8F\u5217\u8868",codeRow:"\u884C\u5185\u4EE3\u7801",code:"\u5757\u7EA7\u4EE3\u7801",link:"\u94FE\u63A5",image:"\u56FE\u7247",table:"\u8868\u683C",mermaid:"mermaid\u56FE",katex:"\u516C\u5F0F",revoke:"\u540E\u9000",next:"\u524D\u8FDB",save:"\u4FDD\u5B58",prettier:"\u7F8E\u5316",pageFullscreen:"\u6D4F\u89C8\u5668\u5168\u5C4F",fullscreen:"\u5C4F\u5E55\u5168\u5C4F",preview:"\u9884\u89C8",htmlPreview:"html\u4EE3\u7801\u9884\u89C8",catalog:"\u76EE\u5F55",github:"\u6E90\u7801\u5730\u5740"},titleItem:{h1:"\u4E00\u7EA7\u6807\u9898",h2:"\u4E8C\u7EA7\u6807\u9898",h3:"\u4E09\u7EA7\u6807\u9898",h4:"\u56DB\u7EA7\u6807\u9898",h5:"\u4E94\u7EA7\u6807\u9898",h6:"\u516D\u7EA7\u6807\u9898"},imgTitleItem:{link:"\u6DFB\u52A0\u94FE\u63A5",upload:"\u4E0A\u4F20\u56FE\u7247",clip2upload:"\u88C1\u526A\u4E0A\u4F20"},linkModalTips:{title:"\u6DFB\u52A0",descLable:"\u94FE\u63A5\u63CF\u8FF0\uFF1A",descLablePlaceHolder:"\u8BF7\u8F93\u5165\u63CF\u8FF0...",urlLable:"\u94FE\u63A5\u5730\u5740\uFF1A",UrlLablePlaceHolder:"\u8BF7\u8F93\u5165\u94FE\u63A5...",buttonOK:"\u786E\u5B9A"},clipModalTips:{title:"\u88C1\u526A\u56FE\u7247\u4E0A\u4F20",buttonUpload:"\u4E0A\u4F20"},copyCode:{text:"\u590D\u5236\u4EE3\u7801",tips:"\u5DF2\u590D\u5236\uFF01"},mermaid:{flow:"\u6D41\u7A0B\u56FE",sequence:"\u65F6\u5E8F\u56FE",gantt:"\u7518\u7279\u56FE",class:"\u7C7B\u56FE",state:"\u72B6\u6001\u56FE",pie:"\u997C\u56FE",relationship:"\u5173\u7CFB\u56FE",journey:"\u65C5\u7A0B\u56FE"},katex:{inline:"\u884C\u5185\u516C\u5F0F",block:"\u5757\u7EA7\u516C\u5F0F"}},"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",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:{title:"Add ",descLable:"Desc:",descLablePlaceHolder:"Enter a description...",urlLable:"Link:",UrlLablePlaceHolder:"Enter a link...",buttonOK:"OK"},clipModalTips:{title:"Crop Image",buttonUpload:"Upload"},copyCode:{text:"Copy",tips:"Copied!"},mermaid:{flow:"flow",sequence:"sequence",gantt:"gantt",class:"class",state:"state",pie:"pie",relationship:"relationship",journey:"journey"},katex:{inline:"inline",block:"block"}}},rt="https://cdn.jsdelivr.net/npm/mermaid@8.13.5/dist/mermaid.min.js",at="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.js",st="https://cdn.jsdelivr.net/npm/katex@0.15.1/dist/katex.min.css";class ot{constructor(){nt(this,"pools",{})}remove(e,t,n){const s=this.pools[e]&&this.pools[e][t];s&&(this.pools[e][t]=s.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 s=this.pools[e][t];s&&s.forEach(a=>{try{a(...n)}catch(o){console.error(`${t} monitor event exception\uFF01`,o)}})}}var x=new ot;const ct=(i,e)=>{const{editorId:t}=i,n=a=>{var o,c;return((o=i.toolbars)==null?void 0:o.includes(a))&&!((c=i.toolbarsExclude)==null?void 0:c.includes(a))},l=a=>{if(a.target===document.querySelector(`#${i.editorId}-textarea`))if(a.ctrlKey||a.metaKey)switch(a.code){case"KeyS":{a.shiftKey?n("strikeThrough")&&x.emit(t,"replace","strikeThrough"):n("save")&&(x.emit(t,"onSave",i.modelValue),a.preventDefault());break}case"KeyB":{n("bold")&&(x.emit(t,"replace","bold"),a.preventDefault());break}case"KeyU":{a.shiftKey?n("unorderedList")&&(x.emit(t,"replace","unorderedList"),a.preventDefault()):n("underline")&&(x.emit(t,"replace","underline"),a.preventDefault());break}case"KeyI":{a.shiftKey?n("image")&&(x.emit(t,"openModals","image"),a.preventDefault()):n("italic")&&(x.emit(t,"replace","italic"),a.preventDefault());break}case"Digit1":{n("title")&&(x.emit(t,"replace","h1"),a.preventDefault());break}case"Digit2":{n("title")&&(x.emit(t,"replace","h2"),a.preventDefault());break}case"Digit3":{n("title")&&(x.emit(t,"replace","h3"),a.preventDefault());break}case"Digit4":{n("title")&&(x.emit(t,"replace","h4"),a.preventDefault());break}case"Digit5":{n("title")&&(x.emit(t,"replace","h5"),a.preventDefault());break}case"Digit6":{n("title")&&(x.emit(t,"replace","h6"),a.preventDefault());break}case"ArrowUp":{n("sup")&&(x.emit(t,"replace","sup"),a.preventDefault());break}case"ArrowDown":{n("sub")&&(x.emit(t,"replace","sub"),a.preventDefault());break}case"KeyQ":{x.emit(t,"replace","quote"),a.preventDefault();break}case"KeyO":{n("orderedList")&&(x.emit(t,"replace","orderedList"),a.preventDefault());break}case"KeyC":{if(a.shiftKey)n("code")&&(x.emit(t,"replace","code"),a.preventDefault());else if(a.altKey)n("codeRow")&&(x.emit(t,"replace","codeRow"),a.preventDefault());else{a.preventDefault(),x.emit(t,"replace","ctrlC");break}break}case"KeyL":{n("link")&&(x.emit(t,"openModals","link"),a.preventDefault());break}case"KeyZ":{a.shiftKey?n("next")&&(x.emit(t,"ctrlShiftZ"),a.preventDefault()):n("revoke")&&(x.emit(t,"ctrlZ"),a.preventDefault());break}case"KeyF":{a.shiftKey&&n("prettier")&&(x.emit(t,"replace","prettier"),a.preventDefault());break}case"KeyT":{a.altKey&&a.shiftKey&&n("table")&&(x.emit(t,"replace","table"),a.preventDefault());break}case"KeyX":{x.emit(t,"replace","ctrlX"),a.preventDefault();break}case"KeyD":{a.preventDefault(),x.emit(t,"replace","ctrlD");break}}else a.code==="Tab"&&(a.preventDefault(),a.shiftKey?x.emit(t,"replace","shiftTab"):x.emit(t,"replace","tab"))},s=a=>{if(a.clipboardData&&a.clipboardData.files.length>0){const o=a.clipboardData.files[0];/image\/.*/.test(o.type)&&(x.emit(t,"uploadImage",[o]),a.preventDefault())}};r.onMounted(()=>{i.previewOnly||(window.addEventListener("keydown",l),document.addEventListener("paste",s),x.on(t,{name:"onSave",callback(){i.onSave?i.onSave(i.modelValue):e.emit("onSave",i.modelValue)}}))}),r.onBeforeUnmount(()=>{i.previewOnly||(window.removeEventListener("keydown",l),document.removeEventListener("paste",s))})},dt=i=>{const{previewOnly:e,editorId:t,tabWidth:n,showCodeRowNumber:l,Cropper:s}=i;r.provide("editorId",t),r.provide("tabWidth",n),r.provide("theme",r.computed(()=>i.theme));const a=r.computed(()=>{let c=I.atom;if(i.highlightCss)c=i.highlightCss;else switch(i.previewTheme){case"github":{i.theme==="dark"?c=I.githubDark:c=I.github;break}}return{js:i.highlightJs,css:c}});r.provide("highlight",a),r.provide("historyLength",i.historyLength),r.provide("previewOnly",e),r.provide("showCodeRowNumber",l);const o=r.computed(()=>{const c=P(P({},se),i.languageUserDefined);return c[i.language]?c[i.language]:se["zh-CN"]});r.provide("usedLanguageText",o),r.provide("Cropper",s),r.provide("previewTheme",r.computed(()=>i.previewTheme))};var ln="",ut=r.defineComponent({setup(){return()=>r.createVNode("div",{class:`${d}-divider`},null)}});const J=({instance:i,ctx:e,props:t={}},n="default")=>{const l=(i==null?void 0:i.$slots[n])||(e==null?void 0:e.slots[n]);return(l?l(i):"")||t[n]};var rn="",U=r.defineComponent({props:{trigger:{type:String,default:"hover"},overlay:{type:[String,Object],default:""},visible:{type:Boolean,default:!1},onChange:{type:Function,default:()=>()=>{}}},setup(i,e){const t=`${d}-dropdown-hidden`,n=r.reactive({overlayClass:[t],overlayStyle:{},triggerHover:!1,overlayHover:!1}),l=r.ref(),s=r.ref(),a=()=>{i.trigger==="hover"&&(n.triggerHover=!0);const m=l.value,h=s.value,u=m.getBoundingClientRect(),g=m.offsetTop,k=m.offsetLeft,w=u.height,y=u.width;n.overlayStyle=Y(P({},n.overlayStyle),{top:g+w+"px",left:k-h.offsetWidth/2+y/2+"px"}),i.onChange(!0)},o=()=>{n.overlayHover=!0};r.watch(()=>i.visible,m=>{m?n.overlayClass=n.overlayClass.filter(h=>h!==t):n.overlayClass.push(t)});const c=m=>{const h=l.value,u=s.value;!h.contains(m.target)&&!u.contains(m.target)&&i.onChange(!1)};let p=-1;const f=m=>{l.value===m.target?n.triggerHover=!1:n.overlayHover=!1,clearTimeout(p),p=window.setTimeout(()=>{!n.overlayHover&&!n.triggerHover&&i.onChange(!1)},10)};return r.onMounted(()=>{i.trigger==="click"?(l.value.addEventListener("click",a),document.addEventListener("click",c)):(l.value.addEventListener("mouseenter",a),l.value.addEventListener("mouseleave",f),s.value.addEventListener("mouseenter",o),s.value.addEventListener("mouseleave",f))}),r.onBeforeUnmount(()=>{i.trigger==="click"?(l.value.removeEventListener("click",a),document.removeEventListener("click",c)):(l.value.removeEventListener("mouseenter",a),l.value.removeEventListener("mouseleave",f),s.value.removeEventListener("mouseenter",o),s.value.removeEventListener("mouseleave",f))}),()=>{const m=J({ctx:e}),h=J({props:i,ctx:e},"overlay"),u=r.cloneVNode(m instanceof Array?m[0]:m,{ref:l}),g=r.createVNode("div",{class:[`${d}-dropdown`,n.overlayClass],style:n.overlayStyle,ref:s},[r.createVNode("div",{class:`${d}-dropdown-overlay`},[h instanceof Array?h[0]:h])]);return[u,g]}}});const A=(i,e=0,t=e)=>{i.setSelectionRange?setTimeout(()=>{i.setSelectionRange(e,t),i.focus()},0):console.log("can not reset position!")},ee=(i,e,t)=>{const{deviationStart:n=0,deviationEnd:l=0,direct:s=!1,select:a=!1}=t;let o="";if(i.selectionStart||i.selectionStart===0){const c=i.selectionStart,p=i.selectionEnd||0,{prefixVal:f=i.value.substring(0,c),subfixVal:m=i.value.substring(p,i.value.length)}=t;o=f+e+m,A(i,a?c+n:c+e.length+l,c+e.length+l)}else o+=e;return s&&(i.value=o),o},ht=(i,e={newWindow:!0,nofollow:!0})=>{i||console.warn("error link!");const t=document.createElement("a");t.href=i,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)},oe=(i,e)=>{const t=pt(()=>{i.removeEventListener("scroll",n),i.addEventListener("scroll",n),e.removeEventListener("scroll",n),e.addEventListener("scroll",n)},50),n=l=>{const s=i.clientHeight,a=e.clientHeight,o=i.scrollHeight,c=e.scrollHeight,p=(o-s)/(c-a);l.target===i?(e.removeEventListener("scroll",n),e.scrollTo({top:i.scrollTop/p}),t()):(i.removeEventListener("scroll",n),i.scrollTo({top:e.scrollTop*p}),t())};return[t,()=>{i.removeEventListener("scroll",n),e.removeEventListener("scroll",n)}]},ft=(i,e="image.png")=>{const t=i.split(","),n=t[0].match(/:(.*?);/);if(n){const l=n[1],s=atob(t[1]);let a=s.length;const o=new Uint8Array(a);for(;a--;)o[a]=s.charCodeAt(a);return new File([o],e,{type:l})}return null},ce=i=>{if(!i.trim())return i;const e=i.split(`
|
|
2
|
+
`),t=['<span rn-wrapper aria-hidden="true">'];return e.forEach(()=>{t.push("<span></span>")}),t.push("</span>"),`<span class="code-block">${i}</span>${t.join("")}`},pt=(i,e=200)=>{let t=0;return(...n)=>{t&&clearTimeout(t),t=window.setTimeout(()=>{i.apply(globalThis,n),t=0},e)}},de=(i,e)=>{const t=n=>{const l=i.parentElement||document.body,s=l.offsetWidth,a=l.offsetHeight,{clientWidth:o}=document.documentElement,{clientHeight:c}=document.documentElement,p=n.offsetX,f=n.offsetY,m=u=>{let g=u.x+document.body.scrollLeft-document.body.clientLeft-p,k=u.y+document.body.scrollTop-document.body.clientTop-f;g=g<1?1:g<o-s-1?g:o-s-1,k=k<1?1:k<c-a-1?k:c-a-1,e?e(g,k):(l.style.left=`${g}px`,l.style.top=`${k}px`)};document.addEventListener("mousemove",m);const h=()=>{document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",h)};document.addEventListener("mouseup",h)};return i.addEventListener("mousedown",t),()=>{i.removeEventListener("mousedown",t)}},te=i=>{document.getElementById(i.id)||document.head.appendChild(i)};var an="",ue=r.defineComponent({props:{title:{type:String,default:""},visible:{type:Boolean,default:!1},width:{type:String,default:"auto"},height:{type:String,default:"auto"},onClosed:{type:Function,default:()=>()=>{}},showAdjust:{type:Boolean,default:!1},isFullscreen:{type:Boolean,default:!1},onAdjust:{type:Function,default:()=>()=>{}}},setup(i,e){const t=r.ref(i.visible),n=r.ref([`${d}-modal`]),l=r.ref(),s=r.ref();let a=()=>{};const o=r.reactive({initPos:{left:"0px",top:"0px"},historyPos:{left:"0px",top:"0px"}});return r.onMounted(()=>{a=de(s.value,(c,p)=>{o.initPos.left=c+"px",o.initPos.top=p+"px"})}),r.onBeforeUnmount(()=>{a()}),r.watch(()=>i.isFullscreen,c=>{c?a():a=de(s.value,(p,f)=>{o.initPos.left=p+"px",o.initPos.top=f+"px"})}),r.watch(()=>i.visible,c=>{c?(n.value.push("zoom-in"),t.value=c,r.nextTick(()=>{const p=l.value.offsetWidth/2,f=l.value.offsetHeight/2,m=document.documentElement.clientWidth/2,h=document.documentElement.clientHeight/2;o.initPos.left=m-p+"px",o.initPos.top=h-f+"px"}),setTimeout(()=>{n.value=n.value.filter(p=>p!=="zoom-in")},140)):(n.value.push("zoom-out"),setTimeout(()=>{n.value=n.value.filter(p=>p!=="zoom-out"),t.value=c},130))}),()=>{const c=J({ctx:e}),p=J({props:i,ctx:e},"title");return r.createVNode("div",{style:{display:t.value?"block":"none"}},[r.createVNode("div",{class:`${d}-modal-mask`,onClick:i.onClosed},null),r.createVNode("div",{class:n.value,style:Y(P({},o.initPos),{width:i.width,height:i.height}),ref:l},[r.createVNode("div",{class:`${d}-modal-header`,ref:s},[p||""]),r.createVNode("div",{class:`${d}-modal-body`},[c]),r.createVNode("div",{class:`${d}-modal-func`},[i.showAdjust&&r.createVNode("div",{class:`${d}-modal-adjust`,onClick:f=>{f.stopPropagation(),i.isFullscreen?o.initPos=o.historyPos:(o.historyPos=o.initPos,o.initPos={left:"0",top:"0"}),i.onAdjust(!i.isFullscreen)}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":`#icon-${i.isFullscreen?"suoxiao":"fangda"}`},null)])]),r.createVNode("div",{class:`${d}-modal-close`,onClick:f=>{f.stopPropagation(),i.onClosed&&i.onClosed()}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-close"},null)])])])])])}}}),gt=r.defineComponent({props:{type:{type:String,default:"link"},visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>()=>{}},onOk:{type:Function,default:()=>()=>{}}},setup(i){const e=r.inject("usedLanguageText"),t=r.inject("editorId"),n=r.computed(()=>{var s,a,o,c;switch(i.type){case"link":return`${(s=e.value.linkModalTips)==null?void 0:s.title}${(a=e.value.toolbarTips)==null?void 0:a.link}`;case"image":return`${(o=e.value.linkModalTips)==null?void 0:o.title}${(c=e.value.toolbarTips)==null?void 0:c.image}`;default:return""}}),l=r.reactive({desc:"",url:""});return r.watch(()=>i.visible,s=>{s||setTimeout(()=>{l.desc="",l.url=""},200)}),()=>r.createVNode(ue,{title:n.value,visible:i.visible,onClosed:i.onCancel},{default:()=>{var s,a,o,c,p;return[r.createVNode("div",{class:`${d}-form-item`},[r.createVNode("label",{class:`${d}-lable`,for:`link-desc-${t}`},[(s=e.value.linkModalTips)==null?void 0:s.descLable]),r.createVNode("input",{placeholder:(a=e.value.linkModalTips)==null?void 0:a.descLablePlaceHolder,class:`${d}-input`,id:`link-desc-${t}`,type:"text",value:l.desc,onChange:f=>{l.desc=f.target.value},autocomplete:"off"},null)]),r.createVNode("div",{class:`${d}-form-item`},[r.createVNode("label",{class:`${d}-lable`,for:`link-url-${t}`},[(o=e.value.linkModalTips)==null?void 0:o.urlLable]),r.createVNode("input",{placeholder:(c=e.value.linkModalTips)==null?void 0:c.UrlLablePlaceHolder,class:`${d}-input`,id:`link-url-${t}`,type:"text",value:l.url,onChange:f=>{l.url=f.target.value},autocomplete:"off"},null)]),r.createVNode("div",{class:`${d}-form-item`},[r.createVNode("button",{class:[`${d}-btn`,`${d}-btn-row`],type:"button",onClick:()=>{i.onOk(l),l.desc="",l.url=""}},[(p=e.value.linkModalTips)==null?void 0:p.buttonOK])])]}})}}),sn="",mt=r.defineComponent({props:{visible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>()=>{}},onOk:{type:Function,default:()=>()=>{}}},setup(i){const e=r.inject("usedLanguageText"),t=r.inject("editorId");let n=r.inject("Cropper");const l=r.ref(),s=r.ref(),a=r.ref(),o=r.reactive({cropperInited:!1,imgSelected:!1,imgSrc:"",isFullscreen:!1});let c=null;r.watch(()=>i.visible,()=>{i.visible&&!o.cropperInited&&(n=n||window.Cropper,l.value.onchange=()=>{const m=l.value.files||[];if(o.imgSelected=!0,(m==null?void 0:m.length)>0){const h=new FileReader;h.onload=u=>{o.imgSrc=u.target.result,r.nextTick(()=>{c=new n(s.value,{viewMode:2,preview:`.${d}-clip-preview-target`})})},h.readAsDataURL(m[0])}})}),r.watch(()=>[o.imgSelected],()=>{a.value.style=""}),r.watch(()=>o.isFullscreen,()=>{r.nextTick(()=>{c==null||c.destroy(),a.value.style="",s.value&&(c=new n(s.value,{viewMode:2,preview:`.${d}-clip-preview-target`}))})});const p=r.computed(()=>o.isFullscreen?{width:"100%",height:"100%"}:{width:"668px",height:"421px"}),f=()=>{c.destroy(),l.value.value="",o.imgSelected=!1};return()=>{var m;return r.createVNode(ue,r.mergeProps({title:(m=e.value.clipModalTips)==null?void 0:m.title,visible:i.visible,onClosed:i.onCancel,showAdjust:!0,isFullscreen:o.isFullscreen,onAdjust:h=>{o.isFullscreen=h}},p.value),{default:()=>{var h;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:s,style:{display:"none"}},null),r.createVNode("div",{class:`${d}-clip-delete`,onClick:f},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-delete"},null)])])]):r.createVNode("div",{class:`${d}-clip-upload`,onClick:()=>{l.value.click()}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#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:()=>{const u=c.getCroppedCanvas();x.emit(t,"uploadImage",[ft(u.toDataURL("image/png"))],i.onOk),f()}},[(h=e.value.linkModalTips)==null?void 0:h.buttonOK])]),r.createVNode("input",{ref:l,accept:"image/*",type:"file",multiple:!1,style:{display:"none"}},null)]}})}}}),kt=r.defineComponent({props:{type:{type:String,default:"link"},linkVisible:{type:Boolean,default:!1},clipVisible:{type:Boolean,default:!1},onCancel:{type:Function,default:()=>()=>{}},onOk:{type:Function,default:()=>()=>{}}},setup(i){return()=>r.createVNode(r.Fragment,null,[r.createVNode(gt,{type:i.type,visible:i.linkVisible,onOk:i.onOk,onCancel:i.onCancel},null),r.createVNode(mt,{visible:i.clipVisible,onOk:i.onOk,onCancel:i.onCancel},null)])}});const bt=i=>{let{screenfull:e}=i;const t=()=>{e.isEnabled?e.isFullscreen?e.exit():e.request():console.error("browser does not support screenfull!")},n=()=>{e=window.screenfull,e&&e.isEnabled&&e.on("change",()=>{i.updateSetting(!i.setting.fullscreen,"fullscreen")})};return r.onMounted(()=>{e&&e.isEnabled&&e.on("change",()=>{i.updateSetting(!i.setting.fullscreen,"fullscreen")})}),{fullScreenHandler:t,screenfullLoad:n}},yt=r.defineComponent({name:"TableShape",props:{tableShape:{type:Array,default:()=>[6,4]},onSelected:{type:Function,default:()=>{}}},setup(i){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(i.tableShape[1]).fill("").map((t,n)=>r.createVNode("div",{class:`${d}-table-shape-row`,key:`table-shape-row-${n}`},[new Array(i.tableShape[0]).fill("").map((l,s)=>r.createVNode("div",{class:`${d}-table-shape-col`,key:`table-shape-col-${s}`,onMouseenter:()=>{e.x=n,e.y=s},onClick:()=>{i.onSelected(e)}},[r.createVNode("div",{class:[`${d}-table-shape-col-default`,n<=e.x&&s<=e.y&&`${d}-table-shape-col-include`]},null)]))]))])}});var wt=r.defineComponent({name:"MDEditorToolbar",props:{prettier:{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]}},setup(i){const e=r.inject("editorId"),t=r.inject("usedLanguageText"),n=r.inject("previewOnly"),{fullScreenHandler:l,screenfullLoad:s}=bt(i),a=r.reactive({title:!1,catalog:!1,image:!1,table:!1,mermaid:!1,katex:!1}),o=(g,k)=>{x.emit(e,"replace",g,k)},c=r.reactive({type:"link",linkVisible:!1,clipVisible:!1}),p=r.ref();r.onMounted(()=>{var g;x.on(e,{name:"openModals",callback(k){c.type=k,c.linkVisible=!0}}),(g=p.value)==null||g.addEventListener("mouseover",()=>{var k;((k=window.getSelection())==null?void 0:k.toString())||x.emit(e,"selectTextChange","")})});const f=r.computed(()=>{const g=i.toolbars.filter(C=>!i.toolbarsExclude.includes(C)),k=g.indexOf("="),w=k===-1?g:g.slice(0,k+1),y=k===-1?[]:g.slice(k,Number.MAX_SAFE_INTEGER);return[w,y]}),m=r.ref(),h=()=>{x.emit(e,"uploadImage",m.value.files),m.value.value=""};r.onMounted(()=>{m.value.addEventListener("change",h)});const u=g=>{var k,w,y,C,S,N,_,F,L,j,R,O,Z,Ve,Ee,Te,Ie,De,Le,Fe,_e,Re,je,ze,Ae,Me,He,Be,Oe,Pe,Ue,qe,Ke,Ze,Je,We,Ge,Qe,Xe,Ye,et;switch(g){case"-":return r.createVNode(ut,null,null);case"bold":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(k=t.value.toolbarTips)==null?void 0:k.bold,onClick:()=>{o("bold")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-bold"},null)])]);case"underline":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(w=t.value.toolbarTips)==null?void 0:w.underline,onClick:()=>{o("underline")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-underline"},null)])]);case"italic":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(y=t.value.toolbarTips)==null?void 0:y.italic,onClick:()=>{o("italic")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-italic"},null)])]);case"strikeThrough":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(C=t.value.toolbarTips)==null?void 0:C.strikeThrough,onClick:()=>{o("strikeThrough")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-strike-through"},null)])]);case"title":return r.createVNode(U,{visible:a.title,onChange:E=>{a.title=E},overlay:r.createVNode("ul",{class:`${d}-menu`,onClick:()=>{a.title=!1}},[r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("h1")}},[(S=t.value.titleItem)==null?void 0:S.h1]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("h2")}},[(N=t.value.titleItem)==null?void 0:N.h2]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("h3")}},[(_=t.value.titleItem)==null?void 0:_.h3]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("h4")}},[(F=t.value.titleItem)==null?void 0:F.h4]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("h5")}},[(L=t.value.titleItem)==null?void 0:L.h5]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("h6")}},[(j=t.value.titleItem)==null?void 0:j.h6])])},{default:()=>{var E;return[r.createVNode("div",{class:`${d}-toolbar-item`,title:(E=t.value.toolbarTips)==null?void 0:E.title},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-title"},null)])])]}});case"sub":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(R=t.value.toolbarTips)==null?void 0:R.sub,onClick:()=>{o("sub")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-sub"},null)])]);case"sup":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(O=t.value.toolbarTips)==null?void 0:O.sup,onClick:()=>{o("sup")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-sup"},null)])]);case"quote":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Z=t.value.toolbarTips)==null?void 0:Z.quote,onClick:()=>{o("quote")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-quote"},null)])]);case"unorderedList":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Ve=t.value.toolbarTips)==null?void 0:Ve.unorderedList,onClick:()=>{o("unorderedList")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-unordered-list"},null)])]);case"orderedList":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Ee=t.value.toolbarTips)==null?void 0:Ee.orderedList,onClick:()=>{o("orderedList")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-ordered-list"},null)])]);case"codeRow":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Te=t.value.toolbarTips)==null?void 0:Te.codeRow,onClick:()=>{o("codeRow")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-code-row"},null)])]);case"code":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Ie=t.value.toolbarTips)==null?void 0:Ie.code,onClick:()=>{o("code")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-code"},null)])]);case"link":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(De=t.value.toolbarTips)==null?void 0:De.link,onClick:()=>{c.type="link",c.linkVisible=!0}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-link"},null)])]);case"image":return r.createVNode(U,{visible:a.image,onChange:E=>{a.image=E},overlay:r.createVNode("ul",{class:`${d}-menu`,onClick:()=>{a.title=!1}},[r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{c.type="image",c.linkVisible=!0}},[(Le=t.value.imgTitleItem)==null?void 0:Le.link]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{m.value.click()}},[(Fe=t.value.imgTitleItem)==null?void 0:Fe.upload]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{c.clipVisible=!0}},[(_e=t.value.imgTitleItem)==null?void 0:_e.clip2upload])])},{default:()=>{var E;return[r.createVNode("div",{class:`${d}-toolbar-item`,title:(E=t.value.toolbarTips)==null?void 0:E.image},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-image"},null)])])]}});case"table":return r.createVNode(U,{visible:a.table,onChange:E=>{a.table=E},key:"bar-table",overlay:r.createVNode(yt,{tableShape:i.tableShape,onSelected:E=>{o("table",{selectedShape:E})}},null)},{default:()=>{var E;return[r.createVNode("div",{class:`${d}-toolbar-item`,title:(E=t.value.toolbarTips)==null?void 0:E.table},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-table"},null)])])]}});case"revoke":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Re=t.value.toolbarTips)==null?void 0:Re.revoke,onClick:()=>{x.emit(e,"ctrlZ")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-revoke"},null)])]);case"next":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(je=t.value.toolbarTips)==null?void 0:je.next,onClick:()=>{x.emit(e,"ctrlShiftZ")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-next"},null)])]);case"save":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(ze=t.value.toolbarTips)==null?void 0:ze.save,onClick:()=>{x.emit(e,"onSave")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-baocun"},null)])]);case"prettier":return i.prettier?r.createVNode("div",{class:`${d}-toolbar-item`,title:(Ae=t.value.toolbarTips)==null?void 0:Ae.prettier,onClick:()=>{o("prettier")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-prettier"},null)])]):"";case"pageFullscreen":return!i.setting.fullscreen&&r.createVNode("div",{class:`${d}-toolbar-item`,title:(Me=t.value.toolbarTips)==null?void 0:Me.pageFullscreen,onClick:()=>{i.updateSetting(!i.setting.pageFullScreen,"pageFullScreen")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":`#icon-${i.setting.pageFullScreen?"suoxiao":"fangda"}`},null)])]);case"fullscreen":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(He=t.value.toolbarTips)==null?void 0:He.fullscreen,onClick:l},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":`#icon-${i.setting.fullscreen?"fullScreen-exit":"fullScreen"}`},null)])]);case"preview":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Be=t.value.toolbarTips)==null?void 0:Be.preview,onClick:()=>{i.updateSetting(!i.setting.preview,"preview")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-preview"},null)])]);case"htmlPreview":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Oe=t.value.toolbarTips)==null?void 0:Oe.htmlPreview,onClick:()=>{i.updateSetting(!i.setting.htmlPreview,"htmlPreview")}},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-coding"},null)])]);case"catalog":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Pe=t.value.toolbarTips)==null?void 0:Pe.catalog,onClick:()=>{x.emit(e,"catalogShow")},key:"bar-catalog"},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-catalog"},null)])]);case"github":return r.createVNode("div",{class:`${d}-toolbar-item`,title:(Ue=t.value.toolbarTips)==null?void 0:Ue.github,onClick:()=>ht("https://github.com/imzbf/md-editor-v3")},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-github"},null)])]);case"mermaid":return r.createVNode(U,{visible:a.mermaid,onChange:E=>{a.mermaid=E},overlay:r.createVNode("ul",{class:`${d}-menu`,onClick:()=>{a.mermaid=!1}},[r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("flow")}},[(qe=t.value.mermaid)==null?void 0:qe.flow]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("sequence")}},[(Ke=t.value.mermaid)==null?void 0:Ke.sequence]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("gantt")}},[(Ze=t.value.mermaid)==null?void 0:Ze.gantt]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("class")}},[(Je=t.value.mermaid)==null?void 0:Je.class]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("state")}},[(We=t.value.mermaid)==null?void 0:We.state]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("pie")}},[(Ge=t.value.mermaid)==null?void 0:Ge.pie]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("relationship")}},[(Qe=t.value.mermaid)==null?void 0:Qe.relationship]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("journey")}},[(Xe=t.value.mermaid)==null?void 0:Xe.journey])]),key:"bar-mermaid"},{default:()=>{var E;return[r.createVNode("div",{class:`${d}-toolbar-item`,title:(E=t.value.toolbarTips)==null?void 0:E.mermaid},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-mermaid"},null)])])]}});case"katex":return r.createVNode(U,{visible:a.katex,onChange:E=>{a.katex=E},overlay:r.createVNode("ul",{class:`${d}-menu`,onClick:()=>{a.katex=!1}},[r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("katexInline")}},[(Ye=t.value.katex)==null?void 0:Ye.inline]),r.createVNode("li",{class:`${d}-menu-item`,onClick:()=>{o("katexBlock")}},[(et=t.value.katex)==null?void 0:et.block])]),key:"bar-katex"},{default:()=>{var E;return[r.createVNode("div",{class:`${d}-toolbar-item`,title:(E=t.value.toolbarTips)==null?void 0:E.mermaid},[r.createVNode("svg",{class:`${d}-icon`,"aria-hidden":"true"},[r.createVNode("use",{"xlink:href":"#icon-formula"},null)])])]}})}};return()=>{const g=f.value[0].map(w=>u(w)),k=f.value[1].map(w=>u(w));return r.createVNode("div",{class:`${d}-toolbar-wrapper`},[r.createVNode("div",{class:`${d}-toolbar`},[r.createVNode("div",{class:`${d}-toolbar-left`,ref:p},[g]),r.createVNode("div",{class:`${d}-toolbar-right`},[k])]),r.createVNode("input",{ref:m,accept:"image/*",type:"file",multiple:!0,style:{display:"none"}},null),r.createVNode(kt,{linkVisible:c.linkVisible,clipVisible:c.clipVisible,type:c.type,onCancel:()=>{c.linkVisible=!1,c.clipVisible=!1},onOk:w=>{w&&o(c.type,{desc:w.desc,url:w.url}),c.linkVisible=!1,c.clipVisible=!1}},null),!n&&i.screenfull===null&&r.createVNode(r.Teleport,{to:"head"},{default:()=>[r.createVNode("script",{src:i.screenfullJs,onLoad:s},null)]})])}}});function he(){return{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,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}let B=he();function xt(i){B=i}const $t=/[&<>"']/,vt=/[&<>"']/g,Ct=/[<>"']|&(?!#?\w+;)/,St=/[<>"']|&(?!#?\w+;)/g,Nt={"&":"&","<":"<",">":">",'"':""","'":"'"},fe=i=>Nt[i];function D(i,e){if(e){if($t.test(i))return i.replace(vt,fe)}else if(Ct.test(i))return i.replace(St,fe);return i}const Vt=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;function pe(i){return i.replace(Vt,(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 Et=/(^|[^\[])\^/g;function V(i,e){i=i.source||i,e=e||"";const t={replace:(n,l)=>(l=l.source||l,l=l.replace(Et,"$1"),i=i.replace(n,l),t),getRegex:()=>new RegExp(i,e)};return t}const Tt=/[^\w:]/g,It=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function ge(i,e,t){if(i){let n;try{n=decodeURIComponent(pe(t)).replace(Tt,"").toLowerCase()}catch{return null}if(n.indexOf("javascript:")===0||n.indexOf("vbscript:")===0||n.indexOf("data:")===0)return null}e&&!It.test(t)&&(t=_t(e,t));try{t=encodeURI(t).replace(/%25/g,"%")}catch{return null}return t}const W={},Dt=/^[^:]+:\/*[^/]*$/,Lt=/^([^:]+:)[\s\S]*$/,Ft=/^([^:]+:\/*[^/]*)[\s\S]*$/;function _t(i,e){W[" "+i]||(Dt.test(i)?W[" "+i]=i+"/":W[" "+i]=Q(i,"/",!0)),i=W[" "+i];const t=i.indexOf(":")===-1;return e.substring(0,2)==="//"?t?e:i.replace(Lt,"$1")+e:e.charAt(0)==="/"?t?e:i.replace(Ft,"$1")+e:i+e}const G={exec:function(){}};function z(i){let e=1,t,n;for(;e<arguments.length;e++){t=arguments[e];for(n in t)Object.prototype.hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i}function me(i,e){const t=i.replace(/\|/g,(s,a,o)=>{let c=!1,p=a;for(;--p>=0&&o[p]==="\\";)c=!c;return c?"|":" |"}),n=t.split(/ \|/);let l=0;if(n[0].trim()||n.shift(),n[n.length-1].trim()||n.pop(),n.length>e)n.splice(e);else for(;n.length<e;)n.push("");for(;l<n.length;l++)n[l]=n[l].trim().replace(/\\\|/g,"|");return n}function Q(i,e,t){const n=i.length;if(n===0)return"";let l=0;for(;l<n;){const s=i.charAt(n-l-1);if(s===e&&!t)l++;else if(s!==e&&t)l++;else break}return i.substr(0,n-l)}function Rt(i,e){if(i.indexOf(e[1])===-1)return-1;const t=i.length;let n=0,l=0;for(;l<t;l++)if(i[l]==="\\")l++;else if(i[l]===e[0])n++;else if(i[l]===e[1]&&(n--,n<0))return l;return-1}function ke(i){i&&i.sanitize&&!i.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 be(i,e){if(e<1)return"";let t="";for(;e>1;)e&1&&(t+=i),e>>=1,i+=i;return t+i}function ye(i,e,t,n){const l=e.href,s=e.title?D(e.title):null,a=i[1].replace(/\\([\[\]])/g,"$1");if(i[0].charAt(0)!=="!"){n.state.inLink=!0;const o={type:"link",raw:t,href:l,title:s,text:a,tokens:n.inlineTokens(a,[])};return n.state.inLink=!1,o}else return{type:"image",raw:t,href:l,title:s,text:D(a)}}function jt(i,e){const t=i.match(/^(\s+)(?:```)/);if(t===null)return e;const n=t[1];return e.split(`
|
|
3
|
+
`).map(l=>{const s=l.match(/^\s+/);if(s===null)return l;const[a]=s;return a.length>=n.length?l.slice(n.length):l}).join(`
|
|
4
|
+
`)}class ne{constructor(e){this.options=e||B}space(e){const t=this.rules.block.newline.exec(e);if(t)return t[0].length>1?{type:"space",raw:t[0]}:{raw:`
|
|
5
|
+
`}}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:Q(n,`
|
|
6
|
+
`)}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const n=t[0],l=jt(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim():t[2],text:l}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let n=t[2].trim();if(/#$/.test(n)){const s=Q(n,"#");(this.options.pedantic||!s||/ $/.test(s))&&(n=s.trim())}const l={type:"heading",raw:t[0],depth:t[1].length,text:n,tokens:[]};return this.lexer.inline(l.text,l.tokens),l}}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(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],tokens:this.lexer.blockTokens(n,[]),text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,l,s,a,o,c,p,f,m,h,u,g,k=t[1].trim();const w=k.length>1,y={type:"list",raw:"",ordered:w,start:w?+k.slice(0,-1):"",loose:!1,items:[]};k=w?`\\d{1,9}\\${k.slice(-1)}`:`\\${k}`,this.options.pedantic&&(k=w?k:"[*+-]");const C=new RegExp(`^( {0,3}${k})((?: [^\\n]*)?(?:\\n|$))`);for(;e&&(g=!1,!(!(t=C.exec(e))||this.rules.block.hr.test(e)));){if(n=t[0],e=e.substring(n.length),f=t[2].split(`
|
|
7
|
+
`,1)[0],m=e.split(`
|
|
8
|
+
`,1)[0],this.options.pedantic?(a=2,u=f.trimLeft()):(a=t[2].search(/[^ ]/),a=a>4?1:a,u=f.slice(a),a+=t[1].length),c=!1,!f&&/^ *$/.test(m)&&(n+=m+`
|
|
9
|
+
`,e=e.substring(m.length+1),g=!0),!g){const N=new RegExp(`^ {0,${Math.min(3,a-1)}}(?:[*+-]|\\d{1,9}[.)])`);for(;e&&(h=e.split(`
|
|
10
|
+
`,1)[0],f=h,this.options.pedantic&&(f=f.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),!N.test(f));){if(f.search(/[^ ]/)>=a||!f.trim())u+=`
|
|
11
|
+
`+f.slice(a);else if(!c)u+=`
|
|
12
|
+
`+f;else break;!c&&!f.trim()&&(c=!0),n+=h+`
|
|
13
|
+
`,e=e.substring(h.length+1)}}y.loose||(p?y.loose=!0:/\n *\n *$/.test(n)&&(p=!0)),this.options.gfm&&(l=/^\[[ xX]\] /.exec(u),l&&(s=l[0]!=="[ ] ",u=u.replace(/^\[[ xX]\] +/,""))),y.items.push({type:"list_item",raw:n,task:!!l,checked:s,loose:!1,text:u}),y.raw+=n}y.items[y.items.length-1].raw=n.trimRight(),y.items[y.items.length-1].text=u.trimRight(),y.raw=y.raw.trimRight();const S=y.items.length;for(o=0;o<S;o++)this.lexer.state.top=!1,y.items[o].tokens=this.lexer.blockTokens(y.items[o].text,[]),!y.loose&&y.items[o].tokens.some(N=>N.type==="space")&&(y.loose=!0,y.items[o].loose=!0);return y}}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]};return this.options.sanitize&&(n.type="paragraph",n.text=this.options.sanitizer?this.options.sanitizer(t[0]):D(t[0]),n.tokens=[],this.lexer.inline(n.text,n.tokens)),n}}def(e){const t=this.rules.block.def.exec(e);if(t){t[3]&&(t[3]=t[3].substring(1,t[3].length-1));const n=t[1].toLowerCase().replace(/\s+/g," ");return{type:"def",tag:n,raw:t[0],href:t[2],title:t[3]}}}table(e){const t=this.rules.block.table.exec(e);if(t){const n={type:"table",header:me(t[1]).map(l=>({text:l})),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]?t[3].replace(/\n[ \t]*$/,"").split(`
|
|
14
|
+
`):[]};if(n.header.length===n.align.length){n.raw=t[0];let l=n.align.length,s,a,o,c;for(s=0;s<l;s++)/^ *-+: *$/.test(n.align[s])?n.align[s]="right":/^ *:-+: *$/.test(n.align[s])?n.align[s]="center":/^ *:-+ *$/.test(n.align[s])?n.align[s]="left":n.align[s]=null;for(l=n.rows.length,s=0;s<l;s++)n.rows[s]=me(n.rows[s],n.header.length).map(p=>({text:p}));for(l=n.header.length,a=0;a<l;a++)n.header[a].tokens=[],this.lexer.inlineTokens(n.header[a].text,n.header[a].tokens);for(l=n.rows.length,a=0;a<l;a++)for(c=n.rows[a],o=0;o<c.length;o++)c[o].tokens=[],this.lexer.inlineTokens(c[o].text,c[o].tokens);return n}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t){const n={type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:[]};return this.lexer.inline(n.text,n.tokens),n}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const n={type:"paragraph",raw:t[0],text:t[1].charAt(t[1].length-1)===`
|
|
15
|
+
`?t[1].slice(0,-1):t[1],tokens:[]};return this.lexer.inline(n.text,n.tokens),n}}text(e){const t=this.rules.block.text.exec(e);if(t){const n={type:"text",raw:t[0],text:t[0],tokens:[]};return this.lexer.inline(n.text,n.tokens),n}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:D(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]):D(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=Q(n.slice(0,-1),"\\");if((n.length-a.length)%2==0)return}else{const a=Rt(t[2],"()");if(a>-1){const c=(t[0].indexOf("!")===0?5:4)+t[1].length+a;t[2]=t[2].substring(0,a),t[0]=t[0].substring(0,c).trim(),t[3]=""}}let l=t[2],s="";if(this.options.pedantic){const a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(l);a&&(l=a[1],s=a[3])}else s=t[3]?t[3].slice(1,-1):"";return l=l.trim(),/^</.test(l)&&(this.options.pedantic&&!/>$/.test(n)?l=l.slice(1):l=l.slice(1,-1)),ye(t,{href:l&&l.replace(this.rules.inline._escapes,"$1"),title:s&&s.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 l=(n[2]||n[1]).replace(/\s+/g," ");if(l=t[l.toLowerCase()],!l||!l.href){const s=n[0].charAt(0);return{type:"text",raw:s,text:s}}return ye(n,l,n[0],this.lexer)}}emStrong(e,t,n=""){let l=this.rules.inline.emStrong.lDelim.exec(e);if(!l||l[3]&&n.match(/[\p{L}\p{N}]/u))return;const s=l[1]||l[2]||"";if(!s||s&&(n===""||this.rules.inline.punctuation.exec(n))){const a=l[0].length-1;let o,c,p=a,f=0;const m=l[0][0]==="*"?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(m.lastIndex=0,t=t.slice(-1*e.length+a);(l=m.exec(t))!=null;){if(o=l[1]||l[2]||l[3]||l[4]||l[5]||l[6],!o)continue;if(c=o.length,l[3]||l[4]){p+=c;continue}else if((l[5]||l[6])&&a%3&&!((a+c)%3)){f+=c;continue}if(p-=c,p>0)continue;if(c=Math.min(c,c+p+f),Math.min(a,c)%2){const u=e.slice(1,a+l.index+c);return{type:"em",raw:e.slice(0,a+l.index+c+1),text:u,tokens:this.lexer.inlineTokens(u,[])}}const h=e.slice(2,a+l.index+c-1);return{type:"strong",raw:e.slice(0,a+l.index+c+1),text:h,tokens:this.lexer.inlineTokens(h,[])}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let n=t[2].replace(/\n/g," ");const l=/[^ ]/.test(n),s=/^ /.test(n)&&/ $/.test(n);return l&&s&&(n=n.substring(1,n.length-1)),n=D(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 l,s;return n[2]==="@"?(l=D(this.options.mangle?t(n[1]):n[1]),s="mailto:"+l):(l=D(n[1]),s=l),{type:"link",raw:n[0],text:l,href:s,tokens:[{type:"text",raw:l,text:l}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let l,s;if(n[2]==="@")l=D(this.options.mangle?t(n[0]):n[0]),s="mailto:"+l;else{let a;do a=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0];while(a!==n[0]);l=D(n[0]),n[1]==="www."?s="http://"+l:s=l}return{type:"link",raw:n[0],text:l,href:s,tokens:[{type:"text",raw:l,text:l}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let l;return this.lexer.state.inRawBlock?l=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):D(n[0]):n[0]:l=D(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:l}}}}const $={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}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)( [^\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>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:G,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,text:/^[^\n]+/};$._label=/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,$._title=/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/,$.def=V($.def).replace("label",$._label).replace("title",$._title).getRegex(),$.bullet=/(?:[*+-]|\d{1,9}[.)])/,$.listItemStart=V(/^( *)(bull) */).replace("bull",$.bullet).getRegex(),$.list=V($.list).replace(/bull/g,$.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+$.def.source+")").getRegex(),$._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",$._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,$.html=V($.html,"i").replace("comment",$._comment).replace("tag",$._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),$.paragraph=V($._paragraph).replace("hr",$.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",$._tag).getRegex(),$.blockquote=V($.blockquote).replace("paragraph",$.paragraph).getRegex(),$.normal=z({},$),$.gfm=z({},$.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),$.gfm.table=V($.gfm.table).replace("hr",$.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",$._tag).getRegex(),$.gfm.paragraph=V($._paragraph).replace("hr",$.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("table",$.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",$._tag).getRegex(),$.pedantic=z({},$.normal,{html:V(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",$._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:G,paragraph:V($.normal._paragraph).replace("hr",$.hr).replace("heading",` *#{1,6} *[^
|
|
16
|
+
]`).replace("lheading",$.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const b={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:G,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)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,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:G,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};b._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",b.punctuation=V(b.punctuation).replace(/punctuation/g,b._punctuation).getRegex(),b.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,b.escapedEmSt=/\\\*|\\_/g,b._comment=V($._comment).replace("(?:-->|$)","-->").getRegex(),b.emStrong.lDelim=V(b.emStrong.lDelim).replace(/punct/g,b._punctuation).getRegex(),b.emStrong.rDelimAst=V(b.emStrong.rDelimAst,"g").replace(/punct/g,b._punctuation).getRegex(),b.emStrong.rDelimUnd=V(b.emStrong.rDelimUnd,"g").replace(/punct/g,b._punctuation).getRegex(),b._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,b._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,b._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])?)+(?![-_])/,b.autolink=V(b.autolink).replace("scheme",b._scheme).replace("email",b._email).getRegex(),b._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,b.tag=V(b.tag).replace("comment",b._comment).replace("attribute",b._attribute).getRegex(),b._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,b._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,b._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,b.link=V(b.link).replace("label",b._label).replace("href",b._href).replace("title",b._title).getRegex(),b.reflink=V(b.reflink).replace("label",b._label).getRegex(),b.reflinkSearch=V(b.reflinkSearch,"g").replace("reflink",b.reflink).replace("nolink",b.nolink).getRegex(),b.normal=z({},b),b.pedantic=z({},b.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:V(/^!?\[(label)\]\((.*?)\)/).replace("label",b._label).getRegex(),reflink:V(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",b._label).getRegex()}),b.gfm=z({},b.normal,{escape:V(b.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.!#$%&'*+\/=?_`{\|}~-]+@)))/}),b.gfm.url=V(b.gfm.url,"i").replace("email",b.gfm._extended_email).getRegex(),b.breaks=z({},b.gfm,{br:V(b.br).replace("{2,}","*").getRegex(),text:V(b.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});function zt(i){return i.replace(/---/g,"\u2014").replace(/--/g,"\u2013").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1\u2018").replace(/'/g,"\u2019").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1\u201C").replace(/"/g,"\u201D").replace(/\.{3}/g,"\u2026")}function we(i){let e="",t,n;const l=i.length;for(t=0;t<l;t++)n=i.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),e+="&#"+n+";";return e}class M{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||B,this.options.tokenizer=this.options.tokenizer||new ne,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:$.normal,inline:b.normal};this.options.pedantic?(t.block=$.pedantic,t.inline=b.pedantic):this.options.gfm&&(t.block=$.gfm,this.options.breaks?t.inline=b.breaks:t.inline=b.gfm),this.tokenizer.rules=t}static get rules(){return{block:$,inline:b}}static lex(e,t){return new M(t).lex(e)}static lexInline(e,t){return new M(t).inlineTokens(e)}lex(e){e=e.replace(/\r\n|\r/g,`
|
|
17
|
+
`).replace(/\t/g," "),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(/^ +$/gm,""));let n,l,s,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.type&&t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),l=t[t.length-1],l&&(l.type==="paragraph"||l.type==="text")?(l.raw+=`
|
|
18
|
+
`+n.raw,l.text+=`
|
|
19
|
+
`+n.text,this.inlineQueue[this.inlineQueue.length-1].src=l.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),l=t[t.length-1],l&&(l.type==="paragraph"||l.type==="text")?(l.raw+=`
|
|
20
|
+
`+n.raw,l.text+=`
|
|
21
|
+
`+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=l.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(s=e,this.options.extensions&&this.options.extensions.startBlock){let o=1/0;const c=e.slice(1);let p;this.options.extensions.startBlock.forEach(function(f){p=f.call({lexer:this},c),typeof p=="number"&&p>=0&&(o=Math.min(o,p))}),o<1/0&&o>=0&&(s=e.substring(0,o+1))}if(this.state.top&&(n=this.tokenizer.paragraph(s))){l=t[t.length-1],a&&l.type==="paragraph"?(l.raw+=`
|
|
22
|
+
`+n.raw,l.text+=`
|
|
23
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=l.text):t.push(n),a=s.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),l=t[t.length-1],l&&l.type==="text"?(l.raw+=`
|
|
24
|
+
`+n.raw,l.text+=`
|
|
25
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=l.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){this.inlineQueue.push({src:e,tokens:t})}inlineTokens(e,t=[]){let n,l,s,a=e,o,c,p;if(this.tokens.links){const f=Object.keys(this.tokens.links);if(f.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)f.includes(o[0].slice(o[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,o.index)+"["+be("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)+"["+be("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)+"++"+a.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(c||(p=""),c=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(f=>(n=f.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),l=t[t.length-1],l&&n.type==="text"&&l.type==="text"?(l.raw+=n.raw,l.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),l=t[t.length-1],l&&n.type==="text"&&l.type==="text"?(l.raw+=n.raw,l.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,a,p)){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,we)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e,we))){e=e.substring(n.raw.length),t.push(n);continue}if(s=e,this.options.extensions&&this.options.extensions.startInline){let f=1/0;const m=e.slice(1);let h;this.options.extensions.startInline.forEach(function(u){h=u.call({lexer:this},m),typeof h=="number"&&h>=0&&(f=Math.min(f,h))}),f<1/0&&f>=0&&(s=e.substring(0,f+1))}if(n=this.tokenizer.inlineText(s,zt)){e=e.substring(n.raw.length),n.raw.slice(-1)!=="_"&&(p=n.raw.slice(-1)),c=!0,l=t[t.length-1],l&&l.type==="text"?(l.raw+=n.raw,l.text+=n.text):t.push(n);continue}if(e){const f="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(f);break}else throw new Error(f)}}return t}}class ie{constructor(e){this.options=e||B}code(e,t,n){const l=(t||"").match(/\S*/)[0];if(this.options.highlight){const s=this.options.highlight(e,l);s!=null&&s!==e&&(n=!0,e=s)}return e=e.replace(/\n$/,"")+`
|
|
26
|
+
`,l?'<pre><code class="'+this.options.langPrefix+D(l,!0)+'">'+(n?e:D(e,!0))+`</code></pre>
|
|
27
|
+
`:"<pre><code>"+(n?e:D(e,!0))+`</code></pre>
|
|
28
|
+
`}blockquote(e){return`<blockquote>
|
|
30
29
|
`+e+`</blockquote>
|
|
31
|
-
`}
|
|
32
|
-
`:"<h"+
|
|
33
|
-
`}
|
|
30
|
+
`}html(e){return e}heading(e,t,n,l){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+l.slug(n)+'">'+e+"</h"+t+`>
|
|
31
|
+
`:"<h"+t+">"+e+"</h"+t+`>
|
|
32
|
+
`}hr(){return this.options.xhtml?`<hr/>
|
|
34
33
|
`:`<hr>
|
|
35
|
-
`}
|
|
36
|
-
`+e+"</"+
|
|
37
|
-
`}
|
|
38
|
-
`}
|
|
39
|
-
`}
|
|
34
|
+
`}list(e,t,n){const l=t?"ol":"ul",s=t&&n!==1?' start="'+n+'"':"";return"<"+l+s+`>
|
|
35
|
+
`+e+"</"+l+`>
|
|
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>
|
|
40
39
|
<thead>
|
|
41
40
|
`+e+`</thead>
|
|
42
|
-
`+
|
|
43
|
-
`}
|
|
41
|
+
`+t+`</table>
|
|
42
|
+
`}tablerow(e){return`<tr>
|
|
44
43
|
`+e+`</tr>
|
|
45
|
-
`}
|
|
46
|
-
`}
|
|
47
|
-
`+(
|
|
48
|
-
Please report this to https://github.com/markedjs/marked.`,
|
|
49
|
-
Please report this to https://github.com/markedjs/marked.`,
|
|
50
|
-
`),
|
|
51
|
-
`),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
`).
|
|
57
|
-
`)
|
|
58
|
-
`);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
-
|
|
62
|
-
|
|
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=ge(this.options.sanitize,this.options.baseUrl,e),e===null)return n;let l='<a href="'+D(e)+'"';return t&&(l+=' title="'+t+'"'),l+=">"+n+"</a>",l}image(e,t,n){if(e=ge(this.options.sanitize,this.options.baseUrl,e),e===null)return n;let l='<img src="'+e+'" alt="'+n+'"';return t&&(l+=' title="'+t+'"'),l+=this.options.xhtml?"/>":">",l}text(e){return e}}class xe{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 $e{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,l=0;if(this.seen.hasOwnProperty(n)){l=this.seen[e];do l++,n=e+"-"+l;while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=l,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class H{constructor(e){this.options=e||B,this.options.renderer=this.options.renderer||new ie,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new xe,this.slugger=new $e}static parse(e,t){return new H(t).parse(e)}static parseInline(e,t){return new H(t).parseInline(e)}parse(e,t=!0){let n="",l,s,a,o,c,p,f,m,h,u,g,k,w,y,C,S,N,_,F;const L=e.length;for(l=0;l<L;l++){if(u=e[l],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[u.type]&&(F=this.options.extensions.renderers[u.type].call({parser:this},u),F!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(u.type))){n+=F||"";continue}switch(u.type){case"space":continue;case"hr":{n+=this.renderer.hr();continue}case"heading":{n+=this.renderer.heading(this.parseInline(u.tokens),u.depth,pe(this.parseInline(u.tokens,this.textRenderer)),this.slugger);continue}case"code":{n+=this.renderer.code(u.text,u.lang,u.escaped);continue}case"table":{for(m="",f="",o=u.header.length,s=0;s<o;s++)f+=this.renderer.tablecell(this.parseInline(u.header[s].tokens),{header:!0,align:u.align[s]});for(m+=this.renderer.tablerow(f),h="",o=u.rows.length,s=0;s<o;s++){for(p=u.rows[s],f="",c=p.length,a=0;a<c;a++)f+=this.renderer.tablecell(this.parseInline(p[a].tokens),{header:!1,align:u.align[a]});h+=this.renderer.tablerow(f)}n+=this.renderer.table(m,h);continue}case"blockquote":{h=this.parse(u.tokens),n+=this.renderer.blockquote(h);continue}case"list":{for(g=u.ordered,k=u.start,w=u.loose,o=u.items.length,h="",s=0;s<o;s++)C=u.items[s],S=C.checked,N=C.task,y="",C.task&&(_=this.renderer.checkbox(S),w?C.tokens.length>0&&C.tokens[0].type==="paragraph"?(C.tokens[0].text=_+" "+C.tokens[0].text,C.tokens[0].tokens&&C.tokens[0].tokens.length>0&&C.tokens[0].tokens[0].type==="text"&&(C.tokens[0].tokens[0].text=_+" "+C.tokens[0].tokens[0].text)):C.tokens.unshift({type:"text",text:_}):y+=_),y+=this.parse(C.tokens,w),h+=this.renderer.listitem(y,N,S);n+=this.renderer.list(h,g,k);continue}case"html":{n+=this.renderer.html(u.text);continue}case"paragraph":{n+=this.renderer.paragraph(this.parseInline(u.tokens));continue}case"text":{for(h=u.tokens?this.parseInline(u.tokens):u.text;l+1<L&&e[l+1].type==="text";)u=e[++l],h+=`
|
|
46
|
+
`+(u.tokens?this.parseInline(u.tokens):u.text);n+=t?this.renderer.paragraph(h):h;continue}default:{const j='Token with "'+u.type+'" type was not found.';if(this.options.silent){console.error(j);return}else throw new Error(j)}}}return n}parseInline(e,t){t=t||this.renderer;let n="",l,s,a;const o=e.length;for(l=0;l<o;l++){if(s=e[l],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]&&(a=this.options.extensions.renderers[s.type].call({parser:this},s),a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type))){n+=a||"";continue}switch(s.type){case"escape":{n+=t.text(s.text);break}case"html":{n+=t.html(s.text);break}case"link":{n+=t.link(s.href,s.title,this.parseInline(s.tokens,t));break}case"image":{n+=t.image(s.href,s.title,s.text);break}case"strong":{n+=t.strong(this.parseInline(s.tokens,t));break}case"em":{n+=t.em(this.parseInline(s.tokens,t));break}case"codespan":{n+=t.codespan(s.text);break}case"br":{n+=t.br();break}case"del":{n+=t.del(this.parseInline(s.tokens,t));break}case"text":{n+=t.text(s.text);break}default:{const c='Token with "'+s.type+'" type was not found.';if(this.options.silent){console.error(c);return}else throw new Error(c)}}}return n}}function v(i,e,t){if(typeof i=="undefined"||i===null)throw new Error("marked(): input parameter is undefined or null");if(typeof i!="string")throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected");if(typeof e=="function"&&(t=e,e=null),e=z({},v.defaults,e||{}),ke(e),t){const n=e.highlight;let l;try{l=M.lex(i,e)}catch(o){return t(o)}const s=function(o){let c;if(!o)try{e.walkTokens&&v.walkTokens(l,e.walkTokens),c=H.parse(l,e)}catch(p){o=p}return e.highlight=n,o?t(o):t(null,c)};if(!n||n.length<3||(delete e.highlight,!l.length))return s();let a=0;v.walkTokens(l,function(o){o.type==="code"&&(a++,setTimeout(()=>{n(o.text,o.lang,function(c,p){if(c)return s(c);p!=null&&p!==o.text&&(o.text=p,o.escaped=!0),a--,a===0&&s()})},0))}),a===0&&s();return}try{const n=M.lex(i,e);return e.walkTokens&&v.walkTokens(n,e.walkTokens),H.parse(n,e)}catch(n){if(n.message+=`
|
|
47
|
+
Please report this to https://github.com/markedjs/marked.`,e.silent)return"<p>An error occurred:</p><pre>"+D(n.message+"",!0)+"</pre>";throw n}}v.options=v.setOptions=function(i){return z(v.defaults,i),xt(v.defaults),v},v.getDefaults=he,v.defaults=B,v.use=function(...i){const e=z({},...i),t=v.defaults.extensions||{renderers:{},childTokens:{}};let n;i.forEach(l=>{if(l.extensions&&(n=!0,l.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if(s.renderer){const a=t.renderers?t.renderers[s.name]:null;a?t.renderers[s.name]=function(...o){let c=s.renderer.apply(this,o);return c===!1&&(c=a.apply(this,o)),c}:t.renderers[s.name]=s.renderer}if(s.tokenizer){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");t[s.level]?t[s.level].unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}s.childTokens&&(t.childTokens[s.name]=s.childTokens)})),l.renderer){const s=v.defaults.renderer||new ie;for(const a in l.renderer){const o=s[a];s[a]=(...c)=>{let p=l.renderer[a].apply(s,c);return p===!1&&(p=o.apply(s,c)),p}}e.renderer=s}if(l.tokenizer){const s=v.defaults.tokenizer||new ne;for(const a in l.tokenizer){const o=s[a];s[a]=(...c)=>{let p=l.tokenizer[a].apply(s,c);return p===!1&&(p=o.apply(s,c)),p}}e.tokenizer=s}if(l.walkTokens){const s=v.defaults.walkTokens;e.walkTokens=function(a){l.walkTokens.call(this,a),s&&s.call(this,a)}}n&&(e.extensions=t),v.setOptions(e)})},v.walkTokens=function(i,e){for(const t of i)switch(e.call(v,t),t.type){case"table":{for(const n of t.header)v.walkTokens(n.tokens,e);for(const n of t.rows)for(const l of n)v.walkTokens(l.tokens,e);break}case"list":{v.walkTokens(t.items,e);break}default:v.defaults.extensions&&v.defaults.extensions.childTokens&&v.defaults.extensions.childTokens[t.type]?v.defaults.extensions.childTokens[t.type].forEach(function(n){v.walkTokens(t[n],e)}):t.tokens&&v.walkTokens(t.tokens,e)}},v.parseInline=function(i,e){if(typeof i=="undefined"||i===null)throw new Error("marked.parseInline(): input parameter is undefined or null");if(typeof i!="string")throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(i)+", string expected");e=z({},v.defaults,e||{}),ke(e);try{const t=M.lexInline(i,e);return e.walkTokens&&v.walkTokens(t,e.walkTokens),H.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>"+D(t.message+"",!0)+"</pre>";throw t}},v.Parser=H,v.parser=H.parse,v.Renderer=ie,v.TextRenderer=xe,v.Lexer=M,v.lexer=M.lex,v.Tokenizer=ne,v.Slugger=$e,v.parse=v,H.parse,M.lex;var At=function(){var i=document.getSelection();if(!i.rangeCount)return function(){};for(var e=document.activeElement,t=[],n=0;n<i.rangeCount;n++)t.push(i.getRangeAt(n));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return i.removeAllRanges(),function(){i.type==="Caret"&&i.removeAllRanges(),i.rangeCount||t.forEach(function(l){i.addRange(l)}),e&&e.focus()}},Mt=At,ve={"text/plain":"Text","text/html":"Url",default:"Text"},Ht="Copy to clipboard: #{key}, Enter";function Bt(i){var e=(/mac os x/i.test(navigator.userAgent)?"\u2318":"Ctrl")+"+C";return i.replace(/#{\s*key\s*}/g,e)}function Ot(i,e){var t,n,l,s,a,o,c=!1;e||(e={}),t=e.debug||!1;try{l=Mt(),s=document.createRange(),a=document.getSelection(),o=document.createElement("span"),o.textContent=i,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(f){if(f.stopPropagation(),e.format)if(f.preventDefault(),typeof f.clipboardData=="undefined"){t&&console.warn("unable to use e.clipboardData"),t&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=ve[e.format]||ve.default;window.clipboardData.setData(m,i)}else f.clipboardData.clearData(),f.clipboardData.setData(e.format,i);e.onCopy&&(f.preventDefault(),e.onCopy(f.clipboardData))}),document.body.appendChild(o),s.selectNodeContents(o),a.addRange(s);var p=document.execCommand("copy");if(!p)throw new Error("copy command was unsuccessful");c=!0}catch(f){t&&console.error("unable to copy using execCommand: ",f),t&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",i),e.onCopy&&e.onCopy(window.clipboardData),c=!0}catch(m){t&&console.error("unable to copy using clipboardData: ",m),t&&console.error("falling back to prompt"),n=Bt("message"in e?e.message:Ht),window.prompt(n,i)}}finally{a&&(typeof a.removeRange=="function"?a.removeRange(s):a.removeAllRanges()),o&&document.body.removeChild(o),l()}return c}var q=Ot;const K=i=>{const e=i.value,t=e.substring(0,i.selectionStart),n=e.substring(i.selectionEnd,e.length),l=t.lastIndexOf(`
|
|
49
|
+
`),s=t.substring(0,l+1),a=n.indexOf(`
|
|
50
|
+
`),o=n.substring(a===-1?n.length:a,n.length),c=t.substring(l+1,t.length),p=n.substring(0,a);return{prefixStr:t,subfixStr:n,prefixStrEndRow:s,subfixStrEndRow:o,prefixSupply:c,subfixSupply:p}},Pt=(i,e="",t,n)=>{var f,m;let l="",s=0,a=0,o=!1,c,p;if(/^h[1-6]{1}$/.test(i)){const h=i.replace(/^h(\d)/,(u,g)=>new Array(Number(g)).fill("#",0,g).join(""));l=`${h} ${e}`,s=h.length+1}else{if(i==="prettier")return window.prettier.format(t.value,{parser:"markdown",plugins:window.prettierPlugins});switch(i){case"bold":{l=`**${e}**`,s=2,a=-2;break}case"underline":{l=`<u>${e}</u>`,s=3,a=-4;break}case"italic":{l=`*${e}*`,s=1,a=-1;break}case"strikeThrough":{l=`~${e}~`,s=1,a=-1;break}case"sub":{l=`<sub>${e}</sub>`,s=5,a=-6;break}case"sup":{l=`<sup>${e}</sup>`,s=5,a=-6;break}case"codeRow":{l="`"+e+"`",s=1,a=-1;break}case"quote":{l=`> ${e}`,s=2;break}case"orderedList":{l=`1. ${e}`,s=3;break}case"unorderedList":{l=`- ${e}`,s=2;break}case"code":{l="```language\n"+e+"\n```\n",s=3,a=11-l.length,o=!0;break}case"table":{l="|";const{selectedShape:h={x:1,y:1}}=n,{x:u,y:g}=h;for(let k=0;k<=g;k++)l+=" col |";l+=`
|
|
51
|
+
|`;for(let k=0;k<=g;k++)l+=" - |";for(let k=0;k<=u;k++){l+=`
|
|
52
|
+
|`;for(let w=0;w<=g;w++)l+=" content |"}s=2,a=5-l.length,o=!0;break}case"link":{const{desc:h,url:u}=n;l=`[${h}](${u})`;break}case"image":{const{desc:h,url:u}=n;l=`
|
|
53
|
+
`;break}case"tab":{e=((f=window.getSelection())==null?void 0:f.toString())||"";const{tabWidth:h=2}=n,u=new Array(h).fill(" ").join("");if(e==="")l=u;else if(/\n/.test(e)){const{prefixStr:g,subfixStr:k,prefixSupply:w,subfixSupply:y}=K(t);l=`${w}${e}${y}`.split(`
|
|
54
|
+
`).map(N=>`${u}${N}`).join(`
|
|
55
|
+
`),c=g.substring(0,g.length-w.length),p=k.substring(y.length,k.length),o=!0,s=h,a=-w.length-y.length}else{const k=t.value.substring(0,t.selectionStart);/\n$/.test(k)||k===""?(l=`${u}${e}`,o=!0):l=u}break}case"shiftTab":{e=((m=window.getSelection())==null?void 0:m.toString())||"";const{tabWidth:h=2}=n,{prefixStr:u,prefixStrEndRow:g,subfixStrEndRow:k,prefixSupply:w,subfixSupply:y}=K(t),C=new RegExp(`^\\s{${h}}`),S=(N=!1,_=!1)=>{const F=`${w}${e}${y}`;if(C.test(F)){const L=u.length-(_?0:h),j=N?L+e.length-h:L;return A(t,L,j),`${g}${F.replace(C,"")}${k}`}else if(/^\s/.test(F)){const L=F.replace(/^\s/,""),j=F.length-L.length,R=t.selectionStart-(_?0:j),O=N?R+e.length-j:R;return A(t,R,O),`${g}${L}${k}`}else l=e};if(e===""){const N=S();if(N)return N}else if(/\n/.test(e)){const _=`${w}${e}${y}`.split(`
|
|
56
|
+
`);let[F,L]=[0,0];const j=_.map((R,O)=>{if(C.test(R))return O===0&&(F=h),L+=h,R.replace(C,"");if(/^\s/.test(R)){const Z=R.replace(/^\s/,"");return L+=R.length-Z.length,Z}return R}).join(`
|
|
57
|
+
`);return A(t,t.selectionStart-F,t.selectionEnd-L),`${g}${j}${k}`}else{const N=S(!0,!0);if(N)return N}break}case"ctrlC":{const{prefixSupply:h,subfixSupply:u}=K(t);return q(e===""?`${h}${u}`:e),t.value}case"ctrlX":{const{prefixStrEndRow:h,subfixStrEndRow:u,prefixStr:g,subfixStr:k,prefixSupply:w,subfixSupply:y}=K(t);return e===""?(q(`${w}${y}`),A(t,h.length),`${h}${u.replace(/^\n/,"")}`):(q(e),A(t,g.length),`${g}${k}`)}case"ctrlD":{const{prefixStrEndRow:h,subfixStrEndRow:u}=K(t);return A(t,h.length),`${h}${u.replace(/^\n/,"")}`}case"flow":{l="```mermaid\nflowchart TD \n Start --> Stop\n```\n",s=2;break}case"sequence":{l="```mermaid\nsequenceDiagram\n A->>B: hello!\n B-->>A: hi!\n A-)B: bye!\n```\n",s=2;break}case"gantt":{l=`\`\`\`mermaid
|
|
58
|
+
gantt
|
|
59
|
+
title A Gantt Diagram
|
|
60
|
+
dateFormat YYYY-MM-DD
|
|
61
|
+
section Section
|
|
62
|
+
A task :a1, 2014-01-01, 30d
|
|
63
|
+
Another task :after a1, 20d
|
|
64
|
+
\`\`\`
|
|
65
|
+
`,s=2;break}case"class":{l="```mermaid\nclassDiagram\n class Animal\n Vehicle <|-- Car\n```\n",s=2;break}case"state":{l="```mermaid\nstateDiagram-v2\n s1 --> s2\n```\n",s=2;break}case"pie":{l='```mermaid\npie title Pets adopted by volunteers\n "Dogs" : 386\n "Cats" : 85\n "Rats" : 15\n```\n',s=2;break}case"relationship":{l="```mermaid\nerDiagram\n CAR ||--o{ NAMED-DRIVER : allows\n PERSON ||--o{ NAMED-DRIVER : is\n```\n",s=2;break}case"journey":{l=`\`\`\`mermaid
|
|
66
|
+
journey
|
|
67
|
+
title My working day
|
|
68
|
+
section Go to work
|
|
69
|
+
Make tea: 5: Me
|
|
70
|
+
Go upstairs: 3: Me
|
|
71
|
+
Do work: 1: Me, Cat
|
|
72
|
+
section Go home
|
|
73
|
+
Go downstairs: 5: Me
|
|
74
|
+
Sit down: 5: Me
|
|
75
|
+
\`\`\`
|
|
76
|
+
`,s=2;break}case"katexInline":{l="$$",s=1,a=-1;break}case"katexBlock":{l=`$$
|
|
77
|
+
|
|
78
|
+
$$
|
|
79
|
+
`,s=1,a=-4;break}}}return ee(t,l,{deviationStart:s,deviationEnd:a,select:o,prefixVal:c,subfixVal:p})};var Ce={block(i,e){return{name:"KaTexBlockExtension",level:"block",start:t=>{var n;return(n=t.match(/\$\$\n/))==null?void 0:n.index},tokenizer(t){const l=/^\$\$\n([^$]*)\$\$\n?/.exec(t);if(l)return{type:"KaTexBlockExtension",raw:l[0],text:l[1].trim(),tokens:[]}},renderer(t){const n=e||typeof window!="undefined"&&window.katex;if(n){const l=n.renderToString(t.text,{throwOnError:!1});return`<span class="${i}-katex-block" data-processed>${l}</span>`}else return`<span class="${i}-katex-block">${t.text}</span>`}}},inline(i,e){return{name:"KaTexInlineExtension",level:"inline",start:t=>{var n;return(n=t.match(/\$[^$]/))==null?void 0:n.index},tokenizer(t){const l=/^\$([^$]*)\$/.exec(t);if(l)return{type:"KaTexInlineExtension",raw:l[0],text:l[1].trim(),tokens:[]}},renderer(t){const n=e||typeof window!="undefined"&&window.katex;if(n){const l=n.renderToString(t.text,{throwOnError:!1});return`<span class="${i}-katex-inline" data-processed>${l}</span>`}else return`<span class="${i}-katex-inline">${t.text}</span>`}}}};const Ut=(i,e)=>{var o,c;const t=r.inject("previewOnly"),n=r.inject("historyLength"),l=r.inject("editorId");if(t)return;let s=-1;const a={list:[{content:i.value,startPos:((o=e.value)==null?void 0:o.selectionStart)||0,endPos:((c=e.value)==null?void 0:c.selectionEnd)||0}],userUpdated:!0,curr:0};r.watch(()=>i.value,p=>{var h,u;clearTimeout(s);const f=((h=e.value)==null?void 0:h.selectionStart)||0,m=((u=e.value)==null?void 0:u.selectionEnd)||0;s=setTimeout(()=>{if(a.userUpdated){a.curr<a.list.length-1&&(a.list=a.list.slice(0,a.curr+1)),a.list.length>n&&a.list.shift();const g=a.list.pop();g.startPos=f,g.endPos=m,Array.prototype.push.call(a.list,g,{content:p,startPos:f,endPos:m}),a.curr=a.list.length-1}else a.userUpdated=!0},10)}),r.onMounted(()=>{x.on(l,{name:"ctrlZ",callback(){a.userUpdated=!1,a.curr=a.curr-1<0?0:a.curr-1;const p=a.list[a.curr];i.onChange(p.content),A(e.value,p.startPos,p.endPos)}}),x.on(l,{name:"ctrlShiftZ",callback(){a.userUpdated=!1,a.curr=a.curr+1===a.list.length?a.curr:a.curr+1;const p=a.list[a.curr];i.onChange(p.content),A(e.value,p.startPos,p.endPos)}})})},qt=(i,e)=>{const t=r.inject("showCodeRowNumber"),n=r.inject("editorId"),l=r.ref(!1),s=r.ref(!1);let a=[];const o=new v.Renderer;o.heading=(...h)=>{const[,u,g]=h;return a.push({text:g,level:u}),i.markedHeading(...h)},o.defaultCode=o.code,o.code=(h,u,g)=>{var k;if(!i.noMermaid&&u==="mermaid"){const w=`${d}-mermaid-${Date.now().toString(36)}`;try{let y="";return i.mermaid?y=i.mermaid.mermaidAPI.render(w,h):typeof window!="undefined"&&window.mermaid?y=window.mermaid.mermaidAPI.render(w,h):y=`<div class="mermaid">${h}</div>`,`<div class="${d}-mermaid">${y}</div>`}catch{if(typeof document!="undefined"){const C=document.querySelector(`#${w}`);if(C){const S=C.outerHTML;return(k=C.parentElement)==null||k.remove(),S}}return""}}return o.defaultCode(h,u,g)},o.image=(h,u,g)=>`<figure><img src="${h}" alt="${g}"><figcaption>${g}</figcaption></figure>`,v.setOptions({renderer:o,breaks:!0}),i.noKatex||v.use({extensions:[Ce.inline(d,i.katex),Ce.block(d,i.katex)]}),i.hljs&&v.setOptions({highlight:h=>{const u=i.hljs.highlightAuto(h).value;return t?ce(u):`<span class="code-block">${u}</span>`}});const c=r.computed(()=>{a=[];const h=v(i.value);return l.value,e.reRender,e.mermaidInited,s.value,i.sanitize(h)}),p=()=>{v.setOptions({highlight:h=>{const u=window.hljs.highlightAuto(h).value;return t?ce(u):`<span class="code-block">${u}</span>`}}),l.value=!0};r.watch(()=>c.value,h=>{i.onHtmlChanged(h),i.onGetCatalog(a),x.emit(n,"catalogChanged",a)});let f,m;return r.onMounted(()=>{!i.noKatex&&!i.katex&&(f=document.createElement("script"),f.src=i.katexJs,f.onload=()=>{s.value=!0},f.id=`${d}-katex`,m=document.createElement("link"),m.rel="stylesheet",m.href=i.katexCss,m.id=`${d}-katexCss`,te(f),te(m))}),r.onBeforeUnmount(()=>{f&&f.remove(),m&&m.remove()}),{html:c,highlightLoad:p}},Kt=(i,e,t,n,l)=>{const s=r.inject("previewOnly"),a=r.inject("usedLanguageText"),o=r.inject("editorId");let c=()=>{},p=()=>{};const f=()=>{document.querySelectorAll(`#${o} .${d}-preview pre`).forEach(u=>{var k;const g=document.createElement("span");g.setAttribute("class","copy-button"),g.innerText=((k=a.value.copyCode)==null?void 0:k.text)||"\u590D\u5236\u4EE3\u7801",g.addEventListener("click",()=>{var w;q(u.querySelector("code").innerText),g.innerText=((w=a.value.copyCode)==null?void 0:w.tips)||"\u5DF2\u590D\u5236\uFF01",setTimeout(()=>{var y;g.innerText=((y=a.value.copyCode)==null?void 0:y.text)||"\u590D\u5236\u4EE3\u7801"},1500)}),u.appendChild(g)})};r.onMounted(()=>{[p,c]=oe(t.value,n.value||l.value)});const m=()=>{r.nextTick(()=>{i.setting.preview&&!s&&(c(),p()),f()})},h=u=>{u&&!s&&r.nextTick(()=>{c(),[p,c]=oe(t.value,n.value||l.value),p()})};r.watch(()=>e.value,m),r.watch(()=>i.setting.preview,h),r.watch(()=>i.setting.htmlPreview,h),r.onMounted(m)},Zt=(i,e)=>{const t=r.inject("previewOnly"),n=r.inject("tabWidth"),l=r.inject("editorId"),s=r.ref("");return r.onMounted(()=>{var a,o;t||((a=e.value)==null||a.addEventListener("select",()=>{var c;s.value=((c=window.getSelection())==null?void 0:c.toString())||""}),(o=e.value)==null||o.addEventListener("keypress",c=>{var p,f,m;if(c.key==="Enter"){const h=(p=e.value)==null?void 0:p.selectionStart,u=(f=e.value)==null?void 0:f.value.substring(0,h),g=(m=e.value)==null?void 0:m.value.substring(h),k=u==null?void 0:u.lastIndexOf(`
|
|
80
|
+
`),w=u==null?void 0:u.substring(k+1,h);if(/^\d+\.\s|^-\s/.test(w))if(c.cancelBubble=!0,c.preventDefault(),c.stopPropagation(),/^\d+\.\s+$|^-\s+$/.test(w)){const y=u==null?void 0:u.replace(new RegExp(w+"$"),"");i.onChange(y+g),A(e.value,y==null?void 0:y.length)}else if(/^-\s+.+/.test(w))i.onChange(ee(e.value,`
|
|
81
|
+
- `,{}));else{const y=w==null?void 0:w.match(/\d+(?=\.)/),C=y&&Number(y[0])+1||1;i.onChange(ee(e.value,`
|
|
82
|
+
${C}. `,{}))}}}),x.on(l,{name:"replace",callback(c,p={}){i.onChange(Pt(c,s.value,e.value,Y(P({},p),{tabWidth:n})))}}))}),x.on(l,{name:"selectTextChange",callback(a){s.value=a}}),{selectedText:s}},Jt=i=>{const e=r.inject("theme"),t=r.reactive({reRender:!1,mermaidInited:!!i.mermaid}),n=()=>{i.noMermaid||(i.mermaid?i.mermaid.initialize({theme:e.value==="dark"?"dark":"default"}):window.mermaid&&window.mermaid.initialize({theme:e.value==="dark"?"dark":"default"}),t.reRender=!t.reRender)};r.watch(()=>e.value,n);let l;return r.onMounted(()=>{!i.noMermaid&&!i.mermaid?(l=document.createElement("script"),l.src=i.mermaidJs,l.onload=()=>{window.mermaid.initialize({theme:e.value==="dark"?"dark":"default",logLevel:"Fatal"}),t.mermaidInited=!0},l.id=`${d}-mermaid`,te(l)):i.noMermaid||n()}),r.onBeforeUnmount(()=>{!i.noMermaid&&!i.mermaid&&l&&l.remove()}),t};var Wt=r.defineComponent({name:"MDEditorContent",props:{value:{type:String,default:""},hljs:{type:Object,default:null},onChange:{type:Function,default:()=>()=>{}},setting:{type:Object,default:()=>({})},onHtmlChanged:{type:Function,default:()=>()=>{}},onGetCatalog:{type:Function,default:()=>()=>{}},markedHeading:{type:Function,default:()=>(i,e)=>`<h${e} id="${i}"><a href="#${i}">${i}</a></h${e}>`},mermaid:{type:Object},mermaidJs:{type:String,default:""},noMermaid:{type:Boolean,default:!1},sanitize:{type:Function,default:i=>i},placeholder:{type:String,default:""},katex:{type:Object},katexJs:{type:String,default:""},katexCss:{type:String,default:""},noKatex:{type:Boolean,default:!1}},setup(i){const e=r.inject("highlight"),t=r.inject("previewOnly"),n=r.inject("showCodeRowNumber"),l=r.inject("previewTheme"),s=r.inject("editorId"),a=r.ref(),o=r.ref(),c=r.ref(),p=Jt(i),{html:f,highlightLoad:m}=qt(i,p);Kt(i,f,a,o,c);const{selectedText:h}=Zt(i,a);return Ut(i,a),()=>r.createVNode(r.Fragment,null,[r.createVNode("div",{class:[`${d}-content`]},[!t&&r.createVNode("div",{class:`${d}-input-wrapper`},[r.createVNode("textarea",{id:`${s}-textarea`,ref:a,value:i.value,onInput:u=>{h.value="",i.onChange(u.target.value)},class:[i.setting.preview||i.setting.htmlPreview?"":"textarea-only"],placeholder:i.placeholder},null)]),i.setting.preview&&r.createVNode("div",{class:`${d}-preview-wrapper`,ref:o,key:"content-preview-wrapper"},[r.createVNode("div",{id:`${d}-preview`,class:[`${d}-preview`,`${l==null?void 0:l.value}-theme`,n&&`${d}-scrn`],innerHTML:f.value},null)]),i.setting.htmlPreview&&r.createVNode("div",{class:`${d}-preview-wrapper`,ref:c,key:"html-preview-wrapper"},[r.createVNode("div",{class:`${d}-html`},[f.value])])]),i.hljs===null&&r.createVNode(r.Teleport,{to:"head"},{default:()=>[r.createVNode("link",{rel:"stylesheet",href:e.value.css},null),r.createVNode("script",{src:e.value.js,onLoad:m},null)]})])}});const Se=r.defineComponent({props:{tocItem:{type:Object,default:()=>({})},markedHeadingId:{type:Function,default:()=>{}}},setup(i){return()=>r.createVNode("div",{class:`${d}-catalog-link`,onClick:e=>{e.stopPropagation();const t=i.markedHeadingId(i.tocItem.text,i.tocItem.level),n=document.getElementById(t),l=document.getElementById(`${d}-preview`);if(n){const s=n.offsetTop;l==null||l.scrollTo({top:s,behavior:"smooth"})}}},[r.createVNode("span",null,[i.tocItem.text]),i.tocItem.children&&i.tocItem.children.map(e=>r.createVNode(Se,{markedHeadingId:i.markedHeadingId,key:e.text,tocItem:e},null))])}});var on="";const Gt=r.defineComponent({props:{markedHeadingId:{type:Function,default:()=>{}}},setup(i){const e=r.inject("editorId"),t=r.reactive({list:[],show:!1}),n=r.computed(()=>{const l=[];return t.list.forEach(({text:s,level:a})=>{const o={level:a,text:s};if(l.length===0)l.push(o);else{let c=l[l.length-1];if(o.level>c.level)for(let p=c.level+1;p<=6;p++){const{children:f}=c;if(!f){c.children=[o];break}if(c=f[f.length-1],o.level<=c.level){f.push(o);break}}else l.push(o)}}),l});return r.onMounted(()=>{x.on(e,{name:"catalogChanged",callback:l=>{t.list=l}}),x.on(e,{name:"catalogShow",callback:()=>{t.show=!t.show}})}),()=>t.show?r.createVNode("div",{class:`${d}-catalog`},[n.value.map(l=>r.createVNode(Se,{markedHeadingId:i.markedHeadingId,tocItem:l,key:l.text},null))]):""}});var cn="",dn="";const d="md",Ne=i=>i,Qt={modelValue:{type:String,default:""},theme:{type:String,default:"light"},editorClass:{type:String,default:""},hljs:{type:Object,default:null},highlightJs:{type:String,default:I.js},highlightCss:{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"},languageUserDefined:{type:Object,default:()=>({})},toolbars:{type:Array,default:lt},toolbarsExclude:{type:Array,default:[]},prettier:{type:Boolean,default:!0},prettierCDN:{type:String,default:re.main},prettierMDCDN:{type:String,default:re.markdown},onHtmlChanged:{type:Function},Cropper:{type:Function,default:null},cropperCss:{type:String,default:ae.css},cropperJs:{type:String,default:ae.js},iconfontJs:{type:String,default:T},onGetCatalog:{type:Function},editorId:{type:String,default:"md-editor-v3"},tabWidth:{type:Number,default:2},showCodeRowNumber:{type:Boolean,default:!1},screenfull:{type:Object,default:null},screenfullJs:{type:String,default:it},previewTheme:{type:String,default:"default"},markedHeading:{type:Function,default:(i,e,t)=>{const n=Ne(t);return i!==t?`<h${e} id="${n}">${i}</h${e}>`:`<h${e} id="${n}"><a href="#${n}">${t}</a></h${e}>`}},style:{type:Object,default:()=>({})},markedHeadingId:{type:Function,default:Ne},tableShape:{type:Array,default:()=>[6,4]},mermaid:{type:Object},mermaidJs:{type:String,default:rt},noMermaid:{type:Boolean,default:!1},sanitize:{type:Function,default:i=>i},placeholder:{type:String,default:""},katex:{type:Object},katexJs:{type:String,default:at},katexCss:{type:String,default:st},noKatex:{type:Boolean,default:!1}};var X=r.defineComponent({name:"MdEditorV3",props:Qt,setup(i,e){const{hljs:t,previewOnly:n,iconfontJs:l,prettier:s,prettierCDN:a,prettierMDCDN:o,Cropper:c,cropperCss:p,cropperJs:f,editorId:m,screenfull:h,screenfullJs:u}=i;ct(i,e),dt(i);const g=r.reactive({pageFullScreen:i.pageFullScreen,fullscreen:!1,preview:i.preview,htmlPreview:i.preview?!1:i.htmlPreview}),k=(S,N)=>{g[N]=S,N==="preview"&&g.preview?g.htmlPreview=!1:N==="htmlPreview"&&g.htmlPreview&&(g.preview=!1)};let w="";const y=()=>{g.pageFullScreen||g.fullscreen?document.body.style.overflow="hidden":document.body.style.overflow=w};r.watch(()=>[g.pageFullScreen,g.fullscreen],y),r.onMounted(()=>{n||x.on(m,{name:"uploadImage",callback(S,N){const _=F=>{F.forEach(L=>{setTimeout(()=>{x.emit(m,"replace","image",{desc:"",url:L})},0)}),N&&N()};i.onUploadImg?i.onUploadImg(S,_):e.emit("onUploadImg",S,_)}}),w=document.body.style.overflow,y()}),r.onBeforeUnmount(()=>{x.clear(m)});const C=r.computed(()=>!i.toolbarsExclude.includes("catalog")&&i.toolbars.includes("catalog"));return()=>r.createVNode("div",{id:m,class:[d,i.editorClass,i.theme==="dark"&&`${d}-dark`,g.fullscreen||g.pageFullScreen?`${d}-fullscreen`:"",n&&`${d}-previewOnly`],style:i.style},[!n&&r.createVNode(wt,{prettier:s,screenfull:h,screenfullJs:u,toolbars:i.toolbars,toolbarsExclude:i.toolbarsExclude,setting:g,updateSetting:k,tableShape:i.tableShape},null),r.createVNode(Wt,{hljs:t,value:i.modelValue,onChange:S=>{i.onChange?i.onChange(S):e.emit("update:modelValue",S)},setting:g,onHtmlChanged:S=>{i.onHtmlChanged?i.onHtmlChanged(S):e.emit("onHtmlChanged",S)},onGetCatalog:S=>{i.onGetCatalog?i.onGetCatalog(S):e.emit("onGetCatalog",S)},markedHeading:i.markedHeading,mermaid:i.mermaid,mermaidJs:i.mermaidJs,noMermaid:i.noMermaid,sanitize:i.sanitize,placeholder:i.placeholder,katex:i.katex,katexJs:i.katexJs,katexCss:i.katexCss,noKatex:i.noKatex},null),C.value&&r.createVNode(Gt,{markedHeadingId:i.markedHeadingId},null),!n&&r.createVNode(r.Teleport,{to:"head"},{default:()=>[r.createVNode("script",{src:l},null)]}),s&&!n&&r.createVNode(r.Teleport,{to:"head"},{default:()=>[r.createVNode("script",{src:a},null),r.createVNode("script",{src:o},null)]}),!n&&c===null&&r.createVNode(r.Teleport,{to:"head"},{default:()=>[r.createVNode("link",{href:p,rel:"stylesheet"},null),r.createVNode("script",{src:f},null)]})])}});return X.install=i=>(i.component(X.name,X),i),X});
|