"use strict";var T=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var Q=Object.prototype.hasOwnProperty;var X=(e,l)=>{for(var a in l)T(e,a,{get:l[a],enumerable:!0})},Y=(e,l,a,c)=>{if(l&&typeof l=="object"||typeof l=="function")for(let s of J(l))!Q.call(e,s)&&s!==a&&T(e,s,{get:()=>l[s],enumerable:!(c=G(l,s))||c.enumerable});return e};var ee=e=>Y(T({},"__esModule",{value:!0}),e);var be={};X(be,{default:()=>ye,footnotes:()=>ke,init_markdown_it:()=>_e,preprocessMarkdown:()=>me,resetFootnotes:()=>we});module.exports=ee(be);var ne=/\\([ \\!"#$%&'()*+,.\/:;<=>?@[\]^_`{|}~-])/g,re="reference?",ie="bookmark?",se=new RegExp("^syn([0-9]+[.]?[0-9]*)+"),te=new RegExp(/^\/\w/),oe=new RegExp("^([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/w \\.-]*)*\\/?.*$"),le=new RegExp("^doi:10[.]{1}[0-9]+[/]{1}[a-zA-Z0-9_.]+$"),D=new RegExp("^\\s*(width[=]{1})?\\s*(.*)[}]{1}\\s*$"),O=new RegExp('^\\s*(text[=]{1}["]{1})?\\s*(.*)["]{1}[}]{1}\\s*$'),ae=new RegExp("^\\s*[*-+>]{1}[^|]*$"),ue=new RegExp("^\\s*\\w+\\s*[.)]{1}[^|]*$"),ce=new RegExp("^\\s*[`]{3}s*([a-zA-Z_0-9-]*)s*$"),A,b,P,w,L,E;function pe(e,l){let c=e.split("?")[1].split("&"),s=null,p;for(let f=0;f=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function fe(e){if(e>=65&&e<=90||e>=48&&e<=57||e>=97&&e<=122)return!0;switch(e){case 64:case 46:case 45:case 95:return!0}return!1}function de(e,l,a){return a=a||0,e.substr(a,l.length)===l}function ge(e){return e.length>2?te.test(e.substr(0,2)):!1}var he=function(e,l){let a=!1,c,s,p,f,m,y="widgetContainer",_=e.posMax,d=e.pos;if(d+3>=_||l)return!1;if(e.src.charCodeAt(d)===64){if(d>0&&!Z(e.src.charCodeAt(e.pos-1)))return!1;for(;e.pos<_&&!Z(e.src.charCodeAt(e.pos))&&fe(e.src.charCodeAt(e.pos));)e.pos++;return c=e.src.slice(d+1,e.pos),e.posMax=e.pos,e.pos=d,s=e.push("synapse_open","span",1),s.markup="@",s.attrs=[["data-widgetparams","badge?alias="+c],["data-widget-type","badge"],["class",y],["id","widget-"+b+A]],s=e.push("link_open","a",1),s.attrs=[["href","https://www.synapse.org/Portal/aliasredirector?alias="+c]],s.markup="autolink",s.info="auto",s=e.push("text","",0),s.content="@"+c,s=e.push("link_close","a",-1),s.markup="autolink",s.info="auto",s=e.push("text","",0),s=e.push("synapse_close","span",-1),e.pos=e.posMax,e.posMax=_,b=b+1,!0}if(e.src.charCodeAt(d)!==36||e.src.charCodeAt(d+1)!==123)return!1;for(e.pos=d+2;e.pos<_;){if(e.src.charCodeAt(e.pos)===125){a=!0;break}e.md.inline.skipToken(e)}return!a||d+2===e.pos?(e.pos=d,!1):(c=e.src.slice(d+2,e.pos),p=c.replace(ne,"$1"),c.lastIndexOf(re,0)===0?(p+="&footnoteId="+w,s=e.push("synapse_reference_open","span",1),s.attrs=[["id","wikiReference"+w]],s=e.push("synapse_reference_close","span",-1),f=decodeURIComponent(p),m=pe(f,"text"),m&&(L+="${bookmark?text=["+w+"]&bookmarkID=wikiReference"+w+"} "+m+` `),w++,y="inlineWidgetContainer"):c.lastIndexOf(ie,0)===0&&(s=e.push("synapse_footnote_target_open","span",1),s.attrs=[["id","wikiFootnote"+w]],s=e.push("synapse_footnote_target_close","span",-1),w++,y="inlineWidgetContainer"),e.posMax=e.pos,e.pos=d+2,s=e.push("synapse_open","span",1),s.markup="${",s.attrs=[["data-widgetparams",p],["class",y],["id","widget-"+b+A],["data-widget-type",p.substring(0,p.indexOf("?"))]],s=e.push("text","",0),s.content="",s=e.push("synapse_close","span",-1),s.markup="}",e.pos=e.posMax+1,e.posMax=_,b=b+1,!0)};function xe(e,l,a){b=0,P=0,w=1,A=l,L="",E="",a&&(E=a),e.inline.ruler.after("emphasis","synapse",he)}function ke(){return L}function we(){L="",w=1}function me(e){let l="",a=e.split(` `),c=!1,s=!1,p=!1;for(let f=0;f=k)return!1;if(v=i,u=j(n.src,i,n.posMax),u.ok){let M=u.str;se.test(M)?u.str=E+"/Synapse:"+M.replace(/[.]/,"/version/"):oe.test(M)?u.str="http://"+M:le.test(M)&&(u.str="http://dx.doi.org/"+M),C=n.md.normalizeLink(u.str),n.md.validateLink(C)?i=u.pos:C=""}for(v=i;i=k||n.src.charCodeAt(i)!==41)return n.pos=$,!1;i++}else{if(typeof n.env.references>"u")return!1;if(i=0?g=n.src.slice(v,i++):i=R+1):i=R+1,g||(g=n.src.slice(W,R)),h=n.env.references[B(g)],!h)return n.pos=$,!1;C=h.href,x=h.title}return o||(n.pos=W,n.posMax=R,I=n.push("link_open","a",1),I.attrs=r=[["href",C]],x&&r.push(["title",x]),n.md.inline.tokenize(n),I=n.push("link_close","a",-1)),n.pos=i,n.posMax=k,!0};function U(n,o,r){let t=r,g=o,i=n.charCodeAt(r);for(;t
':r=`
`,r},validate:function(){return!0}}),e.use(m,"column",{marker:"{column",endMarker:"{column}",minMarkerCount:1,render:function(n,o){let r,t;return n[o].nesting===1?(r=D.exec(n[o].info),t='
'):t=`
`,t},validate:function(n){return D.test(n)}}),e.use(m,"nav",{marker:"{nav",endMarker:"{nav}",minMarkerCount:1,render:function(n,o){let r,t;return n[o].nesting===1?(r=O.exec(n[o].info),t=' `,t},validate:function(n){return O.test(n)}})),d(),F(),q(),e.inline.ruler.at("link",N),e.inline.ruler.at("emphasis",V)}K()}var ye=xe;0&&(module.exports={footnotes,init_markdown_it,preprocessMarkdown,resetFootnotes});