wikiparser-node
Version:
A Node.js parser for MediaWiki markup with AST
7 lines • 124 kB
JavaScript
"use strict";(()=>{var Aa=Object.defineProperty,_a=Object.defineProperties;var $a=Object.getOwnPropertyDescriptors;var Jt=Object.getOwnPropertySymbols;var Fn=Object.prototype.hasOwnProperty,jn=Object.prototype.propertyIsEnumerable;var Pn=e=>{throw TypeError(e)};var js=(e,t,s)=>t in e?Aa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,me=(e,t)=>{for(var s in t||(t={}))Fn.call(t,s)&&js(e,s,t[s]);if(Jt)for(var s of Jt(t))jn.call(t,s)&&js(e,s,t[s]);return e},Le=(e,t)=>_a(e,$a(t));var Rn=(e,t)=>{var s={};for(var i in e)Fn.call(e,i)&&t.indexOf(i)<0&&(s[i]=e[i]);if(e!=null&&Jt)for(var i of Jt(e))t.indexOf(i)<0&&jn.call(e,i)&&(s[i]=e[i]);return s};var Ta=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Ee=(e,t,s)=>js(e,typeof t!="symbol"?t+"":t,s),Ps=(e,t,s)=>t.has(e)||Pn("Cannot "+s);var f=(e,t,s)=>(Ps(e,t,"read from private field"),s?s.call(e):t.get(e)),N=(e,t,s)=>t.has(e)?Pn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),L=(e,t,s,i)=>(Ps(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),R=(e,t,s)=>(Ps(e,t,"access private method"),s);var On=(e,t,s,i)=>({set _(n){L(e,t,n,s)},get _(){return f(e,t,i)}});var Nu=Ta((Eu,ka)=>{var Ca=Object.create,xt=Object.defineProperty,Ll=Object.getOwnPropertyDescriptor,sn=Object.getOwnPropertyNames,Ia=Object.prototype.hasOwnProperty,El=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),vt=e=>{throw TypeError(e)},Fl=(e,t,s)=>t in e?xt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Bn=(e,t)=>xt(e,"name",{value:t,configurable:!0}),C=(e,t)=>function(){return e&&(t=(0,e[sn(e)[0]])(e=0)),t},jl=(e,t)=>function(){return t||(0,e[sn(e)[0]])((t={exports:{}}).exports,t),t.exports},se=(e,t)=>{for(var s in t)xt(e,s,{get:t[s],enumerable:!0})},Na=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of sn(t))!Ia.call(e,n)&&n!==s&&xt(e,n,{get:()=>t[n],enumerable:!(i=Ll(t,n))||i.enumerable});return e},Q=e=>Na(xt({},"__esModule",{value:!0}),e),K=e=>{var t;return[,,,Ca((t=e==null?void 0:e[El("metadata")])!=null?t:null)]},Pl=["class","method","getter","setter","accessor","field","value","get","set"],It=e=>e!==void 0&&typeof e!="function"?vt("Function expected"):e,La=(e,t,s,i,n)=>({kind:Pl[e],name:t,metadata:i,addInitializer:r=>s._?vt("Already initialized"):n.push(It(r||null))}),nn=(e,t)=>Fl(t,El("metadata"),e[3]),J=(e,t,s,i)=>{for(var n=0,r=e[t>>1],l=r&&r.length;n<l;n++)t&1?r[n].call(s):i=r[n].call(s,i);return i},X=(e,t,s,i,n,r)=>{var l,o,u,d,a,h=t&7,g=!!(t&8),c=!!(t&16),p=h>3?e.length+1:h?g?1:2:0,b=Pl[h+5],w=h>3&&(e[p-1]=[]),k=e[p]||(e[p]=[]),_=h&&(!c&&!g&&(n=n.prototype),h<5&&(h>3||!c)&&Ll(h<4?n:{get[s](){return he(this,r)},set[s](m){return ye(this,r,m)}},s));h?c&&h<4&&Bn(r,(h>2?"set ":h>1?"get ":"")+s):Bn(n,s);for(var v=i.length-1;v>=0;v--)d=La(h,s,u={},e[3],k),h&&(d.static=g,d.private=c,a=d.access={has:c?m=>Fa(n,m):m=>s in m},h^3&&(a.get=c?m=>(h^1?he:Ui)(m,n,h^4?r:_.get):m=>m[s]),h>2&&(a.set=c?(m,S)=>ye(m,n,S,h^4?r:_.set):(m,S)=>m[s]=S)),o=(0,i[v])(h?h<4?c?r:_[b]:h>4?void 0:{get:_.get,set:_.set}:n,d),u._=1,h^4||o===void 0?It(o)&&(h>4?w.unshift(o):h?c?r=o:_[b]=o:n=o):typeof o!="object"||o===null?vt("Object expected"):(It(l=o.get)&&(_.get=l),It(l=o.set)&&(_.set=l),It(l=o.init)&&w.unshift(l));return h||nn(e,n),_&&xt(n,s,_),c?h^4?r:_:n},Ea=(e,t,s)=>Fl(e,typeof t!="symbol"?t+"":t,s),rn=(e,t,s)=>t.has(e)||vt("Cannot "+s),Fa=(e,t)=>Object(t)!==t?vt('Cannot use the "in" operator on this value'):e.has(t),he=(e,t,s)=>(rn(e,t,"read from private field"),s?s.call(e):t.get(e)),Re=(e,t,s)=>t.has(e)?vt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),ye=(e,t,s,i)=>(rn(e,t,"write to private field"),i?i.call(e,s):t.set(e,s),s),Ui=(e,t,s)=>(rn(e,t,"access private method"),s),ja=(e,t,s,i)=>({set _(n){ye(e,t,n,s)},get _(){return he(e,t,i)}}),Rl,fs,Ol=C({"base.ts"(){"use strict";Rl=(()=>{const e={redirect:1,onlyinclude:1,noinclude:1,include:1,comment:1,ext:1,arg:2,"magic-word":2,template:2,heading:2,html:3,table:4,hr:5,"double-underscore":5,link:6,category:6,file:6,quote:7,"ext-link":8,"free-ext-link":9,"magic-link":9,list:10,dd:10,converter:11,"list-range":11};return Object.setPrototypeOf(e,null),e})(),fs=(()=>{const e=["bold-header","format-leakage","fostered-content","h1","illegal-attr","insecure-style","invalid-gallery","invalid-imagemap","invalid-invoke","invalid-isbn","lonely-apos","lonely-bracket","lonely-http","nested-link","no-arg","no-duplicate","no-ignored","obsolete-attr","obsolete-tag","parsing-order","pipe-like","table-layout","tag-like","unbalanced-header","unclosed-comment","unclosed-quote","unclosed-table","unescaped","unknown-page","unmatched-tag","unterminated-url","url-encoding","var-anchor","void-ext"];return Object.freeze(e),e})()}});function Se(e,t,s){return s===1?e.replace(/\0(\d+)g\x7F/gu,(i,n)=>Se(String(t[n]),t,2)):s===2?e.replace(/\0(\d+)n\x7F/gu,(i,n)=>String(t[n])):e.replace(/\0(\d+)\x7F/gu,(i,n)=>t[n])}var Be,Rs,ct,gt,pt,st,Bl,be,Ke,qn,Wn,ms,ql,Mn,zn,Ut,ft,ge=C({"util/string.ts"(){"use strict";Be=String.raw` \xA0\u1680\u2000-\u200A\u202F\u205F\u3000`,Rs=String.raw`[^[\]<>"\0-\x1F\x7F${Be}\uFFFD]`,ct=String.raw`(?:\[[\da-f:.]+\]|${Rs})`,gt=String.raw`(?:${Rs}|\0\d+[cn!~]\x7F)*`,pt=e=>e.trim().toLowerCase(),st=(e,t)=>s=>s.replace(e,t),Bl=st(/[\0\x7F]|\r$/gmu,""),be=st(/\0\d+[cn]\x7F/gu,""),Ke=(e,t="")=>e.map(s=>typeof s=="string"?s:s.text()).join(t),qn={lt:"<",gt:">",lbrack:"[",rbrack:"]",lbrace:"{",rbrace:"}",nbsp:" ",amp:"&",quot:'"'},Wn=st(/&(?:#(\d+|[Xx][\da-fA-F]+)|([lg]t|[LG]T|[lr]brac[ke]|nbsp|amp|AMP|quot|QUOT));/gu,(e,t,s)=>t?String.fromCodePoint(+((/^x/iu.test(t)?"0":"")+t)):qn[s.toLowerCase()]),ms=e=>Wn(e),ql=st(/&#(\d+|x[\da-f]+);/giu,(e,t)=>String.fromCodePoint(+((/^x/iu.test(t)?"0":"")+t))),Mn={"&":"amp","<":"lt",">":"gt",'"':"quot","\n":"#10"},zn=e=>st(e,t=>`&${Mn[t]};`),Ut=zn(/[&<>]/gu),ft=(e,t={})=>{const{pre:s="",post:i="",sep:n=""}=t;return s+e.map(r=>r.print()).join(n)+i}}}),Pa=jl({"i18n/en.json"(e,t){t.exports={"attributes-of-closing-tag":"attributes of a closing tag","bold-apostrophes":"bold apostrophes","bold-in-header":"bold text in a section header",close:null,"closing-and-self-closing":"tag that is both closing and self-closing",comment:null,"conflicting-image-parameter":"conflicting image $1 parameter","content-outside-table":"content to be moved outside the table",decode:null,delink:null,"duplicate-attribute":"duplicate $1 attribute","duplicate-category":"duplicate category","duplicate-id":"duplicate HTML id","duplicate-image-parameter":"duplicate image $1 parameter","duplicate-parameter":"duplicate template parameter",encode:null,escape:null,expand:null,"ext-in-html":"extension tag in HTML tag attributes",frame:null,"full-width-punctuation":"full-width punctuation","header-in-html":"section header in HTML tag attributes","horizontal-alignment":null,"html-in-table":"HTML tag in table attributes","illegal-attribute-name":"invalid attribute name","illegal-attribute-value":"invalid attribute value","illegal-module":"invalid Scribunto module name","imagemap-without-image":"<imagemap> without an image","in-url":"$1 in URL","inconsistent-table":"inconsistent table layout","insecure-style":"insecure style","invalid-attribute":"element containing an invalid attribute name","invalid-content":"invalid content in <$1>","invalid-conversion-flag":"invalid conversion flag","invalid-gallery":"invalid gallery image","invalid-image-parameter":"invalid image parameter","invalid-imagemap-link":"invalid link in <imagemap>","invalid-isbn":"invalid ISBN","invalid-parameter":"invalid parameter of <$1>","invalid-self-closing":"invalid self-closing tag","invisible-triple-braces":"invisible content inside triple braces","italic-apostrophes":"italic apostrophes","left-bracket":"opening bracket","link-in-extlink":"internal link in an external link",lonely:'lonely "$1"',"missing-extension":"missing file extension","missing-function":"missing Scribunto module function name",newline:null,"no-self-closing":"no self-closing","nonzero-tabindex":"nonzero tabindex","nothing-in":"nothing should be in <$1>","obsolete-attribute":"obsolete attribute","obsolete-tag":"obsolete HTML tag",open:null,prefix:null,"pipe-in-link":'additional "|" in the link text',"pipe-in-table":'additional "|" in a table cell',remove:null,"template-in-link":"template in an internal link target","unbalanced-in-section-header":"unbalanced $1 in a section header",unclosed:"unclosed $1","unclosed-comment":"unclosed HTML comment","unclosed-quotes":"unclosed quotes","unclosed-table":"unclosed table","unclosed-tag":"unclosed tag","unescaped-query":"unescaped query string in an anonymous parameter","unexpected-argument":"unexpected template argument","unmatched-closing":"unmatched closing tag","unnecessary-encoding":"unnecessary percent-encoding in an internal link",uppercase:null,"useless-attribute":"useless attribute","useless-fragment":"useless fragment","useless-link-text":"useless link text","variable-anchor":"variable anchor in a section header","vertical-alignment":null,whitespace:null}}}),Ra=jl({"config/minimum.json"(e,t){t.exports={ext:[],html:[["b","bdi","del","i","ins","u","font","big","small","sub","sup","h1","h2","h3","h4","h5","h6","cite","code","em","s","strike","strong","tt","var","div","center","blockquote","ol","ul","dl","table","caption","pre","ruby","rb","rp","rt","rtc","p","span","abbr","dfn","kbd","samp","data","time","mark","tr","td","th","q","bdo"],["li","dt","dd"],["br","wbr","hr","meta","link"]],namespaces:{0:"",6:"File",10:"Template",14:"Category",828:"Module"},nsid:{"":0,file:6,template:10,category:14,module:828},functionHook:["msgnw"],variable:["!","=","pageid","articlepath","server","servername","scriptpath","stylepath"],parserFunction:[{msgnw:"msgnw",pageid:"pageid",articlepath:"articlepath",server:"server",servername:"servername",scriptpath:"scriptpath",stylepath:"stylepath","#language":"language","#special":"special","#speciale":"speciale","#tag":"tag","#formatdate":"formatdate","#dateformat":"formatdate","#invoke":"invoke","#while":"while","#dowhile":"dowhile","#loop":"loop","#forargs":"forargs","#fornumargs":"fornumargs","#if":"if","#ifeq":"ifeq","#switch":"switch","#ifexist":"ifexist","#ifexpr":"ifexpr","#iferror":"iferror","#time":"time","#timel":"timel","#expr":"expr","#rel2abs":"rel2abs","#titleparts":"titleparts","#categorytree":"categorytree","#urldecode":"urldecode","#choose":"choose","#var":"var","#varexists":"varexists","#var_final":"var_final","#vardefine":"vardefine","#vardefineecho":"vardefineecho","#widget":"widget","#related":"related","#regex":"regex","#regex_var":"regex_var","#regexquote":"regexquote","#regexall":"regexall","#len":"len","#pos":"pos","#rpos":"rpos","#sub":"sub","#count":"count","#rmatch":"rmatch","#rreplace":"rreplace","#replace":"replace","#rsplit":"rsplit","#explode":"explode","#tab":"tab","#seo":"seo","#babel":"babel","#translation":"translation","#commaseparatedlist":"commaseparatedlist","#coordinates":"coordinates","#lst":"lst","#lsth":"lsth","#lstx":"lstx","#assessment":"assessment","#mentor":"mentor","#property":"property","#target":"target","#section":"lst","#section-x":"lstx","#section-h":"lsth","#statements":"statements","#useliquidthreads":"useliquidthreads","#lqtpagelimit":"lqtpagelimit","#avatar":"avatar","#img":"img","#chart":"chart"},{"!":"!","=":"=","#FORMAL":"formal","#bcp47":"bcp47","#dir":"dir","#interwikilink":"interwikilink","#interlanguagelink":"interlanguagelink","#contentmodel":"contentmodel","#timef":"timef","#timefl":"timefl"},["msg","raw"],["subst","safesubst"]],doubleUnderscore:[[],[]],protocol:"bitcoin:|ftp://|ftps://|geo:|git://|gopher://|http://|https://|irc://|ircs://|magnet:|mailto:|matrix:|mms://|news:|nntp://|redis://|sftp://|sip:|sips:|sms:|ssh://|svn://|tel:|telnet://|urn:|wikipedia://|worldwind://|xmpp:",interwiki:[],img:{},redirection:["#redirect"],variants:[]}}}),we,Wl,Hi,We=C({"util/constants.ts"(){"use strict";we=11,Wl=Pa(),Hi=Ra()}});function ht(e){const t=new Map,s=new WeakMap;return i=>{const n=typeof i=="string"?t:s;if(n.has(i)){const l=n.get(i);return l.lastIndex=0,l}const r=e(i);return n.set(i,r),r}}var Ht,Ml,Ye=C({"../common/dist/index.mjs"(){"use strict";Ht=e=>decodeURIComponent(e.replace(/%(?![\da-f]{2})/giu,"%25")),Ml=ht}}),le,de=C({"lib/rect.ts"(){"use strict";var e,t,s,i,Di,r;le=(r=class{constructor(l,o){N(this,i);N(this,e);N(this,t);N(this,s);L(this,e,l),L(this,t,o)}get start(){return f(this,t)}get top(){return R(this,i,Di).call(this).top}get left(){return R(this,i,Di).call(this).left}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i=new WeakSet,Di=function(){var l;return(l=f(this,s))!=null||L(this,s,f(this,e).getRootNode().posFromIndex(f(this,t))),f(this,s)},r)}}),Un,Hn,zt,Gi,Os,B,G,$e,bs,U,ln,qe,on,an,un,Dt,mt,dn,Xe,zl,M=C({"util/lint.ts"(){"use strict";Ye(),Ne(),de(),W(),Un=new Set(["tr","td","th","caption"]),Hn=new Set(["Template:!!","Template:!-"]),zt=e=>{const t=e.childNodes.find(s=>s.text().trim());if(!t||t.type==="text"&&t.data.trim().startsWith("!")||t.is("magic-word")&&t.name==="!"||t.is("template")&&Hn.has(t.name)||t.is("html")&&Un.has(t.name))return!1;if(t.is("arg"))return t.length>1&&zt(t.childNodes[1]);if(t.is("magic-word"))try{const s=t.getPossibleValues().map(zt);return s.includes(2)?2:s.includes(1)&&1}catch(s){}return t.is("template")||t.is("magic-word")&&t.name==="invoke"?1:2},Gi=(e,t,s,i)=>({line:e+s-1,character:(s===1?t:0)+i}),Os=e=>(t,s,i,n,r="error")=>{const{start:l}=s,{top:o,left:u}=s instanceof le?s:new le(t,l),{offsetHeight:d,offsetWidth:a}=t,{startIndex:h,startLine:g,startCol:c}=e(t,l,o,u),{line:p,character:b}=Gi(g,c,d,a);return{rule:i,message:I.msg(n),severity:r,startIndex:h,endIndex:h+t.toString().length,startLine:g,endLine:p,startCol:c,endCol:b}},B=Os((e,t,s,i)=>{const n=e.getRelativeIndex(),{top:r,left:l}=e.parentNode.posFromIndex(n);return{startIndex:t+n,startLine:s+r,startCol:r?l:i+l}}),G=Os((e,t,s,i)=>({startIndex:t,startLine:s,startCol:i})),$e=(e,t,s,i=0)=>({desc:I.msg(t),range:[e.startIndex+i,e.endIndex],text:s}),bs=(e,t,s)=>({desc:I.msg(t),range:[e,e],text:s}),U=(e,t=0,s="")=>typeof e=="number"?{desc:I.msg("remove"),range:[e,e+t],text:s}:$e(e,"remove",s,t),ln=(e,t)=>$e(e,"decode",Ht(t.text().replace(/%(?=21|3[ce]|5[bd]|7[b-d])/giu,"%25"))),qe=(e,t,s=0)=>({desc:I.msg("close"),range:[e+s,e],text:t}),on=e=>({desc:I.msg("open"),range:[e+1,e+2],text:""}),an=(e,t)=>$e(e,"comment",`<!--${t}-->`),un=(e,t)=>$e(e,"uppercase",t.toUpperCase()),Dt=(e,t=0)=>({desc:I.msg("whitespace"),range:[e,e+t],text:" "}),mt=(e,t,s=1)=>({desc:I.msg("escape"),range:[e,e+s],text:t.repeat(s)}),dn=(e,t)=>({desc:I.msg("escape"),range:[e,e+t.length],text:t.replace(/\|/gu,"|")}),Xe=(e,t,s,i)=>{if(e&&(i||I.viewOnly&&e[0]===ke.rev))return e[1];const n=t();return(i||I.viewOnly)&&s([ke.rev,n]),n},zl=(e,t)=>e==="ol"&&t==="type"?["1","a","A","i","I"]:e==="th"&&t==="scope"?["row","col","rowgroup","colgroup"]:t==="dir"?["ltr","rtl","auto"]:t==="aria-hidden"?["true","false"]:[]}}),Dn,hn,Ul=C({"parser/selector.ts"(){"use strict";Dn=(e,t,s)=>{if(e.includes("#")){const i=e.indexOf("#");return(i===0||e.slice(0,i)===t)&&e.slice(i+1)===s}return!e||e===t},hn=(e,t,s)=>{const i=e.split(",");return({type:n,name:r})=>i.some(l=>Dn(l.trim(),n,r))}}}),ws,cn=C({"mixin/cached.ts"(){"use strict";M(),ws=(e=!0)=>t=>{const s=new WeakMap;return function(...i){return Xe(s.get(this),()=>t.apply(this,i),n=>{s.set(this,n)},e)}}}}),Hl,Oa=C({"mixin/nodeLike.ts"(){"use strict";Hl=e=>{class t extends e{get firstChild(){return this.childNodes[0]}get lastChild(){return this.childNodes[this.childNodes.length-1]}get offsetHeight(){return this.getDimension().height}get offsetWidth(){return this.getDimension().width}}return t}}}),Gn,Vn,Xt,yt,St,Kt,kt,At,_t,Qe,Dl=C({"lib/node.ts"(){"use strict";M(),Ne(),cn(),Oa(),W(),Vn=[Hl],Gn=[ws(!1)],Qe=class{constructor(){J(_t,5,this),Ea(this,"childNodes",[]),Re(this,Xt),Re(this,yt),Re(this,St),Re(this,Kt),Re(this,kt),Re(this,At,{})}get parentNode(){return he(this,Xt)}get nextSibling(){return he(this,yt)}get previousSibling(){return he(this,St)}getChildNodes(){const{childNodes:e}=this;return Object.isFrozen(e)?[...e]:e}getAttribute(e){return e==="padding"?0:this[e]}setAttribute(e,t){switch(e){case"parentNode":ye(this,Xt,t),t||(ye(this,yt,void 0),ye(this,St,void 0));break;case"nextSibling":ye(this,yt,t);break;case"previousSibling":ye(this,St,t);break;case"aIndex":I.viewOnly&&ye(this,kt,[ke.rev,t]);break;default:this[e]=t}}getRootNode(){return Xe(he(this,Kt),()=>{var e,t;return(t=(e=this.parentNode)==null?void 0:e.getRootNode())!=null?t:this},e=>{const[,t]=e;t.type==="root"&&ye(this,Kt,e)})}indexFromPos(e,t){this.lspError("AstNode.indexFromPos")}posFromIndex(e){const{length:t}=String(this);if(e+=e<0?t:0,e>=0&&e<=t){const s=this.getLines(),i=s.findIndex(([,,n])=>e<=n);return{top:i,left:e-s[i][1]}}}getDimension(){const e=this.getLines(),t=e[e.length-1];return{height:e.length,width:t[2]-t[1]}}getGaps(e){return 0}getRelativeIndex(e){if(e===void 0){const{parentNode:t}=this;return t?t.getRelativeIndex(t.childNodes.indexOf(this)):0}return Xe(he(this,At)[e],()=>{const{childNodes:t}=this,s=e+(e<0?t.length:0);let i=this.getAttribute("padding");for(let n=0;n<s;n++)I.viewOnly&&(he(this,At)[n]=[ke.rev,i]),i+=t[n].toString().length+this.getGaps(n);return i},t=>{he(this,At)[e]=t})}getAbsoluteIndex(){return Xe(he(this,kt),()=>{const{parentNode:e}=this;return e?e.getAbsoluteIndex()+this.getRelativeIndex():0},e=>{ye(this,kt,e)})}getBoundingClientRect(){this.lspError("AstNode.getBoundingClientRect")}is(e){return this.type===e}getLines(){const e=[];let t=0;for(const s of String(this).split(`
`)){const i=t+s.length;e.push([s,t,i]),t=i+1}return e}seal(e,t){const s=!t&&!!this[e];Object.defineProperty(this,e,{enumerable:s,configurable:!0})}lspError(e){throw new Error(`${e} method is only available in the LSP version!`)}},_t=K(null),Xt=new WeakMap,yt=new WeakMap,St=new WeakMap,Kt=new WeakMap,kt=new WeakMap,At=new WeakMap,X(_t,1,"getLines",Gn,Qe),Qe=X(_t,0,"AstNode",Vn,Qe),J(_t,1,Qe)}}),Gl,Ba=C({"mixin/elementLike.ts"(){"use strict";Ul(),Gl=e=>{var s,Vi;class t extends e{constructor(){super(...arguments);N(this,s)}getElementBy(l){for(const o of this.childNodes){if(o.type==="text")continue;if(l(o))return o;const u=o.getElementBy(l);if(u)return u}}querySelector(l){return this.getElementBy(R(this,s,Vi).call(this,l))}getElementsBy(l,o=[]){for(const u of this.childNodes)u.type!=="text"&&(l(u)&&o.push(u),u.getElementsBy(l,o));return o}querySelectorAll(l){return this.getElementsBy(R(this,s,Vi).call(this,l))}escape(){}}return s=new WeakSet,Vi=function(l){return hn(l,this)},t}}}),Qn,Bs,Jn,Nt,qa=C({"lib/element.ts"(){"use strict";ge(),Ne(),Ul(),Dl(),Ba(),Qn=[Gl],Nt=class extends(Jn=Qe){get length(){return this.childNodes.length}text(e){return Ke(this.childNodes,e)}normalize(){const e=this.getChildNodes(),t=s=>{var i,n;e.splice(s,1),(i=e[s-1])==null||i.setAttribute("nextSibling",e[s]),(n=e[s])==null||n.setAttribute("previousSibling",e[s-1])};for(let s=e.length-1;s>=0;s--){const{type:i,data:n}=e[s];i!=="text"||e.length===1||this.getGaps(s-(s&&1))||n===""&&t(s)}this.setAttribute("childNodes",e)}removeAt(e){this.lspError("AstElement.removeAt")}insertAt(e,t=this.length){return Tn(this,t,0,[e]),e}closest(e){const t=hn(e,this);let{parentNode:s}=this;for(;s;){if(t(s))return s;({parentNode:s}=s)}}append(...e){this.safeAppend(e)}safeAppend(e){for(const t of e)this.insertAt(t)}safeReplaceChildren(e){}setText(e,t=0){t+=t<0?this.length:0;const s=this.childNodes[t],{data:i}=s;return s.replaceData(e),i}toString(e,t=""){return this.childNodes.map(s=>s.toString(e)).join(t)}caretPositionFromIndex(e){this.lspError("AstElement.caretPositionFromIndex")}elementFromIndex(e){this.lspError("AstElement.elementFromIndex")}elementFromPoint(e,t){this.lspError("AstElement.elementFromPoint")}lint(e=this.getAbsoluteIndex(),t){{const s=[];for(let i=0,n=e+this.getAttribute("padding");i<this.length;i++){const r=this.childNodes[i];r.setAttribute("aIndex",n);const l=r.lint(n,t);l.length>0&&s.push(...l),n+=r.toString().length+this.getGaps(i)}return s}}print(e={}){const t=e.class;return this.toString()?(t===""?"":`<span class="wpb-${t!=null?t:this.type}${this.getAttribute("invalid")?" wpb-invalid":""}">`)+ft(this.childNodes,e)+(t===""?"":"</span>"):""}json(e,t=this.getAbsoluteIndex()){this.lspError("AstElement.json")}},Bs=K(Jn),Nt=X(Bs,0,"AstElement",Qn,Nt),J(Bs,1,Nt)}}),Yt,qs,Ws,Xn,Kn,Yn,Zn,Ms,er,Qi,Wa=C({"lib/text.ts"(){"use strict";var e,Vl,s;ge(),M(),W(),Dl(),Yt=String.raw`[${Be}\t]*`,qs=String.raw`[^\S\n]*`,Ws=String.raw`<${qs}(?:/${qs})?([a-z]\w*)|\{+|\}+|\[{2,}|\[(?![^[]*?\])|((?:^|\])[^[]*?)\]+|(?:rfc|pmid)(?=[-::]?${Yt}\d)|isbn(?=[-::]?${Yt}(?:\d(?:${Yt}|-)){6})`,Xn=new RegExp(String.raw`${Ws}|https?[:/]/+`,"giu"),Kn=new RegExp(Ws,"giu"),Yn=new Set(["attr-value","ext-link-text","link-text"]),Zn={"[":/[[\]]/u,"{":/[{}]/u,"]":/[[\]](?=[^[\]]*$)/u,"}":/[{}](?=[^{}]*$)/u},Ms=new Set(["html","head","style","title","body","a","audio","img","video","embed","iframe","object","canvas","script","col","colgroup","tbody","tfoot","thead","button","input","label","option","select","textarea"]),er=(()=>{try{return new RegExp(String.raw`[\p{L}\p{N}_]`,"u")}catch(i){return/\w/u}})(),Qi=(s=class extends Qe{constructor(n){super();N(this,e);Ee(this,"data","");this.data=n}get type(){return"text"}toString(n){var r;return n&&!((r=this.parentNode)!=null&&r.getAttribute("built"))?be(this.data):this.data}text(){return this.data}lint(n=this.getAbsoluteIndex(),r){var l,o,u;{if(r===!1)return[];const{data:d,parentNode:a,nextSibling:h,previousSibling:g}=this;if(!a)throw new Error("An isolated text node cannot be linted!");const{type:c,name:p,parentNode:b}=a;if(c==="attr-value"){const{name:O,tag:re}=b;if(re==="ref"&&(O==="name"||O==="follow")||O==="group"&&(re==="ref"||re==="references")||re==="choose"&&(O==="before"||O==="after"))return[]}if(r!=null||(r=c==="free-ext-link"||c==="ext-link-url"||c==="ext-link-text"||c==="image-parameter"&&p==="link"||c==="attr-value"?Kn:Xn),d.search(r)===-1)return[];r.lastIndex=0;const w=[],k=h==null?void 0:h.type,_=h==null?void 0:h.name,v=g==null?void 0:g.type,m=this.getRootNode(),S=m.toString(),{ext:A,html:x,variants:y}=m.getAttribute("config"),{top:T,left:$}=m.posFromIndex(n),{lintConfig:E}=I,F=E.rules["tag-like"],P=typeof F=="object"&&F[1]?new Set(Object.keys(F[1]).filter(O=>O!=="invalid"&&O!=="disallowed")):new Set,ne=new Set(["onlyinclude","noinclude","includeonly",...A,...x[0],...x[1],...x[2],...P,...E.getSeverity("tag-like","disallowed")?Ms:[]]);for(let O=r.exec(d);O;O=r.exec(d)){const[,re,fe]=O;let{index:V,0:D}=O;if(fe&&fe!=="]"){const{length:pe}=fe;V+=pe,D=D.slice(pe)}D=D.toLowerCase();const[Y]=D,z=Y==="r"||Y==="p"||Y==="i",Z=Y==="{",H=Y==="}",ee=Y==="[",oe=Y==="]";let{length:ae}=D;if(Y==="<"&&!ne.has(re.toLowerCase())||ee&&c==="ext-link-text"&&(/&(?:rbrack|#93|#x5[Dd];);/u.test(d.slice(V+1))||h!=null&&h.is("ext")&&_==="nowiki"&&((l=h.innerText)!=null&&l.includes("]")))||z&&(!a.isPlain()||Yn.has(c)))continue;oe&&(V||ae>1)&&r.lastIndex--;let te=n+V,He=te+ae,ue,ve;const Ce=S[He],Is=S[te-1],Ns=Z||ee,Ls=Z&&Is==="-"&&y.length>0,Es=H&&Ce==="-"&&y.length>0,Cn=ee&&k==="free-ext-link"&&!d.slice(V+1).trim()||oe&&v==="free-ext-link"&&!d.slice(0,V).includes("]");if(z)ue="lonely-http",D=D.toUpperCase(),ve=E.getSeverity(ue,D);else if(Y==="<"){ue="tag-like";let pe;/^<\/?\s/u.test(D)||!/[\s/>]/u.test(Ce!=null?Ce:"")?pe="invalid":P.has(re)?pe=re:Ms.has(re)&&!A.includes(re)&&(pe="disallowed"),ve=E.getSeverity(ue,pe)}else if(Ls||Es)ue="lonely-bracket",ve=E.getSeverity(ue,"converter"),Ls&&V>0?(D="-{",V--,te--,ae=2):Es&&V<d.length-1&&(D="}-",He++,ae=2);else if(Cn)ue="lonely-bracket",ve=E.getSeverity(ue,"extLink");else if(Ns||H||oe)if(ue="lonely-bracket",ae>1||Z&&Ce===Y||H&&Is===Y)ve=E.getSeverity(ue,"double");else{if(!ee||c!=="ext-link-text"){const pe=Zn[Y],Fs=Ns?d.slice(V+1):d.slice(0,V);if(Z&&((o=pe.exec(Fs))==null?void 0:o[0])==="}"||H&&((u=pe.exec(Fs))==null?void 0:u[0])==="{")continue;if(!Fs.includes(Y)){const En=Ns?"nextSibling":"previousSibling";let Ge=this[En];for(;Ge&&(Ge.type!=="text"||!pe.test(Ge.data));)Ge=Ge[En];if(Ge&&pe.exec(Ge.data)[0]!==Y)continue}}ve=E.getSeverity(ue,"single")}else ue="lonely-http",ve=E.getSeverity(ue);if(!ve)continue;const In=this.posFromIndex(V),{line:Nn,character:Ln}=Gi(T,$,In.top+1,In.left),De={rule:ue,message:I.msg("lonely",z||Y==="h"||Ls||Es?D:Y),severity:ve,startIndex:te,endIndex:He,startLine:Nn,endLine:Nn,startCol:Ln,endCol:Ln+ae};if(E.computeEditInfo)if(Y==="<")De.suggestions=[mt(te,"<")];else if(Y==="h"&&c!=="link-text"&&er.test(Is||""))De.suggestions=[Dt(te)];else if(ee&&c==="ext-link-text"){const pe=a.getAbsoluteIndex()+a.toString().length;De.suggestions=[mt(pe,"]")]}else if(oe&&Cn){const pe=n-g.toString().length;De.suggestions=[bs(pe,"left-bracket","[")]}else z&&(De.suggestions=[...O[0]===D?[]:[un(De,D)],...Ce===":"||Ce===":"?[Dt(He,1)]:[]]);w.push(De)}return w}}replaceData(n){R(this,e,Vl).call(this,n)}splitText(n){this.lspError("AstText.splitText")}escape(){}print(){return Ut(this.data)}},e=new WeakSet,Vl=function(n){this.setAttribute("data",n)},s)}}),Ze,bt=C({"mixin/hidden.ts"(){"use strict";Ze=(e=!0,t=!0)=>s=>{class i extends s{text(){return""}lint(r){return e?[]:super.lint(r)}}return i}}}),Ie,Fe=C({"mixin/noEscape.ts"(){"use strict";Ie=e=>{}}}),et,wt=C({"src/syntax.ts"(){"use strict";var e,t;q(),et=(t=class extends j{constructor(i,n,r,l,o){super(i,r,l,o);N(this,e);L(this,e,n)}get type(){return f(this,e)}lint(i=this.getAbsoluteIndex()){return super.lint(i,!1)}},e=new WeakMap,t)}}),je,Me=C({"mixin/padded.ts"(){"use strict";je=({length:e})=>t=>{class s extends t{getAttribute(n){return n==="padding"?e:super.getAttribute(n)}}return s}}}),xe,ze=C({"src/atom.ts"(){"use strict";var e,t;q(),xe=(t=class extends j{constructor(i,n,r,l,o){super(i,r,l,o);N(this,e);L(this,e,n)}get type(){return f(this,e)}set type(i){L(this,e,i)}getAttribute(i){var n;return i==="invalid"?this.type==="converter-flag"&&!!((n=this.parentNode)!=null&&n.isInvalidFlag(this)):super.getAttribute(i)}},e=new WeakMap,t)}}),tr,sr,zs,ir,Oe,ys=C({"src/link/base.ts"(){"use strict";var e,t,s,i;M(),We(),de(),Me(),Fe(),W(),q(),ze(),tr=n=>n==="redirect-target"||n==="link",sr=[Ie,je("[[")],Oe=(i=class extends(ir=j){constructor(r,l,o,u=[],d="|"){super(void 0,o,u,{});N(this,e,!0);N(this,t);N(this,s);if(this.insertAt(new xe(r,"link-target",o,u,{})),l!==void 0){const a=new j(l,o,u,{});a.type="link-text",a.setAttribute("stage",we-1),this.insertAt(a)}L(this,t,d)}get link(){}get fragment(){}afterBuild(){L(this,s,this.getTitle()),f(this,t).includes("\0")&&L(this,t,this.buildFromStr(f(this,t),0)),this.setAttribute("name",f(this,s).title),super.afterBuild()}setAttribute(r,l){r==="bracket"?L(this,e,l):r==="title"?L(this,s,l):super.setAttribute(r,l)}toString(r){const l=super.toString(r,f(this,t));return f(this,e)?`[[${l}]]`:l}text(){const r=super.text("|");return f(this,e)?`[[${r}]]`:r}getAttribute(r){return r==="title"?f(this,s):super.getAttribute(r)}getGaps(r){return r===0?f(this,t).length:1}lint(r=this.getAbsoluteIndex(),l){{const o=super.lint(r,l),{childNodes:[u,d],type:a}=this,{encoded:h,fragment:g}=f(this,s),{lintConfig:c}=I,{computeEditInfo:p,fix:b}=c,w=new le(this,r);let k="unknown-page",_=c.getSeverity(k);if(_&&u.childNodes.some(({type:v})=>v==="template")&&o.push(B(u,w,k,"template-in-link",_)),k="url-encoding",_=c.getSeverity(k),_&&h){const v=B(u,w,k,"unnecessary-encoding",_);(p||b)&&(v.fix=ln(v,u)),o.push(v)}if(k="pipe-like",_=c.getSeverity(k,"link"),_&&(a==="link"||a==="category")){const v=d==null?void 0:d.childNodes.findIndex(S=>S.type==="text"&&S.data.includes("|")),m=d==null?void 0:d.childNodes[v];if(m){const S=B(d,w,k,"pipe-in-link",_);if(p){const A=S.startIndex+d.getRelativeIndex(v);S.suggestions=[dn(A,m.data)]}o.push(S)}}if(k="no-ignored",_=c.getSeverity(k,"fragment"),_&&g!==void 0&&!tr(a)){const v=B(u,w,k,"useless-fragment",_);if(p||b){const m=u.childNodes.findIndex(A=>A.type==="text"&&A.data.includes("#")),S=u.childNodes[m];S&&(v.fix=U(v,u.getRelativeIndex(m)+S.data.indexOf("#")))}o.push(v)}return o}}getTitle(r,l){return this.normalizeTitle(this.firstChild.text(),0,{halfParsed:l,temporary:r,decode:!0,selfLink:!0})}print(){return super.print(f(this,e)?{pre:"[[",post:"]]",sep:f(this,t)}:{sep:f(this,t)})}json(r,l=this.getAbsoluteIndex()){const o=super.json(void 0,l)}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i),zs=K(ir),Oe=X(zs,0,"LinkBaseToken",sr,Oe),J(zs,1,Oe)}}),nr,Us,rr,Te,tt=C({"src/nowiki/base.ts"(){"use strict";Fe(),q(),nr=[Ie],Te=class extends(rr=j){get innerText(){return this.firstChild.data}constructor(e="",t,s){super(e,t,s)}},Us=K(rr),Te=X(Us,0,"NowikiBaseToken",nr,Te),J(Us,1,Te)}}),lr,Hs,or,ce,Ue=C({"src/nowiki/noinclude.ts"(){"use strict";bt(),tt(),lr=[Ze()],ce=class extends(or=Te){get type(){return"noinclude"}toString(e){return e?"":super.toString()}},Hs=K(or),ce=X(Hs,0,"NoincludeToken",lr,ce),J(Hs,1,ce)}}),Ql,Ma=C({"src/link/redirectTarget.ts"(){"use strict";M(),W(),ys(),Ue(),Ql=class extends Oe{get type(){return"redirect-target"}constructor(e,t,s,i){super(e,void 0,s,i),t!==void 0&&this.insertAt(new ce(t,s,i))}getTitle(){return this.normalizeTitle(this.firstChild.toString(),0,{halfParsed:!0,decode:!0})}lint(e=this.getAbsoluteIndex()){{const t=super.lint(e,!1),s="no-ignored",{lintConfig:i}=I,n=i.getSeverity(s,"redirect");if(n&&this.length===2){const r=B(this.lastChild,{start:e},s,"useless-link-text",n);r.startIndex--,r.startCol--,(i.computeEditInfo||i.fix)&&(r.fix=U(r)),t.push(r)}return t}}}}}),ar,Ds,ur,Lt,za=C({"src/redirect.ts"(){"use strict";var e,t,s;bt(),Fe(),q(),wt(),Ma(),ar=[Ze(!1,!1),Ie],Lt=(s=class extends(ur=j){constructor(n,r,l,o,u,d,a=[]){super(void 0,d,a);N(this,e);N(this,t);L(this,e,n),L(this,t,u),this.append(new et(r,"redirect-syntax",d,a),new Ql(l,o==null?void 0:o.slice(1),d,a))}get type(){return"redirect"}getAttribute(n){return n==="padding"?f(this,e).length:super.getAttribute(n)}toString(n){return f(this,e)+super.toString(n)+f(this,t)}lint(n=this.getAbsoluteIndex()){{const r=n+f(this,e).length+this.firstChild.toString().length;return this.lastChild.setAttribute("aIndex",r),this.lastChild.lint(r)}}print(){return super.print({pre:f(this,e),post:f(this,t)})}},e=new WeakMap,t=new WeakMap,s),Ds=K(ur),Lt=X(Ds,0,"RedirectToken",ar,Lt),J(Ds,1,Lt)}}),Jl={};se(Jl,{parseRedirect:()=>Xl});var Xl,Ua=C({"parser/redirect.ts"(){"use strict";W(),za(),Xl=(e,t,s)=>{var n;(n=t.regexRedirect)!=null||(t.regexRedirect=new RegExp(String.raw`^(\s*)((?:${t.redirection.join("|")})\s*(?::\s*)?)\[\[([^\n|\]]+)(\|.*?)?\]\](\s*)`,"iu"));const i=t.regexRedirect.exec(e);return i&&I.normalizeTitle(i[3],0,!1,t,{halfParsed:!0,temporary:!0,decode:!0}).valid?(e=`\0${s.length}o${e.slice(i[0].length)}`,new Lt(...i.slice(1),t,s),e):!1}}}),dr,Gs,hr,Et,Ha=C({"src/onlyinclude.ts"(){"use strict";Me(),Fe(),q(),dr=[Ie,je("<onlyinclude>")],Et=class extends(hr=j){get type(){return"onlyinclude"}toString(e){return`<onlyinclude>${super.toString(e)}</onlyinclude>`}isPlain(){return!0}print(){return super.print({pre:'<span class="wpb-ext"><onlyinclude></span>',post:'<span class="wpb-ext"></onlyinclude></span>'})}},Gs=K(hr),Et=X(Gs,0,"OnlyincludeToken",dr,Et),J(Gs,1,Et)}}),Vt,Ss=C({"mixin/gapped.ts"(){"use strict";Vt=(e=1)=>t=>{class s extends t{getGaps(){return e}}return s}}}),cr,Vs,gr,Je,gn=C({"src/tagPair/index.ts"(){"use strict";var e,t;Ss(),Fe(),q(),cr=[Vt(),Ie],Je=(t=class extends(gr=j){constructor(i,n,r,l,o,u=[]){super(void 0,o);N(this,e);Ee(this,"closed");Ee(this,"selfClosing");this.setAttribute("name",i.toLowerCase()),L(this,e,[i,l||i]),this.closed=l!=="",this.selfClosing=l===void 0,this.append(n,r);const d=typeof n=="string"?-1:u.indexOf(n);u.splice(d===-1?1/0:d,0,this)}get innerText(){return this.selfClosing?void 0:this.lastChild.text()}toString(i){const{selfClosing:n,firstChild:r,lastChild:l}=this,[o,u]=f(this,e);return n?`<${o}${r.toString(i)}/>`:`<${o}${r.toString(i)}>${l.toString(i)}${this.closed?`</${u}>`:""}`}text(){const[i,n]=f(this,e);return this.selfClosing?`<${i}${this.firstChild.text()}/>`:`<${i}${super.text(">")}${this.closed?`</${n}>`:""}`}getAttribute(i){return i==="padding"?f(this,e)[0].length+1:super.getAttribute(i)}print(){const[i,n]=f(this,e);return super.print(this.selfClosing?{pre:`<${i}`,post:"/>"}:{pre:`<${i}`,sep:">",post:this.closed?`</${n}>`:""})}},e=new WeakMap,t),Vs=K(gr),Je=X(Vs,0,"TagPairToken",cr,Je),J(Vs,1,Je)}}),Kl,Da=C({"src/tagPair/translate.ts"(){"use strict";var e,Yl,s;q(),gn(),wt(),Ue(),Kl=(s=class extends Je{constructor(n,r,l,o=[]){const u=new et(n,"translate-attr",l,o);r=r==null?void 0:r.replace(/(<tvar\|[^>]+>)([\s\S]*?)(<\/>)/gu,(a,h,g,c)=>(new ce(h,l,o),new ce(c,l,o),`\0${o.length-1}n${g}\0${o.length}n`)).replace(/(<tvar\s+name\s*=(?:\s*(?:(["'])[\s\S]*?\2|[^"'\s>]+))?\s*>)([\s\S]*?)(<\/tvar\s*>)/giu,(a,h,g,c,p)=>(new ce(h,l,o),new ce(p,l,o),`\0${o.length-1}n${c}\0${o.length}n`));const d=new j(r,l,o);d.type="translate-inner";super("translate",u,d,"translate",l,o);N(this,e);this.seal("closed",!0),this.seal("selfClosing",!0)}get type(){return"translate"}toString(n){return n?this.lastChild.toString(!0):super.toString()}text(){return this.lastChild.text()}print(){return`<span class="wpb-ext"><translate${R(this,e,Yl).call(this)?'<span class="wpb-ext-attrs"> <span class="wpb-ext-attr"><span class="wpb-attr-key">nowrap</span></span></span>':""}>${this.lastChild.print({class:"ext-inner"})}</translate></span>`}},e=new WeakSet,Yl=function(){return this.firstChild.toString()===" nowrap"},s)}}),pr,Qs,fr,Ft,Ga=C({"src/tagPair/include.ts"(){"use strict";M(),de(),bt(),W(),gn(),pr=[Ze(!1)],Ft=class extends(fr=Je){get type(){return"include"}constructor(e,t="",s,i,n,r){super(e,t,s!=null?s:"",s===void 0||i!=null?i:"",n,r)}toString(e){return e?"":super.toString()}lint(e=this.getAbsoluteIndex()){{const t=[],{firstChild:s,closed:i,name:n}=this,r=new le(this,e),l=["no-ignored","unclosed-comment"],{lintConfig:o}=I,{computeEditInfo:u}=o,d=l.map(a=>o.getSeverity(a,"include"));if(d[0]&&s.data.trim()){const a=B(s,r,l[0],"useless-attribute",d[0]);u&&(a.suggestions=[U(a)]),t.push(a)}if(d[1]&&!i){const a=G(this,r,l[1],I.msg("unclosed",`<${n}>`),d[1]);u&&(a.suggestions=[qe(a.endIndex,`</${n}>`)]),t.push(a)}return t}}},Qs=K(fr),Ft=X(Qs,0,"IncludeToken",pr,Ft),J(Qs,1,Ft)}}),ks,pn=C({"mixin/attributesParent.ts"(){"use strict";ks=(e=0)=>t=>{var i,Zl;class s extends t{constructor(){super(...arguments);N(this,i)}hasAttr(o){this.lspError("AttributesParent.hasAttr")}getAttr(o){return R(this,i,Zl).call(this).getAttr(o)}}return i=new WeakSet,Zl=function(){return this.childNodes[e]},s}}}),ie,Js,Xs,$t,Zt,Ks,Ve,Ys,Zs,ei,es,ti,Ae,eo,to,so,io,Va=C({"util/sharable.ts"(){"use strict";ie=new Set(["align"]),Js=new Set(["cite"]),Xs=new Set(["cite","datetime"]),$t=new Set(["width"]),Zt=new Set(["axis","align","bgcolor","height","width","valign"]),Ks=new Set([...Zt,"abbr","headers","scope","rowspan","colspan"]),Ve=new Set(["type"]),Ys=new Set(["summary","align","bgcolor","cellpadding","cellspacing","frame","rules","width"]),Zs=new Set(["clear"]),ei=new Set(["bgcolor","align","valign"]),es=new Set(["qid","forcemathmode","type","display"]),ti=new Set(["enclose","inline","lang","line","linelinks","style","class","id","dir","copy","highlight","start"]),Ae=new Set,eo=new Set(["id","class","style","lang","dir","title","tabindex","aria-describedby","aria-flowto","aria-hidden","aria-label","aria-labelledby","aria-level","aria-owns","role","about","property","resource","datatype","typeof","itemid","itemprop","itemref","itemscope","itemtype"]),to={div:ie,h1:ie,h2:ie,h3:ie,h4:ie,h5:ie,h6:ie,blockquote:Js,q:Js,p:ie,br:Zs,pre:$t,ins:Xs,del:Xs,ul:Ve,ol:new Set(["type","start","reversed"]),li:new Set(["type","value"]),table:new Set([...Ys,"border"]),caption:ie,tr:ei,td:Ks,th:Ks,font:new Set(["size","color","face"]),hr:$t,data:new Set(["value"]),time:new Set(["datetime"]),meta:new Set(["itemprop","content"]),link:new Set(["itemprop","href","title"]),gallery:Ve,poem:ie,categorytree:ie,combooption:ie,math:Ae,chem:Ae,ce:Ae,img:new Set(["alt","src","width","height","loading","srcset"])},so={gallery:new Set(["mode","showfilename","caption","perrow","widths","heights","showthumbnails"]),poem:new Set(["compact"]),categorytree:new Set(["hideroot","onlyroot","depth","mode","hideprefix","namespaces","showcount","notranslations"]),combooption:new Set(["name","for","inline"]),nowiki:Ae,indicator:new Set(["name"]),langconvert:new Set(["from","to"]),ref:new Set(["group","name","follow","dir","details"]),references:new Set(["group","responsive"]),charinsert:new Set(["label"]),choose:new Set(["uncached","before","after"]),option:new Set(["weight"]),imagemap:Ae,inputbox:Ae,templatestyles:new Set(["src","wrapper"]),dynamicpagelist:Ae,poll:new Set(["id","show-results-before-voting"]),sm2:Ve,flashmp3:Ve,score:new Set(["line_width_inches","lang","override_midi","raw","note-language","override_audio","override_ogg","sound","vorbis"]),seo:new Set(["title","title_mode","title_separator","keywords","description","robots","google_bot","image","image_width","image_height","image_alt","type","site_name","locale","section","author","published_time","twitter_site"]),tab:new Set(["nested","name","index","class","block","inline","openname","closename","collapsed","dropdown","style","bgcolor","container","id","title"]),tabs:new Set(["plain","class","container","id","title","style"]),combobox:new Set(["placeholder","value","id","class","text","dropdown","style"]),math:new Set([...es,"chem"]),chem:es,ce:es,hiero:Ae,phonos:new Set(["ipa","class","text","lang","wikibase","file"]),section:new Set(["begin","end"]),source:ti,syntaxhighlight:ti,templatedata:Ae,timeline:new Set(["method","font"]),quiz:new Set(["display","shuffleanswers","points","shuffle","case"]),languages:Ae},io={table:Ys,td:new Set([...Zt,"scope"]),th:Zt,br:Zs,caption:ie,div:ie,hr:$t,h1:ie,h2:ie,h3:ie,h4:ie,h5:ie,h6:ie,li:Ve,p:ie,pre:$t,tr:ei,ul:Ve}}}),mr,xr,vr,br,as,Qa=C({"src/attribute.ts"(){"use strict";var e,t,s,i,n,Ji,l;M(),ge(),We(),Va(),de(),W(),q(),ze(),mr=/expression|(?:accelerator|-o-link(?:-source)?|-o-replace)\s*:|(?:url|src|image(?:-set)?)\s*\(|attr\s*\([^)]+[\s,]url/u,xr=/(?:^|\s|\*\/)(?:javascript|vbscript)(?:\W|$)/iu,vr=new Set(["ext","arg","magic-word","template"]),br=new Set(["about","property","resource","datatype","typeof","itemid","itemprop","itemref","itemscope","itemtype"]),as=(l=class extends j{constructor(u,d,a,h="",g,c=[],p=I.getConfig(),b=[]){const w=new xe(a,"attr-key",p,b);let k;if(a==="title"||d==="img"&&a==="alt")k=new j(g,p,b,{}),k.type="attr-value",k.setAttribute("stage",we-1);else if(d==="gallery"&&a==="caption"||d==="choose"&&(a==="before"||a==="after")){const _=Le(me({},p),{excludes:[...p.excludes,"heading","html","table","hr","list"]});k=new j(g,_,b,{}),k.type="attr-value",k.setAttribute("stage",1)}else k=new xe(g,"attr-value",p,b,{});super(void 0,p,b);N(this,n);N(this,e);N(this,t);N(this,s);N(this,i);L(this,e,u),this.append(w,k),L(this,s,h),L(this,i,[...c]),L(this,t,d),this.setAttribute("name",pt(be(a)))}get type(){return f(this,e)}get tag(){return f(this,t)}get balanced(){return!f(this,s)||f(this,i)[0]===f(this,i)[1]}afterBuild(){f(this,s).includes("\0")&&L(this,s,this.buildFromStr(f(this,s),0)),this.parentNode&&L(this,t,this.parentNode.name),this.setAttribute("name",pt(this.firstChild.text())),super.afterBuild()}toString(u){const[d="",a=""]=f(this,i);return f(this,s)?super.toString(u,f(this,s)+d)+a:this.firstChild.toString(u)}text(){return f(this,s)?`${super.text(`${f(this,s).trim()}"`)}"`:this.firstChild.text()}getGaps(){var u,d;return f(this,s)?f(this,s).length+((d=(u=f(this,i)[0])==null?void 0:u.length)!=null?d:0):0}lint(u=this.getAbsoluteIndex(),d){var a;{const h=super.lint(u,d),{balanced:g,firstChild:c,lastChild:p,name:b,tag:w}=this,k=new le(this,u),_=["unclosed-quote","obsolete-attr"],{lintConfig:v}=I,m=_.map(A=>v.getSeverity(A,b));if(m[0]&&!g){const A=B(p,k,_[0],"unclosed-quotes",m[0]);A.startIndex--,A.startCol--,v.computeEditInfo&&(A.suggestions=[qe(A.endIndex,f(this,i)[0])]),h.push(A)}const S=R(this,n,Ji).call(this,u,k);return S&&h.push(S),m[1]&&((a=io[w])!=null&&a.has(b))&&h.push(B(c,k,_[1],"obsolete-attribute",m[1])),h}}getValue(){return f(this,s)?this.lastChild.text().trim():this.type==="ext-attr"||""}escape(){}getAttribute(u){return u==="invalid"?R(this,n,Ji).call(this):super.getAttribute(u)}print(){const[u="",d=""]=f(this,i);return f(this,s)?super.print({sep:Ut(f(this,s))+u,post:d}):super.print()}json(u,d=this.getAbsoluteIndex()){const a=super.json(void 0,d)}},e=new WeakMap,t=new WeakMap,s=new WeakMap,i=new WeakMap,n=new WeakSet,Ji=function(u,d){const{firstChild:a,lastChild:h,type:g,name:c,tag:p,parentNode:b}=this,w=!h.childNodes.some(({type:y})=>vr.has(y)),k=this.getValue(),_=so[p],v=to[p],{length:m}=this.toString();let S="illegal-attr",A,x;if({lintConfig:A}=I,{computeEditInfo:x}=A,!(_!=null&&_.has(c))&&!(v!=null&&v.has(c))&&(g==="ext-attr"?_||v:!/\{\{[^{]+\}\}/u.test(c))&&(g==="ext-attr"&&!v||!/^(?:xmlns:[\w:.-]+|data-(?!ooui|mw|parsoid)[^:]*)$/u.test(c)&&(p==="meta"||p==="link"||!eo.has(c)))||(c==="itemtype"||c==="itemid"||c==="itemref")&&!(b!=null&&b.hasAttr("itemscope"))){if(u===void 0)return!0;{const y=A.getSeverity(S,"unknown");if(y){const T=B(a,d,S,"illegal-attribute-name",y);return x&&(T.suggestions=[U(u,m)]),T}}}else if(c==="style"&&typeof k=="string"&&mr.test(k)){if(u===void 0)return!0;{S="insecure-style";const y=A.getSeverity(S);return y&&B(h,d,S,"insecure-style",y)}}else if(c==="tabindex"&&typeof k=="string"&&k!=="0"){if(u===void 0)return!0;{const y=A.getSeverity(S,"tabindex");if(y){const T=B(h,d,S,"nonzero-tabindex",y);return x&&(T.suggestions=[U(u,m),$e(T,"0 tabindex","0")]),T}}}else if(typeof k=="string"&&((/^xmlns:[\w:.-]+$/u.test(c)||br.has(c))&&xr.test(k)||w&&(c==="href"||p==="img"&&c==="src")&&!new RegExp(String.raw`^(?:${this.getAttribute("config").protocol}|//)\S+$`,"iu").test(k))){if(u===void 0)return!0;{const y=A.getSeverity(S,"value");return y&&B(h,d,S,"illegal-attribute-value",y)}}else if(w&&g!=="ext-attr"){const y=zl(p,c),T=String(k).toLowerCase();if(y.length>0&&y.every($=>$!==T)){if(u===void 0)return!0;{const $=A.getSeverity(S,"value");return $&&B(h,d,S,"illegal-attribute-value",$)}}}return!1},l)}}),si,wr,yr,As,fn=C({"src/attributes.ts"(){"use strict";var e,t,us,i;M(),ge(),de(),W(),q(),ze(),Qa(),si=n=>n.slice(0,-1),wr=n=>`${si(n)}-dirty`,yr=(()=>{try{return new RegExp(String.raw`[\p{L}\p{N}]`,"u")}catch(n){return/[^\W_]/u}})(),As=(i=class extends j{constructor(r,l,o,u,d=[]){super(void 0,u,d,{});N(this,t);N(this,e);if(L(this,e,l),this.setAttribute("name",o),r){const a=/([^\s/](?:(?!\0\d+~\x7F)[^\s/=])*)(?:((?:\s(?:\s|\0\d+[cn]\x7F)*)?(?:=|\0\d+~\x7F)(?:\s|\0\d+[cn]\x7F)*)(?:(["'])([\s\S]*?)(\3|$)|(\S*)))?/gu;let h="",g=a.exec(r),c=0;const p=()=>{h&&(super.insertAt(new xe(h,wr(l),u,d,{})),h="")};for(;g;){const{index:b,0:w,1:k,2:_,3:v,4:m,5:S,6:A}=g;if(h+=r.slice(c,b),/^(?:[\w:]|\0\d+t\x7F)(?:[\w:.-]|\0\d+t\x7F)*$/u.test(be(k).trim())){const x=m!=null?m:A,y=[v,S],T=new as(si(l),o,k,_,x,y,u,d);p(),super.insertAt(T)}else h+=w;({lastIndex:c}=a),g=a.exec(r)}h+=r.slice(c),p()}}get type(){return f(this,e)}afterBuild(){const{parentNode:r}=this;r!=null&&r.is("td")&&this.setAttribute("name",r.subtype),super.afterBuild()}getAttrTokens(r){return this.childNodes.filter(l=>l instanceof as&&(!r||l.name===pt(r)))}hasAttr(r){return this.getAttrTokens(r).length>0}getAttrToken(r){const l=this.getAttrTokens(r);return l[l.length-1]}getAttr(r){var l;return(l=this.getAttrToken(r))==null?void 0:l.getValue()}lint(r=this.getAbsoluteIndex(),l){{const o=super.lint(r,l),{parentNode:u,childNodes:d}=this,a=new Map,h=new Set,g=new le(this,r),c=["no-ignored","no-duplicate"],{lintConfig:p}=I,{computeEditInfo:b,fix:w}=p,k=["closingTag","invalidAttributes","nonWordAttributes"].map(v=>p.getSeverity(c[0],v));if(k[0]&&R(this,t,us).call(this)){const v=G(this,g,c[0],"attributes-of-closing-tag",k[0]);if(b){const m=u.getAbsoluteIndex();v.suggestions=[U(v),on(m)]}o.push(v)}for(const v of d)if(v instanceof as){const{name:m}=v;a.has(m)?(h.add(m),a.get(m).push(v)):a.set(m,[v])}else{const m=v.text().trim(),S=k[yr.test(m)?1:2];if(m&&S){const A=B(v,g,c[0],"invalid-attribute",S);b&&(A.suggestions=[U(A,0," ")]),o.push(A)}}const _=p.getSeverity(c[1],"attribute");if(_&&h.size>0)for(const v of h){const m=a.get(v).map(S=>{const A=S.getValue();return[S,A===!0?"":A]});o.push(...m.map(([S,A],x)=>{const y=B(S,g,c[1],I.msg("duplicate-attribute",v),_);if(b||w){const T=U(y);!A||m.slice(0,x).some(([,$])=>$===A)?y.fix=T:b&&(y.suggestions=[T])}return y}))}return o}}getAttribute(r){return r==="invalid"?R(this,t,us).call(this):super.getAttribute(r)}print(){return this.toString()?`<span class="wpb-${this.type}${R(this,t,us).call(this)?" wpb-invalid":""}">${this.childNodes.map(r=>r.print(r instanceof xe?{class:r.toString().trim()&&"attr-dirty"}:void 0)).join("")}</span>`:""}},e=new WeakMap,t=new WeakSet,us=function(){const{parentNode:r}=this;return(r==null?void 0:r.type)==="html"&&r.closing&&this.text().trim()!==""},i)}}),no={};se(no,{PreToken:()=>ro});var ro,Ja=C({"src/pre.ts"(){"use strict";We(),q(),Ue(),ro=class extends j{get type(){return"ext-inner"}constructor(e,t,s=[]){if(e){const i=/<nowiki>/giu,n=/<\/nowiki>/giu,{length:r}=i.source;let l=i.exec(e);l&&(n.lastIndex=l.index+r);let o=n.exec(e),u=0,d="";for(;l&&o;)new ce(l[0],t,s),new ce(o[0],t,s),d+=`${e.slice(u,l.index)}\0${s.length-1}n${e.slice(l.index+r,o.index)}\0${s.length}n`,u=o.index+r+1,i.lastIndex=u,l=i.exec(e),l&&(n.lastIndex=l.index+r),o=n.exec(e);e=d+e.slice(u)}super(e,t,s,{}),this.setAttribute("stage",we-1)}isPlain(){return!0}lint(e=this.getAbsoluteIndex()){return super.lint(e,/<\s*\/\s*(pre)\b/giu)}}}}),_s,mn=C({"mixin/multiLine.ts"(){"use strict";_s=e=>{class t extends e{toString(i){return super.toString(i,`
`)}text(){return super.text(`
`).replace(/\n\s*\n/gu,`
`)}getGaps(){return 1}print(){return super.print({sep:`
`})}}return t}}}),lo={};se(lo,{ParamTagToken:()=>nt});var Sr,ii,kr,nt,oo=C({"src/paramTag/index.ts"(){"use strict";M(),de(),Ts(),mn(),W(),q(),ze(),Sr=[_s],nt=class extends(kr=j){get type(){return"ext-inner"}constructor(e,t,s=I.getConfig(),i=[],n){if(super(void 0,s,i,{}),t){const r=xe;this.append(...t.split(`
`).map(l=>n?l:Qt(l,s,i,e)).map(l=>new r(l,"param-line",s,i,{})))}i.splice(i.indexOf(this),1),i.push(this)}lint(e=this.getAbsoluteIndex()){{const t="no-ignored",{lintConfig:s}=I,i=s.getSeverity(t,this.name);if(!i)return[];const n=new le(this,e),r=I.msg("invalid-parameter",this.name),l=[];for(const o of this.childNodes){o.setAttribute("aIndex",e);const u=o.childNodes.filter(({type:d})=>d!=="comment"&&d!=="include"&&d!=="noinclude");if(u.some(({type:d})=>d==="ext"))l.push(B(o,n,t,r,i));else{const d=u.findIndex(({type:h})=>h!=="text"),a=u.slice(0,d===-1?void 0:d).map(String).join("");if(a&&!(d===-1?/^[a-z]+(?:\[\])?\s*=/iu:/^[a-z]+(?:\[\])?\s*(?:=|$)/iu).test(a)){const h=B(o,n,t,r,i);s.computeEditInfo&&(h.suggestions=[U(h)]),l.push(h)}else{const h=o.lint(e,!1);h.length>0&&l.push(...h)}}e+=o.toString().length+1}return l}}},ii=K(kr),nt=X(ii,0,"ParamTagToken",Sr,nt),J(ii,1,nt)}}),Ar,ni,_r,rt,ao=C({"src/heading.ts"(){"use strict";var e,t,ds,i;M(),Ne(),de(),Fe(),W(),q(),wt(),Ar=[Ie],rt=(i=class extends(_r=j){constructor(r,l,o,u=[]){super(void 0,o,u);N(this,t);N(this,e);L(this,e,r);const d=new j(l[0],o,u);d.type="heading-title",d.setAttribute("stage",2);const a=new et(l[1],"heading-trail",o,u);this.append(d,a)}get type(){return"heading"}get level(){return f(this,e)}toString(r){const l=R(this,t,ds).call(this);return l+this.firstChild.toString(r)+l+this.lastChild.toString(r)}text(){const r=R(this,t,ds).call(this);return r+this.firstChild.text()+r}getAttribute(r){return r==="invalid"?this.inHtmlAttrs()===2:r==="padding"?this.level:super.getAttribute(r)}getGaps(){return this.level}lint(r=this.getAbsoluteIndex(),l){{const o=super.lint(r,l),{firstChild:u,level:d}=this,a=u.toString(),h=a.startsWith("="),g=h||a.endsWith("="),c=new le(this,r),p=this.inHtmlAttrs(),b=["h1","unbalanced-header","format-leakage"],{lintConfig:w}=I,{computeEditInfo:k,fix:_}=w,v=b.map(m=>w.getSeverity(m,"apostrophe"));if(v[0]&&this.level===1){const m=B(u,c,b[0],"<h1>",v[0]);k&&!g&&(m.suggestions=[$e(m,"h2",`=${a}=`)]),o.push(m)}if(v[1]&&g){const m=I.msg("unbalanced-in-section-header",'"="'),S=B(u,c,b[1],m,v[1]);if(!(!k||a==="="))if(h){const[A]=/^=+/u.exec(a),x=d+A.length;S.suggestions=[{desc:`h${d}`,range:[S.startIndex,S.startIndex+A.length],text:""}],x<7&&S.suggestions.push({desc:`h${x}`,range:[S.endIndex,S.endIndex],text:A})}else{const A=/[^=](=+)$/u.exec(a)[1],x=d+A.length;S.suggestions=[{desc:`h${d}`,range:[S.endIndex-A.length,S.endIndex],text:""}],x<7&&S.suggestions.push({desc:`h${x}`,range:[S.startIndex,S.startIndex],text:A})}o.push(S)}if(p){const m="parsing-order",S=w.getSeverity(m,p===2?"heading":"templateInTable");S&&o.push(G(this,c,m,"header-in-html",S))}if(v[2]){const m=this.getRootNode().toString(),S=u.childNodes.filter(Cs("quote")),A=S.filter(({bold:y})=>y),x=S.filter(({italic:y})=>y);if(A.length%2){const y=B(A[A.length-1],Le(me({},c),{start:r+d,left:c.left+d}),b[2],I.msg("unbalanced-in-section-header","bold-apostrophes"),v[2]);if(k||_){const T=r+d+a.length,$=U(y);m.slice(y.endIndex,T).trim()?k&&(y.suggestions=[$,qe(T,"'''")]):A.length===1&&x.length===0?y.fix=$:k&&(y.suggestions=[$])}o.push(y)}if(x.length%2){const y=B(x[x.length-1],{start:r+d},b[2],I.msg("unbalanced-in-section-header","italic-apostrophes"),v[2]);if(k||_){const T=r+d+a.length;m.slice(y.endIndex,T).trim()?k&&(y.suggestions=[qe(T,"''")]):x.length===1&&A.length===0?y.fix=U(y):k&&(y.suggestions=[U(y)])}o.push(y)}}return o}}print(){const r=R(this,t,ds).call(this);return super.print({pre:r,sep:r})}json(r,l=this.getAbsoluteIndex()){const o=super.json(void 0,l)}},e=new WeakMap,t=new WeakSet,ds=function(){return"=".repeat(this.level)},i),ni=K(_r),rt=X(ni,0,"HeadingToken",Ar,rt),J(ni,1,rt)}}),$