wikiparser-node 1.16.2 → 1.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/bundle.lsp.js +38 -0
- package/bundle/bundle.min.js +35 -0
- package/extensions/dist/base.js +286 -0
- package/extensions/dist/codejar.js +56 -0
- package/extensions/dist/editor.js +159 -0
- package/extensions/dist/highlight.js +30 -0
- package/extensions/dist/lint.js +79 -0
- package/extensions/dist/lsp.js +74 -0
- package/extensions/dist/test-page.js +89 -0
- package/extensions/editor.css +59 -0
- package/extensions/es7/base.js +1 -1
- package/extensions/ui.css +162 -0
- package/package.json +2 -2
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";(()=>{var bo=Object.create;var lt=Object.defineProperty;var Yn=Object.getOwnPropertyDescriptor;var To=Object.getOwnPropertyNames;var yo=Object.prototype.hasOwnProperty;var Zn=(a,r)=>(r=Symbol[a])?r:Symbol.for("Symbol."+a),dt=a=>{throw TypeError(a)};var ei=(a,r,e)=>r in a?lt(a,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[r]=e;var Jn=(a,r)=>lt(a,"name",{value:r,configurable:!0});var k=(a,r)=>()=>(a&&(r=a(a=0)),r);var ko=(a,r)=>()=>(r||a((r={exports:{}}).exports,r),r.exports),se=(a,r)=>{for(var e in r)lt(a,e,{get:r[e],enumerable:!0})},vo=(a,r,e,t)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of To(r))!yo.call(a,n)&&n!==e&<(a,n,{get:()=>r[n],enumerable:!(t=Yn(r,n))||t.enumerable});return a};var J=a=>vo(lt({},"__esModule",{value:!0}),a);var de=a=>{var r;return[,,,bo((r=a==null?void 0:a[Zn("metadata")])!=null?r:null)]},ti=["class","method","getter","setter","accessor","field","value","get","set"],Gt=a=>a!==void 0&&typeof a!="function"?dt("Function expected"):a,Ao=(a,r,e,t,n)=>({kind:ti[a],name:r,metadata:t,addInitializer:i=>e._?dt("Already initialized"):n.push(Gt(i||null))}),So=(a,r)=>ei(r,Zn("metadata"),a[3]),ge=(a,r,e,t)=>{for(var n=0,i=a[r>>1],s=i&&i.length;n<s;n++)r&1?i[n].call(e):t=i[n].call(e,t);return t},pe=(a,r,e,t,n,i)=>{var s,o,l,p,g,d=r&7,c=!!(r&8),m=!!(r&16),h=d>3?a.length+1:d?c?1:2:0,f=ti[d+5],v=d>3&&(a[h-1]=[]),T=a[h]||(a[h]=[]),S=d&&(!m&&!c&&(n=n.prototype),d<5&&(d>3||!m)&&Yn(d<4?n:{get[e](){return u(this,i)},set[e](L){return y(this,i,L)}},e));d?m&&d<4&&Jn(i,(d>2?"set ":d>1?"get ":"")+e):Jn(n,e);for(var w=t.length-1;w>=0;w--)p=Ao(d,e,l={},a[3],T),d&&(p.static=c,p.private=m,g=p.access={has:m?L=>wo(n,L):L=>e in L},d^3&&(g.get=m?L=>(d^1?u:E)(L,n,d^4?i:S.get):L=>L[e]),d>2&&(g.set=m?(L,N)=>y(L,n,N,d^4?i:S.set):(L,N)=>L[e]=N)),o=(0,t[w])(d?d<4?m?i:S[f]:d>4?void 0:{get:S.get,set:S.set}:n,p),l._=1,d^4||o===void 0?Gt(o)&&(d>4?v.unshift(o):d?m?i=o:S[f]=o:n=o):typeof o!="object"||o===null?dt("Object expected"):(Gt(s=o.get)&&(S.get=s),Gt(s=o.set)&&(S.set=s),Gt(s=o.init)&&v.unshift(s));return d||So(a,n),S&<(n,e,S),m?d^4?i:S:n},te=(a,r,e)=>ei(a,typeof r!="symbol"?r+"":r,e),nn=(a,r,e)=>r.has(a)||dt("Cannot "+e),wo=(a,r)=>Object(r)!==r?dt('Cannot use the "in" operator on this value'):a.has(r),u=(a,r,e)=>(nn(a,r,"read from private field"),e?e.call(a):r.get(a)),b=(a,r,e)=>r.has(a)?dt("Cannot add the same private member more than once"):r instanceof WeakSet?r.add(a):r.set(a,e),y=(a,r,e,t)=>(nn(a,r,"write to private field"),t?t.call(a,e):r.set(a,e),e),E=(a,r,e)=>(nn(a,r,"access private method"),e);var xr=(a,r,e,t)=>({set _(n){y(a,r,n,e)},get _(){return u(a,r,t)}});var ri,ni,ii=k(()=>{"use strict";ri=(()=>{let a={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};return Object.setPrototypeOf(a,null),a})(),ni=(()=>{let a=["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(a),a})()});var Be,si=k(()=>{"use strict";Be=a=>decodeURIComponent(a.replace(/%(?![\da-f]{2})/giu,"%25"))});var be,oi,we,Ce,Ve,ai,ne,li,ue,Co,$o,Wt,di,gi,No,Eo,gt,$e,Q=k(()=>{"use strict";si();be=String.raw` \xA0\u1680\u2000-\u200A\u202F\u205F\u3000`,oi=String.raw`[^[\]<>"\0-\x1F\x7F${be}\uFFFD]`,we=String.raw`(?:\[[\da-f:.]+\]|${oi})`,Ce=String.raw`(?:${oi}|\0\d+[cn!~]\x7F)*`,Ve=(a,r)=>e=>e.replace(a,r),ai=Ve(/[\0\x7F]|\r$/gmu,""),ne=Ve(/\0\d+[cn]\x7F/gu,""),li=Ve(/[\\{}()|.?*+^$[\]]/gu,String.raw`\$&`),ue=(a,r="")=>a.map(e=>typeof e=="string"?e:e.text()).join(r),Co={lt:"<",gt:">",lbrack:"[",rbrack:"]",lbrace:"{",rbrace:"}",nbsp:" ",amp:"&",quot:'"'},$o=Ve(/&(?:#(\d+|[Xx][\da-fA-F]+)|([lg]t|[LG]T|[lr]brac[ke]|nbsp|amp|AMP|quot|QUOT));/gu,(a,r,e)=>r?String.fromCodePoint(+((/^x/iu.test(r)?"0":"")+r)):Co[e.toLowerCase()]),Wt=a=>$o(a),di=Ve(/&#(\d+|x[\da-f]+);/giu,(a,r)=>String.fromCodePoint(+((/^x/iu.test(r)?"0":"")+r))),gi=Ve(/\n/gu,String.raw`\n`),No={"&":"amp","<":"lt",">":"gt",'"':"quot","\n":"#10"},Eo=a=>Ve(a,r=>`&${No[r]};`),gt=Eo(/[&<>]/gu),$e=(a,r={})=>{let{pre:e="",post:t="",sep:n=""}=r;return e+a.map(i=>i.print()).join(n)+t}});var pi=ko((wa,Io)=>{Io.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},variable:["!","=","pageid","articlepath","server","servername","scriptpath","stylepath"],parserFunction:[{"#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","#cscore":"cscore","#regex":"regex","#regex_var":"regex_var","#regexquote":"regexquote","#regexall":"regexall","#len":"len","#pos":"pos","#rpos":"rpos","#sub":"sub","#count":"count","#replace":"replace","#explode":"explode","#tab":"tab","#seo":"seo","#babel":"babel","#commaseparatedlist":"commaseparatedlist","#coordinates":"coordinates","#lst":"lst","#lsth":"lsth","#lstx":"lstx","#assessment":"assessment","#mentor":"mentor","#property":"property","#target":"target","#section":"section","#section-x":"section-x","#section-h":"section-h","#statements":"statements"},{"!":"!","=":"=","#FORMAL":"formal","#bcp47":"bcp47","#dir":"dir","#interwikilink":"interwikilink","#interlanguagelink":"interlanguagelink","#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:|worldwind://|xmpp:",interwiki:[],img:{},redirection:["#redirect"],variants:[]}});var sn,ui=k(()=>{"use strict";sn=pi()});var Dt,pt,Ut,Ht,on,I,K=k(()=>{"use strict";I=class{constructor(r,e){b(this,Ht);b(this,Dt);b(this,pt);b(this,Ut);y(this,Dt,r),y(this,pt,e)}get start(){return u(this,pt)}get top(){return E(this,Ht,on).call(this).top}get left(){return E(this,Ht,on).call(this).left}};Dt=new WeakMap,pt=new WeakMap,Ut=new WeakMap,Ht=new WeakSet,on=function(){var r;return(r=u(this,Ut))!=null||y(this,Ut,u(this,Dt).getRootNode().posFromIndex(u(this,pt))),u(this,Ut)}});var an,ci,C,$,je,j=k(()=>{"use strict";ve();K();R();an=(a,r,e,t)=>({line:a+e-1,character:(e===1?r:0)+t}),ci=a=>(r,e,t,n,i="error")=>{let{start:s}=e,{top:o,left:l}=e instanceof I?e:new I(r,s),{offsetHeight:p,offsetWidth:g}=r,{startIndex:d,startLine:c,startCol:m}=a(r,s,o,l),{line:h,character:f}=an(c,m,p,g);return{rule:t,message:x.msg(n),severity:i,startIndex:d,endIndex:d+r.toString().length,startLine:c,endLine:h,startCol:m,endCol:f}},C=ci((a,r,e,t)=>{let n=a.getRelativeIndex(),{top:i,left:s}=a.parentNode.posFromIndex(n);return{startIndex:r+n,startLine:e+i,startCol:i?s:t+s}}),$=ci((a,r,e,t)=>({startIndex:r,startLine:e,startCol:t})),je=(a,r,e)=>{if(a)return a[1];let t=r();return e([Ne.rev,t]),t}});var Lo,br,mi=k(()=>{"use strict";Lo=(a,r,e)=>{let[t,...n]=a.split("#");return(!t||t===r)&&n.every(i=>i===e)},br=(a,r,e)=>({type:t,name:n})=>a.split(",").some(i=>Lo(i.trim(),t,n))});var hi,Vt,ut,ct,Xt,Qt,Kt,mt,Tr,ht,ln=k(()=>{"use strict";j();hi=(a,r)=>r.childNodes.slice(0,a).reduce((e,t,n)=>e+t.toString().length+r.getGaps(n),0)+r.getAttribute("padding"),ht=class{constructor(){b(this,mt);te(this,"childNodes",[]);b(this,Vt);b(this,ut);b(this,ct);b(this,Xt);b(this,Qt);b(this,Kt)}get firstChild(){return this.childNodes[0]}get lastChild(){return this.childNodes[this.childNodes.length-1]}get parentNode(){return u(this,Vt)}get nextSibling(){return u(this,ut)}get previousSibling(){return u(this,ct)}get offsetHeight(){return E(this,mt,Tr).call(this).height}get offsetWidth(){return E(this,mt,Tr).call(this).width}getAttribute(r){return r==="padding"?0:this[r]}setAttribute(r,e){switch(r){case"parentNode":y(this,Vt,e),e||(y(this,ut,void 0),y(this,ct,void 0));break;case"nextSibling":y(this,ut,e);break;case"previousSibling":y(this,ct,e);break;default:this[r]=e}}getRootNode(){return je(u(this,Qt),()=>{var r,e;return(e=(r=this.parentNode)==null?void 0:r.getRootNode())!=null?e:this},r=>{let[,e]=r;e.type==="root"&&e.getAttribute("built")&&y(this,Qt,r)})}indexFromPos(r,e){if(r<0||e<0)return;let t=this.getLines();if(r>=t.length)return;let[,n,i]=t[r],s=n+e;return s>i?void 0:s}posFromIndex(r){let{length:e}=String(this);if(r+=r<0?e:0,r>=0&&r<=e){let t=this.getLines(),n=t.findIndex(([,,i])=>r<=i);return{top:n,left:r-t[n][1]}}}getGaps(r){return 0}getRelativeIndex(r){if(r===void 0){let{parentNode:e}=this;return e?hi(e.childNodes.indexOf(this),e):0}return hi(r,this)}getAbsoluteIndex(){return je(u(this,Kt),()=>{let{parentNode:r}=this;return r?r.getAbsoluteIndex()+this.getRelativeIndex():0},r=>{y(this,Kt,r)})}getBoundingClientRect(){return{...E(this,mt,Tr).call(this),...this.getRootNode().posFromIndex(this.getAbsoluteIndex())}}seal(r,e){Object.defineProperty(this,r,{enumerable:!e&&!!this[r],configurable:!0})}is(r){return this.type===r}getLines(){return je(u(this,Xt),()=>{let r=[],e=0;for(let t of String(this).split(`
|
|
2
|
+
`)){let n=e+t.length;r.push([t,e,n]),e=n+1}return r},r=>{y(this,Xt,r)})}};Vt=new WeakMap,ut=new WeakMap,ct=new WeakMap,Xt=new WeakMap,Qt=new WeakMap,Kt=new WeakMap,mt=new WeakSet,Tr=function(){let r=this.getLines(),e=r[r.length-1];return{height:r.length,width:e[2]-e[1]}}});var qe,dn,gn,yr,fi=k(()=>{"use strict";Q();ve();mi();ln();yr=class extends ht{constructor(){super(...arguments);b(this,qe)}get length(){return this.childNodes.length}text(e){return ue(this.childNodes,e)}normalize(){let e=[...this.childNodes],t=n=>{var i,s;e.splice(n,1),(i=e[n-1])==null||i.setAttribute("nextSibling",e[n]),(s=e[n])==null||s.setAttribute("previousSibling",e[n-1])};for(let n=e.length-1;n>=0;n--){let{type:i,data:s}=e[n];i!=="text"||e.length===1||this.getGaps(n-(n&&1))||s===""&&t(n)}this.setAttribute("childNodes",e)}removeAt(e){return pn(this,e,1)[0]}insertAt(e,t=this.length){return pn(this,t,0,[e]),e}closest(e){let t=br(e,this),{parentNode:n}=this;for(;n;){if(t(n))return n;({parentNode:n}=n)}}querySelector(e){let t=br(e,this);return E(this,qe,dn).call(this,t)}querySelectorAll(e){let t=br(e,this);return E(this,qe,gn).call(this,t)}append(...e){for(let t of e)this.insertAt(t)}replaceChildren(...e){for(let t=this.length-1;t>=0;t--)this.removeAt(t);this.append(...e)}setText(e,t=0){t+=t<0?this.length:0;let n=this.childNodes[t],{data:i}=n;return n.replaceData(e),i}toString(e,t=""){return this.childNodes.map(n=>n.toString(e)).join(t)}lint(e=this.getAbsoluteIndex(),t){let n=[];for(let i=0,s=e+this.getAttribute("padding");i<this.length;i++){let o=this.childNodes[i];n.push(...o.lint(s,t)),s+=o.toString().length+this.getGaps(i)}return n}print(e={}){let t=e.class;return this.toString()?(t===""?"":`<span class="wpb-${t!=null?t:this.type}">`)+$e(this.childNodes,e)+(t===""?"":"</span>"):""}json(e,t=this.getAbsoluteIndex()){let n={...this,type:this.type,range:[t,t+this.toString().length],childNodes:[]};for(let i=0,s=t+this.getAttribute("padding");i<this.length;i++){let o=this.childNodes[i],{length:l}=o.toString();n.childNodes.push(o.type==="text"?{data:o.data,range:[s,s+l]}:o.json(void 0,s)),s+=l+this.getGaps(i)}return n}};qe=new WeakSet,dn=function(e){var t;for(let n of this.childNodes){if(n.type==="text")continue;if(e(n))return n;let i=E(t=n,qe,dn).call(t,e);if(i)return i}},gn=function(e){var n;let t=[];for(let i of this.childNodes)i.type!=="text"&&(e(i)&&t.push(i),t.push(...E(n=i,qe,gn).call(n,e)));return t}});var un,xi,Fo,Ro,Po,Bo,jo,qo,cn,kr,bi,Jt,Ti=k(()=>{"use strict";Q();j();R();ln();un=String.raw`[${be}\t]*`,xi=String.raw`<\s*(?:/\s*)?([a-z]\w*)|\{+|\}+|\[{2,}|\[(?![^[]*?\])|((?:^|\])[^[]*?)\]+|(?:rfc|pmid)(?=[-::]?${un}\d)|isbn(?=[-::]?${un}(?:\d(?:${un}|-)){6})`,Fo=new RegExp(String.raw`${xi}|https?[:/]/+`,"giu"),Ro=new RegExp(xi,"giu"),Po=new Set(["attr-value","ext-link-text","link-text"]),Bo={"[":/[[\]]/u,"{":/[{}]/u,"]":/[[\]](?=[^[\]]*$)/u,"}":/[{}](?=[^{}]*$)/u},jo={"<":"tag-like","[":"lonely-bracket","{":"lonely-bracket","]":"lonely-bracket","}":"lonely-bracket",h:"lonely-http",r:"lonely-http",p:"lonely-http",i:"lonely-http"},qo=["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"];try{cn=new RegExp(String.raw`[\p{L}\d_]`,"u")}catch(a){cn=/\w/u}Jt=class extends ht{constructor(e){super();b(this,kr);te(this,"data","");Object.defineProperties(this,{childNodes:{enumerable:!1,configurable:!1},data:{value:e}})}get type(){return"text"}toString(e){var t;return e&&!((t=this.parentNode)!=null&&t.getAttribute("built"))?ne(this.data):this.data}text(){return this.data}lint(e=this.getAbsoluteIndex(),t){var z,B,V;if(t===!1)return[];let{data:n,parentNode:i,nextSibling:s,previousSibling:o}=this;if(!i)throw new Error("An isolated text node cannot be linted!");let{type:l,name:p,parentNode:g}=i,d=!1;if(l==="attr-value"){let{type:X,name:Y,tag:U}=g;if(X!=="ext-attr")d=!0;else if(U==="choose"&&(Y==="before"||Y==="after"))return[]}if(t!=null||(t=l==="free-ext-link"||l==="ext-link-url"||l==="ext-link-text"||l==="image-parameter"&&p==="link"||d?Ro:Fo),n.search(t)===-1)return[];t.lastIndex=0;let c=[],m=s==null?void 0:s.type,h=s==null?void 0:s.name,f=o==null?void 0:o.type,v=this.getRootNode(),T=v.toString(),{ext:S,html:w}=v.getAttribute("config"),{top:L,left:N}=v.posFromIndex(e),q=new Set(["onlyinclude","noinclude","includeonly",...S,...w[0],...w[1],...w[2],...qo]);for(let X=t.exec(n);X;X=t.exec(n)){let[,Y,U]=X,{index:W}=X,Z=X[0].toLowerCase();if(U&&U!=="]"){let{length:ae}=U;W+=ae,Z=Z.slice(ae)}let{0:F,length:ke}=Z,ee=F==="r"||F==="p"||F==="i";if(F==="<"&&!q.has(Y.toLowerCase())||F==="["&&l==="ext-link-text"&&(/&(?:rbrack|#93|#x5[Dd];);/u.test(n.slice(W+1))||s!=null&&s.is("ext")&&h==="nowiki"&&((z=s.innerText)!=null&&z.includes("]")))||ee&&(!i.getAttribute("plain")||Po.has(l)))continue;F==="]"&&(W||ke>1)&&t.lastIndex--;let le=e+W,Ue=le+ke,Pe=T[Ue],fr=T[le-1],en=ke>1&&!(F==="<"&&!/[\s/>]/u.test(Pe!=null?Pe:"")||d&&(F==="["||F==="]")||ee&&l==="parameter-value")||F==="{"&&(Pe===F||fr==="-")||F==="}"&&(fr===F||Pe==="-")||F==="["&&(Pe===F||l==="ext-link-text"||m==="free-ext-link"&&!n.slice(W+1).trim())||F==="]"&&(fr===F||f==="free-ext-link"&&!n.slice(0,W).includes("]"))?"error":"warning",tn=F==="{"||F==="[";if(en==="warning"&&(tn||(F==="]"||F==="}"))){let ae=Bo[F],rn=tn?n.slice(W+1):n.slice(0,W);if(F==="{"&&((B=ae.exec(rn))==null?void 0:B[0])==="}"||F==="}"&&((V=ae.exec(rn))==null?void 0:V[0])==="{")continue;if(!rn.includes(F)){let Kn=tn?"nextSibling":"previousSibling",He=this[Kn];for(;He&&(He.type!=="text"||!ae.test(He.data));)He=He[Kn];if(He&&ae.exec(He.data)[0]!==F)continue}}ee&&(Z=Z.toUpperCase());let Vn=this.posFromIndex(W),{line:Xn,character:Qn}=an(L,N,Vn.top+1,Vn.left),at={rule:jo[F],message:x.msg('lonely "$1"',ee||F==="h"?Z:F),severity:en,startIndex:le,endIndex:Ue,startLine:Xn,endLine:Xn,startCol:Qn,endCol:Qn+ke};if(F==="<")at.suggestions=[{desc:"escape",range:[le,le+1],text:"<"}];else if(F==="h"&&l!=="link-text"&&cn.test(fr||""))at.suggestions=[{desc:"whitespace",range:[le,le],text:" "}];else if(F==="["&&l==="ext-link-text"){let ae=i.getAbsoluteIndex()+i.toString().length;at.suggestions=[{desc:"escape",range:[ae,ae+1],text:"]"}]}else if(F==="]"&&f==="free-ext-link"&&en==="error"){let ae=e-o.toString().length;at.fix={range:[ae,ae],text:"[",desc:"left bracket"}}else ee&&(at.suggestions=[...X[0]===Z?[]:[{desc:"uppercase",range:[le,Ue],text:Z}],...Pe===":"||Pe==="\uFF1A"?[{desc:"whitespace",range:[Ue,Ue+1],text:" "}]:[]]);c.push(at)}return c}replaceData(e){E(this,kr,bi).call(this,e)}print(){return gt(this.data)}};kr=new WeakSet,bi=function(e){this.setAttribute("data",e)}});var ce,Xe=k(()=>{"use strict";ve();ce=(a=!0,r=!0)=>(e,t)=>{class n extends e{text(){return""}lint(s){return a?[]:super.lint(s)}}return vr(n,e),n}});var Yt,me,ft=k(()=>{"use strict";P();me=class extends A{constructor(e,t,n,i,s,o){super(e,i,s,o);b(this,Yt);y(this,Yt,n)}get type(){return u(this,Yt)}lint(e=this.getAbsoluteIndex()){return super.lint(e,!1)}};Yt=new WeakMap});var xt,M,Ee=k(()=>{"use strict";P();M=class extends A{constructor(e,t,n,i,s){super(e,n,i,s);b(this,xt);y(this,xt,t)}get type(){return u(this,xt)}set type(e){y(this,xt,e)}};xt=new WeakMap});var Oo,Qe,Te,Oe,Ae,Zt=k(()=>{"use strict";j();Q();K();R();P();Ee();Oo=a=>a==="redirect-target"||a==="link",Ae=class extends A{constructor(e,t,n=x.getConfig(),i=[],s="|"){super(void 0,n,i,{});b(this,Qe,!0);b(this,Te);b(this,Oe);if(this.insertAt(new M(e,"link-target",n,i,{})),t!==void 0){let o=new A(t,n,i,{});o.type="link-text",o.setAttribute("stage",10),this.insertAt(o)}y(this,Te,s)}afterBuild(){y(this,Oe,this.getTitle()),u(this,Te).includes("\0")&&y(this,Te,this.buildFromStr(u(this,Te),0)),this.setAttribute("name",u(this,Oe).title),super.afterBuild()}setAttribute(e,t){e==="bracket"?y(this,Qe,t):e==="title"?y(this,Oe,t):super.setAttribute(e,t)}toString(e){let t=super.toString(e,u(this,Te));return u(this,Qe)?`[[${t}]]`:t}text(){let e=super.text("|");return u(this,Qe)?`[[${e}]]`:e}getAttribute(e){return e==="title"?u(this,Oe):e==="padding"?2:super.getAttribute(e)}getGaps(e){return e===0?u(this,Te).length:1}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),{childNodes:[i,s],type:o}=this,{encoded:l,fragment:p}=u(this,Oe),g=new I(this,e);if(i.childNodes.some(({type:d})=>d==="template")&&n.push(C(i,g,"unknown-page","template in an internal link target","warning")),l){let d=C(i,g,"url-encoding","unnecessary URL encoding in an internal link");d.suggestions=[{desc:"decode",range:[d.startIndex,d.endIndex],text:Be(i.text())}],n.push(d)}if(o==="link"||o==="category"){let d=s==null?void 0:s.childNodes.find(c=>c.type==="text"&&c.data.includes("|"));if(d){let c=C(s,g,"pipe-like",'additional "|" in the link text',"warning"),m=c.startIndex+d.getRelativeIndex();c.suggestions=[{desc:"escape",range:[m,m+d.data.length],text:d.data.replace(/\|/gu,"|")}],n.push(c)}}if(p!==void 0&&!Oo(o)){let d=C(i,g,"no-ignored","useless fragment"),c=i.childNodes.find(m=>m.type==="text"&&m.data.includes("#"));c&&(d.fix={range:[d.startIndex+c.getRelativeIndex()+c.data.indexOf("#"),d.endIndex],text:"",desc:"remove"}),n.push(d)}return n}getTitle(e){return this.normalizeTitle(this.firstChild.toString(!0),0,e,!0,!0)}print(){return super.print(u(this,Qe)?{pre:"[[",post:"]]",sep:u(this,Te)}:{sep:u(this,Te)})}};Qe=new WeakMap,Te=new WeakMap,Oe=new WeakMap});var ie,_e=k(()=>{"use strict";P();ie=class extends A{get innerText(){return this.firstChild.data}constructor(r="",e,t){super(r,e,t)}}});var yi,mn,_o,D,Me=k(()=>{"use strict";Xe();_e();yi=[ce()];D=class extends(_o=ie){get type(){return"noinclude"}toString(r){return r?"":super.toString()}};mn=de(_o),D=pe(mn,0,"NoincludeToken",yi,D),ge(mn,1,D)});var Ar,ki=k(()=>{"use strict";j();Zt();Me();Ar=class extends Ae{get type(){return"redirect-target"}constructor(r,e,t,n){super(r,void 0,t,n),e!==void 0&&this.insertAt(new D(e,t,n))}getTitle(){return this.normalizeTitle(this.firstChild.toString(),0,!0,!0)}lint(r=this.getAbsoluteIndex()){let e=super.lint(r,!1);if(this.length===2){let t=C(this.lastChild,{start:r},"no-ignored","useless link text");t.startIndex--,t.startCol--,t.fix={range:[t.startIndex,t.endIndex],text:"",desc:"remove"},e.push(t)}return e}}});var vi,ze,bt,hn,Mo,Ke,Ai=k(()=>{"use strict";Xe();R();P();ft();ki();vi=[ce(!1,!1)];Ke=class extends(Mo=A){constructor(e,t,n,i,s,o=x.getConfig(),l=[]){super(void 0,o,l);b(this,ze);b(this,bt);y(this,ze,e),y(this,bt,s);let p=new RegExp(String.raw`^(?:${o.redirection.join("|")})\s*(?::\s*)?$`,"iu");this.append(new me(t,p,"redirect-syntax",o,l,{}),new Ar(n,i==null?void 0:i.slice(1),o,l))}get type(){return"redirect"}getAttribute(e){return e==="padding"?u(this,ze).length:super.getAttribute(e)}toString(e){return u(this,ze)+super.toString(e)+u(this,bt)}lint(e=this.getAbsoluteIndex()){return this.lastChild.lint(e+u(this,ze).length+this.firstChild.toString().length)}print(){return super.print({pre:u(this,ze),post:u(this,bt)})}};hn=de(Mo),ze=new WeakMap,bt=new WeakMap,Ke=pe(hn,0,"RedirectToken",vi,Ke),ge(hn,1,Ke)});var Si={};se(Si,{parseRedirect:()=>zo});var zo,wi=k(()=>{"use strict";R();Ai();zo=(a,r,e)=>{var n;(n=r.regexRedirect)!=null||(r.regexRedirect=new RegExp(String.raw`^(\s*)((?:${r.redirection.join("|")})\s*(?::\s*)?)\[\[([^\n|\]]+)(\|.*?)?\]\](\s*)`,"iu"));let t=r.regexRedirect.exec(a);return t&&x.normalizeTitle(t[3],0,!1,r,!0,!0).valid?(a=`\0${e.length}o\x7F${a.slice(t[0].length)}`,new Ke(...t.slice(1),r,e),a):!1}});var Sr,Ci=k(()=>{"use strict";P();Sr=class extends A{get type(){return"onlyinclude"}toString(r){return`<onlyinclude>${super.toString(r)}</onlyinclude>`}getAttribute(r){return r==="padding"?13:r==="plain"||super.getAttribute(r)}print(){return super.print({pre:'<span class="wpb-ext"><onlyinclude></span>',post:'<span class="wpb-ext"></onlyinclude></span>'})}}});var Ge,Tt,fn=k(()=>{"use strict";P();Tt=class extends A{constructor(e,t,n,i,s,o=[]){super(void 0,s);b(this,Ge);te(this,"closed");te(this,"selfClosing");this.setAttribute("name",e.toLowerCase()),y(this,Ge,[e,i||e]),this.closed=i!=="",this.selfClosing=i===void 0,this.append(t,n);let l=typeof t=="string"?-1:o.indexOf(t);o.splice(l===-1?1/0:l,0,this)}get innerText(){return this.selfClosing?void 0:this.lastChild.text()}toString(e){let{selfClosing:t,firstChild:n,lastChild:i}=this,[s,o]=u(this,Ge);return t?`<${s}${n.toString(e)}/>`:`<${s}${n.toString(e)}>${i.toString(e)}${this.closed?`</${o}>`:""}`}text(){let[e,t]=u(this,Ge);return this.selfClosing?`<${e}${this.firstChild.text()}/>`:`<${e}${super.text(">")}${this.closed?`</${t}>`:""}`}getAttribute(e){return e==="padding"?u(this,Ge)[0].length+1:super.getAttribute(e)}getGaps(){return 1}print(){let[e,t]=u(this,Ge);return super.print(this.selfClosing?{pre:`<${e}`,post:"/>"}:{pre:`<${e}`,sep:">",post:this.closed?`</${t}>`:""})}};Ge=new WeakMap});var $i,xn,Go,Je,Ni=k(()=>{"use strict";j();K();Xe();R();fn();$i=[ce(!1)];Je=class extends(Go=Tt){get type(){return"include"}constructor(r,e="",t,n,i,s){super(r,e,t!=null?t:"",t===void 0||n!=null?n:"",i,s)}toString(r){return r?"":super.toString()}lint(r=this.getAbsoluteIndex()){let e=[],{firstChild:t,closed:n,name:i}=this,s=new I(this,r);if(t.data.trim()){let o=C(t,s,"no-ignored","useless attribute","warning");o.suggestions=[{desc:"remove",range:[o.startIndex,o.endIndex],text:""}],e.push(o)}if(!n){let o=$(this,s,"unclosed-comment",x.msg("unclosed $1",`<${i}>`));o.suggestions=[{desc:"close",range:[o.endIndex,o.endIndex],text:`</${i}>`}],e.push(o)}return e}};xn=de(Go),Je=pe(xn,0,"IncludeToken",$i,Je),ge(xn,1,Je)});var H,Ei,Ii,Cr,bn,Li,yt,Fi,Ri,Pi,wr,Bi,ji,qi,Oi,_i=k(()=>{"use strict";H=new Set(["align"]),Ei=new Set(["cite"]),Ii=new Set(["cite","datetime"]),Cr=new Set(["width"]),bn=new Set(["axis","align","bgcolor","height","width","valign"]),Li=new Set([...bn,"abbr","headers","scope","rowspan","colspan"]),yt=new Set(["type"]),Fi=new Set(["summary","align","bgcolor","cellpadding","cellspacing","frame","rules","width"]),Ri=new Set(["clear"]),Pi=new Set(["bgcolor","align","valign"]),wr=new Set,Bi=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"]),ji={div:H,h1:H,h2:H,h3:H,h4:H,h5:H,h6:H,blockquote:Ei,q:Ei,p:H,br:Ri,pre:Cr,ins:Ii,del:Ii,ul:yt,ol:new Set(["type","start","reversed"]),li:new Set(["type","value"]),table:new Set([...Fi,"border"]),caption:H,tr:Pi,td:Li,th:Li,img:new Set(["alt","src","width","height","srcset"]),font:new Set(["size","color","face"]),hr:Cr,data:new Set(["value"]),time:new Set(["datetime"]),meta:new Set(["itemprop","content"]),link:new Set(["itemprop","href","title"]),gallery:yt,poem:H,categorytree:H,combooption:H},qi={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:wr,indicator:new Set(["name"]),langconvert:new Set(["from","to"]),ref:new Set(["group","name","extends","follow","dir"]),references:new Set(["group","responsive"]),charinsert:new Set(["label"]),choose:new Set(["uncached","before","after"]),option:new Set(["weight"]),imagemap:wr,inputbox:wr,templatestyles:new Set(["src","wrapper"]),dynamicpagelist:wr,poll:new Set(["id","show-results-before-voting"]),sm2:yt,flashmp3:yt,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"])},Oi={table:Fi,td:new Set([...bn,"scope"]),th:bn,br:Ri,caption:H,div:H,hr:Cr,h1:H,h2:H,h3:H,h4:H,h5:H,h6:H,li:yt,p:H,pre:Cr,tr:Pi,ul:yt}});var Wo,er,kt,re,Se,vt,Mi=k(()=>{"use strict";j();Q();_i();K();R();P();Ee();Wo=/expression|(?:accelerator|-o-link(?:-source)?|-o-replace)\s*:|(?:url|image(?:-set)?)\s*\(|attr\s*\([^)]+[\s,]url/u,vt=class extends A{constructor(e,t,n,i="",s,o=[],l=x.getConfig(),p=[]){let g=new M(n,"attr-key",l,p),d;if(n==="title"||t==="img"&&n==="alt")d=new A(s,l,p,{}),d.type="attr-value",d.setAttribute("stage",10);else if(t==="gallery"&&n==="caption"||t==="choose"&&(n==="before"||n==="after")){let c={...l,excludes:[...l.excludes,"heading","html","table","hr","list"]};d=new A(s,c,p,{}),d.type="attr-value",d.setAttribute("stage",1)}else d=new M(s,"attr-value",l,p,{});super(void 0,l,p);b(this,er);b(this,kt);b(this,re);b(this,Se);y(this,er,e),this.append(g,d),y(this,re,i),y(this,Se,[...o]),y(this,kt,t),this.setAttribute("name",ne(n).trim().toLowerCase())}get type(){return u(this,er)}get tag(){return u(this,kt)}get balanced(){return!u(this,re)||u(this,Se)[0]===u(this,Se)[1]}afterBuild(){u(this,re).includes("\0")&&y(this,re,this.buildFromStr(u(this,re),0)),this.parentNode&&y(this,kt,this.parentNode.name),this.setAttribute("name",this.firstChild.toString(!0).trim().toLowerCase()),super.afterBuild()}toString(e){let[t="",n=""]=u(this,Se);return u(this,re)?super.toString(e,u(this,re)+t)+n:this.firstChild.toString(e)}text(){return u(this,re)?`${super.text(`${u(this,re).trim()}"`)}"`:this.firstChild.text()}getGaps(){var e,t;return u(this,re)?u(this,re).length+((t=(e=u(this,Se)[0])==null?void 0:e.length)!=null?t:0):0}lint(e=this.getAbsoluteIndex(),t){var v;let n=super.lint(e,t),{balanced:i,firstChild:s,lastChild:o,type:l,name:p,tag:g}=this,d=this.getValue(),c=new I(this,e);if(!i){let T=C(o,c,"unclosed-quote",x.msg("unclosed $1","quotes"),"warning");T.startIndex--,T.startCol--,T.suggestions=[{range:[T.endIndex,T.endIndex],text:u(this,Se)[0],desc:"close"}],n.push(T)}let m=qi[g],h=ji[g],{length:f}=this.toString();if(!(m!=null&&m.has(p))&&!(h!=null&&h.has(p))&&(l==="ext-attr"?m||h:!/\{\{[^{]+\}\}/u.test(p))&&(l==="ext-attr"&&!h||!/^(?:xmlns:[\w:.-]+|data-(?!ooui|mw|parsoid)[^:]*)$/u.test(p)&&(g==="meta"||g==="link"||!Bi.has(p)))){let T=C(s,c,"illegal-attr","illegal attribute name");T.suggestions=[{desc:"remove",range:[e,e+f],text:""}],n.push(T)}else if((v=Oi[g])!=null&&v.has(p))n.push(C(s,c,"obsolete-attr","obsolete attribute","warning"));else if(p==="style"&&typeof d=="string"&&Wo.test(d))n.push(C(o,c,"insecure-style","insecure style"));else if(p==="tabindex"&&typeof d=="string"&&d!=="0"){let T=C(o,c,"illegal-attr","nonzero tabindex");T.suggestions=[{desc:"remove",range:[e,e+f],text:""},{desc:"0 tabindex",range:[T.startIndex,T.endIndex],text:"0"}],n.push(T)}return n}getValue(){return u(this,re)?this.lastChild.text().trim():this.type==="ext-attr"||""}print(){let[e="",t=""]=u(this,Se);return u(this,re)?super.print({sep:gt(u(this,re))+e,post:t}):super.print()}};er=new WeakMap,kt=new WeakMap,re=new WeakMap,Se=new WeakMap});var zi,Do,Tn,tr,We,$r=k(()=>{"use strict";j();Q();K();R();P();Ee();Mi();zi=a=>a.slice(0,-1),Do=a=>`${zi(a)}-dirty`;try{Tn=new RegExp(String.raw`[\p{L}\d]`,"u")}catch(a){Tn=/[^\W_]/u}We=class extends A{constructor(e,t,n,i=x.getConfig(),s=[]){super(void 0,i,s,{});b(this,tr);if(y(this,tr,t),this.setAttribute("name",n),e){let o=/([^\s/](?:(?!\0\d+~\x7F)[^\s/=])*)(?:((?:\s(?:\s|\0\d+[cn]\x7F)*)?(?:=|\0\d+~\x7F)(?:\s|\0\d+[cn]\x7F)*)(?:(["'])([\s\S]*?)(\3|$)|(\S*)))?/gu,l="",p=o.exec(e),g=0,d=()=>{l&&(super.insertAt(new M(l,Do(t),i,s,{})),l="")};for(;p;){let{index:c,0:m,1:h,2:f,3:v,4:T,5:S,6:w}=p;if(l+=e.slice(g,c),/^(?:[\w:]|\0\d+t\x7F)(?:[\w:.-]|\0\d+t\x7F)*$/u.test(ne(h).trim())){let L=T!=null?T:w,N=[v,S],q=new vt(zi(t),n,h,f,L,N,i,s);d(),super.insertAt(q)}else l+=m;({lastIndex:g}=o),p=o.exec(e)}l+=e.slice(g),d()}}get type(){return u(this,tr)}afterBuild(){let{parentNode:e}=this;(e==null?void 0:e.type)==="td"&&e.subtype==="caption"&&this.setAttribute("name","caption"),super.afterBuild()}getAttrTokens(e){return this.childNodes.filter(t=>t instanceof vt&&(!e||t.name===e.toLowerCase().trim()))}getAttrToken(e){let t=this.getAttrTokens(e);return t[t.length-1]}getAttr(e){var t;return(t=this.getAttrToken(e))==null?void 0:t.getValue()}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),{parentNode:i,childNodes:s}=this,o=new Map,l=new Set,p=new I(this,e);if((i==null?void 0:i.type)==="html"&&i.closing&&this.text().trim()){let g=$(this,p,"no-ignored","attributes of a closing tag"),d=i.getAbsoluteIndex();g.suggestions=[{desc:"remove",range:[e,g.endIndex],text:""},{desc:"open",range:[d+1,d+2],text:""}],n.push(g)}for(let g of s)if(g instanceof vt){let{name:d}=g;o.has(d)?(l.add(d),o.get(d).push(g)):o.set(d,[g])}else{let d=g.text().trim();if(d){let c=C(g,p,"no-ignored","containing invalid attribute",Tn.test(d)?"error":"warning");c.suggestions=[{desc:"remove",range:[c.startIndex,c.endIndex],text:" "}],n.push(c)}}if(l.size>0)for(let g of l){let d=o.get(g).map(c=>{let m=c.getValue();return[c,m===!0?"":m]});n.push(...d.map(([c,m],h)=>{let f=C(c,p,"no-duplicate",x.msg("duplicated $1 attribute",g)),v={desc:"remove",range:[f.startIndex,f.endIndex],text:""};return!m||d.slice(0,h).some(([,T])=>T===m)?f.fix=v:f.suggestions=[v],f}))}return n}print(){return this.toString()?`<span class="wpb-${this.type}">${this.childNodes.map(e=>e.print(e instanceof M?{class:e.toString().trim()&&"attr-dirty"}:void 0)).join("")}</span>`:""}};tr=new WeakMap});var Nr,Gi=k(()=>{"use strict";R();P();Me();Nr=class extends A{get type(){return"ext-inner"}constructor(r,e=x.getConfig(),t=[]){if(r){let n=/<nowiki>/giu,i=/<\/nowiki>/giu,{length:s}=n.source,o=n.exec(r);o&&(i.lastIndex=o.index+s);let l=i.exec(r),p=0,g="";for(;o&&l;)new D(o[0],e,t),new D(l[0],e,t),g+=`${r.slice(p,o.index)}\0${t.length-1}n\x7F${r.slice(o.index+s,l.index)}\0${t.length}n\x7F`,p=l.index+s+1,n.lastIndex=p,o=n.exec(r),o&&(i.lastIndex=o.index+s),l=i.exec(r);r=g+r.slice(p)}super(r,e,t,{}),this.setAttribute("stage",10)}getAttribute(r){return r==="plain"||super.getAttribute(r)}lint(r=this.getAbsoluteIndex()){return super.lint(r,/<\s*\/\s*(pre)\b/giu)}}});var At,yn=k(()=>{"use strict";j();K();rr();R();P();Ee();At=class extends A{get type(){return"ext-inner"}constructor(r,e,t=x.getConfig(),n=[],i){if(super(void 0,t,n,{}),e){let s=M;this.append(...e.split(`
|
|
3
|
+
`).map(o=>i?o:Ye(o,t,n,r)).map(o=>new s(o,"param-line",t,n,{})))}n.splice(n.indexOf(this),1),n.push(this)}toString(r){return super.toString(r,`
|
|
4
|
+
`)}text(){return super.text(`
|
|
5
|
+
`)}getGaps(){return 1}lint(r=this.getAbsoluteIndex()){let e=new I(this,r),t=x.msg("invalid parameter of <$1>",this.name),n=[];for(let i of this.childNodes){let s=i.childNodes.filter(({type:o})=>o!=="comment"&&o!=="include"&&o!=="noinclude");if(s.some(({type:o})=>o==="ext"))n.push(C(i,e,"no-ignored",t));else{let o=s.findIndex(({type:p})=>p!=="text"),l=s.slice(0,o===-1?void 0:o).map(String).join("");if(l&&!(o===-1?/^[a-z]+(?:\[\])?\s*=/iu:/^[a-z]+(?:\[\])?\s*(?:=|$)/iu).test(l)){let p=C(i,e,"no-ignored",t);p.suggestions=[{desc:"remove",range:[p.startIndex,p.endIndex],text:""}],n.push(p)}else n.push(...i.lint(r,!1))}r+=i.toString().length+1}return n}print(){return super.print({sep:`
|
|
6
|
+
`})}}});var nr,St,Er,wt,kn=k(()=>{"use strict";j();ve();K();R();P();ft();wt=class extends A{constructor(e,t,n=x.getConfig(),i=[]){super(void 0,n,i);b(this,St);b(this,nr);y(this,nr,e);let s=new A(t[0],n,i);s.type="heading-title",s.setAttribute("stage",2);let o=new me(t[1],/^\s*$/u,"heading-trail",n,i,{});this.append(s,o)}get type(){return"heading"}get level(){return u(this,nr)}toString(e){let t=u(this,St,Er);return t+this.firstChild.toString(e)+t+this.lastChild.toString(e)}text(){let e=u(this,St,Er);return e+this.firstChild.text()+e}getAttribute(e){return e==="padding"?this.level:super.getAttribute(e)}getGaps(){return this.level}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),{firstChild:i,level:s}=this,o=i.toString(),l=o.startsWith("="),p=l||o.endsWith("="),g=i.childNodes.filter(Ct("quote")),d=g.filter(({bold:f})=>f),c=g.filter(({italic:f})=>f),m=new I(this,e);if(this.level===1){let f=C(i,m,"h1","<h1>");p||(f.suggestions=[{desc:"h2",range:[f.startIndex,f.endIndex],text:`=${o}=`}]),n.push(f)}if(p){let f=C(i,m,"unbalanced-header",x.msg("unbalanced $1 in a section header",'"="'));if(o!=="=")if(l){let[v]=/^=+/u.exec(o);f.suggestions=[{desc:`h${s}`,range:[f.startIndex,f.startIndex+v.length],text:""},{desc:`h${s+v.length}`,range:[f.endIndex,f.endIndex],text:v}]}else{let v=/[^=](=+)$/u.exec(o)[1];f.suggestions=[{desc:`h${s}`,range:[f.endIndex-v.length,f.endIndex],text:""},{desc:`h${s+v.length}`,range:[f.startIndex,f.startIndex],text:v}]}n.push(f)}this.closest("html-attrs,table-attrs")&&n.push($(this,m,"parsing-order","section header in a HTML tag"));let h=this.getRootNode().toString();if(d.length%2){let f=C(d[d.length-1],{...m,start:e+s,left:m.left+s},"format-leakage",x.msg("unbalanced $1 in a section header","bold apostrophes")),v=e+s+o.length;h.slice(f.endIndex,v).trim()?f.suggestions=[{desc:"close",range:[v,v],text:"'''"}]:f.fix={desc:"remove",range:[f.startIndex,f.endIndex],text:""},n.push(f)}if(c.length%2){let f=C(c[c.length-1],{start:e+s},"format-leakage",x.msg("unbalanced $1 in a section header","italic apostrophes")),v=e+s+o.length;f.fix=h.slice(f.endIndex,v).trim()?{desc:"close",range:[v,v],text:"''"}:{desc:"remove",range:[f.startIndex,f.endIndex],text:""},n.push(f)}return n}print(){let e=u(this,St,Er);return super.print({pre:e,sep:e})}json(){let e=super.json();return e.level=this.level,e}};nr=new WeakMap,St=new WeakSet,Er=function(){return"=".repeat(this.level)}});var Uo,Ir,Wi=k(()=>{"use strict";Q();j();R();P();Uo=new RegExp(`https?://${we}${Ce}$`,"iu"),Ir=class extends A{get type(){return"parameter"}get anon(){return this.firstChild.length===0}constructor(r,e,t=x.getConfig(),n=[]){super(void 0,t,n);let i=new A(typeof r=="number"?void 0:r,t,n,{}),s=new A(e,t,n);i.type="parameter-key",i.setAttribute("stage",2),s.type="parameter-value",s.setAttribute("stage",2),this.append(i,s)}trimName(r,e=!0){let t=(typeof r=="string"?r:r.toString(!0)).replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1");return this.setAttribute("name",t),t}afterBuild(){if(!this.anon){let{parentNode:r,firstChild:e}=this,t=this.trimName(e);r&&r.getArgs(t,!1,!1).add(this)}super.afterBuild()}toString(r){return this.anon?this.lastChild.toString(r):super.toString(r,"=")}text(){return this.anon?this.lastChild.text():super.text("=")}getGaps(){return this.anon?0:1}lint(r=this.getAbsoluteIndex(),e){var s;let t=super.lint(r,e),{firstChild:n}=this,i=(s=Uo.exec(n.text()))==null?void 0:s[0];if(i&&new URL(i).search){let o=C(n,{start:r},"unescaped","unescaped query string in an anonymous parameter");o.startIndex=o.endIndex,o.startLine=o.endLine,o.startCol=o.endCol,o.endIndex++,o.endCol++,o.fix={range:[o.startIndex,o.endIndex],text:"{{=}}",desc:"escape"},t.push(o)}return t}print(){return super.print({sep:this.anon?"":"="})}json(){let r=super.json();return r.anon=this.anon,r}}});var sr,Ze,et,tt,vn,Di,ir,Ui=k(()=>{"use strict";Q();j();ve();K();R();P();Wi();Ee();ft();ir=class extends A{constructor(e,t,n=x.getConfig(),i=[]){var f,v;let s,o=/^(?:\s|\0\d+[cn]\x7F)*\0(\d+)h\x7F(?:\s|\0\d+[cn]\x7F)*/u.exec(e);o&&(s=Number(o[1]),e=e.replace(`\0${s}h\x7F`,i[s].toString().replace(/^\n/u,"")));super(void 0,n,i,{});b(this,tt);te(this,"modifier","");b(this,sr,"template");b(this,Ze,!1);b(this,et,new Map);let{parserFunction:[l,p],variable:g}=n,d=(f=/^(?:\s|\0\d+[cn]\x7F)*\0\d+s\x7F/u.exec(e))==null?void 0:f[0];if(d)this.setAttribute("modifier",d),e=e.slice(d.length);else if(e.includes(":")){let[T,...S]=e.split(":"),[w]=/^(?:\s|\0\d+[cn]\x7F)*/u.exec((v=S[0])!=null?v:"");this.setModifier(`${T}:${w}`)&&(e=S.join(":").slice(w.length))}let c=e.includes(":");if(c||t.length===0&&!u(this,Ze)){let T=e.indexOf(":"),S=T===-1?e:e.slice(0,T),w=T===-1?void 0:e.slice(T+1),L=ne(S),N=L[w===void 0?"trim":"trimStart"](),q=N.toLowerCase(),z=Array.isArray(p),B=z?p.includes(N):Object.prototype.hasOwnProperty.call(p,N),V=!z&&B?p[N]:Object.prototype.hasOwnProperty.call(l,q)&&l[q];if(z&&B||g.includes(V)||c&&V){this.setAttribute("name",V||q.replace(/^#/u,"")),y(this,sr,"magic-word");let Y=new RegExp(String.raw`^\s*${N}\s*$`,B?"u":"iu"),U=new me(S,Y,"magic-word-name",n,i,{});if(super.insertAt(U),w!==void 0&&t.unshift([w]),this.name==="invoke")for(let W=0;W<2;W++){let Z=t.shift();if(!Z)break;let F=new M(Z.join("="),`invoke-${W?"function":"module"}`,n,i);super.insertAt(F)}}}if(this.type==="template"){let T=ne(e).trim();if(!this.normalizeTitle(T,10,!0).valid)throw i.pop(),new SyntaxError("Invalid template name");let S=new M(e,"template-name",n,i,{});super.insertAt(S)}typeof s=="number"&&(i[s]=void 0);let m=this.isTemplate(),h=1;for(let[T,S]of t.entries())m||this.name==="switch"&&T>0||this.name==="tag"&&T>1||(S[0]=S.join("="),S.length=1),S.length===1&&(S.unshift(h),h++),this.insertAt(new Ir(...S,n,i));this.seal("modifier")}get type(){return u(this,sr)}setModifier(e){let{parserFunction:[,,t,n]}=this.getAttribute("config"),i=ne(e).trim();if(e&&!i.endsWith(":"))return!1;let s=i.slice(0,-1).toLowerCase(),o=t.includes(s),l=n.includes(s);return u(this,Ze)&&o||!u(this,Ze)&&(l||e==="")||(Ne.running||this.length>1)&&(o||l||e==="")?(this.setAttribute("modifier",e),y(this,Ze,o),!!e):!1}isTemplate(){return this.type==="template"||this.name==="invoke"}afterBuild(){this.modifier.includes("\0")&&this.setAttribute("modifier",this.buildFromStr(this.modifier,0)),super.afterBuild(),this.isTemplate()&&this.type==="template"&&this.setAttribute("name",E(this,tt,vn).call(this).title)}toString(e){return`{{${this.modifier}${this.type==="magic-word"?this.firstChild.toString(e)+(this.length===1?"":":")+this.childNodes.slice(1).map(t=>t.toString(e)).join("|"):super.toString(e,"|")}}}`}text(){let{childNodes:e,length:t,firstChild:n,modifier:i,type:s,name:o}=this;return s==="magic-word"&&o==="vardefine"?"":`{{${i}${s==="magic-word"?n.text()+(t===1?"":":")+ue(e.slice(1),"|"):super.text("|")}}}`}getAttribute(e){switch(e){case"padding":return this.modifier.length+2;default:return super.getAttribute(e)}}getGaps(){return 1}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t);if(!this.isTemplate())return n;let{type:i,childNodes:s,length:o}=this,l=new I(this,e),p=i==="magic-word";if(p&&!E(this,tt,vn).call(this).valid)n.push(C(s[1],l,"invalid-invoke","illegal module name"));else{let d=s[p?1:0],c=d.childNodes.find(m=>m.type==="text"&&Wt(m.data).includes("#"));if(c){let m=C(d,l,"no-ignored","useless fragment");m.fix={range:[m.startIndex+c.getRelativeIndex()+c.data.indexOf("#"),m.endIndex],text:"",desc:"remove"},n.push(m)}}if(p&&o===2)return n.push($(this,l,"invalid-invoke","missing module function")),n;let g=this.getDuplicatedArgs().filter(([,d])=>!d[0].querySelector("ext"));if(g.length>0)for(let[,d]of g)n.push(...d.map(c=>{let m=C(c,l,"no-duplicate","duplicated parameter");return m.suggestions=[{desc:"remove",range:[m.startIndex-1,m.endIndex],text:""}],m}));return n}insertAt(e,t=this.length){return super.insertAt(e,t),e.anon?E(this,tt,Di).call(this,e):e.name&&this.getArgs(e.name,!1,!1).add(e),e}getAllArgs(){return this.childNodes.filter(Ct("parameter"))}getAnonArgs(){return this.getAllArgs().filter(({anon:e})=>e)}getArgs(e,t,n=!0){let i=String(e).replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1"),s;return u(this,et).has(i)?s=u(this,et).get(i):(s=new Set(this.getAllArgs().filter(({name:o})=>i===o)),u(this,et).set(i,s)),s}getDuplicatedArgs(){return[...u(this,et)].filter(([,{size:e}])=>e>1).map(([e,t])=>[e,[...t]])}getPossibleValues(){let{type:e,name:t,childNodes:n}=this;if(e==="template")throw new Error("TranscludeToken.getPossibleValues method is only for specific magic words!");let i;switch(t){case"if":case"ifexist":case"ifexpr":case"iferror":i=2;break;case"ifeq":i=3;break;default:throw new Error("TranscludeToken.getPossibleValues method is only for specific magic words!")}let s=n.slice(i,i+2).map(({childNodes:[,o]})=>o);for(let o=0;o<s.length;){let{length:l,0:p}=s[o].childNodes.filter(g=>g.text().trim());if(l===0)s.splice(o,1);else if(l>1||p.type!=="magic-word")o++;else try{let g=p.getPossibleValues();s.splice(o,1,...g),o+=g.length}catch(g){o++}}return s}print(){let{childNodes:e,length:t,firstChild:n,modifier:i,type:s}=this;return`<span class="wpb-${s}">{{${gt(i)}${s==="magic-word"?n.print()+(t===1?"":":")+$e(e.slice(1),{sep:"|"}):$e(e,{sep:"|"})}}}</span>`}};sr=new WeakMap,Ze=new WeakMap,et=new WeakMap,tt=new WeakSet,vn=function(){let e=this.type==="template",t=this.childNodes[e?0:1];return this.normalizeTitle(t.toString(!0),e?10:828)},Di=function(e){let t=this.getAnonArgs(),n=typeof e!="number";for(let i=n?t.indexOf(e):e-1;i<t.length;i++){let s=t[i],{name:o}=s,l=String(i+1);o!==l&&(s.setAttribute("name",l),this.getArgs(l,!1,!1).add(s))}}});var Hi,An,Ho,rt,Vi=k(()=>{"use strict";Xe();P();Hi=[ce()];rt=class extends(Ho=A){get type(){return"hidden"}};An=de(Ho),rt=pe(An,0,"HiddenToken",Hi,rt),ge(An,1,rt)});var Fr,Xi,Lr,Qi=k(()=>{"use strict";Q();j();K();R();P();Ee();Vi();Lr=class extends A{constructor(e,t=x.getConfig(),n=[]){super(void 0,t,n,{});b(this,Fr);for(let[i,s]of e.entries())if(i===0){let o=new M(s,"arg-name",t,n,{});super.insertAt(o)}else if(i>1){let o=new rt(s,t,n);super.insertAt(o)}else{let o=new A(s,t,n);o.type="arg-default",o.setAttribute("stage",2),super.insertAt(o)}}get type(){return"arg"}get default(){var e,t;return(t=(e=this.childNodes[1])==null?void 0:e.text())!=null?t:!1}toString(e){return`{{{${super.toString(e,"|")}}}}`}text(){return`{{{${ue(this.childNodes.slice(0,2),"|")}}}}`}getAttribute(e){return e==="padding"?3:super.getAttribute(e)}getGaps(){return 1}afterBuild(){E(this,Fr,Xi).call(this),super.afterBuild()}lint(e=this.getAbsoluteIndex(),t){let{childNodes:[n,i,...s]}=this;if(!this.getAttribute("include")){let l=$(this,{start:e},"no-arg","unexpected template argument");return i&&(l.suggestions=[{range:[e,l.endIndex],text:i.text(),desc:"expand"}]),[l]}let o=n.lint(e+3,t);if(i&&o.push(...i.lint(e+4+n.toString().length,t)),s.length>0){let l=new I(this,e);o.push(...s.map(p=>{let g=C(p,l,"no-ignored","invisible content inside triple braces");return g.startIndex--,g.startCol--,g.suggestions=[{desc:"remove",range:[g.startIndex,g.endIndex],text:""},{desc:"escape",range:[g.startIndex,g.startIndex+1],text:"{{!}}"}],g}))}return o}print(){return super.print({pre:"{{{",post:"}}}",sep:"|"})}};Fr=new WeakSet,Xi=function(){this.setAttribute("name",this.firstChild.toString(!0).trim())}});var Ji={};se(Ji,{parseBraces:()=>or});var Vo,Ki,Sn,Xo,or,Rr=k(()=>{"use strict";Q();kn();Ui();Qi();Vo={"=":String.raw`\n(?!(?:[^\S\n]|\0\d+[cn]\x7F)*\n)`,"{":String.raw`\}{2,}|\|`,"-":String.raw`\}-`,"[":String.raw`\]\]`},Ki=String.raw`|\{{2,}`,Sn=new Map([["!","!"],["!!","+"],["(!","{"],["!)","}"],["!-","-"],["=","~"],["server","m"]]),Xo=/\{\{\s*([^\s\0<>[\]{}|_#&%:.]+)\s*\}\}(?!\})/gu,or=(a,r,e)=>{var d,c,m,h,f,v;let t=String.raw`${(d=r.excludes)!=null&&d.includes("heading")?"":String.raw`^((?:\0\d+[cno]\x7F)*)={1,6}|`}\[\[|-\{(?!\{)`,{parserFunction:[,,,n]}=r,i=[];a=a.replace(Xo,(T,S)=>{var w;return new ir(T.slice(2,-2),[],r,e),`\0${e.length-2}${(w=Sn.get(S.toLowerCase()))!=null?w:"t"}\x7F`});let s=a.lastIndexOf("}}")-a.length,o=s+a.length!==-1,l=new RegExp(t+(o?Ki:""),"gmu"),p=l.exec(a),g;for(;p||g!==void 0&&g<=a.length&&((m=(c=i[i.length-1])==null?void 0:c[0])!=null&&m.startsWith("="));){if(p!=null&&p[1]){let[,{length:U}]=p;p[0]=p[0].slice(U),p.index+=U}let{0:T,index:S}=p!=null?p:{0:`
|
|
7
|
+
`,index:a.length},w=(h=i.pop())!=null?h:{},{0:L,index:N,parts:q,findEqual:z,pos:B}=w,V=T==="="&&z,X=U=>{q[q.length-1].push(U.slice(B,S))};if(T==="]]"||T==="}-")g=S+2;else if(T===`
|
|
8
|
+
`){g=S+1;let{pos:U,findEqual:W}=(f=i[i.length-1])!=null?f:{};if(U===void 0||W||ne(a.slice(U,N))!==""){let Z=/^(={1,6})(.+)\1((?:\s|\0\d+[cn]\x7F)*)$/u.exec(a.slice(N,S));Z&&(a=`${a.slice(0,N)}\0${e.length}h\x7F${a.slice(S)}`,g=N+4+String(e.length).length,new wt(Z[1].length,Z.slice(2),r,e))}}else if(T==="|"||V)g=S+1,X(a),T==="|"&&q.push([]),w.pos=g,w.findEqual=T==="|",i.push(w);else if(T.startsWith("}}")){let U=T.slice(0,Math.min(L.length,3)),W=L.length-U.length,{length:Z}=e;g=S+U.length,X(a);let F=!1,ke="t";if(U.length===3){let ee=q.map(Ue=>Ue.join("=")),le=ee.length>1&&ne(ee[1]).trim();new Lr(ee,r,e),le&&le.endsWith(":")&&n.includes(le.slice(0,-1).toLowerCase())&&(ke="s")}else try{new ir(q[0][0],q.slice(1),r,e);let ee=ne(q[0][0]).trim();Sn.has(ee.toLowerCase())?ke=Sn.get(ee.toLowerCase()):/^(?:filepath|(?:full|canonical)urle?):./iu.test(ee)?ke="m":/^#vardefine:./iu.test(ee)&&(ke="n")}catch(ee){if(ee instanceof SyntaxError&&ee.message==="Invalid template name")F=!0;else throw ee}F||(a=`${a.slice(0,N+W)}\0${Z}${ke}\x7F${a.slice(g)}`,g=N+W+3+String(Z).length,W>1?i.push({0:L.slice(0,W),index:N,pos:N+W,parts:[[]]}):W===1&&a[N-1]==="-"&&i.push({0:"-{",index:N-1,pos:N+1,parts:[[]]}))}else g=S+T.length,T.startsWith("{")&&(p.pos=g,p.parts=[[]]),i.push(..."0"in w?[w]:[],p);let Y=i[i.length-1];if(o&&s+a.length<g)for(o=!1;(v=Y==null?void 0:Y[0])!=null&&v.startsWith("{");)i.pop(),Y=i[i.length-1];l=new RegExp(t+(o?Ki:"")+(Y?`|${Vo[Y[0][0]]}${Y.findEqual?"|=":""}`:""),"gmu"),l.lastIndex=g,p=l.exec(a)}return a}});var Pr,Yi=k(()=>{"use strict";rr();Rr();R();yn();Pr=class extends At{constructor(r,e,t=x.getConfig(),n=[]){let i=Symbol("InputboxToken"),{length:s}=n;n.push(i),e&&(e=Ye(e,t,n,r)),e&&(e=or(e,t,n)),n.splice(s,1),super(r,e,t,n,{})}}});function Zi(a,r,e,t,n){r=r.trim();let i=r.replace(a==="link"?/\0\d+[tq]\x7F/gu:/\0\d+t\x7F/gu,"").trim();switch(a){case"width":return!i&&!!r||/^(?:\d+x?|\d*x\d+)(?:\s*px)?$/u.test(i);case"link":{if(!i)return r;let s=new RegExp(String.raw`^(?:${e.protocol}|//|\0\d+m\x7F)`,"iu"),o=new RegExp(String.raw`^(?:(?:${e.protocol}|//)${we}|\0\d+m\x7F)${Ce}$`,"iu");if(s.test(i))return o.test(i)&&r;i.startsWith("[[")&&i.endsWith("]]")&&(i=i.slice(2,-2));let l=x.normalizeTitle(i,0,!1,e,t,!0,!0);return l.valid&&l}case"lang":return(n==="svg"||n==="svgz")&&!/[^a-z\d-]/u.test(i);case"alt":case"class":case"manualthumb":return!0;case"page":return(n==="djvu"||n==="djv"||n==="pdf")&&Number(i)>0;default:return!!i&&!isNaN(i)}}var Qo,oe,jr,es,Br,ts=k(()=>{"use strict";Q();j();R();P();Qo=new Set(["alt","link","lang","page","caption"]);Br=class extends A{constructor(e,t,n=x.getConfig(),i){var r=(...hg)=>(super(...hg),b(this,jr),b(this,oe,""),this);var p;let s,o=Object.entries(n.img).map(([g,d])=>{let c=new RegExp(String.raw`^(\s*(?!\s))${g.replace("$1","(.*)")}${g.endsWith("$1")?`(?=$|
|
|
9
|
+
)`:""}(\s*)$`,"u");return[g,d,c]}),l=o.find(([,g,d])=>(s=d.exec(e),s&&(s.length!==4||Zi(g,s[2],n,!0,t)!==!1)));if(l&&s){s.length===3?(r(void 0,n,i),y(this,oe,e)):(r(s[2],n,i,{}),y(this,oe,s[1]+l[0]+s[3])),this.setAttribute("name",l[1]);return}r(e,{...n,excludes:[...(p=n.excludes)!=null?p:[],"list"]},i),this.setAttribute("name","caption"),this.setAttribute("stage",7)}get type(){return"image-parameter"}get link(){return this.name==="link"?Zi("link",super.text(),this.getAttribute("config")):void 0}afterBuild(){var e;((e=this.parentNode)==null?void 0:e.type)==="gallery-image"&&!Qo.has(this.name)&&this.setAttribute("name","invalid"),super.afterBuild()}toString(e){return u(this,oe)?u(this,oe).replace("$1",super.toString(e)):super.toString(e)}text(){return u(this,oe)?u(this,oe).replace("$1",super.text()).trim():super.text().trim()}getAttribute(e){return e==="plain"?this.name==="caption":e==="padding"?Math.max(0,u(this,oe).indexOf("$1")):super.getAttribute(e)}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),{link:i,name:s}=this;if(s==="invalid"){let o=$(this,{start:e},"invalid-gallery","invalid image parameter");o.fix={range:[e-1,o.endIndex],text:"",desc:"remove"},n.push(o)}else if(typeof i=="object"&&i.encoded){let o=$(this,{start:e},"url-encoding","unnecessary URL encoding in an internal link");o.suggestions=[{desc:"decode",range:[e,o.endIndex],text:Be(this.text())}],n.push(o)}return n}getValue(){return this.name==="invalid"?this.text():E(this,jr,es).call(this)||super.text()}print(){return u(this,oe)?`<span class="wpb-image-parameter">${u(this,oe).replace("$1",`<span class="wpb-image-caption">${$e(this.childNodes)}</span>`)}</span>`:super.print({class:"image-caption"})}};oe=new WeakMap,jr=new WeakSet,es=function(){return u(this,oe)&&!u(this,oe).includes("$1")}});var rs,ns,is,Ko,$t,wn=k(()=>{"use strict";Q();j();K();R();Zt();ts();rs=new Map([["manualthumb","Thumb"],["frameless","Frameless"],["framed","Frame"],["thumbnail","Thumb"]]),ns=new Set(["left","right","center","none"]),is=new Set(["baseline","sub","super","top","text-top","middle","bottom","text-bottom"]),Ko=(a,r,e,t)=>{if(t===void 0)return[];let n=new RegExp(`${[a,r,e].map(li).join("|")}`,"gu"),i=[],s=n.exec(t),o=0,l=0;for(;s;){let{0:p,index:g}=s;p!==e?o+=p===a?1:-1:o===0&&(i.push(t.slice(l,g)),{lastIndex:l}=n),s=n.exec(t)}return i.push(t.slice(l)),i},$t=class extends Ae{get type(){return"file"}get extension(){return this.getTitle().extension}constructor(r,e,t=x.getConfig(),n=[],i="|"){super(r,void 0,t,n,i);let{extension:s}=this.getTitle(!0);this.append(...Ko("-{","}-","|",e).map(o=>new Br(o,s,t,n)))}lint(r=this.getAbsoluteIndex(),e){var m;let t=super.lint(r,e),n=this.getAllArgs().filter(({childNodes:h})=>{let f=h.filter(v=>v.text().trim());return f.length!==1||f[0].type!=="arg"}),i=[...new Set(n.map(({name:h})=>h))],s=i.filter(h=>rs.has(h)),o=i.filter(h=>ns.has(h)),l=i.filter(h=>is.has(h)),[p]=s,g=p==="framed"||p==="manualthumb",d=new I(this,r);if(this.closest("ext-link-text")&&((m=this.getValue("link"))==null?void 0:m.trim())!==""&&t.push($(this,d,"nested-link","internal link in an external link")),g)for(let h of n.filter(({name:f})=>f==="width")){let f=C(h,d,"invalid-gallery","invalid image parameter");f.fix={range:[f.startIndex-1,f.endIndex],text:"",desc:"remove"},t.push(f)}if(n.length===i.length&&s.length<2&&o.length<2&&l.length<2)return t;let c=(h,f)=>v=>{let T=C(v,d,"no-duplicate",x.msg(`${h} image $1 parameter`,f));return T.suggestions=[{desc:"remove",range:[T.startIndex-1,T.endIndex],text:""}],T};for(let h of i){if(h==="invalid"||h==="width"&&g)continue;let f=n.filter(({name:v})=>v===h);h==="caption"&&(f=[...f.slice(0,-1).filter(v=>v.text()),...f.slice(-1)]),f.length>1&&t.push(...f.map(c("duplicated",h)))}return s.length>1&&t.push(...n.filter(({name:h})=>rs.has(h)).map(c("conflicting","frame"))),o.length>1&&t.push(...n.filter(({name:h})=>ns.has(h)).map(c("conflicting","horizontal-alignment"))),l.length>1&&t.push(...n.filter(({name:h})=>is.has(h)).map(c("conflicting","vertical-alignment"))),t}getAllArgs(){return this.childNodes.slice(1)}getArgs(r){return this.getAllArgs().filter(({name:e})=>r===e)}getArg(r){let e=this.getArgs(r);return e[r==="manualthumb"?0:e.length-1]}getValue(r){var e;return(e=this.getArg(r))==null?void 0:e.getValue()}}});var Nt,Cn=k(()=>{"use strict";j();R();P();wn();Nt=class extends $t{constructor(e,t,n,i=x.getConfig(),s=[]){let o;if(n!==void 0){let{length:l}=s;o=new A(n,i,s);for(let p=1;p<11;p++)o.parseOnce();s.splice(l,1)}super(t,o==null?void 0:o.toString(),i,s);te(this,"privateType","imagemap-image");this.setAttribute("bracket",!1),this.privateType=`${e}-image`,this.seal("privateType",!0)}get type(){return this.privateType}getTitle(){let e=this.type==="imagemap-image";return this.normalizeTitle(this.firstChild.toString(),e?0:6,!0,!e)}getAttribute(e){return e==="padding"?0:super.getAttribute(e)}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),{ns:i,interwiki:s}=this.getAttribute("title");if(s||i!==6){let o=$(this,{start:e},"invalid-gallery","invalid gallery image");o.suggestions=[{desc:"prefix",range:[e,e],text:"File:"}],n.push(o)}return n}}});var Or,ss,qr,os=k(()=>{"use strict";R();P();Cn();Me();qr=class extends A{constructor(e,t=x.getConfig(),n=[]){var i;super(void 0,t,n,{});b(this,Or);for(let s of(i=e==null?void 0:e.split(`
|
|
10
|
+
`))!=null?i:[]){let o=/^([^|]+)(?:\|(.*))?/u.exec(s);if(!o){super.insertAt(s.trim()?new D(s,t,n):s);continue}let[,l,p]=o;E(this,Or,ss).call(this,l)?super.insertAt(new Nt("gallery",l,p,t,n)):super.insertAt(new D(s,t,n))}}get type(){return"ext-inner"}toString(e){return super.toString(e,`
|
|
11
|
+
`)}text(){return super.text(`
|
|
12
|
+
`).replace(/\n\s*\n/gu,`
|
|
13
|
+
`)}getGaps(){return 1}lint(e=this.getAbsoluteIndex(),t){let{top:n,left:i}=this.getRootNode().posFromIndex(e),s=[];for(let[o,l]of this.childNodes.entries()){let p=l.toString(),{length:g}=p,d=p.trim(),c=n+o,m=o?0:i;if(l.type==="noinclude"&&d&&!/^<!--.*-->$/u.test(d)){let h=e+g;s.push({rule:"no-ignored",message:x.msg("invalid content in <$1>","gallery"),severity:d.startsWith("|")?"warning":"error",startIndex:e,endIndex:h,startLine:c,endLine:c,startCol:m,endCol:m+g,suggestions:[{desc:"remove",range:[e,h],text:""},{desc:"comment",range:[e,h],text:`<!--${p}-->`}]})}else l.type!=="noinclude"&&l.type!=="text"&&s.push(...l.lint(e,t));e+=g+1}return s}print(){return super.print({sep:`
|
|
14
|
+
`})}};Or=new WeakSet,ss=function(e){return this.normalizeTitle(e,6,!0,!0).valid}});var Et,$n=k(()=>{"use strict";j();Zt();Et=class extends Ae{get type(){return"link"}lint(r=this.getAbsoluteIndex(),e){let t=super.lint(r,e);return this.closest("ext-link-text")&&t.push($(this,{start:r},"nested-link","internal link in an external link")),t}}});var Jo,Yo,ar,Ie,_r=k(()=>{"use strict";j();Q();K();R();P();Jo=String.raw`(?:[${be}\t]| |�*160;|&#[xX]0*[aA]0;)`,Yo=new RegExp(`${Jo}+`,"gu"),Ie=class extends A{constructor(e,t="free-ext-link",n=x.getConfig(),i){super(e,n,i,{});b(this,ar);y(this,ar,t)}get type(){return u(this,ar)}get innerText(){let e=new Map([["!","|"],["=","="]]),t=ue(this.childNodes.map(n=>{let{type:i}=n,s=String(n.name);return i==="magic-word"&&e.has(s)?e.get(s):n}));return this.type==="magic-link"&&(t=t.replace(Yo," ")),t}get link(){let{innerText:e}=this;return this.type==="magic-link"?e.startsWith("ISBN")?`ISBN ${e.slice(5).replace(/[- ]/gu,"").replace(/x$/u,"X")}`:e:di(e)}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),i=new I(this,e);if(this.type==="magic-link"){let{link:p}=this;if(p.startsWith("ISBN")){let g=[...p.slice(5)].map(d=>d==="X"?10:Number(d));(g.length===10&&g.reduce((d,c,m)=>d+c*(10-m),0)%11||g.length===13&&(g[12]===10||g.reduce((d,c,m)=>d+c*(m%2?3:1),0)%10))&&n.push($(this,i,"invalid-isbn","invalid ISBN"))}return n}let s=this.type==="ext-link-url",o=s?/\|/u:/[,;。:!?()]+/u,l=this.childNodes.find(p=>p.type==="text"&&o.test(p.data));if(l){let{data:p}=l,g=C(l,i,"unterminated-url",x.msg("$1 in URL",s?'"|"':"full-width punctuation"),"warning"),{index:d,0:c}=o.exec(p),m=g.startIndex+d;g.suggestions=s?[{desc:"whitespace",range:[m,m+1],text:" "}]:[{desc:"whitespace",range:[m,m],text:" "},{desc:"escape",range:[m,m+c.length],text:encodeURI(c)}],n.push(g)}return n}};ar=new WeakMap});var Le,It,Nn=k(()=>{"use strict";j();R();P();_r();It=class extends A{constructor(e,t="",n="",i=x.getConfig(),s=[]){super(void 0,i,s,{});b(this,Le);let o=e&&/^\0\d+f\x7F$/u.test(e)?s[Number(e.slice(1,-2))]:new Ie(e,"ext-link-url",i,s);if(this.insertAt(o),y(this,Le,t),n){let l=new A(n,i,s,{});l.type="ext-link-text",l.setAttribute("stage",10),this.insertAt(l)}}get type(){return"ext-link"}toString(e){return this.length===1?`[${super.toString(e)}${u(this,Le)}]`:`[${super.toString(e,u(this,Le))}]`}text(){return`[${super.text(" ")}]`}getAttribute(e){return e==="padding"?1:super.getAttribute(e)}getGaps(){return u(this,Le).length}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t);return this.length===1&&this.closest("heading-title")&&n.push($(this,{start:e},"var-anchor","variable anchor in a section header")),n}print(){return super.print(this.length===1?{pre:"[",post:`${u(this,Le)}]`}:{pre:"[",sep:u(this,Le),post:"]"})}};Le=new WeakMap});var lr,as=k(()=>{"use strict";R();P();Me();$n();Nn();lr=class extends A{get type(){return"imagemap-link"}constructor(r,e,t,n=x.getConfig(),i=[]){super(void 0,n,i),this.append(r,e.length===2?new Et(...e,n,i):new It(...e,n,i),new D(t,n,i))}}});var Mr,ls=k(()=>{"use strict";j();ve();K();R();P();Me();Cn();as();Mr=class extends A{get type(){return"ext-inner"}get image(){return this.childNodes.find(Ct("imagemap-image"))}constructor(r,e=x.getConfig(),t=[]){if(super(void 0,e,t,{}),!r)return;let n=r.split(`
|
|
15
|
+
`),i=new Set(e.protocol.split("|")),s=D,o=!0,l=!1;for(let p of n){let g=p.trim();if(!(l||!g||g.startsWith("#"))){if(o){let d=p.indexOf("|"),c=d===-1?p:p.slice(0,d),m=this.normalizeTitle(c,0,!0);if(m.valid&&!m.interwiki&&m.ns===6){let h=new Nt("imagemap",c,d===-1?void 0:p.slice(d+1),e,t);super.insertAt(h),o=!1;continue}else l=!0}else if(p.trim().split(/[\t ]/u,1)[0]==="desc"){super.insertAt(p);continue}else if(p.includes("[")){let d=p.indexOf("["),c=p.slice(d),m=/^\[\[([^|]+)(?:\|([^\]]+))?\]\][\w\s]*$/u.exec(c);if(m){if(this.normalizeTitle(m[1],0,!0,!1,!0).valid){super.insertAt(new lr(p.slice(0,d),m.slice(1),c.slice(c.indexOf("]]")+2),e,t));continue}}else if(i.has(c.slice(1,c.indexOf(":")+1))||i.has(c.slice(1,c.indexOf("//")+2))){let h=/^\[([^\]\s]+)(?:(\s+(?!\s))([^\]]*))?\][\w\s]*$/u.exec(c);if(h){super.insertAt(new lr(p.slice(0,d),h.slice(1),c.slice(c.indexOf("]")+1),e,t));continue}}}}super.insertAt(new s(p,e,t))}}toString(r){return super.toString(r,`
|
|
16
|
+
`)}text(){return super.text(`
|
|
17
|
+
`).replace(/\n{2,}/gu,`
|
|
18
|
+
`)}getGaps(){return 1}lint(r=this.getAbsoluteIndex(),e){let t=super.lint(r,e),n=new I(this,r);return this.image?t.push(...this.childNodes.filter(i=>{let s=i.toString().trim();return i.type==="noinclude"&&s&&!s.startsWith("#")}).map(i=>{let s=C(i,n,"invalid-imagemap","invalid link in <imagemap>");return s.suggestions=[{desc:"remove",range:[s.startIndex-1,s.endIndex],text:""},{desc:"comment",range:[s.startIndex,s.startIndex],text:"# "}],s})):t.push($(this,n,"invalid-imagemap","<imagemap> without an image")),t}print(){return super.print({sep:`
|
|
19
|
+
`})}}});var zr,ds=k(()=>{"use strict";j();R();_e();zr=class extends ie{get type(){return"ext-inner"}lint(r=this.getAbsoluteIndex()){let{name:e,firstChild:{data:t}}=this;if((e==="templatestyles"||e==="section")&&t){let i=$(this,{start:r},"void-ext",x.msg("nothing should be in <$1>",e));return i.fix={range:[r,i.endIndex],text:"",desc:"empty"},[i]}let n=new RegExp(String.raw`<\s*(?:/\s*)${e==="nowiki"?"":"?"}(${e})\b`,"giu");return super.lint(r,n)}}});var Gr={};se(Gr,{NestedToken:()=>En});var Zo,dr,Lt,En,Wr=k(()=>{"use strict";j();K();rr();Rr();R();P();In();Me();Zo=new Set(["comment","include","arg","template","magic-word"]),En=class extends A{constructor(e,t,n,i=x.getConfig(),s=[]){if(typeof t=="boolean"){let o=Symbol("InputboxToken"),{length:l}=s;s.push(o),e&&(e=Ye(e,i,s,t)),e&&(e=or(e,i,s)),s.splice(l,1)}else e&&(e=e.replace(t,(o,l,p,g,d)=>{let c=`\0${s.length+1}e\x7F`;return new Ft(l,p,g,d,i,!1,s),c}));e&&(e=e.replace(/(^|\0\d+.\x7F)([^\0]+)(?=$|\0\d+.\x7F)/gu,(o,l,p)=>(new D(p,i,s),`${l}\0${s.length}n\x7F`)));super(e,i,s);b(this,dr);b(this,Lt);y(this,dr,[...n]),y(this,Lt,t)}get type(){return"ext-inner"}lint(e=this.getAbsoluteIndex(),t){let n=new I(this,e),i=u(this,Lt)?"includeonly":"noinclude",s=typeof u(this,Lt)=="boolean"?new RegExp(String.raw`^(?:<${i}(?:\s[^>]*)?/?>|</${i}\s*>)$`,"iu"):/^<!--[\s\S]*-->$/u;return[...super.lint(e,t),...this.childNodes.filter(o=>{if(o.type==="ext")return!u(this,dr).includes(o.name);if(Zo.has(o.type))return!1;let l=o.toString().trim();return l&&!s.test(l)}).map(o=>{let l=C(o,n,"no-ignored",x.msg("invalid content in <$1>",this.name));return l.suggestions=[{desc:"remove",range:[l.startIndex,l.endIndex],text:""},{desc:"comment",range:[l.startIndex,l.endIndex],text:`<!--${o.toString()}-->`}],l})]}};dr=new WeakMap,Lt=new WeakMap});var gs,Ft,In=k(()=>{"use strict";j();K();R();P();fn();$r();Gi();yn();Yi();os();ls();ds();gs=(a,r)=>{let e=new Set(a);return e.delete(r),[...e]},Ft=class extends Tt{get type(){return"ext"}constructor(r,e,t,n,i=x.getConfig(),s=!1,o=[]){var c;let l=r.toLowerCase(),p=new We(!e||/^\s/u.test(e)?e:` ${e}`,"ext-attrs",l,i,o),g={...i,ext:gs(i.ext,l),excludes:[...(c=i.excludes)!=null?c:[]]},d;switch(g.inExt=!0,l){case"tab":g.ext=gs(g.ext,"tabs");case"indicator":case"poem":case"ref":case"option":case"combooption":case"tabs":case"poll":case"seo":l==="poem"&&g.excludes.push("heading"),d=new A(t,g,o);break;case"pre":d=new Nr(t,g,o);break;case"dynamicpagelist":d=new At(s,t,g,o);break;case"inputbox":g.excludes.push("heading"),d=new Pr(s,t,g,o);break;case"references":{let{NestedToken:m}=(Wr(),J(Gr));g.excludes.push("heading"),d=new m(t,s,["ref"],g,o);break}case"choose":{let{NestedToken:m}=(Wr(),J(Gr));d=new m(t,/<(option|choicetemplate)(\s[^>]*?)?(?:\/>|>([\s\S]*?)<\/(\1)>)/gu,["option","choicetemplate"],g,o);break}case"combobox":{let{NestedToken:m}=(Wr(),J(Gr));d=new m(t,/<(combooption)(\s[^>]*?)?(?:\/>|>([\s\S]*?)<\/(combooption\s*)>)/giu,["combooption"],g,o);break}case"gallery":d=new qr(t,g,o);break;case"imagemap":d=new Mr(t,g,o);break;default:d=new zr(t,g,o)}d.setAttribute("name",l),d.type==="plain"&&(d.type="ext-inner"),super(r,p,d,n,i,o),this.seal("closed",!0)}lint(r=this.getAbsoluteIndex(),e){let t=super.lint(r,e),n=new I(this,r);return this.name!=="nowiki"&&this.closest("html-attrs,table-attrs")&&t.push($(this,n,"parsing-order","extension tag in HTML tag attributes")),this.name==="ref"&&this.closest("heading-title")&&t.push($(this,n,"var-anchor","variable anchor in a section header")),t}}});var ps,Ln,ea,nt,us=k(()=>{"use strict";j();Xe();R();_e();ps=[ce(!1)];nt=class extends(ea=ie){constructor(e,t,n,i){super(e,n,i);te(this,"closed");this.closed=t}get type(){return"comment"}getAttribute(e){return e==="padding"?4:super.getAttribute(e)}lint(e=this.getAbsoluteIndex()){if(this.closed)return[];let t=$(this,{start:e},"unclosed-comment",x.msg("unclosed $1","HTML comment"));return t.suggestions=[{range:[t.endIndex,t.endIndex],text:"-->",desc:"close"}],[t]}toString(e){return e?"":`<!--${this.innerText}${this.closed?"-->":""}`}print(){return super.print({pre:"<!--",post:this.closed?"-->":""})}};Ln=de(ea),nt=pe(Ln,0,"CommentToken",ps,nt),ge(Ln,1,nt)});var hs={};se(hs,{parseCommentAndExt:()=>Ye});var ms,ta,Fn,cs,Ye,rr=k(()=>{"use strict";Ci();Me();Ni();In();us();ms="<onlyinclude>",ta="</onlyinclude>",{length:Fn}=ms,cs=a=>{let r=a.indexOf(ms);return{i:r,j:a.indexOf(ta,r+Fn)}},Ye=(a,r,e,t)=>{if(t){let{i:l,j:p}=cs(a);if(l!==-1&&p!==-1){let g="",d=c=>{new D(c,r,e),g+=`\0${e.length-1}n\x7F`};for(;l!==-1&&p!==-1;){let c=`\0${e.length}e\x7F`;new Sr(a.slice(l+Fn,p),r,e),l>0&&d(a.slice(0,l)),g+=c,a=a.slice(p+Fn+1),{i:l,j:p}=cs(a)}return a&&d(a),g}}let n=r.ext.join("|"),i=t?"includeonly":"(?:no|only)include",s=t?"noinclude":"includeonly",o=new RegExp(String.raw`<!--[\s\S]*?(?:-->|$)|<${i}(?:\s[^>]*)?/?>|</${i}\s*>|<(${n})(\s[^>]*?)?(?:/>|>([\s\S]*?)</(\1\s*)>)|<(${s})(\s[^>]*?)?(?:/>|>([\s\S]*?)(?:</(${s}\s*)>|$))`,"giu");return a.replace(o,(l,p,g,d,c,m,h,f,v)=>{let T=e.length,S="n";if(p)S="e",new Ft(p,g,d,c,r,m,e);else if(l.startsWith("<!--")){S="c";let w=l.endsWith("-->");new nt(l.slice(4,w?-3:void 0),w,r,e)}else m?new Je(m,h,f,v,r,e):new D(l,r,e);return`\0${T}${S}\x7F`})}});var ra,na,ia,Rt,he,De,Dr,fs=k(()=>{"use strict";j();Q();K();P();ra=new Set(["if","ifeq","ifexpr","ifexist","iferror","switch"]),na=new Set(["b","big","center","cite","code","del","dfn","em","font","i","ins","kbd","mark","pre","q","s","samp","small","strike","strong","sub","sup","tt","u","var"]),ia=new Set(["strike","big","center","font","tt"]),Dr=class extends A{constructor(e,t,n,i,s,o){super(void 0,s,o);b(this,Rt);b(this,he);b(this,De);this.insertAt(t),this.setAttribute("name",e.toLowerCase()),y(this,Rt,n),y(this,he,i),y(this,De,e)}get type(){return"html"}get selfClosing(){return u(this,he)}get closing(){return u(this,Rt)}toString(e){return`<${this.closing?"/":""}${u(this,De)}${super.toString(e)}${u(this,he)?"/":""}>`}text(){let{closing:e}=this,t=u(this,De)+(e?"":super.text());return`<${e?"/":""}${t}${u(this,he)?"/":""}>`}getAttribute(e){return e==="padding"?u(this,De).length+(this.closing?2:1):super.getAttribute(e)}lint(e=this.getAbsoluteIndex(),t){var s;let n=super.lint(e,t),i=new I(this,e);if(this.name==="h1"&&!this.closing){let o=$(this,i,"h1","<h1>");o.suggestions=[{desc:"h2",range:[e+2,e+3],text:"2"}],n.push(o)}if(this.closest("table-attrs")){let o=$(this,i,"parsing-order","HTML tag in table attributes");o.fix={desc:"remove",range:[e,o.endIndex],text:""},n.push(o)}try{this.findMatchingTag()}catch(o){if(o instanceof SyntaxError){let{message:l}=o,p=l.split(":",1)[0].toLowerCase(),g=$(this,i,"unmatched-tag",p),d={desc:"no self-closing",range:[g.endIndex-2,g.endIndex-1],text:""};switch(p){case"unclosed tag":{let c=(s=this.parentNode)==null?void 0:s.childNodes;na.has(this.name)&&(c!=null&&c.slice(0,c.indexOf(this)).some(({type:m,name:h})=>m==="html"&&h===this.name))?g.suggestions=[{desc:"close",range:[e+1,e+1],text:"/"}]:this.closest("heading-title")||(g.severity="warning");break}case"unmatched closing tag":{let c=this.closest("magic-word");c&&ra.has(c.name)?g.severity="warning":g.suggestions=[{desc:"remove",range:[e,g.endIndex],text:""}];break}case"tag that is both closing and self-closing":{let{html:[c,,m]}=this.getAttribute("config"),h={desc:"open",range:[e+1,e+2],text:""};m.includes(this.name)?g.fix=h:c.includes(this.name)?g.fix=d:g.suggestions=[h,d];break}case"invalid self-closing tag":g.suggestions=[d,{desc:"close",range:[g.endIndex-2,g.endIndex],text:`></${this.name}>`}]}n.push(g)}}return ia.has(this.name)&&n.push($(this,i,"obsolete-tag","obsolete HTML tag","warning")),(this.name==="b"||this.name==="strong")&&this.closest("heading-title")&&n.push($(this,i,"bold-header","bold in section header","warning")),n}findMatchingTag(){let{html:[e,t,n]}=this.getAttribute("config"),{name:i,parentNode:s,closing:o}=this,l=gi(this.toString());if(o&&(u(this,he)||n.includes(i)))throw new SyntaxError(`Tag that is both closing and self-closing: ${l}`);if(n.includes(i)||u(this,he)&&t.includes(i))return this;if(u(this,he)&&e.includes(i))throw new SyntaxError(`Invalid self-closing tag: ${l}`);if(!s)return;let{childNodes:p}=s,g=p.indexOf(this),d=o?p.slice(0,g).reverse():p.slice(g+1),c=o?-1:1;for(let m of d)if(!(!m.is("html")||m.name!==i)&&(u(m,Rt)?c--:c++,c===0))return m;throw new SyntaxError(`${o?"Unmatched closing":"Unclosed"} tag: ${l}`)}print(){return super.print({pre:`<${this.closing?"/":""}${u(this,De)}`,post:`${u(this,he)?"/":""}>`})}json(){let e=super.json();return Object.assign(e,{closing:this.closing,selfClosing:u(this,he)}),e}};Rt=new WeakMap,he=new WeakMap,De=new WeakMap});var xs={};se(xs,{parseHtml:()=>oa});var sa,oa,bs=k(()=>{"use strict";$r();fs();sa=/^(\/?)([a-z][^\s/>]*)((?:\s|\/(?!>))[^>]*?)?(\/?>)([^<]*)$/iu,oa=(a,r,e)=>{var s;let{html:t}=r;(s=r.htmlElements)!=null||(r.htmlElements=new Set([...t[0],...t[1],...t[2]]));let n=a.split("<"),i=n.shift();for(let o of n){let l=sa.exec(o),p=l==null?void 0:l[2],g=p==null?void 0:p.toLowerCase();if(!l||!r.htmlElements.has(g)){i+=`<${o}`;continue}let[,d,,c="",m,h]=l,{length:f}=e,v=new We(c,"html-attrs",g,r,e),T=v.getAttr("itemprop");if(g==="meta"&&(T===void 0||v.getAttr("content")===void 0)||g==="link"&&(T===void 0||v.getAttr("href")===void 0)){i+=`<${o}`,e.length=f;continue}i+=`\0${e.length}x\x7F${h}`,new Dr(p,v,d==="/",m==="/>",r,e)}return i}});var Ts,ks=k(()=>{"use strict";ve();Ts=(a=0)=>(r,e)=>{var n,ys;class t extends r{constructor(){super(...arguments);b(this,n)}getAttr(l){return u(this,n,ys).getAttr(l)}}return n=new WeakSet,ys=function(){return this.childNodes[a]},vr(t,r),t}});var Pt,Rn=k(()=>{"use strict";ks();R();P();ft();$r();Pt=class extends Ts(1)(A){constructor(r,e,t,n,i=x.getConfig(),s=[],o){super(void 0,i,s,o),this.append(new me(e,r,"table-syntax",i,s,{}),new We(n,"table-attrs",t,i,s))}}});var fe,gr,pr,Pn,it,Bn=k(()=>{"use strict";j();K();R();P();Rn();it=class extends Pt{constructor(e,t,n=x.getConfig(),i=[]){var p;let s=/\||\0\d+!\x7F/u.exec(t!=null?t:""),o=s?t.slice(0,s.index):"";/\[\[|-\{/u.test(o)&&(s=null,o="");super(/^(?:\n[^\S\n]*(?:[|!]|\|\+|\{\{\s*!\s*\}\}\+?)|(?:\||\{\{\s*!\s*\}\}){2}|!!|\{\{\s*!!\s*\}\})$/u,e,"td",o,n,i);b(this,pr);b(this,fe,"");b(this,gr);s&&([xr(this,fe)._]=s);let l=new A(t==null?void 0:t.slice(((p=s==null?void 0:s.index)!=null?p:NaN)+u(this,fe).length),n,i);l.type="td-inner",l.setAttribute("stage",4),this.insertAt(l)}get type(){return"td"}get rowspan(){return this.getAttr("rowspan")}get colspan(){return this.getAttr("colspan")}get subtype(){return E(this,pr,Pn).call(this).subtype}afterBuild(){u(this,fe).includes("\0")&&y(this,fe,this.buildFromStr(u(this,fe),0)),super.afterBuild()}toString(e){let{childNodes:[t,n,i]}=this;return t.toString(e)+n.toString(e)+u(this,fe)+i.toString(e)}text(){let{childNodes:[e,t,n]}=this;return e.text()+t.text()+u(this,fe)+n.text()}getGaps(e){return e===1?u(this,fe).length:0}lint(e=this.getAbsoluteIndex(),t){let n=super.lint(e,t),i=new I(this,e+this.getRelativeIndex(this.length-1));for(let s of this.lastChild.childNodes)if(s.type==="text"){let{data:o}=s;if(o.includes("|")){let l=o.includes("||"),p=C(s,i,"pipe-like",'additional "|" in a table cell',l?"error":"warning");if(l){let g={caption:"|+",td:"|",th:"!"}[this.subtype];p.fix={range:[p.startIndex,p.endIndex],text:o.replace(/\|\|/gu,`
|
|
20
|
+
${g}`),desc:"newline"}}else p.suggestions=[{desc:"escape",range:[p.startIndex,p.endIndex],text:o.replace(/\|/gu,"|")}];n.push(p)}}return n}isIndependent(){return this.firstChild.text().startsWith(`
|
|
21
|
+
`)}getAttr(e){let t=super.getAttr(e);return e==="rowspan"||e==="colspan"?parseInt(t)||1:t}print(){let{childNodes:[e,t,n]}=this;return`<span class="wpb-td">${e.print()}${t.print()}${u(this,fe)}${n.print()}</span>`}json(){let e=super.json();return e.subtype=this.subtype,e}};fe=new WeakMap,gr=new WeakMap,pr=new WeakSet,Pn=function(){return je(u(this,gr),()=>{var o;let e=this.firstChild.text(),t=e.slice(-1),n="td";if(t==="!"?n="th":t==="+"&&(n="caption"),this.isIndependent())return{subtype:n};let{previousSibling:i}=this;return{...E(o=i,pr,Pn).call(o)}},e=>{y(this,gr,e)})}});var Bt,jn=k(()=>{"use strict";j();Rn();Bn();Bt=class extends Pt{lint(r=this.getAbsoluteIndex(),e){let t=super.lint(r,e),n=this.childNodes.find(({type:l})=>l==="table-inter");if(!n)return t;let i=n.childNodes.find(l=>l.text().trim()),s=/^\s*(?:!|\{\{\s*![!-]?\s*\}\})/u;if(!i||s.test(i.toString())||i.is("arg")&&s.test(i.default||""))return t;if(i.is("magic-word"))try{if(i.getPossibleValues().every(l=>s.test(l.text())))return t}catch(l){}let o=C(n,{start:r},"fostered-content","content to be moved out from the table");return o.severity=i.type==="template"?"warning":"error",o.startIndex++,o.startLine++,o.startCol=0,t.push(o),t}getRowCount(){return Number(this.childNodes.some(r=>r instanceof it&&r.isIndependent()&&!r.firstChild.text().endsWith("+")))}getNthCol(r,e){let t=0;for(let n of this.childNodes.slice(2))if(n instanceof it&&(n.isIndependent()&&(t=+(n.subtype!=="caption")),r-=t,r<0))return n}}});var aa,la,da,qn,Ur,vs=k(()=>{"use strict";j();ve();K();R();jn();ft();aa=/^\n[^\S\n]*(?:\|\}|\{\{\s*!\s*\}\}\}|\{\{\s*!\)\s*\}\})$/u,la=(a,r)=>new Array(a).fill(void 0).map((e,t)=>r(t)),da=({type:a})=>a==="tr"||a==="table-syntax",qn=class extends Array{},Ur=class extends Bt{get type(){return"table"}get closed(){return this.lastChild.type==="table-syntax"}constructor(r,e,t,n){super(/^(?:\{\||\{\{\{\s*!\s*\}\}|\{\{\s*\(!\s*\}\})$/u,r,"table",e,t,n,{})}lint(r=this.getAbsoluteIndex(),e){let t=super.lint(r,e),n=new I(this,r);this.closed||t.push(C(this.firstChild,n,"unclosed-table",x.msg("unclosed $1","table")));let i=this.getLayout(),{length:s}=i;if(s>1){let o=1,l=1/0,p=0;for(;p<s;p++){let g=i[p],d=g.length;if(d<o)break;d<l&&(l=d);let c=g.indexOf(g[d-1])+1;if(c>l)break;c>o&&(o=c)}if(p<s){let g=C(this.getNthRow(p),n,"table-layout","inconsistent table layout","warning");g.startIndex++,g.startLine++,g.startCol=0,t.push(g)}}return t}close(r=`
|
|
22
|
+
|}`,e){let t=this.getAttribute("config"),n=this.getAttribute("accum"),i=e?[r]:x.parse(r,this.getAttribute("include"),2,t).childNodes;Ne.run(()=>{let s=new me(void 0,aa,"table-syntax",t,n,{});super.insertAt(s)}),this.lastChild.replaceChildren(...i)}getLayout(r){let e=this.getAllRows(),{length:t}=e,n=new qn(...la(t,()=>[]));for(let[i,s]of n.entries()){let o=0,l=0,p;for(let g of e[i].childNodes.slice(2))if(g.type==="td"){if(g.isIndependent()&&(p=g.subtype!=="caption"),p){let d={row:i,column:o},{rowspan:c,colspan:m}=g;for(o++;s[l];)l++;for(let h=i;h<Math.min(i+c,t);h++)for(let f=l;f<l+m;f++)n[h][f]=d;l+=m}}else if(da(g))break}return n}getAllRows(){return[...super.getRowCount()?[this]:[],...this.childNodes.slice(1).filter(r=>r.type==="tr"&&r.getRowCount()>0)]}getNthCell(r){var t;let e=r;return e&&((t=this.getNthRow(e.row,!1,!1))==null?void 0:t.getNthCol(e.column))}getNthRow(r,e,t){let n=super.getRowCount();if(r===0&&n)return this;n&&r--;for(let i of this.childNodes.slice(2))if(i.type==="tr"&&i.getRowCount()&&(r--,r<0))return i}json(){let r=super.json();return r.closed=this.closed,r}}});var Hr,As=k(()=>{"use strict";jn();Hr=class extends Bt{get type(){return"tr"}constructor(r,e,t,n){super(/^\n[^\S\n]*(?:\|-+|\{\{\s*!\s*\}\}-+|\{\{\s*!-\s*\}\}-*)$/u,r,"tr",e,t,n,{})}}});var jt,On=k(()=>{"use strict";_e();jt=class extends ie{}});var qt,_n=k(()=>{"use strict";On();qt=class extends jt{get type(){return"dd"}}});var ws={};se(ws,{parseTable:()=>pa});var ga,Ss,pa,Cs=k(()=>{"use strict";P();vs();As();Bn();_n();ga=a=>a.lastChild.constructor!==A,Ss=(a,r)=>a.type==="td"?r.pop():a,pa=({firstChild:{data:a},type:r,name:e},t,n)=>{let i=[],s=a.split(`
|
|
23
|
+
`),o=r==="root"||r==="parameter-value"||r==="ext-inner"&&e==="poem"?"":`
|
|
24
|
+
${s.shift()}`,l,p=(g,d)=>{if(!d){o+=g;return}let{lastChild:c}=d;if(ga(d)){let m=new A(g,t,n);m.type="table-inter",m.setAttribute("stage",3),d.insertAt(m)}else c.setText(c.toString()+g)};for(let g of s){l=i.pop();let[d]=/^(?:\s|\0\d+[cno]\x7F)*/u.exec(g),c=g.slice(d.length),m=/^(:*)((?:\s|\0\d+[cn]\x7F)*)(\{\||\{(?:\0\d+[cn]\x7F)*\0\d+!\x7F|\0\d+\{\x7F)(.*)$/u.exec(c);if(m){for(;l&&l.type!=="td";)l=i.pop();let[,w,L,N,q]=m;w&&new qt(w,t,n),p(`
|
|
25
|
+
${d}${w&&`\0${n.length-1}d\x7F`}${L}\0${n.length}b\x7F`,l),i.push(...l?[l]:[],new Ur(N,q,t,n));continue}else if(!l){o+=`
|
|
26
|
+
${g}`;continue}let h=/^(?:(\|\}|\0\d+!\x7F\}|\0\d+\}\x7F)|(\|-+|\0\d+!\x7F-+|\0\d+-\x7F-*)(?!-)|(!|(?:\||\0\d+!\x7F)\+?))(.*)$/u.exec(c);if(!h){p(`
|
|
27
|
+
${g}`,l),i.push(l);continue}let[,f,v,T,S]=h;if(f){for(;l.type!=="table";)l=i.pop();l.close(`
|
|
28
|
+
${d}${f}`,!0),p(S,i[i.length-1])}else if(v){l=Ss(l,i),l.type==="tr"&&(l=i.pop());let w=new Hr(`
|
|
29
|
+
${d}${v}`,S,t,n);i.push(l,w),l.insertAt(w)}else{l=Ss(l,i);let w=T==="!"?/!!|(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu:/(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu,L=w.exec(S),N=0,q=`
|
|
30
|
+
${d}${T}`,z=B=>{let V=new it(q,S.slice(N,L==null?void 0:L.index),t,n);return B.insertAt(V),V};for(;L;)z(l),{lastIndex:N}=w,[q]=L,L=w.exec(S);i.push(l,z(l))}}return o.slice(1)}});var Vr,$s=k(()=>{"use strict";_e();Vr=class extends ie{get type(){return"hr"}}});var Ns,Mn,ua,st,Es=k(()=>{"use strict";Xe();R();_e();Ns=[ce()];st=class extends(ua=ie){get type(){return"double-underscore"}constructor(r,e,t=x.getConfig(),n){super(r,t,n)}getAttribute(r){return r==="padding"?2:super.getAttribute(r)}toString(){return`__${this.innerText}__`}print(){return super.print({pre:"__",post:"__"})}};Mn=de(ua),st=pe(Mn,0,"DoubleUnderscoreToken",Ns,st),ge(Mn,1,st)});var Is={};se(Is,{parseHrAndDoubleUnderscore:()=>ca});var ca,Ls=k(()=>{"use strict";$s();Es();kn();ca=({firstChild:{data:a},type:r,name:e},t,n)=>{var l,p,g;let{doubleUnderscore:[i,s,o]}=t;return(l=t.insensitiveDoubleUnderscore)!=null||(t.insensitiveDoubleUnderscore=new Set(i)),(p=t.sensitiveDoubleUnderscore)!=null||(t.sensitiveDoubleUnderscore=new Set(s)),(g=t.regexHrAndDoubleUnderscore)!=null||(t.regexHrAndDoubleUnderscore=new RegExp(`__(${[...i,...s].join("|")})__`,"giu")),r!=="root"&&(r!=="ext-inner"||e!=="poem")&&(a=`\0${a}`),a=a.replace(/^((?:\0\d+[cno]\x7F)*)(-{4,})/gmu,(d,c,m)=>(new Vr(m,t,n),`${c}\0${n.length-1}r\x7F`)).replace(t.regexHrAndDoubleUnderscore,(d,c)=>{var v;let m=t.sensitiveDoubleUnderscore.has(c),h=c.toLowerCase(),f=t.insensitiveDoubleUnderscore.has(h);return m||f?(new st(c,m,t,n),`\0${n.length-1}${f&&((v=o==null?void 0:o[h])!=null?v:h)==="toc"?"u":"n"}\x7F`):d}).replace(/^((?:\0\d+[cn]\x7F)*)(={1,6})(.+)\2((?:\s|\0\d+[cn]\x7F)*)$/gmu,(d,c,m,h,f)=>{let v=`${c}\0${n.length}h\x7F`;return new wt(m.length,[h,f],t,n),v}),r==="root"||r==="ext-inner"&&e==="poem"?a:a.slice(1)}});var Xr,Fs=k(()=>{"use strict";j();K();R();_e();Xr=class extends ie{get type(){return"quote"}get bold(){return this.innerText.length!==2}get italic(){return this.innerText.length!==3}text(){let{parentNode:r,innerText:e}=this;return(r==null?void 0:r.type)==="image-parameter"&&r.name!=="caption"?"":e}lint(r=this.getAbsoluteIndex()){let{previousSibling:e,nextSibling:t,bold:n}=this,i=x.msg('lonely "$1"',"'"),s=[],o=new I(this,r),l=(p,g,d)=>[{desc:"escape",range:[p,g],text:"'".repeat(d)},{desc:"remove",range:[p,g],text:""}];if((e==null?void 0:e.type)==="text"&&e.data.endsWith("'")){let p=$(this,o,"lonely-apos",i),{startIndex:g,startLine:d,startCol:c}=p,[,{length:m}]=/(?:^|[^'])('+)$/u.exec(e.data),h=r-m;s.push({...p,startIndex:h,endIndex:g,endLine:d,startCol:c-m,endCol:c,suggestions:l(h,g,m)})}if((t==null?void 0:t.type)==="text"&&t.data.startsWith("'")){let p=$(this,o,"lonely-apos",i),{endIndex:g,endLine:d,endCol:c}=p,[{length:m}]=/^'+/u.exec(t.data),h=g+m;s.push({...p,startIndex:g,endIndex:h,startLine:d,startCol:c,endCol:c+m,suggestions:l(g,h,m)})}if(n&&this.closest("heading-title")){let p=$(this,o,"bold-header","bold in section header","warning");p.suggestions=[{desc:"remove",range:[r,r+3],text:""}],s.push(p)}return s}json(){let r=super.json();return Object.assign(r,{bold:this.bold,italic:this.italic}),r}}});var Rs={};se(Rs,{parseQuotes:()=>zn});var zn,Gn=k(()=>{"use strict";Fs();zn=(a,r,e)=>{var g;let t=a.split(/('{2,})/u),{length:n}=t;if(n===1)return a;let i=0,s=0,o,l,p;for(let d=1;d<n;d+=2){let c=t[d].length;switch(c){case 2:s++;break;case 4:t[d-1]+="'",t[d]="'''";case 3:if(i++,o!==void 0)break;t[d-1].endsWith(" ")?l===void 0&&p===void 0&&(p=d):t[d-1].slice(-2,-1)===" "?o=d:l!=null||(l=d);break;default:t[d-1]+="'".repeat(c-5),t[d]="'''''",s++,i++}}if(s%2===1&&i%2===1){let d=(g=o!=null?o:l)!=null?g:p;d!==void 0&&(t[d]="''",t[d-1]+="'")}for(let d=1;d<n;d+=2)new Xr(t[d],r,e),t[d]=`\0${e.length-1}q\x7F`;return t.join("")}});var Ps={};se(Ps,{parseExternalLinks:()=>Wn});var Wn,Dn=k(()=>{"use strict";Q();Nn();_r();Wn=(a,r,e,t)=>{var n;return(n=r.regexExternalLinks)!=null||(r.regexExternalLinks=new RegExp(String.raw`\[(\0\d+f\x7F|(?:(?:${r.protocol}|//)${we}|\0\d+m\x7F)${Ce}(?=[[\]<>"\t${be}]|\0\d))([${be}]*(?![${be}]))([^\]\x01-\x08\x0A-\x1F\uFFFD]*)\]`,"giu")),a.replace(r.regexExternalLinks,(i,s,o,l)=>{let{length:p}=e,g=/&[lg]t;/u.exec(s);return g&&(o="",l=s.slice(g.index)+o+l,s=s.slice(0,g.index)),t?(new Ie(s,"ext-link-url",r,e),`[\0${p}f\x7F${o}${l}]`):(new It(s,o,l,r,e),`\0${p}w\x7F`)})}});var Qr,Bs=k(()=>{"use strict";Zt();Qr=class extends Ae{get type(){return"category"}}});var qs={};se(qs,{parseLinks:()=>js});var ma,js,Os=k(()=>{"use strict";R();Gn();Dn();$n();wn();Bs();ma=/^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(\||\0\d+!\x7F)([\s\S]*)$/u,js=(a,r,e)=>{var s;(s=r.regexLinks)!=null||(r.regexLinks=new RegExp(String.raw`^\s*(?:${r.protocol}|//)`,"iu"));let t=r.inExt?/^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)([\s\S]*?[^\]]))?\]\]([\s\S]*)$/u:/^((?:(?!\0\d+!\x7F)[^\n[\]{}|])+)(?:(\||\0\d+!\x7F)([\s\S]*?[^\]])?)?\]\]([\s\S]*)$/u,n=a.split("[["),i=n.shift();for(let o=0;o<n.length;o++){let l=!1,p,g,d,c,m=n[o],h=t.exec(m);if(h)[,p,g,d,c]=h,c.startsWith("]")&&(d!=null&&d.includes("["))&&(d+="]",c=c.slice(1));else{let N=ma.exec(m);N&&(l=!0,[,p,g,d]=N)}if(p===void 0||r.regexLinks.test(p)||/\0\d+[exhbru]\x7F/u.test(p)){i+=`[[${m}`;continue}let f=p.trim().startsWith(":");if(f&&l){i+=`[[${m}`;continue}let v=x.normalizeTitle(p,0,!1,r,!0,!0,!0),{ns:T,valid:S,interwiki:w}=v;if(S){if(l){if(w||T!==6){i+=`[[${m}`;continue}let N=!1;for(o++;o<n.length;o++){let q=n[o],z=q.split("]]");if(z.length>2){N=!0,d+=`[[${z[0]}]]${z[1]}`,c=z.slice(2).join("]]");break}else if(z.length===2)d+=`[[${z[0]}]]${z[1]}`;else{d+=`[[${q}`;break}}if(d=js(d,r,e),!N){i+=`[[${p}${g}${d}`;continue}}}else{i+=`[[${m}`;continue}d&&(d=zn(d,r,e));let L=Et;f||(!w&&T===6?(d&&(d=Wn(d,r,e,!0)),L=$t):!w&&T===14&&(L=Qr)),d===void 0&&g&&(d=""),i+=`\0${e.length}l\x7F${c}`,new L(p,d,r,e,g)}return i}});var Ws={};se(Ws,{parseMagicLinks:()=>ha});var Gs,_s,Ms,zs,ha,Ds=k(()=>{"use strict";Q();_r();Gs=String.raw`[${be}\t]| |�*160;|�*a0;`,_s=`(?:${Gs})+`,Ms=`(?:${Gs}|-)`,zs=String.raw`(?:RFC|PMID)${_s}\d+\b|ISBN${_s}(?:97[89]${Ms}?)?(?:\d${Ms}?){9}[\dx]\b`,ha=(a,r,e)=>{if(!r.regexMagicLinks)try{r.regexMagicLinks=new RegExp(String.raw`(^|[^\p{L}\d_])(?:(?:${r.protocol})(${we}${Ce})|${zs})`,"giu")}catch(t){r.regexMagicLinks=new RegExp(String.raw`(^|\W)(?:(?:${r.protocol})(${we}${Ce})|${zs})`,"giu")}return a.replace(r.regexMagicLinks,(t,n,i)=>{let s=n?t.slice(n.length):t;if(i){let o="",l=/&(?:lt|gt|nbsp|#x0*(?:3[ce]|a0)|#0*(?:6[02]|160));/iu.exec(s);l&&(o=s.slice(l.index),s=s.slice(0,l.index));let p=s.includes("(")?/[^,;\\.:!?][,;\\.:!?]+$/u:/[^,;\\.:!?)][,;\\.:!?)]+$/u,g=p.exec(s);if(g){let d=1;g[0][1]===";"&&/&(?:[a-z]+|#x[\da-f]+|#\d+)$/iu.test(s.slice(0,g.index))&&(d=2),o=s.slice(g.index+d)+o,s=s.slice(0,g.index+d)}return o.length>=i.length?t:(new Ie(s,void 0,r,e),`${n}\0${e.length-1}w\x7F${o}`)}else if(!/^(?:RFC|PMID|ISBN)/u.test(s))return t;return new Ie(s,"magic-link",r,e),`${n}\0${e.length-1}i\x7F`})}});var Us,Hs=k(()=>{"use strict";Us=(a,r)=>a.startsWith(r)?r.length:[...r].findIndex((e,t)=>e!==a[t])});var Kr,Vs=k(()=>{"use strict";On();Kr=class extends jt{get type(){return"list"}}});var Xs={};se(Xs,{parseList:()=>fa});var fa,Qs=k(()=>{"use strict";Hs();Vs();_n();fa=(a,r,e,t)=>{let n=/^((?:\0\d+[cno]\x7F)*)([;:*#]+\s*)/u.exec(a);if(!n)return r.lastPrefix="",a;let[i,s,o]=n,l=o.replace(/;/gu,":"),p=Us(l,r.lastPrefix),g=(p>1?o.slice(p-1):o).split(/(?=;)/u),d=g[0].startsWith(";"),c=g.length-(d?0:1);if(p>1){let B=o.slice(0,p-1);d?g.unshift(B):g[0]=B+g[0]}r.lastPrefix=l;let m=s+g.map((B,V)=>`\0${t.length+V}d\x7F`).join("")+a.slice(i.length);for(let B of g)new Kr(B,e,t);if(!c)return m;let{html:[h]}=e,f=/:+|-\{|\0\d+[xq]\x7F/gu,v=f,T=v.exec(m),S=0,w=!1,L=!1,N=0,q=(B,V)=>(new qt(B,e,t),`${m.slice(0,V)}\0${t.length-1}d\x7F${m.slice(V+B.length)}`),z=B=>{B?S&&S--:S++};for(;T&&c;){let{0:B,index:V}=T;if(B==="-{"){if(!N){let{lastIndex:X}=v;v=/-\{|\}-/gu,v.lastIndex=X}N++}else if(B==="}-"){if(N--,!N){let{lastIndex:X}=v;v=f,v.lastIndex=X}}else if(B.endsWith("x\x7F")){let{name:X,closing:Y,selfClosing:U}=t[Number(B.slice(1,-2))];(!U||h.includes(X))&&z(Y)}else if(B.endsWith("q\x7F")){let{bold:X,italic:Y}=t[Number(B.slice(1,-2))];X&&(z(w),w=!w),Y&&(z(L),L=!L)}else if(S===0){if(B.length>=c)return q(B.slice(0,c),V);c-=B.length,v.lastIndex=V+4+String(t.length).length,m=q(B,V)}T=v.exec(m)}return m}});var Ks,Fe,Jr,Js=k(()=>{"use strict";j();K();R();P();Ee();Ks=new Set(["A","T","R","D","-","H","N"]),Jr=class extends A{constructor(e,t=x.getConfig(),n=[]){super(void 0,t,n,{});b(this,Fe);this.append(...e.map(i=>new M(i,"converter-flag",t,n)))}get type(){return"converter-flags"}afterBuild(){y(this,Fe,this.childNodes.map(e=>e.text().trim())),super.afterBuild()}toString(e){return super.toString(e,";")}text(){return super.text(";")}getGaps(){return 1}getUnknownFlags(){return new Set(u(this,Fe).filter(e=>/\{{3}[^{}]+\}{3}/u.test(e)))}getVariantFlags(){let e=new Set(this.getAttribute("config").variants);return new Set(u(this,Fe).filter(t=>e.has(t)))}lint(e=this.getAbsoluteIndex(),t){let n=this.getVariantFlags(),i=this.getUnknownFlags(),s=new Set(u(this,Fe).filter(d=>Ks.has(d))),o=u(this,Fe).filter(d=>!d).length,l=u(this,Fe).length-i.size-o,p=super.lint(e,t);if(n.size===l||s.size===l)return p;let g=new I(this,e);for(let[d,c]of this.childNodes.entries()){let m=c.text().trim();if(m&&!n.has(m)&&!i.has(m)&&(n.size>0||!s.has(m))){let h=C(c,g,"no-ignored","invalid conversion flag");n.size===0&&Ks.has(m.toUpperCase())?h.fix={range:[h.startIndex,h.endIndex],text:m.toUpperCase(),desc:"uppercase"}:h.suggestions=[{desc:"remove",range:[h.startIndex-(d&&1),h.endIndex],text:""}],p.push(h)}}return p}print(){return super.print({sep:";"})}};Fe=new WeakMap});var Ot,Ys=k(()=>{"use strict";R();P();Ee();Ot=class extends A{get type(){return"converter-rule"}constructor(r,e=!0,t=x.getConfig(),n=[]){super(void 0,t,n);let i=r.indexOf(":"),s=r.slice(0,i).indexOf("=>"),o=s===-1?r.slice(0,i):r.slice(s+2,i);e&&t.variants.includes(o.trim())?(super.insertAt(new M(o,"converter-rule-variant",t,n)),super.insertAt(new M(r.slice(i+1),"converter-rule-to",t,n)),s!==-1&&super.insertAt(new M(r.slice(0,s),"converter-rule-from",t,n),0)):super.insertAt(new M(r,"converter-rule-to",t,n))}toString(r){let{childNodes:e,firstChild:t,lastChild:n}=this;return e.length===3?`${t.toString(r)}=>${e[1].toString(r)}:${n.toString(r)}`:super.toString(r,":")}text(){let{childNodes:r,firstChild:e,lastChild:t}=this;return r.length===3?`${e.text()}=>${r[1].text()}:${t.text()}`:super.text(":")}getGaps(r){return r===0&&this.length===3?2:1}print(){let{childNodes:r}=this;if(r.length===3){let[e,t,n]=r;return`<span class="wpb-converter-rule">${e.print()}=>${t.print()}:${n.print()}</span>`}return super.print({sep:":"})}}});var Yr,Zs=k(()=>{"use strict";Q();R();P();Js();Ys();Yr=class extends A{get type(){return"converter"}constructor(r,e,t=x.getConfig(),n=[]){super(void 0,t,n),this.append(new Jr(r,t,n));let[i]=e,s=i.includes(":"),o=new Ot(i,s,t,n);s&&o.length===1||!s&&e.length===2&&!ne(e[1]).trim()?this.insertAt(new Ot(e.join(";"),!1,t,n)):this.append(o,...e.slice(1).map(l=>new Ot(l,!0,t,n)))}toString(r){let{childNodes:[e,...t]}=this;return`-{${e.toString(r)}${e.length>0?"|":""}${t.map(n=>n.toString(r)).join(";")}}-`}text(){let{childNodes:[r,...e]}=this;return`-{${r.text()}|${ue(e,";")}}-`}getAttribute(r){return r==="padding"?2:super.getAttribute(r)}getGaps(r){return r||this.firstChild.length>0?1:0}print(){let{childNodes:[r,...e]}=this;return`<span class="wpb-converter">-{${r.print()}${r.length>0?"|":""}${$e(e,{sep:";"})}}-</span>`}}});var eo={};se(eo,{parseConverter:()=>xa});var xa,to=k(()=>{"use strict";Zs();xa=(a,r,e)=>{var l;(l=r.regexConverter)!=null||(r.regexConverter=new RegExp(String.raw`;(?=(?:[^;]*?=>)?\s*(?:${r.variants.join("|")})\s*:|(?:\s|\0\d+[cn]\x7F)*$)`,"u"));let t=/-\{/gu,n=/-\{|\}-/gu,i=[],s=t,o=s.exec(a);for(;o;){let{0:p,index:g}=o;if(p==="}-"){let d=i.pop(),{length:c}=e,m=a.slice(d.index+2,g),h=m.indexOf("|"),[f,v]=h===-1?[[],m]:[m.slice(0,h).split(";"),m.slice(h+1)],T=v.replace(/(&[#a-z\d]+);/giu,"$1"),S=T.split(r.regexConverter).map(w=>w.replace(/\x01/gu,";"));new Yr(f,S,r,e),a=`${a.slice(0,d.index)}\0${c}v\x7F${a.slice(g+2)}`,i.length===0&&(s=t),s.lastIndex=d.index+3+String(c).length}else i.push(o),s=n,s.lastIndex=g+2;o=s.exec(a)}return a}});var Zr={};se(Zr,{Token:()=>A});var ur,xe,O,G,ot,_t,cr,_,ro,no,io,so,oo,ao,lo,go,po,uo,co,mo,Un,A,P=k(()=>{"use strict";Q();j();R();fi();Ti();Un=class Un extends yr{constructor(e,t=x.getConfig(),n=[],i){super();b(this,_);b(this,ur,"plain");b(this,xe,0);b(this,O);b(this,G);b(this,ot);b(this,_t,!1);b(this,cr);typeof e=="string"&&this.insertAt(e),y(this,O,t),y(this,G,n),n.push(this)}get type(){return u(this,ur)}set type(e){y(this,ur,e)}parseOnce(e=u(this,xe),t=!1){if(e<u(this,xe)||this.length===0||!this.getAttribute("plain"))return this;if(u(this,xe)>=11)return this;switch(e){case 0:if(this.type==="root"){u(this,G).pop();let n=E(this,_,ro).call(this);t&&(t=!n)}y(this,ot,t),E(this,_,no).call(this,t);break;case 1:E(this,_,io).call(this);break;case 2:E(this,_,so).call(this);break;case 3:E(this,_,oo).call(this);break;case 4:E(this,_,ao).call(this);break;case 5:E(this,_,lo).call(this);break;case 6:E(this,_,go).call(this);break;case 7:E(this,_,po).call(this);break;case 8:E(this,_,uo).call(this);break;case 9:E(this,_,co).call(this);break;case 10:E(this,_,mo).call(this)}if(this.type==="root")for(let n of u(this,G))n==null||n.parseOnce(e,t);return xr(this,xe)._++,this}buildFromStr(e,t){let n=e.split(/[\0\x7F]/u).map((i,s)=>{if(s%2===0)return new Jt(i);if(isNaN(i.slice(-1)))return u(this,G)[Number(i.slice(0,-1))];throw new Error(`Failed to build! Unrecognized token: ${i}`)});return t===0?n.map(String).join(""):t===1?ue(n):n}build(){y(this,xe,11);let{length:e,firstChild:t}=this,n=t==null?void 0:t.toString();if(e===1&&t.type==="text"&&n.includes("\0")&&(this.replaceChildren(...this.buildFromStr(n)),this.normalize(),this.type==="root"))for(let i of u(this,G))i==null||i.build()}afterBuild(){if(this.type==="root")for(let e of u(this,G))e==null||e.afterBuild();y(this,_t,!0)}parse(e=11,t){for(e=Math.min(e,11);u(this,xe)<e;)this.parseOnce(u(this,xe),t);return e&&(this.build(),this.afterBuild()),this}getAttribute(e){var t;switch(e){case"plain":return this.constructor===Un;case"config":return u(this,O);case"include":return(t=u(this,ot))!=null?t:!!u(this.getRootNode(),ot);case"accum":return u(this,G);case"built":return u(this,_t);default:return super.getAttribute(e)}}setAttribute(e,t){switch(e){case"stage":u(this,xe)===0&&this.type==="root"&&u(this,G).shift(),y(this,xe,t);break;default:super.setAttribute(e,t)}}insertAt(e,t=this.length){let n=typeof e=="string"?new Jt(e):e;return super.insertAt(n,t),n.type==="root"&&(n.type="plain"),n}normalizeTitle(e,t=0,n,i,s){return x.normalizeTitle(e,t,u(this,ot),u(this,O),n,i,s)}lint(e=this.getAbsoluteIndex(),t){var i;let n=super.lint(e,t);if(this.type==="root"){let s=new Map,o="category,html-attr#id,ext-attr#id,table-attr#id";for(let c of this.querySelectorAll(o)){let m;if(c.type==="category")m=c.name;else{let h=c.getValue();h&&h!==!0&&(m=`#${h}`)}if(m){let h=s.get(m);h?h.add(c):s.set(m,new Set([c]))}}for(let[c,m]of s)if(m.size>1&&!c.startsWith("#mw-customcollapsible-")){let h=!c.startsWith("#"),f=`duplicated ${h?"category":"id"}`,v=h?"error":"warning";n.push(...[...m].map(T=>{let S=$(T,{start:T.getAbsoluteIndex()},"no-duplicate",f,v);return h&&(S.suggestions=[{desc:"remove",range:[S.startIndex,S.endIndex],text:""}]),S}))}let l=/<!--\s*lint-(disable(?:(?:-next)?-line)?|enable)(\s[\sa-z,-]*)?-->/gu,p=this.toString(),g=[],d=l.exec(p);for(;d;){let{1:c,index:m}=d,h=(i=d[2])==null?void 0:i.trim();g.push({line:this.posFromIndex(m).top+(c==="disable-line"?0:1),from:c==="disable"?l.lastIndex:void 0,to:c==="enable"?l.lastIndex:void 0,rules:h?new Set(h.split(",").map(f=>f.trim())):void 0}),d=l.exec(p)}n=n.filter(({rule:c,startLine:m,startIndex:h})=>{let f={pos:0};for(let{line:v,from:T,to:S,rules:w}of g){if(v>m+1)break;if(w&&!w.has(c))continue;if(v===m&&T===void 0&&S===void 0)return!1;T<=h&&T>f.pos?(f.pos=T,f.type="from"):S<=h&&S>f.pos&&(f.pos=S,f.type="to")}return f.type!=="from"})}return n}toString(e,t){return e?super.toString(!0,t):je(u(this,cr),()=>super.toString(!1,t),n=>{let i=this.getRootNode();i.type==="root"&&u(i,_t)&&y(this,cr,n)})}caretPositionFromIndex(e){}elementFromIndex(e){}elementFromPoint(e,t){}};ur=new WeakMap,xe=new WeakMap,O=new WeakMap,G=new WeakMap,ot=new WeakMap,_t=new WeakMap,cr=new WeakMap,_=new WeakSet,ro=function(){let{parseRedirect:e}=(wi(),J(Si)),t=this.firstChild.toString(),n=e(t,u(this,O),u(this,G));return n&&this.setText(n),!!n},no=function(e){let{parseCommentAndExt:t}=(rr(),J(hs));this.setText(t(this.firstChild.toString(),u(this,O),u(this,G),e))},io=function(){let{parseBraces:e}=(Rr(),J(Ji)),t=this.type==="root"?this.firstChild.toString():`\0${this.firstChild.toString()}`,n=e(t,u(this,O),u(this,G));this.setText(this.type==="root"?n:n.slice(1))},so=function(){var t;if((t=u(this,O).excludes)!=null&&t.includes("html"))return;let{parseHtml:e}=(bs(),J(xs));this.setText(e(this.firstChild.toString(),u(this,O),u(this,G)))},oo=function(){var t;if((t=u(this,O).excludes)!=null&&t.includes("table"))return;let{parseTable:e}=(Cs(),J(ws));this.setText(e(this,u(this,O),u(this,G)))},ao=function(){var t;if((t=u(this,O).excludes)!=null&&t.includes("hr"))return;let{parseHrAndDoubleUnderscore:e}=(Ls(),J(Is));this.setText(e(this,u(this,O),u(this,G)))},lo=function(){let{parseLinks:e}=(Os(),J(qs));this.setText(e(this.firstChild.toString(),u(this,O),u(this,G)))},go=function(){var n;if((n=u(this,O).excludes)!=null&&n.includes("quote"))return;let{parseQuotes:e}=(Gn(),J(Rs)),t=this.firstChild.toString().split(`
|
|
31
|
+
`);for(let i=0;i<t.length;i++)t[i]=e(t[i],u(this,O),u(this,G));this.setText(t.join(`
|
|
32
|
+
`))},po=function(){var t;if((t=u(this,O).excludes)!=null&&t.includes("extLink"))return;let{parseExternalLinks:e}=(Dn(),J(Ps));this.setText(e(this.firstChild.toString(),u(this,O),u(this,G)))},uo=function(){var t;if((t=u(this,O).excludes)!=null&&t.includes("magicLink"))return;let{parseMagicLinks:e}=(Ds(),J(Ws));this.setText(e(this.firstChild.toString(),u(this,O),u(this,G)))},co=function(){var s;if((s=u(this,O).excludes)!=null&&s.includes("list"))return;let{parseList:e}=(Qs(),J(Xs)),t=this.firstChild.toString().split(`
|
|
33
|
+
`),n={lastPrefix:""},i=this.type==="root"||this.type==="ext-inner"&&this.name==="poem"?0:1;for(;i<t.length;i++)t[i]=e(t[i],n,u(this,O),u(this,G));this.setText(t.join(`
|
|
34
|
+
`))},mo=function(){if(u(this,O).variants.length>0){let{parseConverter:e}=(to(),J(eo));this.setText(e(this.firstChild.toString(),u(this,O),u(this,G)))}};A=Un});var Ne,Ct,pn,vr,ve=k(()=>{"use strict";Ne={running:!1,run(a){let{running:r}=this;this.running=!0;try{let{Token:e}=(P(),J(Zr)),t=a();return t instanceof e&&!t.getAttribute("built")&&t.afterBuild(),this.running=r,t}catch(e){throw this.running=r,e}},rev:0},Ct=a=>r=>r.type===a,pn=(a,r,e,t=[])=>{var o,l;let{childNodes:n}=a,i=Object.isFrozen(n)?[...n]:n,s=i.splice(r,e,...t);for(let p=0;p<t.length;p++){let g=t[p];g.setAttribute("parentNode",a),g.setAttribute("nextSibling",i[r+p+1]),g.setAttribute("previousSibling",i[r+p-1])}return(o=i[r-1])==null||o.setAttribute("nextSibling",i[r]),(l=i[r+t.length])==null||l.setAttribute("previousSibling",i[r+t.length-1]),s},vr=(a,r)=>{Object.defineProperty(a,"name",{value:r.name})}});var ho={};se(ho,{Title:()=>Hn});var mr,hr,Mt,Re,Hn,fo=k(()=>{"use strict";Q();Hn=class{constructor(r,e,t,n,i){b(this,mr);b(this,hr);b(this,Mt);b(this,Re);te(this,"interwiki","");te(this,"valid");te(this,"encoded",!1);let s=r.trim().startsWith("../");if(n&&r.includes("%"))try{let l=/%(?!21|3[ce]|5[bd]|7[b-d])[\da-f]{2}/iu.test(r);r=Be(r),this.encoded=l}catch(l){}if(r=Wt(r).replace(/[_ ]+/gu," ").trim(),s)y(this,Mt,0);else{let l=e;r.startsWith(":")&&(l=0,r=r.slice(1).trim());let p=r.split(":");if(p.length>1){let g=p[0].trim().toLowerCase(),d=Object.prototype.hasOwnProperty.call(t.nsid,g)&&t.nsid[g];d&&(l=d,r=p.slice(1).join(":").trim())}y(this,Mt,l)}let o=r.indexOf("#");if(o!==-1){let l=r.slice(o).trim().slice(1);if(l.includes("%"))try{l=Be(l)}catch(p){}y(this,Re,l.replace(/ /gu,"_")),r=r.slice(0,o).trim()}this.valid=!!(r||this.interwiki||i&&this.ns===0&&u(this,Re)!==void 0)&&Wt(r)===r&&!/^:|\0\d+[eh!+-]\x7F|[<>[\]{}|\n]|%[\da-f]{2}|(?:^|\/)\.{1,2}(?:$|\/)/iu.test(s?/^(?:\.\.\/)+(.*)/u.exec(r)[1]:r),this.main=r,Object.defineProperties(this,{encoded:{enumerable:!1,writable:!1}}),y(this,hr,t.namespaces)}get ns(){return u(this,Mt)}get fragment(){return u(this,Re)}get main(){return u(this,mr)}set main(r){r=r.replace(/_/gu," ").trim(),y(this,mr,r&&r[0].toUpperCase()+r.slice(1))}get prefix(){let r=u(this,hr)[this.ns];return r+(r&&":")}get title(){return this.getRedirection()[1]}get extension(){let{main:r}=this,e=r.lastIndexOf(".");return e===-1?void 0:r.slice(e+1).toLowerCase()}toString(r){return(r?this.title.replace(/_/gu," "):this.title)+(u(this,Re)===void 0?"":`#${u(this,Re)}`)}getRedirection(){return[!1,(this.interwiki+(this.interwiki&&":")+this.prefix+this.main).replace(/ /gu,"_")]}setFragment(r){y(this,Re,r)}};mr=new WeakMap,hr=new WeakMap,Mt=new WeakMap,Re=new WeakMap});var zt,xo,ba,x,R=k(()=>{ii();ve();ui();Q();zt={config:sn,i18n:void 0,rules:ni,getConfig(){let{doubleUnderscore:a}=this.config;for(let r=0;r<2;r++)a.length>r+2&&a[r].length===0&&(a[r]=Object.keys(a[r+2]));return{...sn,...this.config,excludes:[]}},msg(a,r=""){var e,t;return a&&((t=(e=this.i18n)==null?void 0:e[a])!=null?t:a).replace("$1",this.msg(r))},normalizeTitle(a,r=0,e,t=zt.getConfig(),n,i=!1,s=!1){let{Title:o}=(fo(),J(ho)),l;if(n)l=new o(a,r,t,i,s);else{let{Token:p}=(P(),J(Zr));l=Ne.run(()=>{let g=new p(a,t);g.type="root",g.parseOnce(0,e).parseOnce();let d=new o(g.toString(),r,t,i,s);for(let c of["main","fragment"]){let m=d[c];if(m!=null&&m.includes("\0")){let h=g.buildFromStr(m,1);c==="main"?d.main=h:d.setFragment(h)}}return d})}return l},parse(a,r,e=11,t=zt.getConfig()){if(a=ai(a),typeof e!="number"){let s=Array.isArray(e)?e:[e];e=Math.max(...s.map(o=>ri[o]||11))}let{Token:n}=(P(),J(Zr));return Ne.run(()=>{let s=new n(a,t);return s.type="root",s.parse(e,r)})},createLanguageService(a){var n;let r,{LanguageService:e,tasks:t}=r;return(n=t.get(a))!=null?n:new e(a)}},xo={},ba=new Set(["normalizeTitle","parse","createLanguageService"]);for(let a in zt)ba.has(a)||(xo[a]={enumerable:!1});Object.defineProperties(zt,xo);Object.assign(typeof globalThis=="object"?globalThis:self,{Parser:zt});x=zt});R();})();
|
|
35
|
+
//# sourceMappingURL=bundle.min.js.map
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
var _a;
|
|
3
|
+
const version = '1.16.3', src = (_a = document.currentScript) === null || _a === void 0 ? void 0 : _a.src, file = /\/extensions\/dist\/base\.(?:min\.)?js$/u, CDN = src && file.test(src)
|
|
4
|
+
? src.replace(file, '')
|
|
5
|
+
: `https://testingcf.jsdelivr.net/npm/wikiparser-node@${version}`;
|
|
6
|
+
const workerJS = () => {
|
|
7
|
+
importScripts('$CDN/bundle/bundle.lsp.js');
|
|
8
|
+
const entities = { '&': 'amp', '<': 'lt', '>': 'gt' }, lsps = new Map();
|
|
9
|
+
const getLSP = (qid, signature) => {
|
|
10
|
+
let id = Math.floor(qid);
|
|
11
|
+
if (signature) {
|
|
12
|
+
id += 0.5;
|
|
13
|
+
}
|
|
14
|
+
if (lsps.has(id)) {
|
|
15
|
+
return lsps.get(id);
|
|
16
|
+
}
|
|
17
|
+
const lsp = Parser.createLanguageService({});
|
|
18
|
+
lsps.set(id, lsp);
|
|
19
|
+
return lsp;
|
|
20
|
+
};
|
|
21
|
+
const parseColor = (s) => {
|
|
22
|
+
var _a;
|
|
23
|
+
if (s.startsWith('#')) {
|
|
24
|
+
const short = s.length < 7;
|
|
25
|
+
return [
|
|
26
|
+
parseInt(short ? s.charAt(1).repeat(2) : s.slice(1, 3), 16),
|
|
27
|
+
parseInt(short ? s.charAt(2).repeat(2) : s.slice(3, 5), 16),
|
|
28
|
+
parseInt(short ? s.charAt(3).repeat(2) : s.slice(5, 7), 16),
|
|
29
|
+
parseInt((short ? s.charAt(4).repeat(2) : s.slice(7, 9)) || 'ff', 16) / 255,
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
const values = s.slice(s.indexOf('(') + 1, -1).trim().split(/\s+(?:[,/]\s*)?|[,/]\s*/u)
|
|
33
|
+
.map(v => parseFloat(v) / (v.endsWith('%') ? 100 : 1));
|
|
34
|
+
return [
|
|
35
|
+
values[0],
|
|
36
|
+
values[1],
|
|
37
|
+
values[2],
|
|
38
|
+
(_a = values[3]) !== null && _a !== void 0 ? _a : 1,
|
|
39
|
+
];
|
|
40
|
+
};
|
|
41
|
+
self.onmessage = ({ data }) => {
|
|
42
|
+
const [command, qid, wikitext, include, stage] = data;
|
|
43
|
+
switch (command) {
|
|
44
|
+
case 'setI18N':
|
|
45
|
+
Parser.i18n = qid;
|
|
46
|
+
break;
|
|
47
|
+
case 'setConfig':
|
|
48
|
+
Parser.config = qid;
|
|
49
|
+
break;
|
|
50
|
+
case 'getConfig':
|
|
51
|
+
postMessage([qid, Parser.getConfig()]);
|
|
52
|
+
break;
|
|
53
|
+
case 'json':
|
|
54
|
+
postMessage([qid, Parser.parse(wikitext, include, stage).json()]);
|
|
55
|
+
break;
|
|
56
|
+
case 'lint':
|
|
57
|
+
postMessage([qid, Parser.parse(wikitext, include).lint(), wikitext]);
|
|
58
|
+
break;
|
|
59
|
+
case 'print':
|
|
60
|
+
postMessage([
|
|
61
|
+
qid,
|
|
62
|
+
Parser.parse(wikitext, include, stage).childNodes.map(child => [
|
|
63
|
+
stage !== null && stage !== void 0 ? stage : Infinity,
|
|
64
|
+
String(child),
|
|
65
|
+
child.type === 'text'
|
|
66
|
+
? String(child).replace(/[&<>]/gu, p => `&${entities[p]};`)
|
|
67
|
+
: child.print(),
|
|
68
|
+
]),
|
|
69
|
+
]);
|
|
70
|
+
break;
|
|
71
|
+
case 'destroy':
|
|
72
|
+
getLSP(qid).destroy();
|
|
73
|
+
getLSP(qid, true).destroy();
|
|
74
|
+
lsps.delete(qid);
|
|
75
|
+
lsps.delete(qid + 0.5);
|
|
76
|
+
break;
|
|
77
|
+
case 'data':
|
|
78
|
+
getLSP(qid).data = wikitext;
|
|
79
|
+
getLSP(qid, true).data = wikitext;
|
|
80
|
+
break;
|
|
81
|
+
case 'colorPresentations':
|
|
82
|
+
postMessage([qid, getLSP(qid).provideColorPresentations(wikitext)]);
|
|
83
|
+
break;
|
|
84
|
+
case 'documentColors':
|
|
85
|
+
(async () => {
|
|
86
|
+
postMessage([qid, await getLSP(qid).provideDocumentColors(parseColor, wikitext, false), wikitext]);
|
|
87
|
+
})();
|
|
88
|
+
break;
|
|
89
|
+
case 'foldingRanges':
|
|
90
|
+
(async () => {
|
|
91
|
+
postMessage([qid, await getLSP(qid).provideFoldingRanges(wikitext), wikitext]);
|
|
92
|
+
})();
|
|
93
|
+
break;
|
|
94
|
+
case 'links':
|
|
95
|
+
(async () => {
|
|
96
|
+
postMessage([qid, await getLSP(qid).provideLinks(wikitext), wikitext]);
|
|
97
|
+
})();
|
|
98
|
+
break;
|
|
99
|
+
case 'diagnostics':
|
|
100
|
+
(async () => {
|
|
101
|
+
postMessage([qid, await getLSP(qid).provideDiagnostics(wikitext, include), wikitext]);
|
|
102
|
+
})();
|
|
103
|
+
break;
|
|
104
|
+
case 'completionItems':
|
|
105
|
+
(async () => {
|
|
106
|
+
postMessage([qid, await getLSP(qid).provideCompletionItems(wikitext, include), wikitext]);
|
|
107
|
+
})();
|
|
108
|
+
break;
|
|
109
|
+
case 'references':
|
|
110
|
+
(async () => {
|
|
111
|
+
postMessage([qid, await getLSP(qid).provideReferences(wikitext, include), wikitext]);
|
|
112
|
+
})();
|
|
113
|
+
break;
|
|
114
|
+
case 'definition':
|
|
115
|
+
(async () => {
|
|
116
|
+
postMessage([qid, await getLSP(qid).provideDefinition(wikitext, include), wikitext]);
|
|
117
|
+
})();
|
|
118
|
+
break;
|
|
119
|
+
case 'renameLocation':
|
|
120
|
+
(async () => {
|
|
121
|
+
postMessage([qid, await getLSP(qid).resolveRenameLocation(wikitext, include), wikitext]);
|
|
122
|
+
})();
|
|
123
|
+
break;
|
|
124
|
+
case 'renameEdits':
|
|
125
|
+
(async () => {
|
|
126
|
+
postMessage([qid, await getLSP(qid).provideRenameEdits(wikitext, include, stage), wikitext]);
|
|
127
|
+
})();
|
|
128
|
+
break;
|
|
129
|
+
case 'hover':
|
|
130
|
+
(async () => {
|
|
131
|
+
postMessage([qid, await getLSP(qid).provideHover(wikitext, include), wikitext]);
|
|
132
|
+
})();
|
|
133
|
+
break;
|
|
134
|
+
case 'signatureHelp':
|
|
135
|
+
(async () => {
|
|
136
|
+
postMessage([qid, await getLSP(qid, true).provideSignatureHelp(wikitext, include), wikitext]);
|
|
137
|
+
})();
|
|
138
|
+
break;
|
|
139
|
+
case 'inlayHints':
|
|
140
|
+
(async () => {
|
|
141
|
+
postMessage([qid, await getLSP(qid).provideInlayHints(wikitext), wikitext]);
|
|
142
|
+
})();
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
const blob = new Blob([`(${String(workerJS).replace('$CDN', CDN)})()`], { type: 'text/javascript' }), url = URL.createObjectURL(blob), worker = new Worker(url);
|
|
147
|
+
URL.revokeObjectURL(url);
|
|
148
|
+
const getListener = (qid, resolve, raw) => {
|
|
149
|
+
const listener = ({ data: [rid, res, resRaw] }) => {
|
|
150
|
+
if (rid === qid && (raw === undefined || raw === resRaw)) {
|
|
151
|
+
worker.removeEventListener('message', listener);
|
|
152
|
+
resolve(res);
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
return listener;
|
|
156
|
+
};
|
|
157
|
+
const setI18N = (i18n) => {
|
|
158
|
+
worker.postMessage(['setI18N', i18n]);
|
|
159
|
+
};
|
|
160
|
+
const setConfig = (config) => {
|
|
161
|
+
worker.postMessage(['setConfig', config]);
|
|
162
|
+
wikiparse.config = config;
|
|
163
|
+
};
|
|
164
|
+
const getFeedback = (command, qid, strict, raw, ...args) => new Promise(resolve => {
|
|
165
|
+
worker.addEventListener('message', getListener(qid, resolve, strict ? raw : undefined));
|
|
166
|
+
worker.postMessage([command, qid, raw, ...args]);
|
|
167
|
+
});
|
|
168
|
+
const getConfig = () => getFeedback('getConfig', -3);
|
|
169
|
+
const json = (wikitext, include, qid = -4, stage) => getFeedback('json', qid, false, wikitext, include, stage);
|
|
170
|
+
const print = (wikitext, include, stage, qid = -1) => getFeedback('print', qid, false, wikitext, include, stage);
|
|
171
|
+
const lint = (wikitext, include, qid = -2) => getFeedback('lint', qid, true, wikitext, include);
|
|
172
|
+
const provide = (command, qid, wikitext, ...args) => getFeedback(command, qid, typeof wikitext === 'string', wikitext, ...args);
|
|
173
|
+
const append = (parent, text) => {
|
|
174
|
+
if (text) {
|
|
175
|
+
parent.append(text);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const splitNewLine = (html) => {
|
|
179
|
+
let cur = html.cloneNode();
|
|
180
|
+
cur.style.padding = '';
|
|
181
|
+
const result = [cur];
|
|
182
|
+
for (const child of html.childNodes) {
|
|
183
|
+
const { textContent } = child;
|
|
184
|
+
if (!(textContent === null || textContent === void 0 ? void 0 : textContent.includes('\n'))) {
|
|
185
|
+
cur.append(child.cloneNode(true));
|
|
186
|
+
continue;
|
|
187
|
+
}
|
|
188
|
+
const lines = child.nodeType === Node.TEXT_NODE ? textContent.split('\n') : splitNewLine(child);
|
|
189
|
+
append(cur, lines[0]);
|
|
190
|
+
for (const text of lines.slice(1)) {
|
|
191
|
+
cur = html.cloneNode();
|
|
192
|
+
cur.style.padding = '';
|
|
193
|
+
result.push(cur);
|
|
194
|
+
append(cur, text);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return result;
|
|
198
|
+
};
|
|
199
|
+
const getGutter = (container) => container.querySelector('.wikiparser-line-numbers');
|
|
200
|
+
const size = (html) => {
|
|
201
|
+
const container = html.parentElement, gutter = getGutter(container);
|
|
202
|
+
if (!gutter) {
|
|
203
|
+
intersectionObserver.unobserve(html);
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
html.style.marginLeft = '';
|
|
207
|
+
const start = Number(html.dataset['start'] || 1), lines = splitNewLine(html), width = `${String(lines.length + start - 1).length + 1.5}ch`;
|
|
208
|
+
html.style.marginLeft = width;
|
|
209
|
+
gutter.style.width = width;
|
|
210
|
+
const sizer = document.createElement('span'), { style: { paddingLeft, paddingRight } } = html;
|
|
211
|
+
sizer.className = 'wikiparser-sizer';
|
|
212
|
+
sizer.style.paddingLeft = paddingLeft;
|
|
213
|
+
sizer.style.paddingRight = paddingRight;
|
|
214
|
+
for (const child of lines) {
|
|
215
|
+
sizer.append(child, '\n');
|
|
216
|
+
}
|
|
217
|
+
html.append(sizer);
|
|
218
|
+
let line, lastTop;
|
|
219
|
+
for (let i = 0; i < lines.length; i++) {
|
|
220
|
+
const child = lines[i], { top } = child.getBoundingClientRect();
|
|
221
|
+
if (line) {
|
|
222
|
+
line.style.height = `${top - lastTop}px`;
|
|
223
|
+
}
|
|
224
|
+
line = document.createElement('span');
|
|
225
|
+
line.textContent = String(i + start);
|
|
226
|
+
gutter.append(line);
|
|
227
|
+
lastTop = top;
|
|
228
|
+
}
|
|
229
|
+
if (line) {
|
|
230
|
+
const noScroll = html.offsetHeight <= container.clientHeight;
|
|
231
|
+
if (html.isContentEditable) {
|
|
232
|
+
line.style.height = `${container.clientHeight}px`;
|
|
233
|
+
}
|
|
234
|
+
else if (noScroll) {
|
|
235
|
+
line.style.height = `${container.getBoundingClientRect().top + container.scrollHeight - lastTop}px`;
|
|
236
|
+
container.style.overflowY = 'hidden';
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
line.style.height = `${html.getBoundingClientRect().bottom - lastTop}px`;
|
|
240
|
+
container.style.overflowY = '';
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
sizer.remove();
|
|
244
|
+
intersectionObserver.unobserve(html);
|
|
245
|
+
};
|
|
246
|
+
const intersectionObserver = new IntersectionObserver(entries => {
|
|
247
|
+
for (const entry of entries) {
|
|
248
|
+
if (!entry.isIntersecting) {
|
|
249
|
+
continue;
|
|
250
|
+
}
|
|
251
|
+
size(entry.target);
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
const lineNumbers = (html, start = 1, paddingTop = '') => {
|
|
255
|
+
const container = html.parentElement, gutter = document.createElement('span');
|
|
256
|
+
html.dataset['start'] = String(start);
|
|
257
|
+
gutter.className = 'wikiparser-line-numbers';
|
|
258
|
+
gutter.style.paddingTop = paddingTop;
|
|
259
|
+
container.classList.add('wikiparse-container');
|
|
260
|
+
container.append(gutter);
|
|
261
|
+
if (getComputedStyle(html).whiteSpace !== 'pre') {
|
|
262
|
+
html.style.whiteSpace = 'pre-wrap';
|
|
263
|
+
}
|
|
264
|
+
if (html.offsetParent) {
|
|
265
|
+
size(html);
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
intersectionObserver.observe(html);
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
const wikiparse = {
|
|
272
|
+
version,
|
|
273
|
+
CDN,
|
|
274
|
+
id: 0,
|
|
275
|
+
config: {},
|
|
276
|
+
setI18N,
|
|
277
|
+
setConfig,
|
|
278
|
+
getConfig,
|
|
279
|
+
print,
|
|
280
|
+
lint,
|
|
281
|
+
json,
|
|
282
|
+
lineNumbers,
|
|
283
|
+
provide,
|
|
284
|
+
};
|
|
285
|
+
Object.assign(window, { wikiparse });
|
|
286
|
+
})();
|