wikiparser-node 0.9.0 → 0.9.2-b

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.
Files changed (87) hide show
  1. package/bundle/bundle.min.js +38 -0
  2. package/extensions/editor.css +62 -0
  3. package/extensions/editor.js +328 -0
  4. package/extensions/ui.css +119 -0
  5. package/package.json +13 -12
  6. package/README.md +0 -39
  7. package/config/default.json +0 -832
  8. package/config/llwiki.json +0 -630
  9. package/config/moegirl.json +0 -729
  10. package/config/zhwiki.json +0 -1269
  11. package/index.js +0 -333
  12. package/lib/element.js +0 -611
  13. package/lib/node.js +0 -770
  14. package/lib/ranges.js +0 -130
  15. package/lib/text.js +0 -245
  16. package/lib/title.js +0 -83
  17. package/mixin/attributeParent.js +0 -117
  18. package/mixin/fixedToken.js +0 -40
  19. package/mixin/hidden.js +0 -21
  20. package/mixin/singleLine.js +0 -31
  21. package/mixin/sol.js +0 -54
  22. package/parser/brackets.js +0 -126
  23. package/parser/commentAndExt.js +0 -59
  24. package/parser/converter.js +0 -46
  25. package/parser/externalLinks.js +0 -33
  26. package/parser/hrAndDoubleUnderscore.js +0 -38
  27. package/parser/html.js +0 -42
  28. package/parser/links.js +0 -94
  29. package/parser/list.js +0 -59
  30. package/parser/magicLinks.js +0 -41
  31. package/parser/quotes.js +0 -64
  32. package/parser/selector.js +0 -177
  33. package/parser/table.js +0 -114
  34. package/src/arg.js +0 -207
  35. package/src/atom/hidden.js +0 -13
  36. package/src/atom/index.js +0 -43
  37. package/src/attribute.js +0 -470
  38. package/src/attributes.js +0 -453
  39. package/src/charinsert.js +0 -97
  40. package/src/converter.js +0 -176
  41. package/src/converterFlags.js +0 -284
  42. package/src/converterRule.js +0 -256
  43. package/src/extLink.js +0 -180
  44. package/src/gallery.js +0 -149
  45. package/src/hasNowiki/index.js +0 -44
  46. package/src/hasNowiki/pre.js +0 -40
  47. package/src/heading.js +0 -134
  48. package/src/html.js +0 -254
  49. package/src/imageParameter.js +0 -301
  50. package/src/imagemap.js +0 -199
  51. package/src/imagemapLink.js +0 -41
  52. package/src/index.js +0 -936
  53. package/src/link/category.js +0 -44
  54. package/src/link/file.js +0 -287
  55. package/src/link/galleryImage.js +0 -120
  56. package/src/link/index.js +0 -384
  57. package/src/magicLink.js +0 -149
  58. package/src/nested/choose.js +0 -24
  59. package/src/nested/combobox.js +0 -23
  60. package/src/nested/index.js +0 -93
  61. package/src/nested/references.js +0 -23
  62. package/src/nowiki/comment.js +0 -71
  63. package/src/nowiki/dd.js +0 -59
  64. package/src/nowiki/doubleUnderscore.js +0 -56
  65. package/src/nowiki/hr.js +0 -41
  66. package/src/nowiki/index.js +0 -56
  67. package/src/nowiki/list.js +0 -16
  68. package/src/nowiki/noinclude.js +0 -28
  69. package/src/nowiki/quote.js +0 -69
  70. package/src/onlyinclude.js +0 -64
  71. package/src/paramTag/index.js +0 -89
  72. package/src/paramTag/inputbox.js +0 -35
  73. package/src/parameter.js +0 -239
  74. package/src/syntax.js +0 -91
  75. package/src/table/index.js +0 -983
  76. package/src/table/td.js +0 -338
  77. package/src/table/tr.js +0 -319
  78. package/src/tagPair/ext.js +0 -148
  79. package/src/tagPair/include.js +0 -50
  80. package/src/tagPair/index.js +0 -126
  81. package/src/transclude.js +0 -843
  82. package/tool/index.js +0 -1202
  83. package/util/base.js +0 -17
  84. package/util/debug.js +0 -73
  85. package/util/diff.js +0 -76
  86. package/util/lint.js +0 -55
  87. package/util/string.js +0 -126
@@ -0,0 +1,38 @@
1
+ (()=>{var $t=Object.defineProperty;var Tt=(W,D,X)=>D in W?$t(W,D,{enumerable:!0,configurable:!0,writable:!0,value:X}):W[D]=X;var P=(W,D,X)=>(Tt(W,typeof D!="symbol"?D+"":D,X),X),st=(W,D,X)=>{if(!D.has(W))throw TypeError("Cannot "+X)};var x=(W,D,X)=>(st(W,D,"read from private field"),X?X.call(W):D.get(W)),z=(W,D,X)=>{if(D.has(W))throw TypeError("Cannot add the same private member more than once");D instanceof WeakSet?D.add(W):D.set(W,X)},M=(W,D,X,tt)=>(st(W,D,"write to private field"),tt?tt.call(W,X):D.set(W,X),X),nt=(W,D,X,tt)=>({set _(y){M(W,D,y,X)},get _(){return x(W,D,tt)}}),J=(W,D,X)=>(st(W,D,"access private method"),X);(()=>{"use strict";var W={6010:(y,F,t)=>{const c={config:void 0,minConfig:t(8166),i18n:void 0,MAX_STAGE:11,getConfig(){return{...this.minConfig,...this.config,excludes:[]}},msg(d,u){var r,n;return d=(n=(r=this.i18n)==null?void 0:r[d])!=null?n:d,d.replace("$1",u)},normalizeTitle(d,u=0,r=!1,n=c.getConfig(),s=!1,e=!1,i=!1){let o;if(!s){const h=t(8138);o=this.run(()=>{const g=new h(String(d),n),$=g.getAttribute("parseOnce");return $(0,r),$()}),d=o.firstChild}const l=t(6986);return new l(String(d),u,n,e,i)},parse(d,u,r=c.MAX_STAGE,n=c.getConfig()){if(typeof d!="string")throw new TypeError("\u5F85\u89E3\u6790\u7684\u5185\u5BB9\u5E94\u4E3A String\uFF01");const s=t(8138);let e;return this.run(()=>{e=new s(d,n);try{e.parse(r,u)}catch(i){}}),e},run(d){return d()}},m={},A=new Set(["MAX_STAGE","minConfig"]),T=new Set(["config","normalizeTitle","parse"]);for(const d in c)A.has(d)?m[d]={enumerable:!1,writable:!1}:T.has(d)||(m[d]={enumerable:!1});Object.defineProperties(c,m),typeof self=="object"&&(self.Parser=c),y.exports=c},9205:(y,F,t)=>{const{print:c}=t(231),m=t(3853),A=t(7507),T=new Set(["nowiki","pre","charinsert","score","syntaxhighlight","source","math","chem","ce","graph","mapframe","maplink","quiz","templatedata","timeline"]);class d extends m{constructor(){super(...arguments);P(this,"name")}get length(){return this.childNodes.length}closest(n){const s=new Set(n.split(",").map(i=>i.trim()));let{parentNode:e}=this;for(;e;){if(s.has(e.type))return e;({parentNode:e}=e)}}append(...n){for(const s of n)this.insertAt(s)}replaceChildren(...n){this.childNodes.length=0,this.append(...n)}setText(n,s=0){const e=this.childNodes[s],{type:i,data:o}=e;if(i==="text")return e.replaceData(n),o}toString(n,s=""){return this.childNodes.map(e=>e.toString()).join(s)}lint(n=0){const s=t(8058);if(this instanceof s||this.constructor.hidden||this.type==="ext-inner"&&T.has(this.name))return[];const e=[];for(let i=0,o=n+this.getPadding();i<this.length;i++){const l=this.childNodes[i];e.push(...l.lint(o)),o+=String(l).length+this.getGaps(i)}return e}print(n={}){return String(this)?`<span class="wpb-${n.class||this.type}">${c(this.childNodes,n)}</span>`:""}}y.exports=d},3853:(y,F,t)=>{var A,T,it;const{text:c}=t(231);class m{constructor(){z(this,T);P(this,"type");P(this,"childNodes",[]);z(this,A,void 0)}get firstChild(){return this.childNodes[0]}get lastChild(){return this.childNodes[this.childNodes.length-1]}get parentNode(){return x(this,A)}get nextSibling(){var n;const r=(n=x(this,A))==null?void 0:n.childNodes;return r&&r[r.indexOf(this)+1]}get previousSibling(){var n;const r=(n=x(this,A))==null?void 0:n.childNodes;return r&&r[r.indexOf(this)-1]}hasAttribute(r){const n=typeof r;return n==="string"||n==="number"||n==="symbol"?r in this:!1}getAttribute(r){return this.hasAttribute(r)?String(this[r]):void 0}setAttribute(r,n){return r==="parentNode"?M(this,A,n):this[r]=n,this}text(r=""){return c(this.childNodes,r)}removeAt(r){const{childNodes:n}=this,[s]=n.splice(r,1);return s}insertAt(r,n=this.childNodes.length){const{childNodes:s}=this;return-1===-1&&r.setAttribute("parentNode",this),s.splice(n,0,r),r}normalize(){var s;const r=t(7507),{childNodes:n}=this;for(let e=n.length-1;e>=0;e--){const{type:i,data:o}=n[e];this.getGaps(e-1)||(o===""?n.splice(e,1):i==="text"&&((s=n[e-1])==null?void 0:s.type)==="text"&&(n[e-1].setAttribute("data",n[e-1].data+o),n.splice(e,1)))}}getRootNode(){let{parentNode:r}=this;for(;r!=null&&r.parentNode;)({parentNode:r}=r);return r!=null?r:this}posFromIndex(r){const n=String(this);if(r>=-n.length&&r<=n.length){const s=n.slice(0,r).split(`
2
+ `);return{top:s.length-1,left:s[s.length-1].length}}}getPadding(){return 0}getGaps(){return 0}getRelativeIndex(r){let n;const s=(e,i)=>n.slice(0,e).reduce((o,l,a)=>o+String(l).length+i.getGaps(a),0)+i.getPadding();if(r===void 0){const{parentNode:e}=this;return e?({childNodes:n}=e,s(n.indexOf(this),e)):0}return{childNodes:n}=this,s(r,this)}get offsetHeight(){return J(this,T,it).call(this).height}get offsetWidth(){return J(this,T,it).call(this).width}}A=new WeakMap,T=new WeakSet,it=function(){const r=String(this).split(`
3
+ `);return{height:r.length,width:r[r.length-1].length}},y.exports=m},7507:(y,F,t)=>{var n,rt;const c=t(6010),m=t(3853),A=t(9205),T=/https?:\/\/|\{+|\}+|\[{2,}|\[(?![^[]*\])|((?:^|\])[^[]*?)\]+|<\s*\/?([a-z]\w*)(?=[\s/>])/giu,d=/\{+|\}+|\[{2,}|\[(?![^[]*\])|((?:^|\])[^[]*?)\]+|<\s*\/?([a-z]\w*)(?=[\s/>])/giu,u=["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"];class r extends m{constructor(o=""){super();z(this,n);P(this,"type","text");P(this,"data");this.data=o}toString(){return this.data}text(){return this.data}lint(o){const{data:l,parentNode:a}=this,h=a==null?void 0:a.type,g=a==null?void 0:a.name,$=h==="free-ext-link"||h==="ext-link-url"||h==="image-parameter"&&g==="link"?d:T,f=[],{ext:S,html:p}=this.getRootNode().getAttribute("config");if(l.search($)!==-1){$.lastIndex=0;const k=this.getRootNode(),{top:w,left:C}=k.posFromIndex(o),b=new Set([S,p,u].flat(2));for(let v=$.exec(l);v;v=$.exec(l)){const[,L,H]=v;let{0:I,index:E}=v;L&&(E+=L.length,I=I.slice(L.length));const O=o+E,U=l.slice(0,E).split(`
4
+ `),j=U.length+w-1,B=U[U.length-1],V=U.length>1?B.length:C+B.length,{0:K,length:Q}=I,q=O+Q;(K!=="h"||E>0)&&(K!=="<"||b.has(H.toLowerCase()))&&f.push({message:c.msg('lonely "$1"',K==="h"?I:K),severity:Q>1?"error":"warning",startIndex:O,endIndex:q,startLine:j,endLine:j,startCol:V,endCol:V+Q})}}return f}replaceData(o=""){J(this,n,rt).call(this,o)}}n=new WeakSet,rt=function(o){o=String(o),this.setAttribute("data",o)},y.exports=r},6986:(y,F,t)=>{const{decodeHtml:c}=t(231),m=t(6010);class A{constructor(d,u=0,r=m.getConfig(),n=!1,s=!1){P(this,"valid",!0);P(this,"ns",0);P(this,"fragment");P(this,"encoded",!1);const{namespaces:e,nsid:i}=r;let o=e[u];if(d=c(d),n&&d.includes("%"))try{const g=/%(?!21|3[ce]|5[bd]|7[b-d])[\da-f]{2}/iu.test(d);d=decodeURIComponent(d),this.encoded=g}catch(g){}d=d.replace(/_/gu," ").trim(),d[0]===":"&&(o="",d=d.slice(1).trim());const l=d.split(":");if(l.length>1){const g=e[i[l[0].trim().toLowerCase()]];g!==void 0&&(o=g,d=l.slice(1).join(":").trim())}this.ns=i[o.toLowerCase()];const a=d.indexOf("#");let h;a!==-1&&(h=d.slice(a+1).trim(),d=d.slice(0,a).trim()),this.valid=Boolean(d||s&&h!==void 0)&&!/\0\d+[eh!+-]\x7F|[<>[\]{}|]|%[\da-f]{2}/iu.test(d),this.fragment=h}}y.exports=A},2308:y=>{const F=t=>{var c;return c=class extends t{text(){return""}},P(c,"hidden",!0),c};y.exports=F},8275:(y,F,t)=>{const{removeComment:c}=t(231),m=t(6010),A=t(9450),T=t(1782),d=t(9544),u=(r,n=m.getConfig(),s=[])=>{var S,p,k,w,C;const e=`${n.excludes.includes("heading")?"":"^(\0\\d+c\x7F)*={1,6}|"}\\[\\[|\\{{2,}|-\\{(?!\\{)`,{parserFunction:[,,,i]}=n,o=[],l={"=":`
5
+ `,"{":"\\}{2,}|\\|","-":"\\}-","[":"\\]\\]"},a={"!":"!","!!":"+","(!":"{","!)":"}","!-":"-","=":"~"};let h=new RegExp(e,"gmu"),g=h.exec(r),$=r.includes("}}"),f;for(;g||f<=r.length&&((p=(S=o[o.length-1])==null?void 0:S[0])==null?void 0:p[0])==="=";){if(g!=null&&g[1]){const[,{length:V}]=g;g[0]=g[0].slice(V),g.index+=V}const{0:b,index:v}=g!=null?g:{0:`
6
+ `,index:r.length},L=(k=o.pop())!=null?k:{},{0:H,index:I,parts:E,findEqual:O,pos:U}=L,j=b==="="&&O;if(b==="]]"||b==="}-")f=v+2;else if(b===`
7
+ `){f=v+1;const{pos:V,findEqual:K}=(w=o[o.length-1])!=null?w:{};if(!V||K||c(r.slice(V,I))!==""){const Q=/^(={1,6})(.+)\1((?:\s|\0\d+c\x7F)*)$/u.exec(r.slice(I,v));Q&&(r=`${r.slice(0,I)}\0${s.length}h\x7F${r.slice(v)}`,f=I+4+String(s.length).length,new A(Q[1].length,Q.slice(2),n,s))}}else if(b==="|"||j)f=v+1,E[E.length-1].push(r.slice(U,v)),b==="|"&&E.push([]),L.pos=f,L.findEqual=b==="|",o.push(L);else if(b.startsWith("}}")){const V=b.slice(0,Math.min(H.length,3)),K=H.length-V.length,{length:Q}=s;f=v+V.length,E[E.length-1].push(r.slice(U,v));let q=!1,Y="t";if(V.length===3){const N=E.map(G=>G.join("=")),R=N.length>1&&c(N[1]).trim();new d(N,n,s),R&&R.endsWith(":")&&i.includes(R.slice(0,-1).toLowerCase())&&(Y="s")}else{const N=c(E[0][0]).trim();N in a?Y=a[N]:/^(?:filepath|(?:full|canonical)urle?):.|^server$/iu.test(N)?Y="m":/^#vardefine:./iu.test(N)&&(Y="c");try{new T(E[0][0],E.slice(1),n,s)}catch(R){if(R instanceof Error&&R.message.startsWith("\u975E\u6CD5\u7684\u6A21\u677F\u540D\u79F0\uFF1A"))f=I+H.length,q=!0;else throw R}}q||(r=`${r.slice(0,I+K)}\0${Q}${Y}\x7F${r.slice(f)}`,f=I+K+3+String(Q).length,K>1?o.push({0:H.slice(0,K),index:I,pos:I+K,parts:[[]]}):K===1&&r[I-1]==="-"&&o.push({0:"-{",index:I-1,pos:I+1,parts:[[]]}))}else f=v+b.length,b[0]==="{"&&(g.pos=f,g.parts=[[]]),o.push(..."0"in L?[L]:[],g);$&&($=r.slice(f).includes("}}"));let B=o[o.length-1];!$&&((C=B==null?void 0:B[0])==null?void 0:C[0])==="{"&&(o.pop(),B=o[o.length-1]),h=new RegExp(e+(B?`|${l[B[0][0]]}${B.findEqual?"|=":""}`:""),"gmu"),h.lastIndex=f,g=h.exec(r)}return r};y.exports=u},4907:(y,F,t)=>{const c=t(6010),m=t(851),A=t(3423),T=t(8655),d=t(7267),u=t(5749),r=(n,s=c.getConfig(),e=[],i=!1)=>{const o=/<onlyinclude>(.*?)<\/onlyinclude>/gsu;if(i&&n.search(o)!==-1)return n.replace(o,($,f)=>{const S=`\0${e.length}e\x7F`;return new m(f,s,e),S}).replace(/(^|\0\d+e\x7F)([^\0]+)(?=$|\0\d+e\x7F)/gu,($,f,S)=>(new A(S,s,e),`${f}\0${e.length-1}c\x7F`));const l=s.ext.join("|"),a=i?"includeonly":"(?:no|only)include",h=i?"noinclude":"includeonly",g=new RegExp(`<!--.*?(?:-->|$)|<${a}(?:\\s[^>]*?)?>|</${a}\\s*>|<(${l})(\\s[^>]*?)?(?:/>|>(.*?)</(\\1\\s*)>)|<(${h})(\\s[^>]*?)?(?:/>|>(.*?)(?:</(\\5\\s*)>|$))`,"gisu");return n.replace(g,($,f,S,p,k,w,C,b,v)=>{const L=`\0${e.length}${f?"e":"c"}\x7F`;if(f)new d(f,S,p,k,s,e);else if($.startsWith("<!--")){const H=$.endsWith("-->");new u($.slice(4,H?-3:void 0),H,s,e)}else w?new T(w,C,b,v,s,e):new A($,s,e);return L})};y.exports=r},3765:(y,F,t)=>{const c=t(6010),m=t(9910),A=(T,d=c.getConfig(),u=[])=>{const r=/-\{/gu,n=/-\{|\}-/gu,s=[];let e=r,i=e.exec(T);for(;i;){const{0:o,index:l}=i;if(o==="}-"){const a=s.pop(),{length:h}=u,g=T.slice(a.index+2,l),$=g.indexOf("|"),[f,S]=$===-1?[[],g]:[g.slice(0,$).split(";"),g.slice($+1)],p=S.replace(/(&[#a-z\d]+);/giu,"$1"),k=`(?:${d.variants.join("|")})`,w=p.split(new RegExp(`;(?=\\s*(?:${k}|[^;]*?=>\\s*${k})\\s*:)`,"u")).map(C=>C.replace(/\x01/gu,";"));new m(f,w,d,u),T=`${T.slice(0,a.index)}\0${h}v\x7F${T.slice(l+2)}`,s.length===0&&(e=r),e.lastIndex=a.index+3+String(h).length}else s.push(i),e=n,e.lastIndex=l+2;i=e.exec(T)}return T};y.exports=A},7513:(y,F,t)=>{const{extUrlChar:c,extUrlCharFirst:m}=t(231),A=t(6010),T=t(741),d=(u,r=A.getConfig(),n=[])=>{const s=new RegExp(`\\[((?:(?:${r.protocol}|//)${m}|\0\\d+m\x7F)${c})(\\p{Zs}*)([^\\]-\b
8
+ -\uFFFD]*)\\]`,"giu");return u.replace(s,(e,i,o,l)=>{const{length:a}=n,h=/&[lg]t;/u.exec(i);return h&&(i=i.slice(0,h.index),o="",l=`${i.slice(h.index)}${o}${l}`),new T(i,o,l,r,n),`\0${a}w\x7F`})};y.exports=d},2937:(y,F,t)=>{const c=t(6010),m=t(7507),A=t(8138),T=t(2582),d=t(7815),u=({firstChild:{data:r},type:n,name:s},e=c.getConfig(),i=[])=>{const{doubleUnderscore:o}=e,l=new Set(o[0]),a=new Set(o[1]);return n!=="root"&&(n!=="ext-inner"||s!=="poem")&&(r=`\0${r}`),r=r.replace(/^((?:\0\d+c\x7F)*)(-{4,})/gmu,(h,g,$)=>(new T($.length,e,i),`${g}\0${i.length-1}r\x7F`)).replace(new RegExp(`__(${o.flat().join("|")})__`,"giu"),(h,g)=>l.has(g.toLowerCase())||a.has(g)?(new d(g,e,i),`\0${i.length-1}u\x7F`):h),n==="root"||n==="ext-inner"&&s==="poem"?r:r.slice(1)};y.exports=u},5130:(y,F,t)=>{const c=t(6010),m=t(5649),A=t(2350),T=(d,u=c.getConfig(),r=[])=>{const n=/^(\/?)([a-z][^\s/>]*)((?:\s|\/(?!>))[^>]*?)?(\/?>)([^<]*)$/iu,s=new Set(u.html.flat()),e=d.split("<");let i=e.shift();for(const o of e){const l=n.exec(o),a=l==null?void 0:l[2],h=a==null?void 0:a.toLowerCase();if(!l||!s.has(h)){i+=`<${o}`;continue}const[,g,,$="",f,S]=l,p=new m($,"html-attrs",h,u,r),k=p.getAttr("itemprop");if(h==="meta"&&(k===void 0||p.getAttr("content")===void 0)||h==="link"&&(k===void 0||p.getAttr("href")===void 0)){i+=`<${o}`,r.pop();continue}i+=`\0${r.length}x\x7F${S}`,new A(a,p,g==="/",f==="/>",u,r)}return i};y.exports=T},1452:(y,F,t)=>{const c=t(6010),m=t(3905),A=t(7625),T=t(337),d=(u,r=c.getConfig(),n=[])=>{const s=t(3360),e=r.inExt?/^((?:(?!\0\d+!\x7F)[^\n<>[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]]))?\]\](.*)$/su:/^((?:(?!\0\d+!\x7F)[^\n<>[\]{}|])+)(?:(\||\0\d+!\x7F)(.*?[^\]])?)?\]\](.*)$/su,i=/^((?:(?!\0\d+!\x7F)[^\n<>[\]{}|])+)(\||\0\d+!\x7F)(.*)$/su,o=new RegExp(`^\\s*(?:${r.protocol})`,"iu"),l=u.split("[[");let a=l.shift();for(let h=0;h<l.length;h++){let g,$,f,S,p;const k=l[h],w=e.exec(k);if(w)[,$,f,S,p]=w,p[0]==="]"&&(S==null?void 0:S.includes("["))&&(S+="]",p=p.slice(1));else{const I=i.exec(k);I&&(g=!0,[,$,f,S]=I)}if($===void 0||o.test($)||/\0\d+[exhbru]\x7F/u.test($)){a+=`[[${k}`;continue}const C=$.trim()[0]===":";if(C&&g){a+=`[[${k}`;continue}const b=c.normalizeTitle($,0,!1,r,!0,!0,!0),{ns:v,valid:L}=b;if(L){if(g){if(v!==6){a+=`[[${k}`;continue}let I;for(h++;h<l.length;h++){const E=l[h],O=E.split("]]");if(O.length>2){I=!0,S+=`[[${O[0]}]]${O[1]}`,p=O.slice(2).join("]]");break}else if(O.length===2)S+=`[[${O[0]}]]${O[1]}`;else{S+=`[[${E}`;break}}if(S=d(S,r,n),!I){a+=`[[${$}${f}${S}`;continue}}}else{a+=`[[${k}`;continue}S&&(S=s(S,r,n)),a+=`\0${n.length}l\x7F${p}`;let H=m;C||(v===6?H=A:v===14&&(H=T)),S===void 0&&f&&(S=""),new H($,S,r,n,f)}return a};y.exports=d},6622:(y,F,t)=>{const c=t(6010),m=t(962),A=t(3434),T=(d,u=c.getConfig(),r=[])=>{const n=/^((?:\0\d+c\x7F)*)([;:*#]+)/u.exec(d);if(!n)return d;const[s,e,i]=n;d=`${e}\0${r.length}d\x7F${d.slice(s.length)}`,new m(i,u,r);let o=i.split(";").length-1;if(!o)return d;let l=/:+|-\{/gu,a=l.exec(d),h=0;for(;a&&o;){const{0:g,index:$}=a;if(g[0]===":"){if(g.length>=o)return new A(":".repeat(o),u,r),`${d.slice(0,$)}\0${r.length-1}d\x7F${d.slice($+o)}`;d=`${d.slice(0,$)}\0${r.length}d\x7F${d.slice(l.lastIndex)}`,o-=g.length,l.lastIndex=$+4+String(r.length).length,new A(g,u,r)}else if(g==="-{"){if(!h){const{lastIndex:f}=l;l=/-\{|\}-/gu,l.lastIndex=f}h++}else if(h--,!h){const{lastIndex:f}=l;l=/:+|-\{/gu,l.lastIndex=f}a=l.exec(d)}return d};y.exports=T},4737:(y,F,t)=>{const{extUrlChar:c,extUrlCharFirst:m}=t(231),A=t(6010),T=t(8962),d=(u,r=A.getConfig(),n=[])=>{const s=new RegExp(`(^|[^\\p{L}\\d_])(?:${r.protocol})(${m}${c})`,"giu");return u.replace(s,(e,i,o)=>{let l="",a=i?e.slice(1):e;const h=/&(?:lt|gt|nbsp|#x0*(?:3[ce]|a0)|#0*(?:6[02]|160));/iu.exec(a);h&&(l=a.slice(h.index),a=a.slice(0,h.index));const g=new RegExp(`[,;.:!?${a.includes("(")?"":")"}]+$`,"u"),$=g.exec(a);if($){let f=0;$[0][0]===";"&&/&(?:[a-z]+|#x[\da-f]+|#\d+)$/iu.test(a.slice(0,$.index))&&(f=1),l=`${a.slice($.index+f)}${l}`,a=a.slice(0,$.index+f)}return l.length>=o.length?e:(new T(a,!1,r,n),`${i}\0${n.length-1}w\x7F${l}`)})};y.exports=d},3360:(y,F,t)=>{const c=t(6010),m=t(6714),A=(T,d=c.getConfig(),u=[])=>{var a;const r=T.split(/('{2,})/u),{length:n}=r;if(n===1)return T;let s=0,e=0,i,o,l;for(let h=1;h<n;h+=2){const{length:g}=r[h];switch(g){case 2:e++;break;case 4:r[h-1]+="'",r[h]="'''";case 3:if(s++,i)break;r[h-1].endsWith(" ")?!o&&!l&&(l=h):r[h-1].slice(-2,-1)===" "?i=h:o||(o=h);break;default:r[h-1]+="'".repeat(g-5),r[h]="'''''",e++,s++}}if(e%2===1&&s%2===1){const h=(a=i!=null?i:o)!=null?a:l;r[h]="''",r[h-1]+="'"}for(let h=1;h<n;h+=2)new m(r[h].length,d,u),r[h]=`\0${u.length-1}q\x7F`;return r.join("")};y.exports=A},4624:(y,F,t)=>{const c=t(6010),m=t(7507),A=t(8138),T=t(2840),d=t(3125),u=t(5567),r=t(3434),n=({firstChild:{data:s},type:e,name:i},o=c.getConfig(),l=[])=>{const a=[],h=s.split(`
9
+ `);let g=e==="root"||e==="parameter-value"||e==="ext-inner"&&i==="poem"?"":`
10
+ ${h.shift()}`;const $=(f,S)=>{if(!S){g+=f;return}const{lastChild:p}=S;if(p.constructor===A)p.setText(String(p)+f);else{const k=new A(f,o,!0,l);k.type="table-inter",S.insertAt(k.setAttribute("stage",3))}};for(const f of h){let S=a.pop();const[p]=/^(?:\s|\0\d+c\x7F)*/u.exec(f),k=f.slice(p.length),w=/^(:*)((?:\s|\0\d+c\x7F)*)(\{\||\{(?:\0\d+c\x7F)*\0\d+!\x7F|\0\d+\{\x7F)(.*)$/u.exec(k);if(w){for(;S&&S.type!=="td";)S=a.pop();const[,I,E,O,U]=w;I&&new r(I,o,l),$(`
11
+ ${p}${I&&`\0${l.length-1}d\x7F`}${E}\0${l.length}b\x7F`,S);const j=new T(O,U,o,l);a.push(...S?[S]:[],j);continue}else if(!S){g+=`
12
+ ${f}`;continue}const C=/^(?:(\|\}|\0\d+!\x7F\}|\0\d+\}\x7F)|(\|-+|\0\d+!\x7F-+|\0\d+-\x7F-*)(?!-)|(!|(?:\||\0\d+!\x7F)\+?))(.*)$/u.exec(k);if(!C){$(`
13
+ ${f}`,S),a.push(...S?[S]:[]);continue}const[,b,v,L,H]=C;if(b){for(;!(S instanceof T);)S=a.pop();S.close(`
14
+ ${p}${b}`,!0),$(H,a[a.length-1])}else if(v){S.type==="td"&&(S=a.pop()),S.type==="tr"&&(S=a.pop());const I=new d(`
15
+ ${p}${v}`,H,o,l);a.push(S,I),S.insertAt(I)}else{S.type==="td"&&(S=a.pop());const I=L==="!"?/!!|(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu:/(?:\||\0\d+!\x7F){2}|\0\d+\+\x7F/gu;let E=I.exec(H),O=0,U=`
16
+ ${p}${L}`;for(;E;){const B=new u(U,H.slice(O,E.index),o,l);S.insertAt(B),{lastIndex:O}=I,[U]=E,E=I.exec(H)}const j=new u(U,H.slice(O),o,l);a.push(S,j),S.insertAt(j)}}return g.slice(1)};y.exports=n},9544:(y,F,t)=>{const{text:c}=t(231),{generateForChild:m}=t(8277),A=t(6010),T=t(8138);class d extends T{constructor(n,s=A.getConfig(),e=[]){super(void 0,s,!0,e,{});P(this,"type","arg");for(let i=0;i<n.length;i++)if(i===0||i>1){const o=t(i===0?9237:9263),l=new o(n[i],i===0?"arg-name":void 0,s,e,{});super.insertAt(l)}else{const o=new T(n[i],s,!0,e);o.type="arg-default",super.insertAt(o.setAttribute("stage",2))}}get default(){var n,s;return(s=(n=this.childNodes[1])==null?void 0:n.text())!=null?s:!1}toString(n){return`{{{${super.toString(n,"|")}}}}`}text(){return`{{{${c(this.childNodes.slice(0,2),"|")}}}}`}getPadding(){return 3}getGaps(){return 1}print(){return super.print({pre:"{{{",post:"}}}",sep:"|"})}lint(n){const{childNodes:[s,e,...i]}=this,o=s.lint(n+3);if(e&&o.push(...e.lint(n+4+String(s).length)),i.length>0){const l={start:n,...this.getRootNode().posFromIndex(n)};o.push(...i.map(a=>{const h=m(a,l,"invisible content inside triple brackets"),{startIndex:g,startCol:$}=h;return{...h,startIndex:g-1,startCol:$-1}}))}return o}}y.exports=d},9263:(y,F,t)=>{const c=t(2308),m=t(9237);class A extends c(m){constructor(){super(...arguments);P(this,"type","hidden")}}y.exports=A},9237:(y,F,t)=>{const c=t(6010),m=t(8138);class A extends m{constructor(u,r,n=c.getConfig(),s=[],e=void 0){super(u,n,!0,s,e);P(this,"type","plain");r&&(this.type=r)}}y.exports=A},5037:(y,F,t)=>{var f,S,p;const{generateForChild:c}=t(8277),{removeComment:m}=t(231),A=t(6010),T=t(8138),d=t(9237),u=new Set(["id","class","style","lang","dir","title","tabindex","aria-describedby","aria-flowto","aria-hidden","aria-label","aria-labelledby","aria-owns","role","about","property","resource","datatype","typeof","itemid","itemprop","itemref","itemscope","itemtype"]),r=new Set(["align"]),n=new Set(["cite"]),s=new Set(["cite","datetime"]),e=new Set(["width"]),i=new Set(["align","valign","abbr","axis","headers","scope","rowspan","colspan","width","height","bgcolor"]),o=new Set(["type"]),l={div:r,h1:r,h2:r,h3:r,h4:r,h5:r,h6:r,blockquote:n,q:n,p:r,br:new Set(["clear"]),pre:e,ins:s,del:s,ul:o,ol:new Set(["type","start","reversed"]),li:new Set(["type","value"]),table:new Set(["summary","width","border","frame","rules","cellspacing","cellpadding","align","bgcolor"]),caption:r,tr:new Set(["bgcolor","align","valign"]),td:i,th:i,img:new Set(["alt","src","width","height","srcset"]),font:new Set(["size","color","face"]),hr:e,rt:new Set(["rbspan"]),data:new Set(["value"]),time:new Set(["datetime"]),meta:new Set(["itemprop","content"]),link:new Set(["itemprop","href","title"]),gallery:new Set(["mode","showfilename","caption","perrow","widths","heights","showthumbnails","type"]),poem:new Set(["compact","align"]),categorytree:new Set(["align","hideroot","onlyroot","depth","mode","hideprefix","namespaces","showcount","notranslations"]),combooption:new Set(["name","for","inline","align"])},a=new Set,h={nowiki:a,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:a,inputbox:a,templatestyles:new Set(["src","wrapper"]),dynamicpagelist:a,poll:new Set(["id","show-results-before-voting"]),sm2:o,flashmp3:o,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"])},g=new RegExp("expression|(?:filter|accelerator|-o-link(?:-source)?|-o-replace)\\s*:|(?:url|image(?:-set)?)\\s*\\(|attr\\s*\\([^)]+[\\s,]url","u");class $ extends T{constructor(C,b,v,L="",H="",I=[],E=A.getConfig(),O=[]){const U=new d(v,"attr-key",E,O,{});let j;if(v==="title")j=new T(H,E,!0,O,{}).setAttribute("type","attr-value").setAttribute("stage",A.MAX_STAGE-1);else if(b==="gallery"&&v==="caption"){const B={...E,excludes:[...E.excludes,"quote","extLink","magicLink","list"]};j=new T(H,B,!0,O,{}).setAttribute("type","attr-value").setAttribute("stage",5)}else if(b==="choose"&&(v==="before"||v==="after")){const B={...E,excludes:[...E.excludes,"heading","html","table","hr","list"]};j=new T(H,B,!0,O,{}).setAttribute("type","attr-value").setAttribute("stage",1)}else j=new d(H,"attr-value",E,O,{});super(void 0,E,!0,O);z(this,f,void 0);z(this,S,void 0);z(this,p,void 0);this.type=C,this.append(U,j),M(this,f,L),M(this,S,I),M(this,p,b),this.setAttribute("name",m(v).trim().toLowerCase())}get balanced(){return!x(this,f)||x(this,S)[0]===x(this,S)[1]}get value(){return this.getValue()}get tag(){return x(this,p)}afterBuild(){x(this,f).includes("\0")&&M(this,f,this.getAttribute("buildFromStr")(x(this,f),"string")),this.parentNode&&M(this,p,this.parentNode.name),this.setAttribute("name",this.firstChild.text().trim().toLowerCase())}toString(C){const[b="",v=""]=x(this,S);return x(this,f)?`${super.toString(C,`${x(this,f)}${b}`)}${v}`:this.firstChild.toString(C)}text(){return x(this,f)?`${super.text(`${x(this,f).trim()}"`)}"`:this.firstChild.text()}getGaps(){var C,b;return x(this,f)?x(this,f).length+((b=(C=x(this,S)[0])==null?void 0:C.length)!=null?b:0):0}print(){const[C="",b=""]=x(this,S);return x(this,f)?super.print({sep:`${x(this,f)}${C}`,post:b}):super.print()}lint(C){var V;const b=super.lint(C),{balanced:v,firstChild:L,lastChild:H,type:I,name:E,parentNode:O,value:U}=this,j=O==null?void 0:O.name;let B;if(!v){const K=this.getRootNode();B={start:C,...K.posFromIndex(C)};const Q=c(H,B,"unclosed quotes","warning"),q=Q.startIndex-1,Y=Q.startCol-1;b.push({...Q,startIndex:q,startCol:Y})}return!/\{\{[^{]+\}\}/u.test(E)&&(I==="ext-attr"&&!(j in l)&&h[j]&&!h[j].has(E)||(I==="html-attr"||I==="table-attr"||j in l)&&!((V=l[j])!=null&&V.has(E))&&!/^(?:xmlns:[\w:.-]+|data-[^:]*)$/u.test(E)&&(j==="meta"||j==="link"||!u.has(E)))?(B||(B={start:C,...this.getRootNode().posFromIndex(C)}),b.push(c(L,B,"illegal attribute name"))):E==="style"&&typeof U=="string"&&g.test(U)&&(B||(B={start:C,...this.getRootNode().posFromIndex(C)}),b.push(c(H,B,"insecure style"))),b}getValue(){if(x(this,f)){const C=this.lastChild.text();return x(this,S)[1]?C:C.trim()}return!0}}f=new WeakMap,S=new WeakMap,p=new WeakMap,y.exports=$},5649:(y,F,t)=>{const{generateForSelf:c,generateForChild:m}=t(8277),{removeComment:A}=t(231),T=t(6010),d=t(8138),u=t(9237),r=t(5037);class n extends d{constructor(e,i,o,l=T.getConfig(),a=[]){if(super(void 0,l,!0,a,{}),this.type=i,this.setAttribute("name",o),e){const h=new RegExp(`([^\\s/](?:(?!\0\\d+~\x7F)[^\\s/=])*)(?:((?:\\s|\0\\d+c\x7F)*(?:=|\0\\d+~\x7F)(?:\\s|\0\\d+c\x7F)*)(?:(["'])(.*?)(\\3|$)|(\\S*)))?`,"gsu");let g="",$=h.exec(e),f=0;const S=()=>{g&&(super.insertAt(new u(g,`${i.slice(0,-1)}-dirty`,l,a,{})),g="")};for(;$;){const{index:p,0:k,1:w,2:C,3:b,4:v,5:L,6:H}=$;if(g+=e.slice(f,p),/^(?:[\w:]|\0\d+[t!~{}+-]\x7F)(?:[\w:.-]|\0\d+[t!~{}+-]\x7F)*$/u.test(A(w).trim())){const I=v!=null?v:H,E=[b,L],O=new r(i.slice(0,-1),o,w,C,I,E,l,a);S(),super.insertAt(O)}else g+=k;({lastIndex:f}=h),$=h.exec(e)}g+=e.slice(f),S()}}afterBuild(){var i,o;const e=t(5567);this.type==="table-attrs"&&this.setAttribute("name",((i=this.parentNode)==null?void 0:i.subtype)==="caption"?"caption":(o=this.parentNode)==null?void 0:o.type)}getAttrTokens(e){return this.childNodes.filter(i=>i instanceof r&&i.name===e.toLowerCase().trim())}getAttrToken(e){const i=this.getAttrTokens(e);return i[i.length-1]}getAttr(e){var i;return(i=this.getAttrToken(e))==null?void 0:i.getValue()}lint(e){const i=t(2350),o=super.lint(e),{parentNode:{closing:l},length:a,childNodes:h}=this,g={},$=new Set;let f;l&&this.text().trim()&&(f={start:e,...this.getRootNode().posFromIndex(e)},o.push(c(this,f,"attributes of a closing tag")));for(let S=0;S<a;S++){const p=h[S];if(p instanceof u&&p.text().trim())f||(f={start:e,...this.getRootNode().posFromIndex(e)}),o.push(m(p,f,"containing invalid attribute"));else if(p instanceof r){const{name:k}=p;k in g?($.add(k),g[k].push(p)):k!=="class"&&(g[k]=[p])}}if($.size>0){f||(f={start:e,...this.getRootNode().posFromIndex(e)});for(const S of $)o.push(...g[S].map(p=>m(p,f,T.msg("duplicated $1 attribute",S))))}return o}print(){const e=t(2350);return String(this)?`<span class="wpb-${this.type}">${this.childNodes.map(i=>i.print({class:i instanceof u&&i.text().trim()&&"hidden"})).join("")}</span>`:""}}y.exports=n},9910:(y,F,t)=>{const{text:c,print:m}=t(231),A=t(6010),T=t(8138),d=t(6719),u=t(8683);class r extends T{constructor(e,i,o=A.getConfig(),l=[]){super(void 0,o,!0,l);P(this,"type","converter");this.append(new d(e,o,l));const[a]=i,h=a.includes(":"),g=new u(a,h,o,l);h&&g.length===1?this.insertAt(new u(i.join(";"),!1,o,l)):this.append(g,...i.slice(1).map($=>new u($,!0,o,l)))}toString(e){const{childNodes:[i,...o]}=this;return`-{${i.toString()}${i.length>0?"|":""}${o.map(String).join(";")}}-`}text(){const{childNodes:[e,...i]}=this;return`-{${e.text()}|${c(i,";")}}-`}getPadding(){return 2}getGaps(e=0){return e=e<0?e+this.length:e,e||this.firstChild.length>0?1:0}print(){const{childNodes:[e,...i]}=this;return`<span class="wpb-converter">-{${e.print()}${e.length>0?"|":""}${m(i,{sep:";"})}}-</span>`}}y.exports=r},6719:(y,F,t)=>{var r;const{generateForChild:c}=t(8277),m=t(6010),A=t(8138),T=t(9237),d=new Set(["A","T","R","D","-","H","N"]);class u extends A{constructor(e,i=m.getConfig(),o=[]){super(void 0,i,!0,o,{});P(this,"type","converter-flags");z(this,r,void 0);this.append(...e.map(l=>new T(l,"converter-flag",i,o)))}afterBuild(){M(this,r,this.childNodes.map(e=>e.text().trim()))}toString(e){return super.toString(e,";")}text(){return super.text(";")}getGaps(){return 1}print(){return super.print({sep:";"})}lint(e){const i=this.getVariantFlags(),o=this.getUnknownFlags(),l=new Set(x(this,r).filter(p=>d.has(p))),{length:a}=x(this,r).filter(p=>!p),h=x(this,r).length-o.size-a,g=super.lint(e);if(i.size===h||l.size===h)return g;const $={start:e,...this.getRootNode().posFromIndex(e)},{childNodes:f,length:S}=this;for(let p=0;p<S;p++){const k=f[p],w=k.text().trim();if(w&&!i.has(w)&&!o.has(w)&&(i.size>0||!l.has(w))){const C=c(k,$,"invalid conversion flag");g.push(C)}}return g}getUnknownFlags(){return new Set(x(this,r).filter(e=>/\{{3}[^{}]+\}{3}/u.test(e)))}getVariantFlags(){const e=new Set(this.getAttribute("config").variants);return new Set(x(this,r).filter(i=>e.has(i)))}}r=new WeakMap,y.exports=u},8683:(y,F,t)=>{const c=t(6010),m=t(8138),A=t(9237);class T extends m{constructor(r,n=!0,s=c.getConfig(),e=[]){super(void 0,s,!0,e);P(this,"type","converter-rule");if(n){const i=r.indexOf(":"),o=r.slice(0,i).indexOf("=>"),l=o===-1?r.slice(0,i):r.slice(o+2,i);s.variants.includes(l.trim())?(super.insertAt(new A(l,"converter-rule-variant",s,e)),super.insertAt(new A(r.slice(i+1),"converter-rule-to",s,e)),o!==-1&&super.insertAt(new A(r.slice(0,o),"converter-rule-from",s,e),0)):super.insertAt(new A(r,"converter-rule-noconvert",s,e))}else super.insertAt(new A(r,"converter-rule-noconvert",s,e))}toString(r){if(this.length===3){const{childNodes:[n,s,e]}=this;return`${n.toString(r)}=>${s.toString(r)}:${e.toString(r)}`}return super.toString(r,":")}text(){if(this.length===3){const{childNodes:[r,n,s]}=this;return`${r.text()}=>${n.text()}:${s.text()}`}return super.text(":")}getGaps(r=0){const{length:n}=this;return r=r<0?r+n:r,r===0&&n===3?2:1}print(){if(this.length===3){const{childNodes:[r,n,s]}=this;return`<span class="wpb-converter-rule">${r.print()}=>${n.print()}:${s.print()}</span>`}return super.print({sep:":"})}}y.exports=T},741:(y,F,t)=>{var d;const c=t(6010),m=t(8138),A=t(8962);class T extends m{constructor(n,s="",e="",i=c.getConfig(),o=[]){super(void 0,i,!0,o,{});P(this,"type","ext-link");z(this,d,void 0);if(this.insertAt(new A(n,!0,i,o)),M(this,d,s),e){const l=new m(e,i,!0,o,{});l.type="ext-link-text",this.insertAt(l.setAttribute("stage",c.MAX_STAGE-1))}}toString(n){return this.length===1?`[${super.toString(n)}${x(this,d)}]`:`[${super.toString(n,x(this,d))}]`}text(){return`[${super.text(" ")}]`}getPadding(){return 1}getGaps(){return x(this,d).length}print(){const{length:n}=this;return super.print(n>1?{pre:"[",sep:x(this,d),post:"]"}:{pre:"[",post:`${x(this,d)}]`})}}d=new WeakMap,y.exports=T},1891:(y,F,t)=>{const c=t(6010),m=t(8138),A=t(1031),T=t(9263);class d extends m{constructor(n,s=c.getConfig(),e=[]){var i;super(void 0,s,!0,e,{});P(this,"type","ext-inner");P(this,"name","gallery");for(const o of(i=n==null?void 0:n.split(`
17
+ `))!=null?i:[]){const l=/^([^|]+)(?:\|(.*))?/u.exec(o);if(!l){super.insertAt(o.trim()?new T(o,void 0,s,[],{}):o);continue}const[,a,h]=l;this.normalizeTitle(a,6,!0,!0).valid?super.insertAt(new A(a,h,s,e)):super.insertAt(new T(o,void 0,s,[],{}))}}toString(n){return super.toString(n,`
18
+ `)}text(){return super.text(`
19
+ `).replace(/\n\s*\n/gu,`
20
+ `)}getGaps(){return 1}print(){return super.print({sep:`
21
+ `})}lint(n){const{top:s,left:e}=this.getRootNode().posFromIndex(n),i=[];for(let o=0,l=n;o<this.length;o++){const a=this.childNodes[o],h=String(a),{length:g}=h,$=h.trim(),f=s+o,S=o?0:e;a.type==="hidden"&&$&&!/^<!--.*-->$/u.test($)?i.push({message:c.msg("invalid content in <$1>","gallery"),severity:"error",startIndex:l,endIndex:l+g,startLine:f,endLine:f,startCol:S,endCol:S+g}):a.type!=="hidden"&&a.type!=="text"&&i.push(...a.lint(l)),l+=g+1}return i}}y.exports=d},2158:(y,F,t)=>{const c=t(6010),m=t(8138),A=t(3423);class T extends m{constructor(u,r,n=c.getConfig(),s=[]){u=u.replace(/(<nowiki>)(.*?)(<\/nowiki>)/giu,(e,i,o,l)=>(new A(i,n,s),new A(l,n,s),`\0${s.length-1}c\x7F${o}\0${s.length}c\x7F`)),super(u,n,!0,s,{}),this.type=r}}y.exports=T},428:(y,F,t)=>{const c=t(6010),m=t(2158);class A extends m{constructor(u,r=c.getConfig(),n=[]){super(u,"ext-inner",r,n);P(this,"name","pre");this.setAttribute("stage",c.MAX_STAGE-1)}isPlain(){return!0}}y.exports=A},9450:(y,F,t)=>{const{generateForSelf:c}=t(8277),m=t(6010),A=t(8138),T=t(8058);class d extends A{constructor(n,s,e=m.getConfig(),i=[]){super(void 0,e,!0,i);P(this,"type","heading");this.setAttribute("name",String(n));const o=new A(s[0],e,!0,i);o.type="heading-title",o.setAttribute("stage",2);const l=new T(s[1],/^[^\S\n]*$/u,"heading-trail",e,i,{});this.append(o,l)}toString(n){const s="=".repeat(Number(this.name));return`${s}${this.firstChild.toString()}${s}${this.lastChild.toString()}`}text(){const n="=".repeat(Number(this.name));return`${n}${this.firstChild.text()}${n}`}getPadding(){return super.getPadding()+Number(this.name)}getGaps(){return Number(this.name)}print(){const n="=".repeat(Number(this.name));return super.print({pre:n,sep:n})}lint(n){const s=super.lint(n),e=String(this.firstChild);let i;return this.name==="1"&&(i=c(this,{start:n},"<h1>"),s.push(i)),(e[0]==="="||e.endsWith("="))&&(i||(i=c(this,{start:n},"")),s.push({...i,message:m.msg('unbalanced "=" in a section header')})),this.closest("html-attrs, table-attrs")&&(i||(i=c(this,{start:n},"")),s.push({...i,message:m.msg("section header in a HTML tag")})),s}}y.exports=d},2350:(y,F,t)=>{var u,r,n;const{generateForSelf:c}=t(8277),m=t(6010),A=t(8138),T=new Set(["if","ifeq","ifexpr","ifexist","iferror","switch"]);class d extends A{constructor(i,o,l,a,h=m.getConfig(),g=[]){super(void 0,h,!0,g);P(this,"type","html");z(this,u,void 0);z(this,r,void 0);z(this,n,void 0);this.insertAt(o),this.setAttribute("name",i.toLowerCase()),M(this,u,l),M(this,r,a),M(this,n,i)}get closing(){return x(this,u)}toString(i){return`<${x(this,u)?"/":""}${x(this,n)}${super.toString()}${x(this,r)?"/":""}>`}text(){return`<${x(this,u)?"/":""}${x(this,n)}${x(this,u)?"":super.text()}${x(this,r)?"/":""}>`}getPadding(){return x(this,n).length+(x(this,u)?2:1)}print(){return super.print({pre:`&lt;${x(this,u)?"/":""}${x(this,n)}`,post:`${x(this,r)?"/":""}&gt;`})}lint(i){var a;const o=super.lint(i);let l;this.name==="h1"&&!x(this,u)&&(l=c(this,{start:i},"<h1>"),o.push(l)),this.closest("table-attrs")&&(l||(l=c(this,{start:i},"")),o.push({...l,message:"HTML tag in table attributes"}));try{this.findMatchingTag()}catch({message:h}){l||(l=c(this,{start:i},""));const[g]=h.split(":"),$={...l,message:m.msg(g)};(g==="unclosed tag"||g==="unmatched closing tag"&&T.has((a=this.closest("magic-word"))==null?void 0:a.name))&&($.severity="warning"),o.push($)}return o}findMatchingTag(){const{html:i}=this.getAttribute("config"),{name:o,parentNode:l}=this,a=String(this);if(x(this,u)&&(x(this,r)||i[2].includes(o)))throw new SyntaxError(`tag that is both closing and self-closing: ${a}`);if(i[2].includes(o)||x(this,r)&&i[1].includes(o))return this;if(x(this,r)&&i[0].includes(o))throw new SyntaxError(`invalid self-closing tag: ${a}`);if(!l)return;const{childNodes:h}=l,g=h.indexOf(this),$=x(this,u)?h.slice(0,g).reverse().filter(({type:S,name:p})=>S==="html"&&p===o):h.slice(g+1).filter(({type:S,name:p})=>S==="html"&&p===o);let f=x(this,u)?-1:1;for(const S of $)if(S.closing?f--:f++,f===0)return S;throw new SyntaxError(`${x(this,u)?"unmatched closing":"unclosed"} tag: ${a}`)}}u=new WeakMap,r=new WeakMap,n=new WeakMap,y.exports=d},1874:(y,F,t)=>{var i;const{print:c,extUrlChar:m,extUrlCharFirst:A}=t(231),{generateForSelf:T}=t(8277),d=t(6986),u=t(6010),r=t(8138),n=new Set(["alt","link","lang","page","caption"]),s=(l,a,h=u.getConfig(),g=!1)=>{switch(a=a.replace(/\0\d+t\x7F/gu,"").trim(),l){case"width":return/^(?:\d+x?|\d*x\d+)$/u.test(a);case"link":{if(!a)return"";if(new RegExp(`(?:(?:${h.protocol}|//)${A}|\0\\d+m\x7F)${m}(?=\0\\d+t\x7F|$)`,"iu").test(a))return a;a.startsWith("[[")&&a.endsWith("]]")&&(a=a.slice(2,-2));const f=u.normalizeTitle(a,0,!1,h,g,!0,!0);return f.valid&&f}case"lang":return h.variants.includes(a);case"alt":case"class":case"manualthumb":return!0;default:return!isNaN(a)}};class e extends r{constructor(h,g=u.getConfig(),$=[]){var a=(...o)=>{super(...o);P(this,"type","image-parameter");z(this,i,"")};let f;const S=Object.entries(g.img).map(([k,w])=>[k,w,new RegExp(`^(\\s*)${k.replace("$1","(.*)")}(\\s*)$`,"u")]),p=S.find(([,k,w])=>(f=w.exec(h),f&&(f.length!==4||s(k,f[2],g,!0)!==!1)));if(p){f.length===3?(a(void 0,g,!0,$),M(this,i,h)):(a(f[2],g,!0,$,{}),M(this,i,`${f[1]}${p[0]}${f[3]}`)),this.setAttribute("name",p[1]);return}a(h,{...g,excludes:[...g.excludes,"list"]},!0,$),this.setAttribute("name","caption").setAttribute("stage",7)}get link(){return this.name==="link"?s("link",super.text(),this.getAttribute("config")):void 0}afterBuild(){this.parentNode.type==="gallery-image"&&!n.has(this.name)&&this.setAttribute("name","invalid")}isPlain(){return this.name==="caption"}toString(h){return x(this,i)?x(this,i).replace("$1",super.toString(h)):super.toString(h)}text(){return x(this,i)?x(this,i).replace("$1",super.text()).trim():super.text().trim()}getPadding(){return Math.max(0,x(this,i).indexOf("$1"))}lint(h){var $;const g=super.lint(h);return this.name==="invalid"?g.push(T(this,{start:h},"invalid gallery image parameter")):($=this.link)!=null&&$.encoded&&g.push(T(this,{start:h},"unnecessary URL encoding in an internal link")),g}print(){return x(this,i)?`<span class="wpb-image-parameter">${x(this,i).replace("$1",`<span class="wpb-image-caption">${c(this.childNodes)}</span>`)}</span>`:super.print({class:"image-caption"})}}i=new WeakMap,y.exports=e},2641:(y,F,t)=>{const{generateForSelf:c,generateForChild:m}=t(8277),A=t(6010),T=t(8138),d=t(3423),u=t(1031),r=t(2571);class n extends T{constructor(i,o=A.getConfig(),l=[]){super(void 0,o,!0,l,{});P(this,"type","ext-inner");P(this,"name","imagemap");if(!i)return;const a=i.split(`
22
+ `),h=new Set(o.protocol.split("|")),g=d,$=p=>{super.insertAt(new g(p,o,l))};let f=!0,S=!1;for(const p of a){const k=p.trim();if(!(S||!k||k[0]==="#")){if(f){const[w,...C]=p.split("|"),b=this.normalizeTitle(w,0,!0);if(b.valid&&b.ns===6){const v=new u(w,C.length>0?C.join("|"):void 0,o,l);v.type="imagemap-image",super.insertAt(v),f=!1;continue}else S=!0}else if(p.trim().split(/[\t ]/u)[0]==="desc"){super.insertAt(p);continue}else if(p.includes("[")){const w=p.indexOf("["),C=p.slice(w),b=/^\[{2}([^|]+)(?:\|([^\]]+))?\]{2}[\w\s]*$/u.exec(C);if(b){if(this.normalizeTitle(b[1],0,!0,!1,!0).valid){super.insertAt(new r(p.slice(0,w),b.slice(1),C.slice(C.indexOf("]]")+2),o,l));continue}}else if(h.has(C.slice(1,C.indexOf(":")+1))||h.has(C.slice(1,C.indexOf("//")+2))){const v=/^\[([^\]\s]+)(?:(\s+)(\S[^\]]*)?)?\][\w\s]*$/u.exec(C);if(v){super.insertAt(new r(p.slice(0,w),v.slice(1),C.slice(C.indexOf("]")+1),o,l));continue}}}}$(p)}}get image(){return this.childNodes.find(({type:i})=>i==="imagemap-image")}toString(i){return super.toString(i,`
23
+ `)}text(){return super.text(`
24
+ `).replace(/\n{2,}/gu,`
25
+ `)}getGaps(){return 1}print(){return super.print({sep:`
26
+ `})}lint(i){const o=super.lint(i),l={start:i,...this.getRootNode().posFromIndex(i)};return this.image?o.push(...this.childNodes.filter(a=>{const h=String(a).trim();return a.type==="noinclude"&&h&&h[0]!=="#"}).map(a=>m(a,l,"invalid link in <imagemap>"))):o.push(c(this,l,"<imagemap> without an image")),o}}y.exports=n},2571:(y,F,t)=>{const c=t(6986),m=t(8138),A=t(3423),T=t(3905),d=t(741);class u extends m{constructor(s,e,i,o,l){const a=e.length===2?T:d;super(void 0,o,!0,l);P(this,"type","imagemap-link");this.append(s,new a(...e,o,l),new A(i,o,l))}}y.exports=u},8138:(y,F,t)=>{var r,n,s,e,i,o,l,a,ot,g,lt,f,at,p,ht,w,dt,b,pt,L,ut,I,gt,O,ct,j,ft,V,xt;const{text:c}=t(231),m=t(6010),A=t(9205),T=t(7507),{MAX_STAGE:d}=m,Q=class extends A{constructor(N,R=m.getConfig(),G=!1,Z=[],_=void 0){super();z(this,a);z(this,g);z(this,f);z(this,p);z(this,w);z(this,b);z(this,L);z(this,I);z(this,O);z(this,j);z(this,V);P(this,"type","root");z(this,r,0);z(this,n,void 0);z(this,s,void 0);z(this,e,void 0);z(this,i,(N=x(this,r),R=!1)=>{if(N<x(this,r)||!this.isPlain()||this.length===0)return this;switch(N){case 0:this.type==="root"&&x(this,s).shift(),M(this,e,Boolean(R)),J(this,a,ot).call(this,R);break;case 1:J(this,g,lt).call(this);break;case 2:J(this,f,at).call(this);break;case 3:J(this,p,ht).call(this);break;case 4:J(this,w,dt).call(this);break;case 5:J(this,b,pt).call(this);break;case 6:J(this,L,ut).call(this);break;case 7:J(this,I,gt).call(this);break;case 8:J(this,O,ct).call(this);break;case 9:J(this,j,ft).call(this);break;case 10:J(this,V,xt).call(this)}if(this.type==="root")for(const G of x(this,s))G.getAttribute("parseOnce")(N,R);return nt(this,r)._++,this});z(this,o,(N,R)=>{const G=N.split(/[\0\x7F]/u).map((Z,_)=>{if(_%2===0)return new T(Z);if(isNaN(Z[Z.length-1]))return x(this,s)[Number(Z.slice(0,-1))];throw new Error(`\u89E3\u6790\u9519\u8BEF\uFF01\u672A\u6B63\u786E\u6807\u8BB0\u7684 Token\uFF1A${Z}`)});return R==="string"?G.map(String).join(""):R==="text"?c(G):G});z(this,l,()=>{M(this,r,d);const{length:N,firstChild:R}=this,G=String(R);if(N===1&&R.type==="text"&&G.includes("\0")&&(this.replaceChildren(...x(this,o).call(this,G)),this.normalize(),this.type==="root"))for(const Z of x(this,s))Z.getAttribute("build")()});typeof N=="string"&&this.insertAt(G?N:N.replace(/[\0\x7F]/gu,"")),M(this,n,R),M(this,s,Z),Z.push(this)}getAttribute(N){switch(N){case"config":return JSON.parse(JSON.stringify(x(this,n)));case"accum":return x(this,s);case"parseOnce":return x(this,i);case"buildFromStr":return x(this,o);case"build":return x(this,l);default:return super.getAttribute(N)}}setAttribute(N,R){switch(N){case"stage":return x(this,r)===0&&this.type==="root"&&x(this,s).shift(),M(this,r,R),this;default:return super.setAttribute(N,R)}}isPlain(){return this.constructor===Q}insertAt(N,R=this.length){return typeof N=="string"&&(N=new T(N)),super.insertAt(N,R),N.type==="root"&&(N.type="plain"),N}normalizeTitle(N,R=0,G=!1,Z=!1,_=!1){return m.normalizeTitle(N,R,x(this,e),x(this,n),G,Z,_)}afterBuild(){if(this.type==="root")for(const N of x(this,s))N.afterBuild()}parse(N=d,R=!1){for(;x(this,r)<N;)x(this,i).call(this,x(this,r),R);return N&&(x(this,l).call(this),this.afterBuild()),this}};let u=Q;r=new WeakMap,n=new WeakMap,s=new WeakMap,e=new WeakMap,i=new WeakMap,o=new WeakMap,l=new WeakMap,a=new WeakSet,ot=function(N){const R=t(4907);this.setText(R(String(this.firstChild),x(this,n),x(this,s),N))},g=new WeakSet,lt=function(){const N=t(8275),R=this.type==="root"?String(this.firstChild):`\0${String(this.firstChild)}`,G=N(R,x(this,n),x(this,s));this.setText(this.type==="root"?G:G.slice(1))},f=new WeakSet,at=function(){if(x(this,n).excludes.includes("html"))return;const N=t(5130);this.setText(N(String(this.firstChild),x(this,n),x(this,s)))},p=new WeakSet,ht=function(){if(x(this,n).excludes.includes("table"))return;const N=t(4624),R=t(2840);this.setText(N(this,x(this,n),x(this,s)));for(const G of x(this,s))if(G instanceof R&&G.type!=="td"){G.normalize();const{childNodes:[,Z]}=G;if(typeof Z=="string"&&Z.includes("\0")){G.removeAt(1);const _=new Q(Z,x(this,n),!0,x(this,s));G.insertAt(_,1),_.setAttribute("stage",4)}}},w=new WeakSet,dt=function(){if(x(this,n).excludes.includes("hr"))return;const N=t(2937);this.setText(N(this,x(this,n),x(this,s)))},b=new WeakSet,pt=function(){const N=t(1452);this.setText(N(String(this.firstChild),x(this,n),x(this,s)))},L=new WeakSet,ut=function(){if(x(this,n).excludes.includes("quote"))return;const N=t(3360),R=String(this.firstChild).split(`
27
+ `);for(let G=0;G<R.length;G++)R[G]=N(R[G],x(this,n),x(this,s));this.setText(R.join(`
28
+ `))},I=new WeakSet,gt=function(){if(x(this,n).excludes.includes("extLink"))return;const N=t(7513);this.setText(N(String(this.firstChild),x(this,n),x(this,s)))},O=new WeakSet,ct=function(){if(x(this,n).excludes.includes("magicLink"))return;const N=t(4737);this.setText(N(String(this.firstChild),x(this,n),x(this,s)))},j=new WeakSet,ft=function(){if(x(this,n).excludes.includes("list"))return;const N=t(6622),R=String(this.firstChild).split(`
29
+ `);let G=this.type==="root"||this.type==="ext-inner"&&this.name==="poem"?0:1;for(;G<R.length;G++)R[G]=N(R[G],x(this,n),x(this,s));this.setText(R.join(`
30
+ `))},V=new WeakSet,xt=function(){var N;if(((N=x(this,n).variants)==null?void 0:N.length)>0){const R=t(3765);this.setText(R(String(this.firstChild),x(this,n),x(this,s)))}},y.exports=u},337:(y,F,t)=>{const c=t(3905);class m extends c{constructor(){super(...arguments);P(this,"type","category")}}y.exports=m},7625:(y,F,t)=>{var e,et;const{explode:c}=t(231),{generateForChild:m}=t(8277),A=t(6010),T=t(3905),d=t(1874),u=new Set(["manualthumb","frameless","framed","thumbnail"]),r=new Set(["left","right","center","none"]),n=new Set(["baseline","sub","super","top","text-top","middle","bottom","text-bottom"]);class s extends T{constructor(a,h,g=A.getConfig(),$=[],f="|"){super(a,void 0,g,$,f);z(this,e);P(this,"type","file");this.append(...c("-{","}-","|",h).map(S=>new d(S,g,$)))}lint(a){const h=super.lint(a),g=this.getAllArgs().filter(({childNodes:w})=>{const C=w.filter(b=>b.text().trim());return C.length!==1||C[0].type!=="arg"}),$=[...new Set(g.map(({name:w})=>w))].filter(w=>w!=="invalid"),f=$.filter(w=>u.has(w)),S=$.filter(w=>r.has(w)),p=$.filter(w=>n.has(w));if(g.length===$.length&&f.length<2&&S.length<2&&p.length<2)return h;const k={start:a,...this.getRootNode().posFromIndex(a)};for(const w of $){let C=g.filter(({name:b})=>b===w);w==="caption"&&(C=[...C.slice(0,-1).filter(b=>b.text()),C[C.length-1]]),C.length>1&&h.push(...C.map(b=>m(b,k,A.msg("duplicated image $1 parameter",w))))}return f.size>1&&h.push(...g.filter(({name:w})=>u.has(w)).map(w=>m(w,k,"conflicting image $1 parameter","frame"))),S.size>1&&h.push(...g.filter(({name:w})=>r.has(w)).map(w=>m(w,k,"conflicting image $1 parameter","horizontal-alignment"))),p.size>1&&h.push(...g.filter(({name:w})=>n.has(w)).map(w=>m(w,k,"conflicting image $1 parameter","vertical-alignment"))),h}getAllArgs(){return this.childNodes.slice(1)}getArgs(a){return this.getAllArgs().filter(({name:h})=>a===h)}getFrameArgs(){return J(this,e,et).call(this,u,"\u6846\u67B6")}getHorizAlignArgs(){return J(this,e,et).call(this,r,"\u6C34\u5E73\u5BF9\u9F50")}getVertAlignArgs(){return J(this,e,et).call(this,n,"\u5782\u76F4\u5BF9\u9F50")}}e=new WeakSet,et=function(a,h){return this.getAllArgs().filter(({name:$})=>a.has($))},y.exports=s},1031:(y,F,t)=>{var u;const{generateForSelf:c}=t(8277),m=t(6010),A=t(8138),T=t(7625);class d extends T{constructor(s,e,i=m.getConfig(),o=[]){let l;if(e!==void 0){l=new A(e,i,!0,o),l.type="temp";for(let a=1;a<m.MAX_STAGE;a++)l.getAttribute("parseOnce")();o.splice(o.indexOf(l),1)}super(s,l==null?void 0:l.toString(),i,o);P(this,"type","gallery-image");z(this,u,!1);this.setAttribute("bracket",!1)}afterBuild(){const s=this.type==="imagemap-image",e=this.normalizeTitle(String(this.firstChild),s?0:6,!0,!s);M(this,u,e.ns!==6)}getPadding(){return 0}lint(s){const e=super.lint(s);return x(this,u)&&e.push(c(this,{start:s},"invalid gallery image")),e}}u=new WeakMap,y.exports=d},3905:(y,F,t)=>{var r,n,s,e;const{generateForChild:c}=t(8277),m=t(6010),A=t(7507),T=t(8138),d=t(9237);class u extends T{constructor(l,a,h=m.getConfig(),g=[],$="|"){super(void 0,h,!0,g,{});P(this,"type","link");z(this,r,!0);z(this,n,void 0);z(this,s,void 0);z(this,e,!1);if(this.insertAt(new d(l,"link-target",h,g,{})),a!==void 0){const f=new T(a,h,!0,g,{});f.type="link-text",this.insertAt(f.setAttribute("stage",m.MAX_STAGE-1))}M(this,n,$)}afterBuild(){var a;const l=this.normalizeTitle(this.firstChild.text(),0,!1,!0,!0);M(this,s,l.fragment),M(this,e,l.encoded),(a=x(this,n))!=null&&a.includes("\0")&&M(this,n,this.getAttribute("buildFromStr")(x(this,n),"string"))}setAttribute(l,a){return l==="bracket"?(M(this,r,Boolean(a)),this):super.setAttribute(l,a)}toString(l){const a=super.toString(l,x(this,n));return x(this,r)?`[[${a}]]`:a}text(){const l=super.text("|");return x(this,r)?`[[${l}]]`:l}getPadding(){return 2}getGaps(){return x(this,n).length}print(){return super.print(x(this,r)?{pre:"[[",post:"]]",sep:x(this,n)}:{sep:x(this,n)})}lint(l){var S;const a=super.lint(l),{childNodes:[h,g],type:$}=this;let f;return x(this,e)&&(f={start:l,...this.getRootNode().posFromIndex(l)},a.push(c(h,f,"unnecessary URL encoding in an internal link"))),$==="link"&&((S=g==null?void 0:g.childNodes)==null?void 0:S.some(({type:p,data:k})=>p==="text"&&k.includes("|")))?(f||(f={start:l,...this.getRootNode().posFromIndex(l)}),a.push(c(g,f,'additional "|" in the link text',"warning"))):$!=="link"&&x(this,s)!==void 0&&(f||(f={start:l,...this.getRootNode().posFromIndex(l)}),a.push(c(h,f,"useless fragment"))),a}}r=new WeakMap,n=new WeakMap,s=new WeakMap,e=new WeakMap,y.exports=u},8962:(y,F,t)=>{const{generateForChild:c}=t(8277),m=t(6010),A=t(8138);class T extends A{constructor(r,n,s=m.getConfig(),e=[]){super(r,s,!0,e,{});P(this,"type","free-ext-link");n&&(this.type="ext-link-url")}lint(r){const n=super.lint(r),s=`[\uFF0C\uFF1B\u3002\uFF1A\uFF01\uFF1F\uFF08\uFF09]+${this.type==="ext-link-url"?"|\\|+":""}`;let e;for(const i of this.childNodes){const o=String(i);if(i.type!=="text"||!new RegExp(s,"u").test(o))continue;e||(e={start:r,...this.getRootNode().posFromIndex(r)});const l=c(i,e,"","warning"),a=new RegExp(s,"gu");for(let h=a.exec(o);h;h=a.exec(o)){const{index:g,0:{0:$,length:f}}=h,S=o.slice(0,g).split(`
31
+ `),{length:p}=S,{length:k}=S[p-1],w=r+g,C=l.startLine+p-1,b=(p>1?0:l.startCol)+k;n.push({...l,message:m.msg("$1 in URL",$==="|"?'"|"':m.msg("full-width punctuation")),startIndex:w,endIndex:w+f,startLine:C,endLine:C,startCol:b,endCol:b+f})}}return n}}y.exports=T},9389:(y,F,t)=>{const c=t(6010),m=t(8889);class A extends m{constructor(u,r=c.getConfig(),n=[]){super(u,/<(option|choicetemplate)(\s[^>]*)?>(.*?)<\/(\1)>/gsu,["option","choicetemplate"],r,n);P(this,"name","choose")}}y.exports=A},9269:(y,F,t)=>{const c=t(6010),m=t(8889);class A extends m{constructor(u,r=c.getConfig(),n=[]){super(u,/<(combooption)(\s[^>]*)?>(.*?)<\/(combooption\s*)>/gisu,["combooption"],r,n);P(this,"name","combobox")}}y.exports=A},8889:(y,F,t)=>{const{generateForChild:c}=t(8277),m=t(6010),A=t(8138),T=t(7267),d=t(3423),u=t(5749);class r extends A{constructor(e,i,o,l=m.getConfig(),a=[]){var g;const h=(g=e==null?void 0:e.replace(i,($,f,S,p,k)=>{const w=`\0${a.length+1}${f?"e":"c"}\x7F`;if(f)new T(f,S,p,k,l,a);else{const C=$.endsWith("-->");new u($.slice(4,C?-3:void 0),C,l,a)}return w}))==null?void 0:g.replace(/(^|\0\d+[ce]\x7F)([^\0]+)(?=$|\0\d+[ce]\x7F)/gu,($,f,S)=>(new d(S,l,a),`${f}\0${a.length}c\x7F`));super(h,l,!0,a,{});P(this,"type","ext-inner")}lint(e){let i;return[...super.lint(e),...this.childNodes.filter(o=>{if(o.type==="ext"||o.type==="comment")return!1;const l=String(o).trim();return l&&!/^<!--.*-->$/u.test(l)}).map(o=>(i||(i={start:e,...this.getRootNode().posFromIndex(e)}),c(o,i,m.msg("invalid content in <$1>",this.name))))]}}y.exports=r},5937:(y,F,t)=>{const c=t(6010),m=t(8889);class A extends m{constructor(u,r=c.getConfig(),n=[]){super(u,/<!--.*?(?:-->|$)|<(ref)(\s[^>]*)?>(.*?)<\/(ref\s*)>/gisu,["ref"],r,n);P(this,"name","references")}}y.exports=A},5749:(y,F,t)=>{const c=t(2308),{generateForSelf:m}=t(8277),A=t(6010),T=t(6935);class d extends c(T){constructor(n,s=!0,e=A.getConfig(),i=[]){super(n,e,i);P(this,"type","comment");P(this,"closed");this.closed=s}getPadding(){return 4}print(){return super.print({pre:"&lt;!--",post:this.closed?"--&gt;":""})}lint(n){return this.closed?[]:[m(this,{start:n},"unclosed HTML comment")]}toString(n){return`<!--${String(this.firstChild)}${this.closed?"-->":""}`}}y.exports=d},3434:(y,F,t)=>{const c=t(6935);class m extends c{constructor(){super(...arguments);P(this,"type","dd")}}y.exports=m},7815:(y,F,t)=>{const c=t(2308),m=t(6935);class A extends c(m){constructor(){super(...arguments);P(this,"type","double-underscore")}getPadding(){return 2}print(){return super.print({pre:"__",post:"__"})}toString(u){return`__${String(this.firstChild)}__`}}y.exports=A},2582:(y,F,t)=>{const c=t(6010),m=t(6935);class A extends m{constructor(u,r=c.getConfig(),n=[]){super("-".repeat(u),r,n);P(this,"type","hr")}}y.exports=A},6935:(y,F,t)=>{const{generateForSelf:c}=t(8277),m=t(6010),A=t(8138);class T extends A{constructor(r,n=m.getConfig(),s=[]){super(r,n,!0,s);P(this,"type","ext-inner")}lint(r){const{type:n,name:s}=this;return n==="ext-inner"&&(s==="templatestyles"||s==="section")&&String(this)?[c(this,{start:r},m.msg("nothing should be in <$1>",s))]:super.lint(r)}}y.exports=T},962:(y,F,t)=>{const c=t(3434);class m extends c{constructor(){super(...arguments);P(this,"type","list")}}y.exports=m},3423:(y,F,t)=>{const c=t(2308),m=t(6935);class A extends c(m){constructor(){super(...arguments);P(this,"type","noinclude")}}y.exports=A},6714:(y,F,t)=>{const{generateForSelf:c}=t(8277),m=t(6010),A=t(7507),T=t(6935);class d extends T{constructor(n,s=m.getConfig(),e=[]){super("'".repeat(n),s,e);P(this,"type","quote")}lint(n){const{previousSibling:s,nextSibling:e}=this,i=m.msg('lonely "$1"',"'"),o=[];let l;if((s==null?void 0:s.type)==="text"&&s.data.endsWith("'")){l=c(this,{start:n},i);const{startIndex:a,startLine:h,startCol:g}=l,[,{length:$}]=s.data.match(/(?:^|[^'])('+)$/u),f=n-$;o.push({...l,startIndex:f,endIndex:a,startCol:g-$,endLine:h,endCol:g})}if((e==null?void 0:e.type)==="text"&&e.data[0]==="'"){l||(l=c(this,{start:n},i));const{endIndex:a,endLine:h,endCol:g}=l,[{length:$}]=e.data.match(/^'+/u),f=a+$;o.push({...l,startIndex:a,endIndex:f,startLine:h,startCol:g,endCol:g+$})}return o}}y.exports=d},851:(y,F,t)=>{const c=t(6010),m=t(8138);class A extends m{constructor(u,r=c.getConfig(),n=[]){super(u,r,!0,n);P(this,"type","onlyinclude")}toString(u){return`<onlyinclude>${super.toString()}</onlyinclude>`}getPadding(){return 13}print(){return super.print({pre:'<span class="wpb-ext">&lt;onlyinclude&gt;</span>',post:'<span class="wpb-ext">&lt;/onlyinclude&gt;</span>'})}isPlain(){return!0}}y.exports=A},9380:(y,F,t)=>{const{generateForChild:c}=t(8277),m=t(6010),A=t(8138),T=t(9237);class d extends A{constructor(n,s=m.getConfig(),e=[]){super(void 0,s,!0,e,{});P(this,"type","ext-inner");if(n){const i=T;this.append(...n.split(`
32
+ `).map(o=>new i(o,"param-line",s,e,{})))}}toString(n){return super.toString(n,`
33
+ `)}text(){return super.text(`
34
+ `)}getGaps(){return 1}print(){return super.print({sep:`
35
+ `})}lint(n){let s;return this.childNodes.filter(e=>{const{childNodes:i}=e,o=i.findIndex(({type:a})=>a!=="text"),l=(o>=0?i.slice(0,o).map(String).join(""):String(e)).trim();return l&&!(o>=0?/^[a-z]+(?:\[\])?\s*(?:=|$)/iu:/^[a-z]+(?:\[\])?\s*=/iu).test(l)}).map(e=>(s||(s={start:n,...this.getRootNode().posFromIndex(n)}),c(e,s,m.msg("invalid parameter of $1",this.name))))}}y.exports=d},6934:(y,F,t)=>{const c=t(8275),m=t(6010),A=t(9380),T=t(9237);class d extends A{constructor(n,s=m.getConfig(),e=[]){super(void 0,s,e);P(this,"name","inputbox");if(n=c(n,s,e),e.splice(e.indexOf(this),1),e.push(this),n){const i=T;this.append(...n.split(`
36
+ `).map(o=>new i(o,"param-line",s,e,{})))}}}y.exports=d},9799:(y,F,t)=>{const{extUrlChar:c,extUrlCharFirst:m}=t(231),{generateForChild:A}=t(8277),T=t(6010),d=t(8138);class u extends d{constructor(s,e,i=T.getConfig(),o=[]){super(void 0,i,!0,o);P(this,"type","parameter");const l=new d(typeof s=="number"?void 0:s,i,!0,o,{}),a=new d(e,i,!0,o);l.type="parameter-key",a.type="parameter-value",this.append(l,a.setAttribute("stage",2))}get anon(){return this.firstChild.length===0}afterBuild(){if(!this.anon){const s=t(1782),e=String(this.firstChild).replace(/<!--.*?-->/gu,"").replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1"),{parentNode:i}=this;this.setAttribute("name",e),i instanceof s&&i.getArgs(e,!1,!1).add(this)}}toString(s){return this.anon?this.lastChild.toString(s):super.toString(s,"=")}text(){return this.anon?this.lastChild.text():super.text("=")}getGaps(){return this.anon?0:1}print(){return super.print({sep:this.anon?"":"="})}lint(s){var l;const e=super.lint(s),{firstChild:i}=this,o=(l=new RegExp(`https?://${m}${c}$`,"iu").exec(String(i).replace(/<!--.*?-->/gu,"")))==null?void 0:l[0];if(o&&new URL(o).search){const a=A(i,{start:s},"unescaped query string in an anonymous parameter");e.push({...a,startIndex:a.endIndex,endIndex:a.endIndex+1,startLine:a.endLine,startCol:a.endCol,endCol:a.endCol+1})}return e}}y.exports=u},8058:(y,F,t)=>{const c=t(6010),m=t(8138);class A extends m{constructor(d,u,r="plain",n=c.getConfig(),s=[],e=void 0){super(d,n,!0,s,e),this.type=r}}y.exports=A},2840:(y,F,t)=>{const{generateForChild:c}=t(8277),m=t(3125),A=t(8058);class T extends m{constructor(){super(...arguments);P(this,"type","table")}get closed(){return this.lastChild.type==="table-syntax"}lint(r){const n=super.lint(r);if(!this.closed){const{firstChild:s}=this,e=c(s,{start:r},"unclosed table");n.push(e)}return n}close(r=`
37
+ |}`,n=!1){const s=this.getAttribute("config"),e=this.getAttribute("accum");super.insertAt(new A(r,void 0,"table-syntax",s,e))}}y.exports=T},5567:(y,F,t)=>{var u;const{generateForChild:c}=t(8277),m=t(6010),A=t(8138),T=t(3125);class d extends T{constructor(s,e,i=m.getConfig(),o=[]){let l=e==null?void 0:e.match(/\||\0\d+!\x7F/u),a=l?e.slice(0,l.index):"";/\[\[|-\{/u.test(a)&&(l=void 0,a="");super(s,a,i,o);P(this,"type","td");z(this,u,"");l&&([nt(this,u)._]=l);const h=new A(e==null?void 0:e.slice((l==null?void 0:l.index)+x(this,u).length),i,!0,o);h.type="td-inner",this.insertAt(h.setAttribute("stage",4))}get subtype(){return this.getSyntax().subtype}getSyntax(){const s=this.firstChild.text(),e=s[s.length-1];let i="td";return e==="!"?i="th":e==="+"&&(i="caption"),{subtype:i}}afterBuild(){x(this,u).includes("\0")&&M(this,u,this.getAttribute("buildFromStr")(x(this,u),"string"))}toString(s){const{childNodes:[e,i,o]}=this;return`${e.toString()}${i.toString()}${x(this,u)}${o.toString()}`}text(){const{childNodes:[s,e,i]}=this;return`${s.text()}${e.text()}${x(this,u)}${i.text()}`}getGaps(s=0){return s=s<0?s+this.length:s,s===1?x(this,u).length:0}lint(s){const e=super.lint(s);s+=this.getRelativeIndex(-1);for(const i of this.lastChild.childNodes)i.type==="text"&&i.data.includes("|")&&e.push(c(i,{start:s},'additional "|" in a table cell',"warning"));return e}print(){const{childNodes:[s,e,i]}=this;return`<span class="wpb-td">${s.print()}${e.print()}${x(this,u)}${i.print()}</span>`}}u=new WeakMap,y.exports=d},3125:(y,F,t)=>{const{generateForChild:c}=t(8277),m=t(6010),A=t(8138),T=t(8058),d=t(5649);class u extends A{constructor(s,e="",i=m.getConfig(),o=[],l=void 0){super(void 0,i,!0,o,{});P(this,"type","tr");this.append(new T(s,l,"table-syntax",i,o,{}),new d(e,"table-attrs",this.type,i,o))}lint(s){const e=t(1782),i=t(9544),o=super.lint(s),l=this.childNodes.find(({type:$})=>$==="table-inter");if(!l)return o;const a=l.childNodes.find($=>$.text().trim()),h=/^\s*(?:!|\{\{\s*![!-]?\s*\}\})/u;if(!a||h.test(String(a))||a.type==="arg"&&h.test(a.default||""))return o;if(a.type==="magic-word")try{if(a.getPossibleValues().every(f=>h.test(f.text())))return o}catch($){}const g=c(l,{start:s},"content to be moved out from the table");return o.push({...g,startIndex:g.startIndex+1,startLine:g.startLine+1,startCol:0}),o}text(){const s=super.text();return this.type==="tr"&&!s.trim().includes(`
38
+ `)?"":s}}y.exports=u},7267:(y,F,t)=>{const{generateForSelf:c}=t(8277),m=t(6010),A=t(8138),T=t(1074),d=t(5649);class u extends T{constructor(s,e="",i="",o=void 0,l=m.getConfig(),a=[]){e=!e||/^\s/u.test(e)?e:` ${e}`;const h=s.toLowerCase(),g=new d(e,"ext-attrs",h,l,a),$={...l,excludes:[...l.excludes]},f=new Set($.ext);let S;switch(f.delete(h),$.ext=[...f],$.inExt=!0,h){case"tab":f.delete("tabs"),$.ext=[...f];case"indicator":case"poem":case"ref":case"option":case"combooption":case"tabs":case"poll":case"seo":h==="poem"&&$.excludes.push("heading"),S=new A(i,$,!0,a);break;case"gallery":{const p=t(1891);S=new p(i,$,a);break}case"pre":{const p=t(428);S=new p(i,$,a);break}case"references":{const p=t(5937);S=new p(i,$,a);break}case"choose":{const p=t(9389);S=new p(i,$,a);break}case"combobox":{const p=t(9269);S=new p(i,$,a);break}case"imagemap":{const p=t(2641);S=new p(i,l,a);break}case"dynamicpagelist":{const p=t(9380);S=new p(i,$,a);break}case"inputbox":{$.excludes.push("heading");const p=t(6934);S=new p(i,$,a);break}default:{const p=t(6935);S=new p(i,l)}}S.setAttribute("name",h).type="ext-inner";super(s,g,S,o,l,a);P(this,"type","ext");P(this,"closed",!0)}lint(s){const e=super.lint(s);if(this.name!=="nowiki"&&this.closest("html-attrs, table-attrs")){const i=this.getRootNode(),o={start:s,...i.posFromIndex(s)};e.push(c(this,o,"extension tag in HTML tag attributes"))}return e}}y.exports=u},8655:(y,F,t)=>{const c=t(2308),m=t(6010),A=t(1074);class T extends c(A){constructor(r,n="",s=void 0,e=void 0,i=m.getConfig(),o=[]){super(r,n,s!=null?s:"",s===void 0||e!=null?e:"",i,o);P(this,"type","include")}}y.exports=T},1074:(y,F,t)=>{var T,d,u;const c=t(6010),m=t(8138);class A extends m{constructor(s,e,i,o,l=c.getConfig(),a=[]){super(void 0,l,!0);z(this,T,void 0);z(this,d,void 0);z(this,u,void 0);this.setAttribute("name",s.toLowerCase()),M(this,u,[s,o||s]),M(this,T,o===void 0),M(this,d,o!==""),this.append(e,i);let h=a.indexOf(e);h===-1&&(h=a.indexOf(i)),h===-1&&(h=1/0),a.splice(h,0,this)}get closed(){return x(this,d)}toString(s){const{firstChild:e,lastChild:i}=this,[o,l]=x(this,u);return x(this,T)?`<${o}${String(e)}/>`:`<${o}${String(e)}>${String(i)}${x(this,d)?`</${l}>`:""}`}text(){const[s,e]=x(this,u);return x(this,T)?`<${s}${this.firstChild.text()}/>`:`<${s}${super.text(">")}${x(this,d)?`</${e}>`:""}`}getPadding(){return x(this,u)[0].length+1}getGaps(){return 1}print(){const[s,e]=x(this,u);return super.print(x(this,T)?{pre:`&lt;${s}`,post:"/&gt;"}:{pre:`&lt;${s}`,sep:"&gt;",post:x(this,d)?`&lt;/${e}&gt;`:""})}}T=new WeakMap,d=new WeakMap,u=new WeakMap,y.exports=A},1782:(y,F,t)=>{var o,l,a,h,g,mt;const{removeComment:c,print:m,text:A,decodeHtml:T}=t(231),{generateForChild:d}=t(8277),u=t(6010),r=t(8138),n=t(9799),s=t(9237),e=t(8058);class i extends r{constructor(p,k,w=u.getConfig(),C=[]){var E,O;super(void 0,w,!0,C,{});z(this,g);P(this,"type","template");P(this,"modifier","");z(this,o,{});z(this,l,void 0);z(this,a,!0);z(this,h,!1);const{parserFunction:[b,v]}=w,L=(E=/^(?:\s|\0\d+c\x7F)*\0\d+s\x7F/u.exec(p))==null?void 0:E[0];if(L)this.setAttribute("modifier",L),p=p.slice(L.length);else if(p.includes(":")){const[U,...j]=p.split(":"),[B]=/^(?:\s|\0\d+c\x7F)*/u.exec((O=j[0])!=null?O:"");this.setModifier(`${U}:${B}`)&&(p=j.join(":").slice(B.length))}if(p.includes(":")||k.length===0&&!x(this,h)){const[U,...j]=p.split(":"),B=c(U),V=B.trim(),K=v.includes(V),Q=b[V.toLowerCase()];if(!(j.length>0&&/\s$/u.test(B))&&(K||Q)){this.setAttribute("name",Q||V.toLowerCase()).type="magic-word";const q=new RegExp(`^\\s*${V}\\s*$`,K?"u":"iu"),Y=new e(U,q,"magic-word-name",w,C,{});if(this.insertAt(Y),j.length>0&&k.unshift([j.join(":")]),this.name==="invoke")for(let N=0;N<2;N++){const R=k.shift();if(!R)break;const G=new s(R.join("="),`invoke-${N?"function":"module"}`,w,C,{});this.insertAt(G)}}}if(this.type==="template"){const U=c(T(p)).split("#")[0].trim();if(!U||/\0\d+[eh!+-]\x7F|[<>[\]{}\n]|%[\da-f]{2}/u.test(U))throw C.pop(),new SyntaxError(`\u975E\u6CD5\u7684\u6A21\u677F\u540D\u79F0\uFF1A${U}`);const j=new s(p,"template-name",w,C,{});this.insertAt(j)}const H=this.isTemplate();let I=1;for(let U=0;U<k.length;U++){const j=k[U];!H&&!(this.name==="switch"&&U>0)&&(j[0]=j.join("="),j.length=1),j.length===1&&(j.unshift(I),I++),this.insertAt(new n(...j,w,C))}}setModifier(p=""){const{parserFunction:[,,k,w]}=this.getAttribute("config"),C=c(p).trim();if(p&&!C.endsWith(":"))return!1;const b=C.slice(0,-1).toLowerCase(),v=k.includes(b),L=w.includes(b);return v||L||p===""?(this.setAttribute("modifier",p),M(this,h,v),Boolean(p)):!1}afterBuild(){if(this.modifier.includes("\0")&&this.setAttribute("modifier",this.getAttribute("buildFromStr")(this.modifier,"string")),this.isTemplate()){const p=this.type==="template",k=this.normalizeTitle(this.childNodes[p?0:1].text(),p?10:828);M(this,l,k.fragment),M(this,a,k.valid)}}toString(p){const{childNodes:k,firstChild:w,modifier:C}=this;return`{{${C}${this.type==="magic-word"?`${String(w)}${k.length>1?":":""}${k.slice(1).map(String).join("|")}`:super.toString(p,"|")}}}`}text(){const{childNodes:p,firstChild:k,modifier:w,type:C,name:b}=this;return C==="magic-word"&&b==="vardefine"?"":`{{${w}${this.type==="magic-word"?`${k.text()}${p.length>1?":":""}${A(p.slice(1),"|")}`:super.text("|")}}}`}getPadding(){return this.modifier.length+2}getGaps(){return 1}print(){const{childNodes:p,firstChild:k,modifier:w}=this;return`<span class="wpb-${this.type}">{{${w}${this.type==="magic-word"?`${k.print()}${p.length>1?":":""}${m(p.slice(1),{sep:"|"})}`:m(p,{sep:"|"})}}}</span>`}lint(p){const k=super.lint(p),{type:w,childNodes:C}=this;let b;if(this.isTemplate())x(this,l)!==void 0&&(b={start:p,...this.getRootNode().posFromIndex(p)},k.push(d(C[w==="template"?0:1],b,"useless fragment")));else return k;x(this,a)||(b={start:p,...this.getRootNode().posFromIndex(p)},k.push(d(C[1],b,"illegal module name")));const v=this.getDuplicatedArgs();return v.length>0&&(b||(b={start:p,...this.getRootNode().posFromIndex(p)}),k.push(...v.flatMap(([,L])=>L).map(L=>d(L,b,"duplicated parameter")))),k}isTemplate(){return this.type==="template"||this.type==="magic-word"&&this.name==="invoke"}insertAt(p,k=this.length){return super.insertAt(p,k),p.anon?J(this,g,mt).call(this,p):p.name&&this.getArgs(p.name,!1,!1).add(p),p}getAllArgs(){return this.childNodes.filter(p=>p instanceof n)}getAnonArgs(){return this.getAllArgs().filter(({anon:p})=>p)}getArgs(p,k,w=!0){const C=String(p).replace(/^[ \t\n\0\v]+|([^ \t\n\0\v])[ \t\n\0\v]+$/gu,"$1");let b;return Object.prototype.hasOwnProperty.call(x(this,o),C)?b=x(this,o)[C]:(b=new Set(this.getAllArgs().filter(({name:v})=>C===v)),x(this,o)[C]=b),b}getDuplicatedArgs(){return this.isTemplate()?Object.entries(x(this,o)).filter(([,{size:p}])=>p>1).map(([p,k])=>[p,[...k]]):[]}getPossibleValues(){const{type:p,name:k,childNodes:w,constructor:{name:C}}=this;if(p==="template")throw new Error(`${C}.getPossibleValues \u65B9\u6CD5\u4EC5\u4F9B\u7279\u5B9A\u9B54\u672F\u5B57\u4F7F\u7528\uFF01`);let b;switch(k){case"if":case"ifexist":case"ifexpr":case"iferror":b=2;break;case"ifeq":b=3;break;default:throw new Error(`${C}.getPossibleValues \u65B9\u6CD5\u4EC5\u4F9B\u7279\u5B9A\u9B54\u672F\u5B57\u4F7F\u7528\uFF01`)}const v=w.slice(b,b+2).map(({childNodes:[,L]})=>L);for(let L=0;L<v.length;){const{length:H,0:I}=v[L].childNodes.filter(E=>E.text().trim());if(H===0)v.splice(L,1);else if(H>1||I.type!=="magic-word")L++;else try{const E=I.getPossibleValues();v.splice(L,1,...E),L+=E.length}catch(E){L++}}return v}}o=new WeakMap,l=new WeakMap,a=new WeakMap,h=new WeakMap,g=new WeakSet,mt=function(p){const k=this.getAnonArgs(),w=k.indexOf(p);for(let C=w;C<k.length;C++){const b=k[C],{name:v}=b,L=String(C+1);v!==L&&this.getArgs(L,!1,!1).add(b.setAttribute("name",L))}},y.exports=i},8277:(y,F,t)=>{const c=t(6010),m=t(8138),A=(d,u,r,n="error")=>{const s=d.getRelativeIndex(),{offsetHeight:e,offsetWidth:i,parentNode:o,length:l}=d,{top:a,left:h}=o.posFromIndex(s),{start:g}=u,{top:$,left:f}="top"in u?u:d.getRootNode().posFromIndex(g),S=g+s,p=S+l,k=$+a,w=k+e-1,C=a?h:f+h,b=e>1?i:C+i;return{message:c.msg(r),severity:n,startIndex:S,endIndex:p,startLine:k,endLine:w,startCol:C,endCol:b}},T=(d,u,r,n="error")=>{const{start:s}=u,{offsetHeight:e,offsetWidth:i,length:o}=d,{top:l,left:a}="top"in u?u:d.getRootNode().posFromIndex(s);return{message:c.msg(r),severity:n,startIndex:s,endIndex:s+o,startLine:l,endLine:l+e-1,startCol:a,endCol:e>1?i:a+i}};y.exports={generateForChild:A,generateForSelf:T}},231:(y,F,t)=>{const c='(?:\\[[\\da-f:.]+\\]|[^[\\]<>"\\0-\\x1F\\x7F\\p{Zs}\\uFFFD])',m='(?:[^[\\]<>"\\0-\\x1F\\x7F\\p{Zs}\\uFFFD]|\\0\\d+c\\x7F)*',A=s=>s.replace(/\0\d+c\x7F/gu,""),T=(s,e={})=>{const i=t(7507),o=t(9205),{pre:l="",post:a="",sep:h=""}=e,g={"&":"amp","<":"lt",">":"gt"};return`${l}${s.map($=>$ instanceof o?$.print():String($).replace(/[&<>]/gu,f=>`&${g[f]};`)).join(h)}${a}`},d=s=>s.replace(/[\\{}()|.?*+^$[\]]/gu,"\\$&"),u=(s,e,i,o)=>{if(o===void 0)return[];const l=new RegExp(`${[s,e,i].map(d).join("|")}`,"gu"),a=[];let h=l.exec(o),g=0,$=0;for(;h;){const{0:f,index:S}=h;f!==i?g+=f===s?1:-1:g===0&&(a.push(o.slice($,S)),{lastIndex:$}=l),h=l.exec(o)}return a.push(o.slice($)),a},r=(s,e="")=>{const i=t(3853);return s.map(o=>typeof o=="string"?o:o.text()).join(e)},n=s=>s==null?void 0:s.replace(/&#(\d+|x[\da-f]+);/giu,(e,i)=>String.fromCodePoint(`${i[0].toLowerCase()==="x"?"0":""}${i}`));y.exports={extUrlCharFirst:c,extUrlChar:m,removeComment:A,print:T,escapeRegExp:d,explode:u,text:r,decodeHtml:n}},8166:y=>{y.exports=JSON.parse('{"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","img"]],"namespaces":{},"nsid":{},"parserFunction":[{"#language":"language","#special":"special","#speciale":"speciale","#tag":"tag","#formatdate":"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","#regex":"regex","#related":"related","#cscore":"cscore"},[],["msg","\u539F\u59CB","raw"],["\u66FF\u4EE3","subst","\u5B89\u5168\u66FF\u4EE3","safesubst"]],"doubleUnderscore":[[],[]],"protocol":"bitcoin:|ftp://|ftps://|geo:|git://|gopher://|http://|https://|irc://|ircs://|magnet:|mailto:|mms://|news:|nntp://|redis://|sftp://|sip:|sips:|sms:|ssh://|svn://|tel:|telnet://|urn:|worldwind://|xmpp:","img":{},"variants":["zh","zh-hans","zh-hant","zh-cn","zh-tw","zh-hk","zh-sg","zh-my","zh-mo"]}')}},D={};function X(y){var F=D[y];if(F!==void 0)return F.exports;var t=D[y]={exports:{}};return W[y](t,t.exports,X),t.exports}var tt=X(6010)})();})();
@@ -0,0 +1,62 @@
1
+ .wikiparse-container {
2
+ position: relative;
3
+ }
4
+ .wikiparsed {
5
+ position: relative;
6
+ display: block;
7
+ box-sizing: border-box;
8
+ width: 100%;
9
+ resize: vertical;
10
+ font-family: monospace;
11
+ background: none !important;
12
+ caret-color: #000;
13
+ }
14
+ #wikiPretty {
15
+ position: absolute;
16
+ inset: 0;
17
+ background-color: #fff;
18
+ -webkit-user-select: none;
19
+ user-select: none;
20
+ }
21
+ #wikiPretty + .wikiparsed, #wikiPretty {
22
+ outline: none;
23
+ border: 1.5px solid #dedede !important;
24
+ border-radius: 0;
25
+ padding: .4em;
26
+ line-height: 1.4 !important;
27
+ font-size: inherit;
28
+ tab-size: 4;
29
+ overflow-y: auto;
30
+ word-break: normal;
31
+ }
32
+
33
+ /* compromise for font-weight: bold */
34
+ .wpb-ext, .wpb-html,
35
+ .wpb-arg,
36
+ .wpb-template,
37
+ .wpb-magic-word,
38
+ .wpb-heading-title,
39
+ .wpb-table, .wpb-tr, .wpb-td,
40
+ .wpb-double-underscore, .wpb-hr, .wpb-quote, .wpb-list, .wpb-dd
41
+ .wpb-converter {
42
+ -webkit-text-stroke-width: .1ex;
43
+ }
44
+ .wpb-hidden, .wpb-table-inter, .wpb-table-inter span,
45
+ .wpb-noinclude, .wpb-include, .wpb-comment,
46
+ .wpb-ext-attrs, .wpb-html-attrs,
47
+ .wpb-ext-inner,
48
+ .wpb-arg-default,
49
+ .wpb-invoke-module, .wpb-invoke-function,
50
+ .wpb-parameter,
51
+ .wpb-table-attrs, .wpb-td-inner,
52
+ .wpb-converter-rule {
53
+ -webkit-text-stroke-width: 0;
54
+ }
55
+ #wikiPretty span {
56
+ font-weight: normal;
57
+ }
58
+
59
+ #wikiPretty.active span {
60
+ color: transparent;
61
+ background: none;
62
+ }
@@ -0,0 +1,328 @@
1
+ 'use strict';
2
+
3
+ (() => {
4
+ const MAX_STAGE = 11;
5
+
6
+ /** web worker */
7
+ const workerJS = () => {
8
+ self.importScripts('https://fastly.jsdelivr.net/gh/bhsd-harry/wikiparser-node@0.9.2-b/bundle/bundle.min.js');
9
+ const /** @type {{Parser: Parser}} */ {Parser} = self,
10
+ entities = {'&': 'amp', '<': 'lt', '>': 'gt'};
11
+
12
+ /**
13
+ * @param {{data: ['setI18N|'setConfig', ParserConfig]|[string, number, string, Boolean, number]}}
14
+ */
15
+ self.onmessage = ({data}) => {
16
+ const [command, qid, ...args] = data;
17
+ switch (command) {
18
+ case 'setI18N':
19
+ Parser.i18n = qid;
20
+ break;
21
+ case 'setConfig':
22
+ Parser.config = qid;
23
+ break;
24
+ case 'getConfig':
25
+ self.postMessage([qid, Parser.minConfig]);
26
+ break;
27
+ case 'lint':
28
+ self.postMessage([qid, Parser.parse(...args).lint(), args[0]]);
29
+ break;
30
+ default: {
31
+ const stage = args[2] === undefined ? MAX_STAGE : args[2];
32
+ self.postMessage([
33
+ qid,
34
+ Parser.parse(...args).childNodes.map(child => [
35
+ stage,
36
+ String(child),
37
+ child.type === 'text'
38
+ ? String(child).replace(/[&<>]/gu, p => `&${entities[p]};`)
39
+ : child.print(),
40
+ ]),
41
+ ]);
42
+ }
43
+ }
44
+ };
45
+ };
46
+
47
+ const blob = new Blob([`(${String(workerJS).replace(/MAX_STAGE/gu, MAX_STAGE)})()`], {type: 'text/javascript'}),
48
+ url = URL.createObjectURL(blob),
49
+ worker = new Worker(url);
50
+ URL.revokeObjectURL(url);
51
+
52
+ /**
53
+ * 生成事件监听函数
54
+ * @param {number} qid 输入id
55
+ * @param {(res: *) => void} resolve Promise对象的resolve函数
56
+ * @param {string} raw 原始文本
57
+ */
58
+ const getListener = (qid, resolve, raw) => {
59
+ const listener = /** @param {{data: [number, *, string]}} e 消息事件 */ ({data: [rid, res, resRaw]}) => {
60
+ if (rid === qid && (raw === undefined || raw === resRaw)) {
61
+ worker.removeEventListener('message', listener);
62
+ resolve(res);
63
+ }
64
+ };
65
+ return listener;
66
+ };
67
+
68
+ /**
69
+ * 更新I18N消息
70
+ * @param {Record<string, string>} i18n I18N消息
71
+ */
72
+ const setI18N = i18n => {
73
+ worker.postMessage(['setI18N', i18n]);
74
+ };
75
+
76
+ /**
77
+ * 更新解析设置
78
+ * @param {ParserConfig} config 设置
79
+ */
80
+ const setConfig = config => {
81
+ worker.postMessage(['setConfig', config]);
82
+ };
83
+
84
+ /**
85
+ * 获取Parser.minConfig
86
+ * @returns {Promise<ParserConfig>}
87
+ */
88
+ const getConfig = () => new Promise(resolve => {
89
+ worker.addEventListener('message', getListener(-3, resolve));
90
+ worker.postMessage(['getConfig', -3]);
91
+ });
92
+
93
+ /**
94
+ * 将解析改为异步执行
95
+ * @param {string} wikitext wikitext
96
+ * @param {boolean} include 是否嵌入
97
+ * @param {number} stage 解析层级
98
+ * @param {number} qid Printer编号
99
+ * @returns {Promise<[number, string, string][]>}
100
+ */
101
+ const print = (wikitext, include, stage, qid = -1) => new Promise(resolve => {
102
+ worker.addEventListener('message', getListener(qid, resolve));
103
+ worker.postMessage(['print', qid, wikitext, include, stage]);
104
+ });
105
+
106
+ /**
107
+ * 将语法分析改为异步执行
108
+ * @param {string} wikitext wikitext
109
+ * @param {boolean} include 是否嵌入
110
+ * @param {number} qid Linter编号,暂时固定为`-2`
111
+ * @returns {Promise<LintError[]>}
112
+ */
113
+ const lint = (wikitext, include, qid = -2) => new Promise(resolve => {
114
+ worker.addEventListener('message', getListener(qid, resolve, wikitext));
115
+ worker.postMessage(['lint', qid, wikitext, include]);
116
+ });
117
+
118
+ let id = 0;
119
+
120
+ /** 用于打印AST */
121
+ class Printer {
122
+ /**
123
+ * @param {HTMLDivElement} preview 置于下层的代码高亮
124
+ * @param {HTMLTextAreaElement} textbox 置于上层的文本框
125
+ * @param {boolean} include 是否嵌入
126
+ */
127
+ constructor(preview, textbox, include) {
128
+ this.id = id++;
129
+ this.preview = preview;
130
+ this.textbox = textbox;
131
+ this.include = Boolean(include);
132
+ /** @type {[number, string, string][]} */ this.root = [];
133
+ /** @type {Promise<void>} */ this.running = undefined;
134
+ this.viewportChanged = false;
135
+ /** @type {[number, string]} */ this.ticks = [0, undefined];
136
+ }
137
+
138
+ /** 倒计时 */
139
+ tick() {
140
+ setTimeout(() => {
141
+ const {ticks} = this;
142
+ if (ticks[0] > 0) {
143
+ ticks[0] -= 500;
144
+ this[ticks[0] <= 0 ? ticks[1] : 'tick']();
145
+ }
146
+ }, 500);
147
+ }
148
+
149
+ /**
150
+ * 用于debounce
151
+ * @param {number} delay 延迟
152
+ * @param {string} method 方法
153
+ */
154
+ queue(delay, method) {
155
+ const {ticks} = this,
156
+ [state] = ticks;
157
+ if (state <= 0 || method === 'coarsePrint' || ticks[1] !== 'coarsePrint') {
158
+ ticks[0] = delay;
159
+ ticks[1] = method;
160
+ if (state <= 0) {
161
+ this.tick();
162
+ }
163
+ }
164
+ }
165
+
166
+ /** 渲染 */
167
+ paint() {
168
+ this.preview.innerHTML = `<span class="wpb-root">${
169
+ this.root.map(([,, printed]) => printed).join('')
170
+ }</span> `;
171
+ this.preview.scrollTop = this.textbox.scrollTop;
172
+ this.preview.classList.remove('active');
173
+ this.textbox.style.color = 'transparent';
174
+ }
175
+
176
+ /** 初步解析 */
177
+ async coarsePrint() {
178
+ if (this.running) {
179
+ return undefined;
180
+ }
181
+ const {include, textbox: {value}} = this,
182
+ parsed = await print(value, include, 2, this.id);
183
+ if (this.include !== include || this.textbox.value !== value) {
184
+ this.running = undefined;
185
+ this.running = this.coarsePrint();
186
+ return this.running;
187
+ }
188
+ this.root = parsed;
189
+ this.paint();
190
+ this.running = undefined;
191
+ this.running = this.finePrint();
192
+ return this.running;
193
+ }
194
+
195
+ /** 根据可见范围精细解析 */
196
+ async finePrint() {
197
+ if (this.running) {
198
+ this.viewportChanged = true;
199
+ return undefined;
200
+ }
201
+ this.viewportChanged = false;
202
+ const {
203
+ root,
204
+ preview: {scrollHeight, offsetHeight: parentHeight, scrollTop, children: [rootNode]},
205
+ include,
206
+ textbox: {value},
207
+ } = this;
208
+ let text = value,
209
+ start = 0,
210
+ {length: end} = root;
211
+ if (scrollHeight > parentHeight) {
212
+ const /** @type {HTMLElement[]} */ childNodes = [...rootNode.childNodes],
213
+ headings = childNodes.filter(({className}) => className === 'wpb-heading'),
214
+ {length} = headings;
215
+ if (length > 0) {
216
+ let i = headings.findIndex(({offsetTop, offsetHeight}) => offsetTop + offsetHeight > scrollTop);
217
+ i = i === -1 ? length : i;
218
+ let j = headings.slice(i).findIndex(({offsetTop}) => offsetTop >= scrollTop + parentHeight);
219
+ j = j === -1 ? length : i + j;
220
+ start = i ? childNodes.indexOf(headings[i - 1]) : 0;
221
+ while (i <= j && root[start][0] === MAX_STAGE) {
222
+ start = childNodes.indexOf(headings[i++]);
223
+ }
224
+ end = j === length ? end : childNodes.indexOf(headings[j]);
225
+ while (i <= j && root[end - 1][0] === MAX_STAGE) {
226
+ end = childNodes.indexOf(headings[--j]);
227
+ }
228
+ text = root.slice(start, end).map(([, str]) => str).join('');
229
+ }
230
+ }
231
+ if (start === end) {
232
+ this.running = undefined;
233
+ return undefined;
234
+ }
235
+ const parsed = await print(text, include, MAX_STAGE, this.id);
236
+ if (this.include === include && this.textbox.value === value) {
237
+ this.root.splice(start, end - start, ...parsed);
238
+ this.paint();
239
+ this.running = undefined;
240
+ if (this.viewportChanged) {
241
+ this.running = this.finePrint();
242
+ }
243
+ } else {
244
+ this.running = undefined;
245
+ this.running = this.coarsePrint();
246
+ }
247
+ return this.running;
248
+ }
249
+ }
250
+
251
+ /** 用于语法分析 */
252
+ class Linter {
253
+ /** @param {boolean} include 是否嵌入 */
254
+ constructor(include) {
255
+ this.id = id++;
256
+ this.include = Boolean(include);
257
+ this.wikitext = undefined;
258
+ /** @type {Promise<LintError[]>} */ this.running = undefined;
259
+ }
260
+
261
+ /**
262
+ * 提交语法分析
263
+ * @param {string} wikitext 待分析的文本
264
+ */
265
+ queue(wikitext) {
266
+ this.wikitext = wikitext;
267
+ this.running = this.lint(wikitext);
268
+ return this.running;
269
+ }
270
+
271
+ /**
272
+ * 执行语法分析
273
+ * @param {string} wikitext 待分析的文本
274
+ */
275
+ async lint(wikitext) {
276
+ const {include} = this,
277
+ errors = await lint(wikitext, include, this.id);
278
+ return this.include === include && this.wikitext === wikitext ? errors : this.running;
279
+ }
280
+ }
281
+
282
+ /**
283
+ * 高亮textarea
284
+ * @param {HTMLTextAreaElement} textbox textarea元素
285
+ * @param {boolean} include 是否嵌入
286
+ * @throws `TypeError` 不是textarea
287
+ */
288
+ const wikiparse = (textbox, include) => {
289
+ if (!(textbox instanceof HTMLTextAreaElement)) {
290
+ throw new TypeError('wikiparse方法仅可用于textarea元素!');
291
+ }
292
+ const preview = document.createElement('div'),
293
+ container = document.createElement('div'),
294
+ printer = new Printer(preview, textbox, include);
295
+ preview.id = 'wikiPretty';
296
+ preview.classList.add('wikiparser', 'active');
297
+ container.classList.add('wikiparse-container');
298
+ textbox.replaceWith(container);
299
+ textbox.classList.add('wikiparsed');
300
+ container.append(preview, textbox);
301
+
302
+ textbox.addEventListener('input', ({isComposing}) => {
303
+ if (!isComposing) {
304
+ printer.queue(2000, 'coarsePrint');
305
+ }
306
+ textbox.style.color = '';
307
+ preview.classList.add('active');
308
+ });
309
+ textbox.addEventListener('scroll', () => {
310
+ if (preview.scrollHeight > preview.offsetHeight && !preview.classList.contains('active')) {
311
+ preview.scrollTop = textbox.scrollTop;
312
+ printer.queue(500, 'finePrint');
313
+ }
314
+ });
315
+ textbox.addEventListener('keydown', e => {
316
+ if ((e.ctrlKey || e.metaKey) && e.key === 'k') {
317
+ e.preventDefault();
318
+ printer.ticks[0] = 0;
319
+ printer.running = printer.coarsePrint();
320
+ }
321
+ });
322
+ printer.running = printer.coarsePrint();
323
+ return printer;
324
+ };
325
+
326
+ Object.assign(wikiparse, {print, lint, setI18N, setConfig, getConfig, Printer, Linter});
327
+ window.wikiparse = wikiparse;
328
+ })();