| 122 | W |
| 123 | ;if("object"!=typeof e.endScope||null===e.endScope)throw q("endScope must be object"), |
| 124 | W;Q(e,e.end,{key:"endScope"}),e.end=b(e.end,{joinWith:""})}})(e)}function j(e){ |
| 125 | function t(t,a){ |
| 126 | return RegExp(d(t),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(a?"g":"")) |
| 127 | }class a{constructor(){ |
| 128 | this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0} |
| 129 | addRule(e,t){ |
| 130 | t.position=this.position++,this.matchIndexes[this.matchAt]=t,this.regexes.push([t,e]), |
| 131 | this.matchAt+=S(e)+1}compile(){0===this.regexes.length&&(this.exec=()=>null) |
| 132 | ;const e=this.regexes.map((e=>e[1]));this.matcherRe=t(b(e,{joinWith:"|" |
| 133 | }),!0),this.lastIndex=0}exec(e){this.matcherRe.lastIndex=this.lastIndex |
| 134 | ;const t=this.matcherRe.exec(e);if(!t)return null |
| 135 | ;const a=t.findIndex(((e,t)=>t>0&&void 0!==e)),n=this.matchIndexes[a] |
| 136 | ;return t.splice(0,a),Object.assign(t,n)}}class n{constructor(){ |
| 137 | this.rules=[],this.multiRegexes=[], |
| 138 | this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(e){ |
| 139 | if(this.multiRegexes[e])return this.multiRegexes[e];const t=new a |
| 140 | ;return this.rules.slice(e).forEach((([e,a])=>t.addRule(e,a))), |
| 141 | t.compile(),this.multiRegexes[e]=t,t}resumingScanAtSamePosition(){ |
| 142 | return 0!==this.regexIndex}considerAll(){this.regexIndex=0}addRule(e,t){ |
| 143 | this.rules.push([e,t]),"begin"===t.type&&this.count++}exec(e){ |
| 144 | const t=this.getMatcher(this.regexIndex);t.lastIndex=this.lastIndex |
| 145 | ;let a=t.exec(e) |
| 146 | ;if(this.resumingScanAtSamePosition())if(a&&a.index===this.lastIndex);else{ |
| 147 | const t=this.getMatcher(0);t.lastIndex=this.lastIndex+1,a=t.exec(e)} |
| 148 | return a&&(this.regexIndex+=a.position+1, |
| 149 | this.regexIndex===this.count&&this.considerAll()),a}} |
| 150 | if(e.compilerExtensions||(e.compilerExtensions=[]), |
| 151 | e.contains&&e.contains.includes("self"))throw Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.") |
| 152 | ;return e.classNameAliases=r(e.classNameAliases||{}),function a(i,s){const o=i |
| 153 | ;if(i.isCompiled)return o |
| 154 | ;[w,U,K,B].forEach((e=>e(i,s))),e.compilerExtensions.forEach((e=>e(i,s))), |
| 155 | i.__beforeBegin=null,[P,k,F].forEach((e=>e(i,s))),i.isCompiled=!0;let l=null |
| 156 | ;return"object"==typeof i.keywords&&i.keywords.$pattern&&(i.keywords=Object.assign({},i.keywords), |
| 157 | l=i.keywords.$pattern, |
| 158 | delete i.keywords.$pattern),l=l||/\w+/,i.keywords&&(i.keywords=Y(i.keywords,e.case_insensitive)), |
| 159 | o.keywordPatternRe=t(l,!0), |
| 160 | s&&(i.begin||(i.begin=/\B|\b/),o.beginRe=t(o.begin),i.end||i.endsWithParent||(i.end=/\B|\b/), |
| 161 | i.end&&(o.endRe=t(o.end)), |
| 162 | o.terminatorEnd=d(o.end)||"",i.endsWithParent&&s.terminatorEnd&&(o.terminatorEnd+=(i.end?"|":"")+s.terminatorEnd)), |
| 163 | i.illegal&&(o.illegalRe=t(i.illegal)), |
| 164 | i.contains||(i.contains=[]),i.contains=[].concat(...i.contains.map((e=>(e=>(e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map((t=>r(e,{ |
| 165 | variants:null},t)))),e.cachedVariants?e.cachedVariants:X(e)?r(e,{ |
| 166 | starts:e.starts?r(e.starts):null |
| 167 | }):Object.isFrozen(e)?r(e):e))("self"===e?i:e)))),i.contains.forEach((e=>{a(e,o) |
| 168 | })),i.starts&&a(i.starts,s),o.matcher=(e=>{const t=new n |
| 169 | ;return e.contains.forEach((e=>t.addRule(e.begin,{rule:e,type:"begin" |
| 170 | }))),e.terminatorEnd&&t.addRule(e.terminatorEnd,{type:"end" |
| 171 | }),e.illegal&&t.addRule(e.illegal,{type:"illegal"}),t})(o),o}(e)}function X(e){ |
| 172 | return!!e&&(e.endsWithParent||X(e.starts))}class Z extends Error{ |
| 173 | constructor(e,t){super(e),this.name="HTMLInjectionError",this.html=t}} |
| 174 | const J=n,ee=r,te=Symbol("nomatch");var ae=(t=>{ |