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