@lexical/code-shiki 0.36.2-nightly.20250930.0 → 0.36.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LexicalCodeShiki.prod.js +10 -10
- package/LexicalCodeShiki.prod.mjs +10 -10
- package/package.json +4 -4
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{$isCodeNode as e,$createCodeHighlightNode as t,CodeExtension as n,DEFAULT_CODE_LANGUAGE as r,CodeNode as s,CodeHighlightNode as i,$isCodeHighlightNode as o,$getFirstCodeNodeOfLine as a,$getLastCodeNodeOfLine as l,$getStartOfCodeInLine as c,$getEndOfCodeInLine as u}from"@lexical/code";import{mergeRegister as p}from"@lexical/utils";import{$getNodeByKey as h,$createLineBreakNode as d,$createTabNode as m,defineExtension as g,TextNode as f,KEY_TAB_COMMAND as y,COMMAND_PRIORITY_LOW as k,INSERT_TAB_COMMAND as b,$getSelection as w,$insertNodes as C,INDENT_CONTENT_COMMAND as _,OUTDENT_CONTENT_COMMAND as S,KEY_ARROW_UP_COMMAND as v,$isRangeSelection as x,KEY_ARROW_DOWN_COMMAND as N,MOVE_TO_START as A,MOVE_TO_END as j,$isLineBreakNode as E,$createTextNode as L,$createPoint as I,$setSelectionFromCaretRange as P,$getCaretRangeInDirection as R,$getCaretRange as T,$getTextPointCaret as M,$normalizeCaret as $,$getSiblingCaret as O,$isTabNode as G,$isTextNode as D}from"lexical";function B(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let F=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function U(e){return Array.isArray(e)?function(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=U(e[n]);return t}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let t={};for(let n in e)t[n]=U(e[n]);return t}(e):e}function z(e,...t){return t.forEach((t=>{for(let n in t)e[n]=t[n]})),e}function W(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t==e.length-1?W(e.substring(0,e.length-1)):e.substr(1+~t)}var H=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,q=class{static hasCaptures(e){return null!==e&&(H.lastIndex=0,H.test(e))}static replaceCaptures(e,t,n){return e.replace(H,((e,r,s,i)=>{let o=n[parseInt(r||s,10)];if(!o)return e;{let e=t.substring(o.start,o.end);for(;"."===e[0];)e=e.substring(1);switch(i){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}}))}};function V(e,t){return e<t?-1:e>t?1:0}function X(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=V(e[r],t[r]);if(0!==n)return n}return 0}return n-r}function K(e){return!!/^#[0-9a-f]{6}$/i.test(e)||(!!/^#[0-9a-f]{8}$/i.test(e)||(!!/^#[0-9a-f]{3}$/i.test(e)||!!/^#[0-9a-f]{4}$/i.test(e)))}function Q(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Z=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},J=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,s=t.length;e<s;e++){let s,i=t[e];if(!i.settings)continue;if("string"==typeof i.scope){let e=i.scope;e=e.replace(/^[,]+/,""),e=e.replace(/[,]+$/,""),s=e.split(",")}else s=Array.isArray(i.scope)?i.scope:[""];let o=-1;if("string"==typeof i.settings.fontStyle){o=0;let e=i.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++){switch(e[t]){case"italic":o|=1;break;case"bold":o|=2;break;case"underline":o|=4;break;case"strikethrough":o|=8}}}let a=null;"string"==typeof i.settings.foreground&&K(i.settings.foreground)&&(a=i.settings.foreground);let l=null;"string"==typeof i.settings.background&&K(i.settings.background)&&(l=i.settings.background);for(let t=0,i=s.length;t<i;t++){let i=s[t].trim().split(" "),c=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new ne(c,u,e,o,a,l)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort(((e,t)=>{let n=V(e.scope,t.scope);return 0!==n?n:(n=X(e.parentScopes,t.parentScopes),0!==n?n:e.index-t.index)}));let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(r=t.foreground),null!==t.background&&(s=t.background)}let i=new se(t),o=new te(n,i.getId(r),i.getId(s)),a=new ae(new oe(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];a.insert(0,n.scope,n.parentScopes,n.fontStyle,i.getId(n.foreground),i.getId(n.background))}return new J(i,o,a)}(e,t)}_cachedMatchRoot=new Z((e=>this._root.match(e)));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find((t=>function(e,t){if(0===t.length)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(">"===r){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!ee(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}(e.parent,t.parentScopes)));return n?new te(n.fontStyle,n.foreground,n.background):null}},Y=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(const r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function ee(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var te=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};var ne=class{constructor(e,t,n,r,s,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=i}},re=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(re||{});var se=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},ie=Object.freeze([]),oe=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,s){this.scopeDepth=e,this.parentScopes=t||ie,this.fontStyle=n,this.foreground=r,this.background=s}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==r&&(this.background=r)}},ae=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[r]&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){const s=t.parentScopes[r].length-e.parentScopes[n].length;if(0!==s)return s;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,r=t.indexOf(".");if(-1===r?(e=t,n=""):(e=t.substring(0,r),n=t.substring(r+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,s,i,o){if(""===n)return void this._doInsertHere(t,r,s,i,o);let a,l,c,u=n.indexOf(".");-1===u?(a=n,l=""):(a=n.substring(0,u),l=n.substring(u+1)),this._children.hasOwnProperty(a)?c=this._children[a]:(c=new e(this._mainRule.clone(),oe.cloneArr(this._rulesWithParentScopes)),this._children[a]=c),c.insert(t+1,l,r,s,i,o)}_doInsertHere(e,t,n,r,s){if(null!==t){for(let i=0,o=this._rulesWithParentScopes.length;i<o;i++){let o=this._rulesWithParentScopes[i];if(0===X(o.parentScopes,t))return void o.acceptOverwrite(e,n,r,s)}-1===n&&(n=this._mainRule.fontStyle),0===r&&(r=this._mainRule.foreground),0===s&&(s=this._mainRule.background),this._rulesWithParentScopes.push(new oe(e,t,n,r,s))}else this._mainRule.acceptOverwrite(e,n,r,s)}},le=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){const n=e.getLanguageId(t),r=e.getTokenType(t),s=e.getFontStyle(t),i=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:i,background:o})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,r,s,i,o,a){let l=e.getLanguageId(t),c=e.getTokenType(t),u=e.containsBalancedBrackets(t)?1:0,p=e.getFontStyle(t),h=e.getForeground(t),d=e.getBackground(t);return 0!==n&&(l=n),8!==r&&(c=r),null!==s&&(u=s?1:0),-1!==i&&(p=i),0!==o&&(h=o),0!==a&&(d=a),(l|c<<8|u<<10|p<<11|h<<15|d<<24)>>>0}};function ce(e,t){const n=[],r=function(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}(e);let s=r.next();for(;null!==s;){let e=0;if(2===s.length&&":"===s.charAt(1)){switch(s.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let t=o();if(n.push({matcher:t,priority:e}),","!==s)break;s=r.next()}return n;function i(){if("-"===s){s=r.next();const e=i();return t=>!!e&&!e(t)}if("("===s){s=r.next();const e=function(){const e=[];let t=o();for(;t&&(e.push(t),"|"===s||","===s);){do{s=r.next()}while("|"===s||","===s);t=o()}return t=>e.some((e=>e(t)))}();return")"===s&&(s=r.next()),e}if(ue(s)){const e=[];do{e.push(s),s=r.next()}while(ue(s));return n=>t(e,n)}return null}function o(){const e=[];let t=i();for(;t;)e.push(t),t=i();return t=>e.every((e=>e(t)))}}function ue(e){return!!e&&!!e.match(/[\w\.:]+/)}function pe(e){"function"==typeof e.dispose&&e.dispose()}var he=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},de=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},me=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},ge=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new he(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new me;for(const n of e)fe(n,this.initialScopeName,this.repo,t);for(const e of t.references)if(e instanceof he){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName))continue;if(this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function fe(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof he?ke({baseGrammar:i,selfGrammar:s},r):ye(e.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);const o=n.injections(e.scopeName);if(o)for(const e of o)r.add(new he(e))}function ye(e,t,n){if(t.repository&&t.repository[e]){be([t.repository[e]],t,n)}}function ke(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&be(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&be(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function be(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const e=r.repository?z({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&be(r.patterns,{...t,repository:e},n);const s=r.include;if(!s)continue;const i=xe(s);switch(i.kind){case 0:ke({...t,selfGrammar:t.baseGrammar},n);break;case 1:ke(t,n);break;case 2:ye(i.ruleName,{...t,repository:e},n);break;case 3:case 4:const r=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){const s={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};4===i.kind?ye(i.ruleName,s,n):ke(s,n)}else 4===i.kind?n.add(new de(i.scopeName,i.ruleName)):n.add(new he(i.scopeName))}}}var we=class{kind=0},Ce=class{kind=1},_e=class{constructor(e){this.ruleName=e}kind=2},Se=class{constructor(e){this.scopeName=e}kind=3},ve=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function xe(e){if("$base"===e)return new we;if("$self"===e)return new Ce;const t=e.indexOf("#");if(-1===t)return new Se(e);if(0===t)return new _e(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new ve(n,r)}}var Ne=/\\(\d+)/,Ae=/\\(\d+)/g,je=-1,Ee=-2;var Le=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=q.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=q.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${W(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?q.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?q.replaceCaptures(this._contentName,e,t):this._contentName}},Ie=class extends Le{retokenizeCapturedWithRuleId;constructor(e,t,n,r,s){super(e,t,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},Pe=class extends Le{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new Oe(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Re=class extends Le{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns){e.getRule(n).collectPatterns(e,t)}}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Te=class extends Le{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s,i,o,a,l,c){super(e,t,n,r),this._begin=new Oe(s,this.id),this.beginCaptures=i,this._end=new Oe(o||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ge;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Me=class extends Le{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,s,i,o,a,l){super(e,t,n,r),this._begin=new Oe(s,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new Oe(o,Ee),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ge;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Ge,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},$e=class e{static createCaptureRule(e,t,n,r,s){return e.registerRule((e=>new Ie(t,e,n,r,s)))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule((s=>{if(t.id=s,t.match)return new Pe(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(void 0===t.begin){t.repository&&(r=z({},r,t.repository));let s=t.patterns;return void 0===s&&t.include&&(s=[{include:t.include}]),new Re(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(s,n,r))}return t.while?new Me(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Te(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))})),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let i=0;for(const e in t){if("$vscodeTextmateLocation"===e)continue;const t=parseInt(e,10);t>i&&(i=t)}for(let e=0;e<=i;e++)s[e]=null;for(const i in t){if("$vscodeTextmateLocation"===i)continue;const o=parseInt(i,10);let a=0;t[i].patterns&&(a=e.getCompiledRuleId(t[i],n,r)),s[o]=e.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,a)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let i=0,o=t.length;i<o;i++){const o=t[i];let a=-1;if(o.include){const t=xe(o.include);switch(t.kind){case 0:case 1:a=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let s=r[t.ruleName];s&&(a=e.getCompiledRuleId(s,n,r));break;case 3:case 4:const i=t.scopeName,l=4===t.kind?t.ruleName:null,c=n.getExternalGrammar(i,r);if(c)if(l){let t=c.repository[l];t&&(a=e.getCompiledRuleId(t,n,c.repository))}else a=e.getCompiledRuleId(c.repository.$self,n,c.repository)}}else a=e.getCompiledRuleId(o,n,r);if(-1!==a){const e=n.getRule(a);let t=!1;if((e instanceof Re||e instanceof Te||e instanceof Me)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},Oe=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let n=0,r=[],s=!1;for(let i=0;i<t;i++){if("\\"===e.charAt(i)&&i+1<t){const t=e.charAt(i+1);"z"===t?(r.push(e.substring(n,i)),r.push("$(?!\\n)(?<!\\n)"),n=i+2):"A"!==t&&"G"!==t||(s=!0),i++}}this.hasAnchor=s,0===n?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=Ne.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let n=t.map((t=>e.substring(t.start,t.end)));return Ae.lastIndex=0,this.source.replace(Ae,((e,t)=>Q(n[parseInt(t,10)]||"")))}_buildAnchorCache(){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let e,t,n,r,s=[],i=[],o=[],a=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),s[e]=n,i[e]=n,o[e]=n,a[e]=n,"\\"===n&&e+1<t&&(r=this.source.charAt(e+1),"A"===r?(s[e+1]="",i[e+1]="",o[e+1]="A",a[e+1]="A"):"G"===r?(s[e+1]="",i[e+1]="G",o[e+1]="",a[e+1]="G"):(s[e+1]=r,i[e+1]=r,o[e+1]=r,a[e+1]=r),e++);return{A0_G0:s.join(""),A0_G1:i.join(""),A1_G0:o.join(""),A1_G1:a.join("")}}resolveAnchors(e,t){return this.hasAnchor&&this._anchorCache&&"string"==typeof this.source?e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0:this.source}},Ge=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map((e=>e.source));this._cached=new De(e,t,this._items.map((e=>e.ruleId)))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map((e=>e.resolveAnchors(t,n)));return new De(e,r,this._items.map((e=>e.ruleId)))}},De=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Be=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Fe=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Be(e,8),this._embeddedLanguagesMatcher=new Ue(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Be(0,0);_getBasicScopeAttributes=new Z((e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new Be(t,n)}));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){const n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Ue=class{values;scopesRegExp;constructor(e){if(0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map((([e,t])=>Q(e)));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);return t?this.values.get(t[1]):void 0}};"undefined"!=typeof process&&process.env.VSCODE_TEXTMATE_DEBUG;var ze=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function We(e,t,n,r,s,i,o,a){const l=t.content.length;let c=!1,u=-1;if(o){const o=function(e,t,n,r,s,i){let o=s.beginRuleCapturedEOL?0:-1;const a=[];for(let t=s;t;t=t.pop()){const n=t.getRule(e);n instanceof Me&&a.push({rule:n,stack:t})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:a,findOptions:c}=qe(l.rule,e,l.stack.endRule,n,r===o),u=a.findNextMatchSync(t,r,c);if(!u){s=l.stack.pop();break}if(u.ruleId!==Ee){s=l.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(i.produce(l.stack,u.captureIndices[0].start),Ve(e,t,n,l.stack,i,l.rule.whileCaptures,u.captureIndices),i.produce(l.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}(e,t,n,r,s,i);s=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}const p=Date.now();for(;!c;){if(0!==a){if(Date.now()-p>a)return new ze(s,!0)}h()}return new ze(s,!1);function h(){const o=function(e,t,n,r,s,i){const o=function(e,t,n,r,s,i){const o=s.getRule(e),{ruleScanner:a,findOptions:l}=He(o,e,s.endRule,n,r===i),c=a.findNextMatchSync(t,r,l);if(c)return{captureIndices:c.captureIndices,matchedRuleId:c.ruleId};return null}(e,t,n,r,s,i),a=e.getInjections();if(0===a.length)return o;const l=function(e,t,n,r,s,i,o){let a,l=Number.MAX_VALUE,c=null,u=0;const p=i.contentNameScopesList.getScopeNames();for(let i=0,h=e.length;i<h;i++){const h=e[i];if(!h.matcher(p))continue;const d=t.getRule(h.ruleId),{ruleScanner:m,findOptions:g}=He(d,t,null,r,s===o),f=m.findNextMatchSync(n,s,g);if(!f)continue;const y=f.captureIndices[0].start;if(!(y>=l)&&(l=y,c=f.captureIndices,a=f.ruleId,u=h.priority,l===s))break}if(c)return{priorityMatch:-1===u,captureIndices:c,matchedRuleId:a};return null}(a,e,t,n,r,s,i);if(!l)return o;if(!o)return l;const c=o.captureIndices[0].start,u=l.captureIndices[0].start;if(u<c||l.priorityMatch&&u===c)return l;return o}(e,t,n,r,s,u);if(!o)return i.produce(s,l),void(c=!0);const a=o.captureIndices,p=o.matchedRuleId,h=!!(a&&a.length>0)&&a[0].end>r;if(p===je){const o=s.getRule(e);i.produce(s,a[0].start),s=s.withContentNameScopesList(s.nameScopesList),Ve(e,t,n,s,i,o.endCaptures,a),i.produce(s,a[0].end);const p=s;if(s=s.parent,u=p.getAnchorPos(),!h&&p.getEnterPos()===r)return s=p,i.produce(s,l),void(c=!0)}else{const o=e.getRule(p);i.produce(s,a[0].start);const d=s,m=o.getName(t.content,a),g=s.contentNameScopesList.pushAttributed(m,e);if(s=s.push(p,r,u,a[0].end===l,null,g,g),o instanceof Te){const r=o;Ve(e,t,n,s,i,r.beginCaptures,a),i.produce(s,a[0].end),u=a[0].end;const p=r.getContentName(t.content,a),m=g.pushAttributed(p,e);if(s=s.withContentNameScopesList(m),r.endHasBackReferences&&(s=s.withEndRule(r.getEndWithResolvedBackReferences(t.content,a))),!h&&d.hasSameRuleAs(s))return s=s.pop(),i.produce(s,l),void(c=!0)}else if(o instanceof Me){const r=o;Ve(e,t,n,s,i,r.beginCaptures,a),i.produce(s,a[0].end),u=a[0].end;const p=r.getContentName(t.content,a),m=g.pushAttributed(p,e);if(s=s.withContentNameScopesList(m),r.whileHasBackReferences&&(s=s.withEndRule(r.getWhileWithResolvedBackReferences(t.content,a))),!h&&d.hasSameRuleAs(s))return s=s.pop(),i.produce(s,l),void(c=!0)}else{if(Ve(e,t,n,s,i,o.captures,a),i.produce(s,a[0].end),s=s.pop(),!h)return s=s.safePop(),i.produce(s,l),void(c=!0)}}a[0].end>r&&(r=a[0].end,n=!1)}}function He(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function qe(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function Ve(e,t,n,r,s,i,o){if(0===i.length)return;const a=t.content,l=Math.min(i.length,o.length),c=[],u=o[0].end;for(let t=0;t<l;t++){const l=i[t];if(null===l)continue;const p=o[t];if(0===p.length)continue;if(p.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=p.start;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?s.produceFromScopes(c[c.length-1].scopes,p.start):s.produce(r,p.start),l.retokenizeCapturedWithRuleId){const t=l.getName(a,o),i=r.contentNameScopesList.pushAttributed(t,e),c=l.getContentName(a,o),u=i.pushAttributed(c,e),h=r.push(l.retokenizeCapturedWithRuleId,p.start,-1,!1,null,i,u),d=e.createOnigString(a.substring(0,p.end));We(e,d,n&&0===p.start,p.start,h,s,!1,0),pe(d);continue}const h=l.getName(a,o);if(null!==h){const t=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(h,e);c.push(new Xe(t,p.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var Xe=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Ke(e,t,n,r,s){const i=ce(t,Qe),o=$e.getCompiledRuleId(n,r,s.repository);for(const n of i)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:s,priority:n.priority})}function Qe(e,t){if(t.length<e.length)return!1;let n=0;return e.every((e=>{for(let r=n;r<t.length;r++)if(Ze(t[r],e))return n=r+1,!0;return!1}))}function Ze(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}var Je=class{constructor(e,t,n,r,s,i,o,a){if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new Fe(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Ye(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const e of Object.keys(s)){const t=ce(e,Qe);for(const n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:s[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e=e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),t=[],n=this._rootScopeName,r=e(n);if(r){const e=r.injections;if(e)for(let n in e)Ke(t,n,e[n],this,r);const s=this._grammarRepository.injections(n);s&&s.forEach((e=>{const n=this.getExternalGrammar(e);if(n){const e=n.injectionSelector;e&&Ke(t,e,n,this,n)}}))}return t.sort(((e,t)=>e.priority-t.priority)),t}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Ye(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){let s;if(-1===this._rootId&&(this._rootId=$e.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==tt.NULL)s=!1,t.reset();else{s=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=le.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),i=this.getRule(this._rootId).getName(null,null);let o;o=i?et.createRootAndLookUpScopeName(i,r,this):et.createRoot("unknown",r),t=new tt(null,this._rootId,-1,-1,!1,null,o,o)}e+="\n";const i=this.createOnigString(e),o=i.content.length,a=new rt(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=We(this,i,s,0,t,a,!0,r);return pe(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Ye(e,t){return(e=U(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var et=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,s=t?.scopePath??null;for(const t of n)s=Y.push(s,t.scopeNames),r=new e(r,s,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Y(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new Y(null,t),o=r.themeProvider.themeMatch(i),a=e.mergeAttributes(n,s,o);return new e(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let r=-1,s=0,i=0;return null!==n&&(r=n.fontStyle,s=n.foregroundId,i=n.backgroundId),le.set(e,t.languageId,t.tokenType,null,r,s,i)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const t of r)s=e._pushAttributed(s,t,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),i=t.scopePath.push(n),o=r.themeProvider.themeMatch(i),a=e.mergeAttributes(t.tokenAttributes,s,o);return new e(t,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},tt=class e{constructor(e,t,n,r,s,i,o,a){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=s,this.endRule=i,this.nameScopesList=o,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&et.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,i,o,a){return new e(this,t,n,r,s,i,o,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){const r=et.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,et.fromExtension(r,n.contentNameScopesList))}},nt=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap((e=>"*"===e?(this.allowAny=!0,[]):ce(e,Qe).map((e=>e.matcher)))),this.unbalancedBracketScopes=t.flatMap((e=>ce(e,Qe).map((e=>e.matcher))))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},rt=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const t=e?.getScopeNames()??[];for(const e of this._tokenTypeOverrides)e.matcher(t)&&(n=le.set(n,0,e.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}return r&&(n=le.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n?void(this._lastTokenEndIndex=t):(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),void(this._lastTokenEndIndex=t))}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},st=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,s){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,function(e,t,n,r,s,i,o,a){return new Je(e,t,n,r,s,i,o,a)}(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},it=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new st(J.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(J.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new nt(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,s){const i=new ge(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map((e=>this._loadSingleGrammar(e.scopeName))),i.processQueue();return this._grammarForScopeName(e,t,n,r,s)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,s=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,s)}},ot=tt.NULL;const at=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class lt{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function ct(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new lt(n,r,t)}function ut(e){return e.toLowerCase()}lt.prototype.normal={},lt.prototype.property={},lt.prototype.space=void 0;class pt{constructor(e,t){this.attribute=t,this.property=e}}pt.prototype.attribute="",pt.prototype.booleanish=!1,pt.prototype.boolean=!1,pt.prototype.commaOrSpaceSeparated=!1,pt.prototype.commaSeparated=!1,pt.prototype.defined=!1,pt.prototype.mustUseProperty=!1,pt.prototype.number=!1,pt.prototype.overloadedBoolean=!1,pt.prototype.property="",pt.prototype.spaceSeparated=!1,pt.prototype.space=void 0;let ht=0;const dt=wt(),mt=wt(),gt=wt(),ft=wt(),yt=wt(),kt=wt(),bt=wt();function wt(){return 2**++ht}var Ct={__proto__:null,boolean:dt,booleanish:mt,commaOrSpaceSeparated:bt,commaSeparated:kt,number:ft,overloadedBoolean:gt,spaceSeparated:yt};const _t=Object.keys(Ct);class St extends pt{constructor(e,t,n,r){let s=-1;if(super(e,t),vt(this,"space",r),"number"==typeof n)for(;++s<_t.length;){const e=_t[s];vt(this,_t[s],(n&Ct[e])===Ct[e])}}}function vt(e,t,n){n&&(e[t]=n)}function xt(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new St(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[ut(r)]=r,n[ut(i.attribute)]=r}return new lt(t,n,e.space)}St.prototype.defined=!0;const Nt=xt({properties:{ariaActiveDescendant:null,ariaAtomic:mt,ariaAutoComplete:null,ariaBusy:mt,ariaChecked:mt,ariaColCount:ft,ariaColIndex:ft,ariaColSpan:ft,ariaControls:yt,ariaCurrent:null,ariaDescribedBy:yt,ariaDetails:null,ariaDisabled:mt,ariaDropEffect:yt,ariaErrorMessage:null,ariaExpanded:mt,ariaFlowTo:yt,ariaGrabbed:mt,ariaHasPopup:null,ariaHidden:mt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:yt,ariaLevel:ft,ariaLive:null,ariaModal:mt,ariaMultiLine:mt,ariaMultiSelectable:mt,ariaOrientation:null,ariaOwns:yt,ariaPlaceholder:null,ariaPosInSet:ft,ariaPressed:mt,ariaReadOnly:mt,ariaRelevant:null,ariaRequired:mt,ariaRoleDescription:yt,ariaRowCount:ft,ariaRowIndex:ft,ariaRowSpan:ft,ariaSelected:mt,ariaSetSize:ft,ariaSort:null,ariaValueMax:ft,ariaValueMin:ft,ariaValueNow:ft,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function At(e,t){return t in e?e[t]:t}function jt(e,t){return At(e,t.toLowerCase())}const Et=xt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:kt,acceptCharset:yt,accessKey:yt,action:null,allow:null,allowFullScreen:dt,allowPaymentRequest:dt,allowUserMedia:dt,alt:null,as:null,async:dt,autoCapitalize:null,autoComplete:yt,autoFocus:dt,autoPlay:dt,blocking:yt,capture:null,charSet:null,checked:dt,cite:null,className:yt,cols:ft,colSpan:null,content:null,contentEditable:mt,controls:dt,controlsList:yt,coords:ft|kt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:dt,defer:dt,dir:null,dirName:null,disabled:dt,download:gt,draggable:mt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:dt,formTarget:null,headers:yt,height:ft,hidden:gt,high:ft,href:null,hrefLang:null,htmlFor:yt,httpEquiv:yt,id:null,imageSizes:null,imageSrcSet:null,inert:dt,inputMode:null,integrity:null,is:null,isMap:dt,itemId:null,itemProp:yt,itemRef:yt,itemScope:dt,itemType:yt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:dt,low:ft,manifest:null,max:null,maxLength:ft,media:null,method:null,min:null,minLength:ft,multiple:dt,muted:dt,name:null,nonce:null,noModule:dt,noValidate:dt,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:dt,optimum:ft,pattern:null,ping:yt,placeholder:null,playsInline:dt,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:dt,referrerPolicy:null,rel:yt,required:dt,reversed:dt,rows:ft,rowSpan:ft,sandbox:yt,scope:null,scoped:dt,seamless:dt,selected:dt,shadowRootClonable:dt,shadowRootDelegatesFocus:dt,shadowRootMode:null,shape:null,size:ft,sizes:null,slot:null,span:ft,spellCheck:mt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:ft,step:null,style:null,tabIndex:ft,target:null,title:null,translate:null,type:null,typeMustMatch:dt,useMap:null,value:mt,width:ft,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:yt,axis:null,background:null,bgColor:null,border:ft,borderColor:null,bottomMargin:ft,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:dt,declare:dt,event:null,face:null,frame:null,frameBorder:null,hSpace:ft,leftMargin:ft,link:null,longDesc:null,lowSrc:null,marginHeight:ft,marginWidth:ft,noResize:dt,noHref:dt,noShade:dt,noWrap:dt,object:null,profile:null,prompt:null,rev:null,rightMargin:ft,rules:null,scheme:null,scrolling:mt,standby:null,summary:null,text:null,topMargin:ft,valueType:null,version:null,vAlign:null,vLink:null,vSpace:ft,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:dt,disableRemotePlayback:dt,prefix:null,property:null,results:ft,security:null,unselectable:null},space:"html",transform:jt}),Lt=xt({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:bt,accentHeight:ft,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:ft,amplitude:ft,arabicForm:null,ascent:ft,attributeName:null,attributeType:null,azimuth:ft,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:ft,by:null,calcMode:null,capHeight:ft,className:yt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:ft,diffuseConstant:ft,direction:null,display:null,dur:null,divisor:ft,dominantBaseline:null,download:dt,dx:null,dy:null,edgeMode:null,editable:null,elevation:ft,enableBackground:null,end:null,event:null,exponent:ft,externalResourcesRequired:null,fill:null,fillOpacity:ft,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:kt,g2:kt,glyphName:kt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:ft,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:ft,horizOriginX:ft,horizOriginY:ft,id:null,ideographic:ft,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:ft,k:ft,k1:ft,k2:ft,k3:ft,k4:ft,kernelMatrix:bt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:ft,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:ft,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:ft,overlineThickness:ft,paintOrder:null,panose1:null,path:null,pathLength:ft,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:yt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:ft,pointsAtY:ft,pointsAtZ:ft,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:bt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:bt,rev:bt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:bt,requiredFeatures:bt,requiredFonts:bt,requiredFormats:bt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:ft,specularExponent:ft,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:ft,strikethroughThickness:ft,string:null,stroke:null,strokeDashArray:bt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:ft,strokeOpacity:ft,strokeWidth:null,style:null,surfaceScale:ft,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:bt,tabIndex:ft,tableValues:null,target:null,targetX:ft,targetY:ft,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:bt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:ft,underlineThickness:ft,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:ft,values:null,vAlphabetic:ft,vMathematical:ft,vectorEffect:null,vHanging:ft,vIdeographic:ft,version:null,vertAdvY:ft,vertOriginX:ft,vertOriginY:ft,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:ft,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:At}),It=xt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),Pt=xt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:jt}),Rt=xt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),Tt=/[A-Z]/g,Mt=/-[a-z]/g,$t=/^data[-\w.:]+$/i;function Ot(e){return"-"+e.toLowerCase()}function Gt(e){return e.charAt(1).toUpperCase()}const Dt=ct([Nt,Et,It,Pt,Rt],"html"),Bt=ct([Nt,Lt,It,Pt,Rt],"svg"),Ft={}.hasOwnProperty;const Ut=/["&'<>`]/g,zt=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Wt=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Ht=/[|\\{}()[\]^$+*?.]/g,qt=new WeakMap;function Vt(e,t){return e=e.replace(t.subset?function(e){let t=qt.get(e);t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Ht,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),qt.set(e,t));return t}(t.subset):Ut,n),t.subset||t.escapeOnly?e:e.replace(zt,(function(e,n,r){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)})).replace(Wt,n);function n(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}const Xt=/[\dA-Fa-f]/;const Kt=/\d/;const Qt=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Zt={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Jt=["cent","copy","divide","gt","lt","not","para","times"],Yt={}.hasOwnProperty,en={};let tn;for(tn in Zt)Yt.call(Zt,tn)&&(en[Zt[tn]]=tn);const nn=/[^\dA-Za-z]/;function rn(e,t,n){let r,s=function(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!Xt.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);if((n.useNamedReferences||n.useShortestReferences)&&(r=function(e,t,n,r){const s=String.fromCharCode(e);if(Yt.call(en,s)){const e=en[s],i="&"+e;return n&&Qt.includes(e)&&!Jt.includes(e)&&(!r||t&&61!==t&&nn.test(String.fromCharCode(t)))?i:i+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const r=function(e,t,n){const r="&#"+String(e);return n&&t&&!Kt.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);r.length<s.length&&(s=r)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function sn(e,t){return Vt(e,Object.assign({format:rn},t))}const on=/^>|^->|<!--|-->|--!>|<!-$/g,an=[">"],ln=["<",">"];function cn(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;-1!==s;)r++,s=n.indexOf(t,s+t.length);return r}function un(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}function pn(e){return e.join(" ").trim()}const hn=/[ \t\n\f\r]/g;function dn(e){return"object"==typeof e?"text"===e.type&&mn(e.value):mn(e)}function mn(e){return""===e.replace(hn,"")}const gn=kn(1),fn=kn(-1),yn=[];function kn(e){return function(t,n,r){const s=t?t.children:yn;let i=(n||0)+e,o=s[i];if(!r)for(;o&&dn(o);)i+=e,o=s[i];return o}}const bn={}.hasOwnProperty;function wn(e){return function(t,n,r){return bn.call(e,t.tagName)&&e[t.tagName](t,n,r)}}const Cn=wn({body:function(e,t,n){const r=gn(n,t);return!r||"comment"!==r.type},caption:_n,colgroup:_n,dd:function(e,t,n){const r=gn(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){const r=gn(n,t);return Boolean(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:_n,html:function(e,t,n){const r=gn(n,t);return!r||"comment"!==r.type},li:function(e,t,n){const r=gn(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){const r=gn(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){const r=gn(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){const r=gn(n,t);return r?"element"===r.type&&("address"===r.tagName||"article"===r.tagName||"aside"===r.tagName||"blockquote"===r.tagName||"details"===r.tagName||"div"===r.tagName||"dl"===r.tagName||"fieldset"===r.tagName||"figcaption"===r.tagName||"figure"===r.tagName||"footer"===r.tagName||"form"===r.tagName||"h1"===r.tagName||"h2"===r.tagName||"h3"===r.tagName||"h4"===r.tagName||"h5"===r.tagName||"h6"===r.tagName||"header"===r.tagName||"hgroup"===r.tagName||"hr"===r.tagName||"main"===r.tagName||"menu"===r.tagName||"nav"===r.tagName||"ol"===r.tagName||"p"===r.tagName||"pre"===r.tagName||"section"===r.tagName||"table"===r.tagName||"ul"===r.tagName):!n||!("element"===n.type&&("a"===n.tagName||"audio"===n.tagName||"del"===n.tagName||"ins"===n.tagName||"map"===n.tagName||"noscript"===n.tagName||"video"===n.tagName))},rp:Sn,rt:Sn,tbody:function(e,t,n){const r=gn(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:vn,tfoot:function(e,t,n){return!gn(n,t)},th:vn,thead:function(e,t,n){const r=gn(n,t);return Boolean(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){const r=gn(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function _n(e,t,n){const r=gn(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&dn(r.value.charAt(0)))}function Sn(e,t,n){const r=gn(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function vn(e,t,n){const r=gn(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}const xn=wn({body:function(e){const t=gn(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&dn(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,n){const r=fn(n,t),s=gn(e,-1,!0);if(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&Cn(r,n.children.indexOf(r),n))return!1;return Boolean(s&&"element"===s.type&&"col"===s.tagName)},head:function(e){const t=new Set;for(const n of e.children)if("element"===n.type&&("base"===n.tagName||"title"===n.tagName)){if(t.has(n.tagName))return!1;t.add(n.tagName)}const n=e.children[0];return!n||"element"===n.type},html:function(e){const t=gn(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const r=fn(n,t),s=gn(e,-1);if(n&&r&&"element"===r.type&&("thead"===r.tagName||"tbody"===r.tagName)&&Cn(r,n.children.indexOf(r),n))return!1;return Boolean(s&&"element"===s.type&&"tr"===s.tagName)}});const Nn={name:[["\t\n\f\r &/=>".split(""),"\t\n\f\r \"&'/=>`".split("")],["\0\t\n\f\r \"&'/<=>".split(""),"\0\t\n\f\r \"&'/<=>`".split("")]],unquoted:[["\t\n\f\r &>".split(""),"\0\t\n\f\r \"&'<=>`".split("")],["\0\t\n\f\r \"&'<=>`".split(""),"\0\t\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function An(e,t,n){const r=function(e,t){const n=ut(t);let r=t,s=pt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&$t.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Mt,Gt);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Mt.test(e)){let n=e.replace(Tt,Ot);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}s=St}return new s(r,t)}(e.schema,t),s=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,i=e.settings.allowDangerousCharacters?0:1;let o,a=e.quote;if(!r.overloadedBoolean||n!==r.attribute&&""!==n?!r.boolean&&!r.overloadedBoolean||"string"==typeof n&&n!==r.attribute&&""!==n||(n=Boolean(n)):n=!0,null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";const l=sn(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Nn.name[s][i]}));return!0===n?l:(n=Array.isArray(n)?(r.commaSeparated?un:pn)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?l:(e.settings.preferUnquoted&&(o=sn(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Nn.unquoted[s][i]}))),o!==n&&(e.settings.quoteSmart&&cn(n,a)>cn(n,e.alternative)&&(a=e.alternative),o=a+sn(n,Object.assign({},e.settings.characterReferences,{subset:("'"===a?Nn.single:Nn.double)[s][i],attribute:!0}))+a),l+(o?"="+o:o)))}const jn=["<","&"];function En(e,t,n,r){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?sn(e.value,Object.assign({},r.settings.characterReferences,{subset:jn})):e.value}const Ln=function(e,t){const n=t||{};function r(t,...n){let s=r.invalid;const i=r.handlers;if(t&&Ft.call(t,e)){const n=String(t[e]);s=Ft.call(i,n)?i[n]:r.unknown}if(s)return s.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,r){return r.settings.bogusComments?"<?"+sn(e.value,Object.assign({},r.settings.characterReferences,{subset:an}))+">":"\x3c!--"+e.value.replace(on,(function(e){return sn(e,Object.assign({},r.settings.characterReferences,{subset:ln}))}))+"--\x3e"},doctype:function(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,r){const s=r.schema,i="svg"!==s.space&&r.settings.omitOptionalTags;let o="svg"===s.space?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;"html"===s.space&&"svg"===e.tagName&&(r.schema=Bt);const c=function(e,t){const n=[];let r,s=-1;if(t)for(r in t)if(null!==t[r]&&void 0!==t[r]){const s=An(e,r,t[r]);s&&n.push(s)}for(;++s<n.length;){const t=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&'"'!==t&&"'"!==t&&(n[s]+=" ")}return n.join("")}(r,e.properties),u=r.all("html"===s.space&&"template"===e.tagName?e.content:e);return r.schema=s,u&&(o=!1),!c&&i&&xn(e,t,n)||(a.push("<",e.tagName,c?" "+c:""),o&&("svg"===s.space||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||"/"===l||l&&'"'!==l&&"'"!==l)&&a.push(" "),a.push("/")),a.push(">")),a.push(u),o||i&&Cn(e,t,n)||a.push("</"+e.tagName+">"),a.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:En(e,0,n,r)},root:function(e,t,n,r){return r.all(e)},text:En}});const In={},Pn={},Rn=[];function Tn(e,t,n){return Ln(e,t,n,this)}function Mn(e){const t=[],n=e&&e.children||Rn;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function $n(e,t){const n="string"==typeof e?{}:{...e.colorReplacements},r="string"==typeof e?e:e.name;for(const[e,s]of Object.entries(t?.colorReplacements||{}))"string"==typeof s?n[e]=s:e===r&&Object.assign(n,s);return n}function On(e,t){return e&&t?.[e?.toLowerCase()]||e}async function Gn(e){return Promise.resolve("function"==typeof e?e():e).then((e=>e.default||e))}function Dn(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Bn(e){return"ansi"===e||Dn(e)}function Fn(e){return"none"===e}function Un(e){return Fn(e)}function zn(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function Wn(e,t=!1){const n=e.split(/(\r?\n)/g);let r=0;const s=[];for(let e=0;e<n.length;e+=2){const i=t?n[e]+(n[e+1]||""):n[e];s.push([i,r]),r+=n[e].length,r+=n[e+1]?.length||0}return s}const Hn="light-dark()",qn=["color","background-color"];function Vn(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&re.Italic&&(t["font-style"]="italic"),e.fontStyle&re.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&re.Underline&&n.push("underline"),e.fontStyle&re.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function Xn(e){return"string"==typeof e?e:Object.entries(e).map((([e,t])=>`${e}:${t}`)).join(";")}const Kn=new WeakMap;function Qn(e,t){Kn.set(e,t)}function Zn(e){return Kn.get(e)}class Jn{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new Jn(Object.fromEntries(function(e){return Array.isArray(e)?e:[e]}(t).map((e=>[e,ot]))),e)}constructor(...e){if(2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return function(e){const t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);const s=e?.nameScopesList?.scopeName;s&&t.push(s),e.parent&&r(e.parent)}return r(e),t}(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Yn(){const e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new F(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...r.indexToPos(e),offset:e}}{const t=r.lines[e.line];if(void 0===t)throw new F(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);if(e.character<0||e.character>t.length)throw new F(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,offset:r.posToIndex(e.line,e.character)}}};const r=function(e){const t=Wn(e,!0).map((([e])=>e));return{lines:t,indexToPos:function(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=n,s=0;for(const e of t){if(r<e.length)break;r-=e.length,s++}return{line:s,character:r}},posToIndex:function(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}}}(t.source),s=(t.options.decorations||[]).map((e=>({...e,start:n(e.start),end:n(e.end)})));!function(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new F(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const t=e[r],s=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,i=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,a=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(s||i||o||a){if(s&&i)continue;if(o&&a)continue;throw new F(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}(s),e.set(t.meta,{decorations:s,converter:r,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){if(!this.options.decorations?.length)return;const n=t(this).decorations.flatMap((e=>[e.start.offset,e.end.offset])),r=function(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort(((e,t)=>e-t));return n.length?e.map((e=>e.flatMap((e=>{const t=n.filter((t=>e.offset<t&&t<e.offset+e.content.length)).map((t=>t-e.offset)).sort(((e,t)=>e-t));return t.length?function(e,t){let n=0;const r=[];for(const s of t)s>n&&r.push({...e,content:e.content.slice(n,s),offset:e.offset+n}),n=s;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}(e,t):e})))):e}(e,n);return r},code(e){if(!this.options.decorations?.length)return;const n=t(this),r=Array.from(e.children).filter((e=>"element"===e.type&&"span"===e.tagName));if(r.length!==n.converter.lines.length)throw new F(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function s(e,t,n,s){const i=r[e];let a="",l=-1,c=-1;if(0===t&&(l=0),0===n&&(c=0),n===Number.POSITIVE_INFINITY&&(c=i.children.length),-1===l||-1===c)for(let e=0;e<i.children.length;e++)a+=er(i.children[e]),-1===l&&a.length===t&&(l=e+1),-1===c&&a.length===n&&(c=e+1);if(-1===l)throw new F(`Failed to find start index for decoration ${JSON.stringify(s.start)}`);if(-1===c)throw new F(`Failed to find end index for decoration ${JSON.stringify(s.end)}`);const u=i.children.slice(l,c);if(s.alwaysWrap||u.length!==i.children.length)if(s.alwaysWrap||1!==u.length||"element"!==u[0].type){const e={type:"element",tagName:"span",properties:{},children:u};o(e,s,"wrapper"),i.children.splice(l,u.length,e)}else o(u[0],s,"token");else o(i,s,"line")}function i(e,t){r[e]=o(r[e],t,"line")}function o(e,t,n){const r=t.properties||{},s=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&zn(e,t.properties.class),e=s(e,n)||e}const a=[],l=n.decorations.sort(((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset));for(const e of l){const{start:t,end:n}=e;if(t.line===n.line)s(t.line,t.character,n.character,e);else if(t.line<n.line){s(t.line,t.character,Number.POSITIVE_INFINITY,e);for(let r=t.line+1;r<n.line;r++)a.unshift((()=>i(r,e)));s(n.line,0,n.character,e)}}a.forEach((e=>e()))}}}function er(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(er).join(""):""}const tr=[Yn()];function nr(e){return[...e.transformers||[],...tr]}var rr=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],sr={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function ir(e,t){const n=e.indexOf("",t);if(-1!==n&&"["===e[n+1]){const t=e.indexOf("m",n);if(-1!==t)return{sequence:e.substring(n+2,t).split(";"),startPosition:n,position:t+1}}return{position:e.length}}function or(e){const t=e.shift();if("2"===t){const t=e.splice(0,3).map((e=>Number.parseInt(e)));if(3!==t.length||t.some((e=>Number.isNaN(e))))return;return{type:"rgb",rgb:t}}if("5"===t){const t=e.shift();if(t)return{type:"table",index:Number(t)}}}function ar(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(0===r)t.push({type:"resetAll"});else if(r<=9){sr[r]&&t.push({type:"setDecoration",value:sr[r]})}else if(r<=29){const e=sr[r-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:rr[r-30]}});else if(38===r){const n=or(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===r)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:rr[r-40]}});else if(48===r){const n=or(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===r?t.push({type:"resetBackgroundColor"}):53===r?t.push({type:"setDecoration",value:"overline"}):55===r?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:rr[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:rr[r-100+8]}})}return t}var lr={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function cr(e=lr){function t(t){return e[t]}function n(e){return`#${e.map((e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0"))).join("")}`}let r;function s(e){return function(){if(r)return r;r=[];for(let e=0;e<rr.length;e++)r.push(t(rr[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let s=0;s<6;s++)for(let i=0;i<6;i++)r.push(n([e[t],e[s],e[i]]));let s=8;for(let e=0;e<24;e++,s+=10)r.push(n([s,s,s]));return r}()[e]}return{value:function(e){switch(e.type){case"named":return t(e.name);case"rgb":return n(e.rgb);case"table":return s(e.index)}}}}function ur(e,t,n){const r=$n(e,n),s=Wn(t),i=cr(Object.fromEntries(rr.map((t=>[t,e.colors?.[`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`]])))),o=function(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let i=0;do{const o=ir(r,i),a=o.sequence?r.substring(i,o.startPosition):r.substring(i);if(a.length>0&&s.push({value:a,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const r=ar(o.sequence);for(const s of r)"resetAll"===s.type?(e=null,t=null,n.clear()):"resetForegroundColor"===s.type?e=null:"resetBackgroundColor"===s.type?t=null:"resetDecoration"===s.type&&n.delete(s.value);for(const s of r)"setForegroundColor"===s.type?e=s.value:"setBackgroundColor"===s.type?t=s.value:"setDecoration"===s.type&&n.add(s.value)}i=o.position}while(i<r.length);return s}}}();return s.map((t=>o.parse(t[0]).map((n=>{let s,o;n.decorations.has("reverse")?(s=n.background?i.value(n.background):e.bg,o=n.foreground?i.value(n.foreground):e.fg):(s=n.foreground?i.value(n.foreground):e.fg,o=n.background?i.value(n.background):void 0),s=On(s,r),o=On(o,r),n.decorations.has("dim")&&(s=function(e){const t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(t){if(t[3]){const e=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,"0");return`#${t[1]}${t[2]}${e}`}return t[2]?`#${t[1]}${t[2]}80`:`#${Array.from(t[1]).map((e=>`${e}${e}`)).join("")}80`}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}(s));let a=re.None;return n.decorations.has("bold")&&(a|=re.Bold),n.decorations.has("italic")&&(a|=re.Italic),n.decorations.has("underline")&&(a|=re.Underline),n.decorations.has("strikethrough")&&(a|=re.Strikethrough),{content:n.value,offset:t[1],color:s,bgColor:o,fontStyle:a}}))))}function pr(e,t,n={}){const{lang:r="text",theme:s=e.getLoadedThemes()[0]}=n;if(Dn(r)||Fn(s))return Wn(t).map((e=>[{content:e[0],offset:e[1]}]));const{theme:i,colorMap:o}=e.setTheme(s);if("ansi"===r)return ur(i,t,n);const a=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new F(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new F(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return function(e,t,n,r,s){const i=hr(e,t,n,r,s),o=new Jn(hr(e,t,n,r,s).stateStack,t.name,n.name);return Qn(i.tokens,o),i.tokens}(t,a,i,o,n)}function hr(e,t,n,r,s){const i=$n(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=s,l=Wn(e);let c=s.grammarState?function(e,t){if(!(e instanceof Jn))throw new F("Invalid grammar state");return e.getInternalStack(t)}(s.grammarState,n.name)??ot:null!=s.grammarContextCode?hr(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:ot,u=[];const p=[];for(let e=0,d=l.length;e<d;e++){const[d,m]=l[e];if(""===d){u=[],p.push([]);continue}if(o>0&&d.length>=o){u=[],p.push([{content:d,offset:m,color:"",fontStyle:0}]);continue}let g,f,y;s.includeExplanation&&(g=t.tokenizeLine(d,c,a),f=g.tokens,y=0);const k=t.tokenizeLine2(d,c,a),b=k.tokens.length/2;for(let e=0;e<b;e++){const t=k.tokens[2*e],o=e+1<b?k.tokens[2*e+2]:d.length;if(t===o)continue;const a=k.tokens[2*e+1],l=On(r[le.getForeground(a)],i),c=le.getFontStyle(a),p={content:d.substring(t,o),offset:m+t,color:l,fontStyle:c};if(s.includeExplanation){const e=[];if("scopeName"!==s.includeExplanation)for(const t of n.settings){let n;switch(typeof t.scope){case"string":n=t.scope.split(/,/).map((e=>e.trim()));break;case"object":n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map((e=>e.split(/ /)))})}p.explanation=[];let r=0;for(;t+r<o;){const t=f[y],n=d.substring(t.startIndex,t.endIndex);r+=n.length,p.explanation.push({content:n,scopes:"scopeName"===s.includeExplanation?(h=t.scopes,h.map((e=>({scopeName:e})))):dr(e,t.scopes)}),y+=1}}u.push(p)}p.push(u),u=[],c=k.ruleStack}var h;return{tokens:p,stateStack:c}}function dr(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const s=t[r];n[r]={scopeName:s,themeMatches:fr(e,s,t.slice(0,r))}}return n}function mr(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function gr(e,t,n){if(!mr(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)mr(e[r],n[s])&&(r-=1),s-=1;return-1===r}function fr(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const e of s)if(gr(e,t,n)){r.push(i);break}return r}function yr(e,t,n){const r=Object.entries(n.themes).filter((e=>e[1])).map((e=>({color:e[0],theme:e[1]}))),s=r.map((r=>{const s=pr(e,t,{...n,theme:r.theme});return{tokens:s,state:Zn(s),theme:"string"==typeof r.theme?r.theme:r.theme.name}})),i=function(...e){const t=e.map((()=>[])),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map((e=>e[r])),i=t.map((()=>[]));t.forEach(((e,t)=>e.push(i[t])));const o=s.map((()=>0)),a=s.map((e=>e[0]));for(;a.every((e=>e));){const e=Math.min(...a.map((e=>e.content.length)));for(let t=0;t<n;t++){const n=a[t];n.content.length===e?(i[t].push(n),o[t]+=1,a[t]=s[t][o[t]]):(i[t].push({...n,content:n.content.slice(0,e)}),a[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...s.map((e=>e.tokens))),o=i[0].map(((e,t)=>e.map(((e,s)=>{const o={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(o.explanation=e.explanation),i.forEach(((e,n)=>{const{content:i,explanation:a,offset:l,...c}=e[t][s];o.variants[r[n].color]=c})),o})))),a=s[0].state?new Jn(Object.fromEntries(s.map((e=>[e.theme,e.state?.getInternalStack(e.theme)]))),s[0].state.lang):void 0;return a&&Qn(o,a),o}function kr(e,t,n){let r,s,i,o,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:p="css-vars"}=n,h=Object.entries(n.themes).filter((e=>e[1])).map((e=>({color:e[0],theme:e[1]}))).sort(((e,t)=>e.color===c?-1:t.color===c?1:0));if(0===h.length)throw new F("`themes` option must not be empty");const d=yr(e,t,n);if(l=Zn(d),c&&Hn!==c&&!h.find((e=>e.color===c)))throw new F(`\`themes\` option must contain the defaultColor key \`${c}\``);const m=h.map((t=>e.getTheme(t.theme))),g=h.map((e=>e.color));i=d.map((e=>e.map((e=>function(e,t,n,r,s="css-vars"){const i={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map((t=>Vn(e.variants[t]))),a=new Set(o.flatMap((e=>Object.keys(e)))),l={},c=(e,r)=>{const s="color"===r?"":"background-color"===r?"-bg":`-${r}`;return n+t[e]+("color"===r?"":s)};return o.forEach(((e,n)=>{for(const i of a){const a=e[i]||"inherit";if(0===n&&r&&qn.includes(i))if(r===Hn&&o.length>1){const e=t.findIndex((e=>"light"===e)),r=t.findIndex((e=>"dark"===e));if(-1===e||-1===r)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const u=o[e][i]||"inherit",p=o[r][i]||"inherit";l[i]=`light-dark(${u}, ${p})`,"css-vars"===s&&(l[c(n,i)]=a)}else l[i]=a;else"css-vars"===s&&(l[c(n,i)]=a)}})),i.htmlStyle=l,i}(e,g,u,c,p))))),l&&Qn(i,l);const f=h.map((e=>$n(e.theme,n)));s=br(h,m,f,u,c,"fg",p),r=br(h,m,f,u,c,"bg",p),o=`shiki-themes ${m.map((e=>e.name)).join(" ")}`,a=c?void 0:[s,r].join(";")}else{if(!("theme"in n))throw new F("Invalid options, either `theme` or `themes` must be provided");{const a=$n(n.theme,n);i=pr(e,t,n);const c=e.getTheme(n.theme);r=On(c.bg,a),s=On(c.fg,a),o=c.name,l=Zn(i)}}return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:a,grammarState:l}}function br(e,t,n,r,s,i,o){return e.map(((a,l)=>{const c=On(t[l][i],n[l])||"inherit",u=`${r+a.color}${"bg"===i?"-bg":""}:${c}`;if(0===l&&s){if(s===Hn&&e.length>1){const r=e.findIndex((e=>"light"===e.color)),s=e.findIndex((e=>"dark"===e.color));if(-1===r||-1===s)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${On(t[r][i],n[r])||"inherit"}, ${On(t[s][i],n[s])||"inherit"});${u}`}return c}return"css-vars"===o?u:null})).filter((e=>!!e)).join(";")}function wr(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>wr(e,t,n),codeToTokens:(t,n)=>kr(e,t,n)}){let s=t;for(const e of nr(n))s=e.preprocess?.call(r,s,n)||s;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:c,grammarState:u}=kr(e,s,n);const{mergeWhitespaces:p=!0,mergeSameStyleTokens:h=!1}=n;!0===p?i=function(e){return e.map((e=>{const t=[];let n="",r=0;return e.forEach(((s,i)=>{const o=!(s.fontStyle&&(s.fontStyle&re.Underline||s.fontStyle&re.Strikethrough));o&&s.content.match(/^\s+$/)&&e[i+1]?(r||(r=s.offset),n+=s.content):n?(o?t.push({...s,offset:r,content:n+s.content}):t.push({content:n,offset:r},s),r=0,n=""):t.push(s)})),t}))}(i):"never"===p&&(i=function(e){return e.map((e=>e.flatMap((e=>{if(e.content.match(/^\s+$/))return e;const t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;const[,n,r,s]=t;if(!n&&!s)return e;const i=[{...e,offset:e.offset+n.length,content:r}];return n&&i.unshift({content:n,offset:e.offset}),s&&i.push({content:s,offset:e.offset+n.length+r.length}),i}))))}(i)),h&&(i=function(e){return e.map((e=>{const t=[];for(const n of e){if(0===t.length){t.push({...n});continue}const e=t[t.length-1],r=Xn(e.htmlStyle||Vn(e)),s=Xn(n.htmlStyle||Vn(n)),i=e.fontStyle&&(e.fontStyle&re.Underline||e.fontStyle&re.Strikethrough),o=n.fontStyle&&(n.fontStyle&re.Underline||n.fontStyle&re.Strikethrough);i||o||r!==s?t.push({...n}):e.content+=n.content}return t}))}(i));const d={...r,get source(){return s}};for(const e of nr(n))i=e.tokens?.call(d,i)||i;return function(e,t,n,r=Zn(e)){const s=nr(t),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=t;let c={type:"element",tagName:"pre",properties:{class:`shiki ${t.themeName||""}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...!1!==l&&null!=l?{tabindex:l.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter((([e])=>!e.startsWith("_"))))},children:[]},u={type:"element",tagName:"code",properties:{},children:i};const p=[],h={...n,structure:a,addClassToHast:zn,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return u},get lines(){return p}};if(e.forEach(((e,t)=>{t&&("inline"===a?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===a&&i.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},r=0;for(const i of e){let e={type:"element",tagName:"span",properties:{...i.htmlAttrs},children:[{type:"text",value:i.content}]};const l=Xn(i.htmlStyle||Vn(i));l&&(e.properties.style=l);for(const o of s)e=o?.span?.call(h,e,t+1,r,n,i)||e;"inline"===a?o.children.push(e):"classic"===a&&n.children.push(e),r+=i.content.length}if("classic"===a){for(const e of s)n=e?.line?.call(h,n,t+1)||n;p.push(n),i.push(n)}})),"classic"===a){for(const e of s)u=e?.code?.call(h,u)||u;c.children.push(u);for(const e of s)c=e?.pre?.call(h,c)||c;o.children.push(c)}let d=o;for(const e of s)d=e?.root?.call(h,d)||d;r&&Qn(d,r);return d}(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},d,u)}const Cr=function(e,t){const n=t||In,r=n.quote||'"',s='"'===r?"'":'"';if('"'!==r&&"'"!==r)throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Tn,all:Mn,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||at,characterReferences:n.characterReferences||Pn,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?Bt:Dt,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)};const _r={light:"#333333",dark:"#bbbbbb"},Sr={light:"#fffffe",dark:"#1e1e1e"},vr="__shiki_resolved";function xr(e){if(e?.[vr])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){const e=t.settings?t.settings.find((e=>!e.name&&!e.scope)):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r="light"===t.type?_r.light:_r.dark),n||(n="light"===t.type?Sr.light:Sr.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0;const i=new Map;function o(e){if(i.has(e))return i.get(e);s+=1;const n=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(i.set(e,n),n)}t.settings=t.settings.map((e=>{const n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),r=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!r)return e;const s={...e,settings:{...e.settings}};if(n){const n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,s.settings.foreground=n}if(r){const n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,s.settings.background=n}return s}));for(const e of Object.keys(t.colors||{}))if(("editor.foreground"===e||"editor.background"===e||e.startsWith("terminal.ansi"))&&!t.colors[e]?.startsWith("#")){const n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,vr,{enumerable:!1,writable:!1,value:!0}),t}class Nr extends Error{constructor(e){super(e),this.name="ShikiError"}}class Ar extends it{constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map((e=>this.loadTheme(e))),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=xr(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=J.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){if(this._alias[e]){const t=new Set([e]);for(;this._alias[e];){if(e=this._alias[e],t.has(e))throw new Nr(`Circular alias \`${Array.from(t).join(" -> ")} -> ${e}\``);t.add(e)}}return this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter((t=>t.embeddedLangsLazy?.includes(e.name))));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach((t=>{this._alias[t]=e.name})),this._loadedLanguagesCache=null,t.size)for(const e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const t of e)this.resolveEmbeddedLanguages(t);const t=Array.from(this._langGraph.entries()),n=t.filter((([e,t])=>!t));if(n.length){const e=t.filter((([e,t])=>t&&t.embeddedLangs?.some((e=>n.map((([e])=>e)).includes(e))))).filter((e=>!n.includes(e)));throw new Nr(`Missing languages ${n.map((([e])=>`\`${e}\``)).join(", ")}, required by ${e.map((([e])=>`\`${e}\``)).join(", ")}`)}for(const[e,n]of t)this._resolver.addLanguage(n);for(const[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){if(this._langMap.set(e.name,e),this._langGraph.set(e.name,e),e.embeddedLangs)for(const t of e.embeddedLangs)this._langGraph.set(t,this._langMap.get(t))}}class jr{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach((e=>this.addLanguage(e)))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach((t=>{this._langs.set(t,e)})),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach((t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)}))}getInjections(e){const t=e.split(".");let n=[];for(let e=1;e<=t.length;e++){const r=t.slice(0,e).join(".");n=[...n,...this._injections.get(r)||[]]}return n}}let Er=0;function Lr(e){Er+=1,!1!==e.warnings&&Er>=10&&Er%10==0&&console.warn(`[Shiki] ${Er} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Nr("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(xr),s=new jr(e.engine,n),i=new Ar(s,r,n,e.langAlias);let o;function a(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();const t=i.getTheme(e);if(!t)throw new Nr(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(...e){u(),i.loadLanguages(e.flat(1))}function c(...e){u();for(const t of e.flat(1))i.loadTheme(t)}function u(){if(t)throw new Nr("Shiki instance has been disposed")}function p(){t||(t=!0,i.dispose(),Er-=1)}return{setTheme:function(e){u();const t=a(e);return o!==e&&(i.setTheme(t),o=e),{theme:t,colorMap:i.getColorMap()}},getTheme:a,getLanguage:function(e){u();const t=i.getGrammar("string"==typeof e?e:e.name);if(!t)throw new Nr(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),i.getLoadedThemes()},getLoadedLanguages:function(){return u(),i.getLoadedLanguages()},loadLanguage:async function(...e){return l(await async function(e){return Array.from(new Set((await Promise.all(e.filter((e=>!Bn(e))).map((async e=>await Gn(e).then((e=>Array.isArray(e)?e:[e])))))).flat()))}(e))},loadLanguageSync:l,loadTheme:async function(...e){return u(),c(await async function(e){return(await Promise.all(e.map((async e=>Un(e)?null:xr(await Gn(e)))))).filter((e=>!!e))}(e))},loadThemeSync:c,dispose:p,[Symbol.dispose]:p}}function Ir(e){if(1!==[...e].length)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}const Pr=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),Rr=String.raw;function Tr(e,t){if(null==e)throw new Error(t??"Value expected");return e}const Mr=Rr`\[\^?`,$r=`c.? | C(?:-.?)?|${Rr`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Rr`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Rr`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Rr`o\{[^\}]*\}?`}|${Rr`\d{1,3}`}`,Or=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Gr=new RegExp(Rr`
|
|
9
|
+
import{$isCodeNode as e,$createCodeHighlightNode as t,CodeExtension as n,DEFAULT_CODE_LANGUAGE as r,CodeNode as s,CodeHighlightNode as i,$isCodeHighlightNode as o,$getFirstCodeNodeOfLine as a,$getLastCodeNodeOfLine as l,$getStartOfCodeInLine as c,$getEndOfCodeInLine as u}from"@lexical/code";import{mergeRegister as p}from"@lexical/utils";import{$getNodeByKey as h,$createLineBreakNode as d,$createTabNode as m,defineExtension as g,TextNode as f,KEY_TAB_COMMAND as y,COMMAND_PRIORITY_LOW as k,INSERT_TAB_COMMAND as b,$getSelection as w,$insertNodes as C,INDENT_CONTENT_COMMAND as _,OUTDENT_CONTENT_COMMAND as S,KEY_ARROW_UP_COMMAND as v,$isRangeSelection as x,KEY_ARROW_DOWN_COMMAND as N,MOVE_TO_START as A,MOVE_TO_END as j,$isLineBreakNode as E,$createTextNode as L,$createPoint as I,$setSelectionFromCaretRange as P,$getCaretRangeInDirection as R,$getCaretRange as T,$getTextPointCaret as M,$normalizeCaret as $,$getSiblingCaret as O,$isTabNode as G,$isTextNode as D}from"lexical";function B(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let F=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function U(e){return Array.isArray(e)?function(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=U(e[n]);return t}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let t={};for(let n in e)t[n]=U(e[n]);return t}(e):e}function z(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function W(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t===e.length-1?W(e.substring(0,e.length-1)):e.substr(1+~t)}var H=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,q=class{static hasCaptures(e){return null!==e&&(H.lastIndex=0,H.test(e))}static replaceCaptures(e,t,n){return e.replace(H,(e,r,s,i)=>{let o=n[parseInt(r||s,10)];if(!o)return e;{let e=t.substring(o.start,o.end);for(;"."===e[0];)e=e.substring(1);switch(i){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function V(e,t){return e<t?-1:e>t?1:0}function X(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=V(e[r],t[r]);if(0!==n)return n}return 0}return n-r}function K(e){return!!/^#[0-9a-f]{6}$/i.test(e)||(!!/^#[0-9a-f]{8}$/i.test(e)||(!!/^#[0-9a-f]{3}$/i.test(e)||!!/^#[0-9a-f]{4}$/i.test(e)))}function Q(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Z=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},J=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,s=t.length;e<s;e++){let s,i=t[e];if(!i.settings)continue;if("string"==typeof i.scope){let e=i.scope;e=e.replace(/^[,]+/,""),e=e.replace(/[,]+$/,""),s=e.split(",")}else s=Array.isArray(i.scope)?i.scope:[""];let o=-1;if("string"==typeof i.settings.fontStyle){o=0;let e=i.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++){switch(e[t]){case"italic":o|=1;break;case"bold":o|=2;break;case"underline":o|=4;break;case"strikethrough":o|=8}}}let a=null;"string"==typeof i.settings.foreground&&K(i.settings.foreground)&&(a=i.settings.foreground);let l=null;"string"==typeof i.settings.background&&K(i.settings.background)&&(l=i.settings.background);for(let t=0,i=s.length;t<i;t++){let i=s[t].trim().split(" "),c=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new ne(c,u,e,o,a,l)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{let n=V(e.scope,t.scope);return 0!==n?n:(n=X(e.parentScopes,t.parentScopes),0!==n?n:e.index-t.index)});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(r=t.foreground),null!==t.background&&(s=t.background)}let i=new se(t),o=new te(n,i.getId(r),i.getId(s)),a=new ae(new oe(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];a.insert(0,n.scope,n.parentScopes,n.fontStyle,i.getId(n.foreground),i.getId(n.background))}return new J(i,o,a)}(e,t)}_cachedMatchRoot=new Z(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>function(e,t){if(0===t.length)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(">"===r){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!ee(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}(e.parent,t.parentScopes));return n?new te(n.fontStyle,n.foreground,n.background):null}},Y=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(const r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function ee(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var te=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};var ne=class{constructor(e,t,n,r,s,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=i}},re=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(re||{});var se=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},ie=Object.freeze([]),oe=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,s){this.scopeDepth=e,this.parentScopes=t||ie,this.fontStyle=n,this.foreground=r,this.background=s}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==r&&(this.background=r)}},ae=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[r]&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){const s=t.parentScopes[r].length-e.parentScopes[n].length;if(0!==s)return s;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,r=t.indexOf(".");if(-1===r?(e=t,n=""):(e=t.substring(0,r),n=t.substring(r+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,s,i,o){if(""===n)return void this._doInsertHere(t,r,s,i,o);let a,l,c,u=n.indexOf(".");-1===u?(a=n,l=""):(a=n.substring(0,u),l=n.substring(u+1)),this._children.hasOwnProperty(a)?c=this._children[a]:(c=new e(this._mainRule.clone(),oe.cloneArr(this._rulesWithParentScopes)),this._children[a]=c),c.insert(t+1,l,r,s,i,o)}_doInsertHere(e,t,n,r,s){if(null!==t){for(let i=0,o=this._rulesWithParentScopes.length;i<o;i++){let o=this._rulesWithParentScopes[i];if(0===X(o.parentScopes,t))return void o.acceptOverwrite(e,n,r,s)}-1===n&&(n=this._mainRule.fontStyle),0===r&&(r=this._mainRule.foreground),0===s&&(s=this._mainRule.background),this._rulesWithParentScopes.push(new oe(e,t,n,r,s))}else this._mainRule.acceptOverwrite(e,n,r,s)}},le=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){const n=e.getLanguageId(t),r=e.getTokenType(t),s=e.getFontStyle(t),i=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:i,background:o})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,r,s,i,o,a){let l=e.getLanguageId(t),c=e.getTokenType(t),u=e.containsBalancedBrackets(t)?1:0,p=e.getFontStyle(t),h=e.getForeground(t),d=e.getBackground(t);return 0!==n&&(l=n),8!==r&&(c=r),null!==s&&(u=s?1:0),-1!==i&&(p=i),0!==o&&(h=o),0!==a&&(d=a),(l|c<<8|u<<10|p<<11|h<<15|d<<24)>>>0}};function ce(e){return e}function ue(e,t){const n=[],r=function(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}(e);let s=r.next();for(;null!==s;){let e=0;if(2===s.length&&":"===s.charAt(1)){switch(s.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let t=o();if(n.push({matcher:t,priority:e}),","!==s)break;s=r.next()}return n;function i(){if("-"===s){s=r.next();const e=i();return t=>!!e&&!e(t)}if("("===s){s=r.next();const e=function(){const e=[];let t=o();for(;t&&(e.push(t),"|"===s||","===s);){do{s=r.next()}while("|"===s||","===s);t=o()}return t=>e.some(e=>e(t))}();return")"===s&&(s=r.next()),e}if(pe(s)){const e=[];do{e.push(s),s=r.next()}while(pe(s));return n=>t(e,n)}return null}function o(){const e=[];let t=i();for(;t;)e.push(t),t=i();return t=>e.every(e=>e(t))}}function pe(e){return!!e&&!!e.match(/[\w\.:]+/)}function he(e){"function"==typeof e.dispose&&e.dispose()}var de=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},me=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},ge=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},fe=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new de(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new ge;for(const n of e)ye(n,this.initialScopeName,this.repo,t);for(const e of t.references)if(e instanceof de){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName))continue;if(this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function ye(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const i=n.lookup(t);e instanceof de?be({baseGrammar:i,selfGrammar:s},r):ke(e.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);const o=n.injections(e.scopeName);if(o)for(const e of o)r.add(new de(e))}function ke(e,t,n){if(t.repository&&t.repository[e]){we([t.repository[e]],t,n)}}function be(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&we(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&we(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function we(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const e=r.repository?z({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&we(r.patterns,{...t,repository:e},n);const s=r.include;if(!s)continue;const i=Ne(s);switch(i.kind){case 0:be({...t,selfGrammar:t.baseGrammar},n);break;case 1:be(t,n);break;case 2:ke(i.ruleName,{...t,repository:e},n);break;case 3:case 4:const r=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){const s={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};4===i.kind?ke(i.ruleName,s,n):be(s,n)}else 4===i.kind?n.add(new me(i.scopeName,i.ruleName)):n.add(new de(i.scopeName))}}}var Ce=class{kind=0},_e=class{kind=1},Se=class{constructor(e){this.ruleName=e}kind=2},ve=class{constructor(e){this.scopeName=e}kind=3},xe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Ne(e){if("$base"===e)return new Ce;if("$self"===e)return new _e;const t=e.indexOf("#");if(-1===t)return new ve(e);if(0===t)return new Se(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new xe(n,r)}}var Ae=/\\(\d+)/,je=/\\(\d+)/g;var Ee=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=q.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=q.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${W(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?q.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?q.replaceCaptures(this._contentName,e,t):this._contentName}},Le=class extends Ee{retokenizeCapturedWithRuleId;constructor(e,t,n,r,s){super(e,t,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},Ie=class extends Ee{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new $e(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Oe,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Pe=class extends Ee{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns){e.getRule(n).collectPatterns(e,t)}}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Oe,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Re=class extends Ee{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s,i,o,a,l,c){super(e,t,n,r),this._begin=new $e(s,this.id),this.beginCaptures=i,this._end=new $e(o||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Oe;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Te=class extends Ee{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,s,i,o,a,l){super(e,t,n,r),this._begin=new $e(s,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new $e(o,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Oe;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Oe,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},Me=class e{static createCaptureRule(e,t,n,r,s){return e.registerRule(e=>new Le(t,e,n,r,s))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new Ie(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(void 0===t.begin){t.repository&&(r=z({},r,t.repository));let s=t.patterns;return void 0===s&&t.include&&(s=[{include:t.include}]),new Pe(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(s,n,r))}return t.while?new Te(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Re(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let i=0;for(const e in t){if("$vscodeTextmateLocation"===e)continue;const t=parseInt(e,10);t>i&&(i=t)}for(let e=0;e<=i;e++)s[e]=null;for(const i in t){if("$vscodeTextmateLocation"===i)continue;const o=parseInt(i,10);let a=0;t[i].patterns&&(a=e.getCompiledRuleId(t[i],n,r)),s[o]=e.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,a)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let i=0,o=t.length;i<o;i++){const o=t[i];let a=-1;if(o.include){const t=Ne(o.include);switch(t.kind){case 0:case 1:a=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let s=r[t.ruleName];s&&(a=e.getCompiledRuleId(s,n,r));break;case 3:case 4:const i=t.scopeName,l=4===t.kind?t.ruleName:null,c=n.getExternalGrammar(i,r);if(c)if(l){let t=c.repository[l];t&&(a=e.getCompiledRuleId(t,n,c.repository))}else a=e.getCompiledRuleId(c.repository.$self,n,c.repository)}}else a=e.getCompiledRuleId(o,n,r);if(-1!==a){const e=n.getRule(a);let t=!1;if((e instanceof Pe||e instanceof Re||e instanceof Te)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},$e=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let n=0,r=[],s=!1;for(let i=0;i<t;i++){if("\\"===e.charAt(i)&&i+1<t){const t=e.charAt(i+1);"z"===t?(r.push(e.substring(n,i)),r.push("$(?!\\n)(?<!\\n)"),n=i+2):"A"!==t&&"G"!==t||(s=!0),i++}}this.hasAnchor=s,0===n?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=Ae.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let n=t.map(t=>e.substring(t.start,t.end));return je.lastIndex=0,this.source.replace(je,(e,t)=>Q(n[parseInt(t,10)]||""))}_buildAnchorCache(){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let e,t,n,r,s=[],i=[],o=[],a=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),s[e]=n,i[e]=n,o[e]=n,a[e]=n,"\\"===n&&e+1<t&&(r=this.source.charAt(e+1),"A"===r?(s[e+1]="",i[e+1]="",o[e+1]="A",a[e+1]="A"):"G"===r?(s[e+1]="",i[e+1]="G",o[e+1]="",a[e+1]="G"):(s[e+1]=r,i[e+1]=r,o[e+1]=r,a[e+1]=r),e++);return{A0_G0:s.join(""),A0_G1:i.join(""),A1_G0:o.join(""),A1_G1:a.join("")}}resolveAnchors(e,t){return this.hasAnchor&&this._anchorCache&&"string"==typeof this.source?e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0:this.source}},Oe=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new Ge(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(e=>e.resolveAnchors(t,n));return new Ge(e,r,this._items.map(e=>e.ruleId))}},Ge=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},De=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Be=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new De(e,8),this._embeddedLanguagesMatcher=new Fe(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new De(0,0);_getBasicScopeAttributes=new Z(e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new De(t,n)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){const n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Fe=class{values;scopesRegExp;constructor(e){if(0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>Q(e));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);return t?this.values.get(t[1]):void 0}};"undefined"!=typeof process&&process.env.VSCODE_TEXTMATE_DEBUG;var Ue=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function ze(e,t,n,r,s,i,o,a){const l=t.content.length;let c=!1,u=-1;if(o){const o=function(e,t,n,r,s,i){let o=s.beginRuleCapturedEOL?0:-1;const a=[];for(let t=s;t;t=t.pop()){const n=t.getRule(e);n instanceof Te&&a.push({rule:n,stack:t})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:a,findOptions:c}=He(l.rule,e,l.stack.endRule,n,r===o),u=a.findNextMatchSync(t,r,c);if(!u){s=l.stack.pop();break}if(-2!==u.ruleId){s=l.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(i.produce(l.stack,u.captureIndices[0].start),qe(e,t,n,l.stack,i,l.rule.whileCaptures,u.captureIndices),i.produce(l.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}(e,t,n,r,s,i);s=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}const p=Date.now();for(;!c;){if(0!==a){if(Date.now()-p>a)return new Ue(s,!0)}h()}return new Ue(s,!1);function h(){const o=function(e,t,n,r,s,i){const o=function(e,t,n,r,s,i){const o=s.getRule(e),{ruleScanner:a,findOptions:l}=We(o,e,s.endRule,n,r===i),c=a.findNextMatchSync(t,r,l);if(c)return{captureIndices:c.captureIndices,matchedRuleId:c.ruleId};return null}(e,t,n,r,s,i),a=e.getInjections();if(0===a.length)return o;const l=function(e,t,n,r,s,i,o){let a,l=Number.MAX_VALUE,c=null,u=0;const p=i.contentNameScopesList.getScopeNames();for(let i=0,h=e.length;i<h;i++){const h=e[i];if(!h.matcher(p))continue;const d=t.getRule(h.ruleId),{ruleScanner:m,findOptions:g}=We(d,t,null,r,s===o),f=m.findNextMatchSync(n,s,g);if(!f)continue;const y=f.captureIndices[0].start;if(!(y>=l)&&(l=y,c=f.captureIndices,a=f.ruleId,u=h.priority,l===s))break}if(c)return{priorityMatch:-1===u,captureIndices:c,matchedRuleId:a};return null}(a,e,t,n,r,s,i);if(!l)return o;if(!o)return l;const c=o.captureIndices[0].start,u=l.captureIndices[0].start;if(u<c||l.priorityMatch&&u===c)return l;return o}(e,t,n,r,s,u);if(!o)return i.produce(s,l),void(c=!0);const a=o.captureIndices,p=o.matchedRuleId,h=!!(a&&a.length>0)&&a[0].end>r;if(-1===p){const o=s.getRule(e);i.produce(s,a[0].start),s=s.withContentNameScopesList(s.nameScopesList),qe(e,t,n,s,i,o.endCaptures,a),i.produce(s,a[0].end);const p=s;if(s=s.parent,u=p.getAnchorPos(),!h&&p.getEnterPos()===r)return s=p,i.produce(s,l),void(c=!0)}else{const o=e.getRule(p);i.produce(s,a[0].start);const d=s,m=o.getName(t.content,a),g=s.contentNameScopesList.pushAttributed(m,e);if(s=s.push(p,r,u,a[0].end===l,null,g,g),o instanceof Re){const r=o;qe(e,t,n,s,i,r.beginCaptures,a),i.produce(s,a[0].end),u=a[0].end;const p=r.getContentName(t.content,a),m=g.pushAttributed(p,e);if(s=s.withContentNameScopesList(m),r.endHasBackReferences&&(s=s.withEndRule(r.getEndWithResolvedBackReferences(t.content,a))),!h&&d.hasSameRuleAs(s))return s=s.pop(),i.produce(s,l),void(c=!0)}else if(o instanceof Te){const r=o;qe(e,t,n,s,i,r.beginCaptures,a),i.produce(s,a[0].end),u=a[0].end;const p=r.getContentName(t.content,a),m=g.pushAttributed(p,e);if(s=s.withContentNameScopesList(m),r.whileHasBackReferences&&(s=s.withEndRule(r.getWhileWithResolvedBackReferences(t.content,a))),!h&&d.hasSameRuleAs(s))return s=s.pop(),i.produce(s,l),void(c=!0)}else{if(qe(e,t,n,s,i,o.captures,a),i.produce(s,a[0].end),s=s.pop(),!h)return s=s.safePop(),i.produce(s,l),void(c=!0)}}a[0].end>r&&(r=a[0].end,n=!1)}}function We(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function He(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function qe(e,t,n,r,s,i,o){if(0===i.length)return;const a=t.content,l=Math.min(i.length,o.length),c=[],u=o[0].end;for(let t=0;t<l;t++){const l=i[t];if(null===l)continue;const p=o[t];if(0===p.length)continue;if(p.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=p.start;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?s.produceFromScopes(c[c.length-1].scopes,p.start):s.produce(r,p.start),l.retokenizeCapturedWithRuleId){const t=l.getName(a,o),i=r.contentNameScopesList.pushAttributed(t,e),c=l.getContentName(a,o),u=i.pushAttributed(c,e),h=r.push(l.retokenizeCapturedWithRuleId,p.start,-1,!1,null,i,u),d=e.createOnigString(a.substring(0,p.end));ze(e,d,n&&0===p.start,p.start,h,s,!1,0),he(d);continue}const h=l.getName(a,o);if(null!==h){const t=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(h,e);c.push(new Ve(t,p.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var Ve=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Xe(e,t,n,r,s){const i=ue(t,Ke),o=Me.getCompiledRuleId(n,r,s.repository);for(const n of i)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:s,priority:n.priority})}function Ke(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Qe(t[r],e))return n=r+1,!0;return!1})}function Qe(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}var Ze=class{constructor(e,t,n,r,s,i,o,a){if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new Be(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Je(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const e of Object.keys(s)){const t=ue(e,Ke);for(const n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:s[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e=e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),t=[],n=this._rootScopeName,r=e(n);if(r){const e=r.injections;if(e)for(let n in e)Xe(t,n,e[n],this,r);const s=this._grammarRepository.injections(n);s&&s.forEach(e=>{const n=this.getExternalGrammar(e);if(n){const e=n.injectionSelector;e&&Xe(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Je(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){let s;if(-1===this._rootId&&(this._rootId=Me.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==et.NULL)s=!1,t.reset();else{s=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=le.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),i=this.getRule(this._rootId).getName(null,null);let o;o=i?Ye.createRootAndLookUpScopeName(i,r,this):Ye.createRoot("unknown",r),t=new et(null,this._rootId,-1,-1,!1,null,o,o)}e+="\n";const i=this.createOnigString(e),o=i.content.length,a=new nt(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=ze(this,i,s,0,t,a,!0,r);return he(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Je(e,t){return(e=U(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Ye=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,s=t?.scopePath??null;for(const t of n)s=Y.push(s,t.scopeNames),r=new e(r,s,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Y(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new Y(null,t),o=r.themeProvider.themeMatch(i),a=e.mergeAttributes(n,s,o);return new e(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let r=-1,s=0,i=0;return null!==n&&(r=n.fontStyle,s=n.foregroundId,i=n.backgroundId),le.set(e,t.languageId,t.tokenType,null,r,s,i)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const t of r)s=e._pushAttributed(s,t,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),i=t.scopePath.push(n),o=r.themeProvider.themeMatch(i),a=e.mergeAttributes(t.tokenAttributes,s,o);return new e(t,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},et=class e{constructor(e,t,n,r,s,i,o,a){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=s,this.endRule=i,this.nameScopesList=o,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&Ye.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,i,o,a){return new e(this,t,n,r,s,i,o,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){const r=Ye.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Ye.fromExtension(r,n.contentNameScopesList))}},tt=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):ue(e,Ke).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>ue(e,Ke).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},nt=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const t=e?.getScopeNames()??[];for(const e of this._tokenTypeOverrides)e.matcher(t)&&(n=le.set(n,0,ce(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}return r&&(n=le.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n?void(this._lastTokenEndIndex=t):(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),void(this._lastTokenEndIndex=t))}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},rt=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,s){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,function(e,t,n,r,s,i,o,a){return new Ze(e,t,n,r,s,i,o,a)}(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},st=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new rt(J.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(J.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new tt(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,s){const i=new fe(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(e=>this._loadSingleGrammar(e.scopeName)),i.processQueue();return this._grammarForScopeName(e,t,n,r,s)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,s=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,s)}},it=et.NULL;const ot=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class at{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function lt(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new at(n,r,t)}function ct(e){return e.toLowerCase()}at.prototype.normal={},at.prototype.property={},at.prototype.space=void 0;class ut{constructor(e,t){this.attribute=t,this.property=e}}ut.prototype.attribute="",ut.prototype.booleanish=!1,ut.prototype.boolean=!1,ut.prototype.commaOrSpaceSeparated=!1,ut.prototype.commaSeparated=!1,ut.prototype.defined=!1,ut.prototype.mustUseProperty=!1,ut.prototype.number=!1,ut.prototype.overloadedBoolean=!1,ut.prototype.property="",ut.prototype.spaceSeparated=!1,ut.prototype.space=void 0;let pt=0;const ht=bt(),dt=bt(),mt=bt(),gt=bt(),ft=bt(),yt=bt(),kt=bt();function bt(){return 2**++pt}var wt={__proto__:null,boolean:ht,booleanish:dt,commaOrSpaceSeparated:kt,commaSeparated:yt,number:gt,overloadedBoolean:mt,spaceSeparated:ft};const Ct=Object.keys(wt);class _t extends ut{constructor(e,t,n,r){let s=-1;if(super(e,t),St(this,"space",r),"number"==typeof n)for(;++s<Ct.length;){const e=Ct[s];St(this,Ct[s],(n&wt[e])===wt[e])}}}function St(e,t,n){n&&(e[t]=n)}function vt(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new _t(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[ct(r)]=r,n[ct(i.attribute)]=r}return new at(t,n,e.space)}_t.prototype.defined=!0;const xt=vt({properties:{ariaActiveDescendant:null,ariaAtomic:dt,ariaAutoComplete:null,ariaBusy:dt,ariaChecked:dt,ariaColCount:gt,ariaColIndex:gt,ariaColSpan:gt,ariaControls:ft,ariaCurrent:null,ariaDescribedBy:ft,ariaDetails:null,ariaDisabled:dt,ariaDropEffect:ft,ariaErrorMessage:null,ariaExpanded:dt,ariaFlowTo:ft,ariaGrabbed:dt,ariaHasPopup:null,ariaHidden:dt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ft,ariaLevel:gt,ariaLive:null,ariaModal:dt,ariaMultiLine:dt,ariaMultiSelectable:dt,ariaOrientation:null,ariaOwns:ft,ariaPlaceholder:null,ariaPosInSet:gt,ariaPressed:dt,ariaReadOnly:dt,ariaRelevant:null,ariaRequired:dt,ariaRoleDescription:ft,ariaRowCount:gt,ariaRowIndex:gt,ariaRowSpan:gt,ariaSelected:dt,ariaSetSize:gt,ariaSort:null,ariaValueMax:gt,ariaValueMin:gt,ariaValueNow:gt,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function Nt(e,t){return t in e?e[t]:t}function At(e,t){return Nt(e,t.toLowerCase())}const jt=vt({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:yt,acceptCharset:ft,accessKey:ft,action:null,allow:null,allowFullScreen:ht,allowPaymentRequest:ht,allowUserMedia:ht,alt:null,as:null,async:ht,autoCapitalize:null,autoComplete:ft,autoFocus:ht,autoPlay:ht,blocking:ft,capture:null,charSet:null,checked:ht,cite:null,className:ft,cols:gt,colSpan:null,content:null,contentEditable:dt,controls:ht,controlsList:ft,coords:gt|yt,crossOrigin:null,data:null,dateTime:null,decoding:null,default:ht,defer:ht,dir:null,dirName:null,disabled:ht,download:mt,draggable:dt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:ht,formTarget:null,headers:ft,height:gt,hidden:mt,high:gt,href:null,hrefLang:null,htmlFor:ft,httpEquiv:ft,id:null,imageSizes:null,imageSrcSet:null,inert:ht,inputMode:null,integrity:null,is:null,isMap:ht,itemId:null,itemProp:ft,itemRef:ft,itemScope:ht,itemType:ft,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:ht,low:gt,manifest:null,max:null,maxLength:gt,media:null,method:null,min:null,minLength:gt,multiple:ht,muted:ht,name:null,nonce:null,noModule:ht,noValidate:ht,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:ht,optimum:gt,pattern:null,ping:ft,placeholder:null,playsInline:ht,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:ht,referrerPolicy:null,rel:ft,required:ht,reversed:ht,rows:gt,rowSpan:gt,sandbox:ft,scope:null,scoped:ht,seamless:ht,selected:ht,shadowRootClonable:ht,shadowRootDelegatesFocus:ht,shadowRootMode:null,shape:null,size:gt,sizes:null,slot:null,span:gt,spellCheck:dt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:gt,step:null,style:null,tabIndex:gt,target:null,title:null,translate:null,type:null,typeMustMatch:ht,useMap:null,value:dt,width:gt,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ft,axis:null,background:null,bgColor:null,border:gt,borderColor:null,bottomMargin:gt,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:ht,declare:ht,event:null,face:null,frame:null,frameBorder:null,hSpace:gt,leftMargin:gt,link:null,longDesc:null,lowSrc:null,marginHeight:gt,marginWidth:gt,noResize:ht,noHref:ht,noShade:ht,noWrap:ht,object:null,profile:null,prompt:null,rev:null,rightMargin:gt,rules:null,scheme:null,scrolling:dt,standby:null,summary:null,text:null,topMargin:gt,valueType:null,version:null,vAlign:null,vLink:null,vSpace:gt,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:ht,disableRemotePlayback:ht,prefix:null,property:null,results:gt,security:null,unselectable:null},space:"html",transform:At}),Et=vt({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:kt,accentHeight:gt,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:gt,amplitude:gt,arabicForm:null,ascent:gt,attributeName:null,attributeType:null,azimuth:gt,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:gt,by:null,calcMode:null,capHeight:gt,className:ft,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:gt,diffuseConstant:gt,direction:null,display:null,dur:null,divisor:gt,dominantBaseline:null,download:ht,dx:null,dy:null,edgeMode:null,editable:null,elevation:gt,enableBackground:null,end:null,event:null,exponent:gt,externalResourcesRequired:null,fill:null,fillOpacity:gt,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:yt,g2:yt,glyphName:yt,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:gt,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:gt,horizOriginX:gt,horizOriginY:gt,id:null,ideographic:gt,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:gt,k:gt,k1:gt,k2:gt,k3:gt,k4:gt,kernelMatrix:kt,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:gt,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:gt,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:gt,overlineThickness:gt,paintOrder:null,panose1:null,path:null,pathLength:gt,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ft,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:gt,pointsAtY:gt,pointsAtZ:gt,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:kt,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:kt,rev:kt,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:kt,requiredFeatures:kt,requiredFonts:kt,requiredFormats:kt,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:gt,specularExponent:gt,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:gt,strikethroughThickness:gt,string:null,stroke:null,strokeDashArray:kt,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:gt,strokeOpacity:gt,strokeWidth:null,style:null,surfaceScale:gt,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:kt,tabIndex:gt,tableValues:null,target:null,targetX:gt,targetY:gt,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:kt,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:gt,underlineThickness:gt,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:gt,values:null,vAlphabetic:gt,vMathematical:gt,vectorEffect:null,vHanging:gt,vIdeographic:gt,version:null,vertAdvY:gt,vertOriginX:gt,vertOriginY:gt,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:gt,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Nt}),Lt=vt({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),It=vt({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:At}),Pt=vt({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),Rt=/[A-Z]/g,Tt=/-[a-z]/g,Mt=/^data[-\w.:]+$/i;function $t(e){return"-"+e.toLowerCase()}function Ot(e){return e.charAt(1).toUpperCase()}const Gt=lt([xt,jt,Lt,It,Pt],"html"),Dt=lt([xt,Et,Lt,It,Pt],"svg"),Bt={}.hasOwnProperty;const Ft=/["&'<>`]/g,Ut=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,zt=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Wt=/[|\\{}()[\]^$+*?.]/g,Ht=new WeakMap;function qt(e,t){return e=e.replace(t.subset?function(e){let t=Ht.get(e);t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Wt,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),Ht.set(e,t));return t}(t.subset):Ft,n),t.subset||t.escapeOnly?e:e.replace(Ut,function(e,n,r){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}).replace(zt,n);function n(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}const Vt=/[\dA-Fa-f]/;const Xt=/\d/;const Kt=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],Qt={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},Zt=["cent","copy","divide","gt","lt","not","para","times"],Jt={}.hasOwnProperty,Yt={};let en;for(en in Qt)Jt.call(Qt,en)&&(Yt[Qt[en]]=en);const tn=/[^\dA-Za-z]/;function nn(e,t,n){let r,s=function(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!Vt.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);if((n.useNamedReferences||n.useShortestReferences)&&(r=function(e,t,n,r){const s=String.fromCharCode(e);if(Jt.call(Yt,s)){const e=Yt[s],i="&"+e;return n&&Kt.includes(e)&&!Zt.includes(e)&&(!r||t&&61!==t&&tn.test(String.fromCharCode(t)))?i:i+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const r=function(e,t,n){const r="&#"+String(e);return n&&t&&!Xt.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);r.length<s.length&&(s=r)}return r&&(!n.useShortestReferences||r.length<s.length)?r:s}function rn(e,t){return qt(e,Object.assign({format:nn},t))}const sn=/^>|^->|<!--|-->|--!>|<!-$/g,on=[">"],an=["<",">"];function ln(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;-1!==s;)r++,s=n.indexOf(t,s+t.length);return r}function cn(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}function un(e){return e.join(" ").trim()}const pn=/[ \t\n\f\r]/g;function hn(e){return"object"==typeof e?"text"===e.type&&dn(e.value):dn(e)}function dn(e){return""===e.replace(pn,"")}const mn=yn(1),gn=yn(-1),fn=[];function yn(e){return function(t,n,r){const s=t?t.children:fn;let i=(n||0)+e,o=s[i];if(!r)for(;o&&hn(o);)i+=e,o=s[i];return o}}const kn={}.hasOwnProperty;function bn(e){return function(t,n,r){return kn.call(e,t.tagName)&&e[t.tagName](t,n,r)}}const wn=bn({body:function(e,t,n){const r=mn(n,t);return!r||"comment"!==r.type},caption:Cn,colgroup:Cn,dd:function(e,t,n){const r=mn(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){const r=mn(n,t);return Boolean(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:Cn,html:function(e,t,n){const r=mn(n,t);return!r||"comment"!==r.type},li:function(e,t,n){const r=mn(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){const r=mn(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){const r=mn(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){const r=mn(n,t);return r?"element"===r.type&&("address"===r.tagName||"article"===r.tagName||"aside"===r.tagName||"blockquote"===r.tagName||"details"===r.tagName||"div"===r.tagName||"dl"===r.tagName||"fieldset"===r.tagName||"figcaption"===r.tagName||"figure"===r.tagName||"footer"===r.tagName||"form"===r.tagName||"h1"===r.tagName||"h2"===r.tagName||"h3"===r.tagName||"h4"===r.tagName||"h5"===r.tagName||"h6"===r.tagName||"header"===r.tagName||"hgroup"===r.tagName||"hr"===r.tagName||"main"===r.tagName||"menu"===r.tagName||"nav"===r.tagName||"ol"===r.tagName||"p"===r.tagName||"pre"===r.tagName||"section"===r.tagName||"table"===r.tagName||"ul"===r.tagName):!n||!("element"===n.type&&("a"===n.tagName||"audio"===n.tagName||"del"===n.tagName||"ins"===n.tagName||"map"===n.tagName||"noscript"===n.tagName||"video"===n.tagName))},rp:_n,rt:_n,tbody:function(e,t,n){const r=mn(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:Sn,tfoot:function(e,t,n){return!mn(n,t)},th:Sn,thead:function(e,t,n){const r=mn(n,t);return Boolean(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){const r=mn(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function Cn(e,t,n){const r=mn(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&hn(r.value.charAt(0)))}function _n(e,t,n){const r=mn(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function Sn(e,t,n){const r=mn(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}const vn=bn({body:function(e){const t=mn(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&hn(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,n){const r=gn(n,t),s=mn(e,-1,!0);if(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&wn(r,n.children.indexOf(r),n))return!1;return Boolean(s&&"element"===s.type&&"col"===s.tagName)},head:function(e){const t=new Set;for(const n of e.children)if("element"===n.type&&("base"===n.tagName||"title"===n.tagName)){if(t.has(n.tagName))return!1;t.add(n.tagName)}const n=e.children[0];return!n||"element"===n.type},html:function(e){const t=mn(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const r=gn(n,t),s=mn(e,-1);if(n&&r&&"element"===r.type&&("thead"===r.tagName||"tbody"===r.tagName)&&wn(r,n.children.indexOf(r),n))return!1;return Boolean(s&&"element"===s.type&&"tr"===s.tagName)}});const xn={name:[["\t\n\f\r &/=>".split(""),"\t\n\f\r \"&'/=>`".split("")],["\0\t\n\f\r \"&'/<=>".split(""),"\0\t\n\f\r \"&'/<=>`".split("")]],unquoted:[["\t\n\f\r &>".split(""),"\0\t\n\f\r \"&'<=>`".split("")],["\0\t\n\f\r \"&'<=>`".split(""),"\0\t\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Nn(e,t,n){const r=function(e,t){const n=ct(t);let r=t,s=ut;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&Mt.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Tt,Ot);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Tt.test(e)){let n=e.replace(Rt,$t);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}s=_t}return new s(r,t)}(e.schema,t),s=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,i=e.settings.allowDangerousCharacters?0:1;let o,a=e.quote;if(!r.overloadedBoolean||n!==r.attribute&&""!==n?!r.boolean&&!r.overloadedBoolean||"string"==typeof n&&n!==r.attribute&&""!==n||(n=Boolean(n)):n=!0,null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";const l=rn(r.attribute,Object.assign({},e.settings.characterReferences,{subset:xn.name[s][i]}));return!0===n?l:(n=Array.isArray(n)?(r.commaSeparated?cn:un)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?l:(e.settings.preferUnquoted&&(o=rn(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:xn.unquoted[s][i]}))),o!==n&&(e.settings.quoteSmart&&ln(n,a)>ln(n,e.alternative)&&(a=e.alternative),o=a+rn(n,Object.assign({},e.settings.characterReferences,{subset:("'"===a?xn.single:xn.double)[s][i],attribute:!0}))+a),l+(o?"="+o:o)))}const An=["<","&"];function jn(e,t,n,r){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?rn(e.value,Object.assign({},r.settings.characterReferences,{subset:An})):e.value}const En=function(e,t){const n=t||{};function r(t,...n){let s=r.invalid;const i=r.handlers;if(t&&Bt.call(t,e)){const n=String(t[e]);s=Bt.call(i,n)?i[n]:r.unknown}if(s)return s.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,r){return r.settings.bogusComments?"<?"+rn(e.value,Object.assign({},r.settings.characterReferences,{subset:on}))+">":"\x3c!--"+e.value.replace(sn,function(e){return rn(e,Object.assign({},r.settings.characterReferences,{subset:an}))})+"--\x3e"},doctype:function(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,r){const s=r.schema,i="svg"!==s.space&&r.settings.omitOptionalTags;let o="svg"===s.space?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;"html"===s.space&&"svg"===e.tagName&&(r.schema=Dt);const c=function(e,t){const n=[];let r,s=-1;if(t)for(r in t)if(null!==t[r]&&void 0!==t[r]){const s=Nn(e,r,t[r]);s&&n.push(s)}for(;++s<n.length;){const t=e.settings.tightAttributes?n[s].charAt(n[s].length-1):void 0;s!==n.length-1&&'"'!==t&&"'"!==t&&(n[s]+=" ")}return n.join("")}(r,e.properties),u=r.all("html"===s.space&&"template"===e.tagName?e.content:e);return r.schema=s,u&&(o=!1),!c&&i&&vn(e,t,n)||(a.push("<",e.tagName,c?" "+c:""),o&&("svg"===s.space||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||"/"===l||l&&'"'!==l&&"'"!==l)&&a.push(" "),a.push("/")),a.push(">")),a.push(u),o||i&&wn(e,t,n)||a.push("</"+e.tagName+">"),a.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:jn(e,0,n,r)},root:function(e,t,n,r){return r.all(e)},text:jn}});const Ln={},In={},Pn=[];function Rn(e,t,n){return En(e,t,n,this)}function Tn(e){const t=[],n=e&&e.children||Pn;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function Mn(e,t){const n="string"==typeof e?{}:{...e.colorReplacements},r="string"==typeof e?e:e.name;for(const[e,s]of Object.entries(t?.colorReplacements||{}))"string"==typeof s?n[e]=s:e===r&&Object.assign(n,s);return n}function $n(e,t){return e&&t?.[e?.toLowerCase()]||e}async function On(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function Gn(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Dn(e){return"ansi"===e||Gn(e)}function Bn(e){return"none"===e}function Fn(e){return Bn(e)}function Un(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}function zn(e,t=!1){const n=e.split(/(\r?\n)/g);let r=0;const s=[];for(let e=0;e<n.length;e+=2){const i=t?n[e]+(n[e+1]||""):n[e];s.push([i,r]),r+=n[e].length,r+=n[e+1]?.length||0}return s}const Wn="light-dark()",Hn=["color","background-color"];function qn(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&re.Italic&&(t["font-style"]="italic"),e.fontStyle&re.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&re.Underline&&n.push("underline"),e.fontStyle&re.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function Vn(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}const Xn=new WeakMap;function Kn(e,t){Xn.set(e,t)}function Qn(e){return Xn.get(e)}class Zn{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new Zn(Object.fromEntries(function(e){return Array.isArray(e)?e:[e]}(t).map(e=>[e,it])),e)}constructor(...e){if(2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return function(e){const t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);const s=e?.nameScopesList?.scopeName;s&&t.push(s),e.parent&&r(e.parent)}return r(e),t}(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Jn(){const e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new F(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...r.indexToPos(e),offset:e}}{const t=r.lines[e.line];if(void 0===t)throw new F(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);if(e.character<0||e.character>t.length)throw new F(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,offset:r.posToIndex(e.line,e.character)}}};const r=function(e){const t=zn(e,!0).map(([e])=>e);return{lines:t,indexToPos:function(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=n,s=0;for(const e of t){if(r<e.length)break;r-=e.length,s++}return{line:s,character:r}},posToIndex:function(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}}}(t.source),s=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));!function(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new F(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const t=e[r],s=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,i=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,a=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(s||i||o||a){if(s&&i)continue;if(o&&a)continue;throw new F(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}(s),e.set(t.meta,{decorations:s,converter:r,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){if(!this.options.decorations?.length)return;const n=t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]),r=function(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{const t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?function(e,t){let n=0;const r=[];for(const s of t)s>n&&r.push({...e,content:e.content.slice(n,s),offset:e.offset+n}),n=s;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}(e,t):e})):e}(e,n);return r},code(e){if(!this.options.decorations?.length)return;const n=t(this),r=Array.from(e.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(r.length!==n.converter.lines.length)throw new F(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function s(e,t,n,s){const i=r[e];let a="",l=-1,c=-1;if(0===t&&(l=0),0===n&&(c=0),n===Number.POSITIVE_INFINITY&&(c=i.children.length),-1===l||-1===c)for(let e=0;e<i.children.length;e++)a+=Yn(i.children[e]),-1===l&&a.length===t&&(l=e+1),-1===c&&a.length===n&&(c=e+1);if(-1===l)throw new F(`Failed to find start index for decoration ${JSON.stringify(s.start)}`);if(-1===c)throw new F(`Failed to find end index for decoration ${JSON.stringify(s.end)}`);const u=i.children.slice(l,c);if(s.alwaysWrap||u.length!==i.children.length)if(s.alwaysWrap||1!==u.length||"element"!==u[0].type){const e={type:"element",tagName:"span",properties:{},children:u};o(e,s,"wrapper"),i.children.splice(l,u.length,e)}else o(u[0],s,"token");else o(i,s,"line")}function i(e,t){r[e]=o(r[e],t,"line")}function o(e,t,n){const r=t.properties||{},s=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&Un(e,t.properties.class),e=s(e,n)||e}const a=[],l=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(const e of l){const{start:t,end:n}=e;if(t.line===n.line)s(t.line,t.character,n.character,e);else if(t.line<n.line){s(t.line,t.character,Number.POSITIVE_INFINITY,e);for(let r=t.line+1;r<n.line;r++)a.unshift(()=>i(r,e));s(n.line,0,n.character,e)}}a.forEach(e=>e())}}}function Yn(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(Yn).join(""):""}const er=[Jn()];function tr(e){return[...e.transformers||[],...er]}var nr=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],rr={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function sr(e,t){const n=e.indexOf("",t);if(-1!==n&&"["===e[n+1]){const t=e.indexOf("m",n);if(-1!==t)return{sequence:e.substring(n+2,t).split(";"),startPosition:n,position:t+1}}return{position:e.length}}function ir(e){const t=e.shift();if("2"===t){const t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){const t=e.shift();if(t)return{type:"table",index:Number(t)}}}function or(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(0===r)t.push({type:"resetAll"});else if(r<=9){rr[r]&&t.push({type:"setDecoration",value:rr[r]})}else if(r<=29){const e=rr[r-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:nr[r-30]}});else if(38===r){const n=ir(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===r)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:nr[r-40]}});else if(48===r){const n=ir(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===r?t.push({type:"resetBackgroundColor"}):53===r?t.push({type:"setDecoration",value:"overline"}):55===r?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:nr[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:nr[r-100+8]}})}return t}var ar={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function lr(e=ar){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(e){return function(){if(r)return r;r=[];for(let e=0;e<nr.length;e++)r.push(t(nr[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let s=0;s<6;s++)for(let i=0;i<6;i++)r.push(n([e[t],e[s],e[i]]));let s=8;for(let e=0;e<24;e++,s+=10)r.push(n([s,s,s]));return r}()[e]}return{value:function(e){switch(e.type){case"named":return t(e.name);case"rgb":return n(e.rgb);case"table":return s(e.index)}}}}function cr(e,t,n){const r=Mn(e,n),s=zn(t),i=lr(Object.fromEntries(nr.map(t=>[t,e.colors?.[`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`]]))),o=function(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let i=0;do{const o=sr(r,i),a=o.sequence?r.substring(i,o.startPosition):r.substring(i);if(a.length>0&&s.push({value:a,foreground:e,background:t,decorations:new Set(n)}),o.sequence){const r=or(o.sequence);for(const s of r)"resetAll"===s.type?(e=null,t=null,n.clear()):"resetForegroundColor"===s.type?e=null:"resetBackgroundColor"===s.type?t=null:"resetDecoration"===s.type&&n.delete(s.value);for(const s of r)"setForegroundColor"===s.type?e=s.value:"setBackgroundColor"===s.type?t=s.value:"setDecoration"===s.type&&n.add(s.value)}i=o.position}while(i<r.length);return s}}}();return s.map(t=>o.parse(t[0]).map(n=>{let s,o;n.decorations.has("reverse")?(s=n.background?i.value(n.background):e.bg,o=n.foreground?i.value(n.foreground):e.fg):(s=n.foreground?i.value(n.foreground):e.fg,o=n.background?i.value(n.background):void 0),s=$n(s,r),o=$n(o,r),n.decorations.has("dim")&&(s=function(e){const t=e.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(t){if(t[3]){const e=Math.round(Number.parseInt(t[3],16)/2).toString(16).padStart(2,"0");return`#${t[1]}${t[2]}${e}`}return t[2]?`#${t[1]}${t[2]}80`:`#${Array.from(t[1]).map(e=>`${e}${e}`).join("")}80`}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}(s));let a=re.None;return n.decorations.has("bold")&&(a|=re.Bold),n.decorations.has("italic")&&(a|=re.Italic),n.decorations.has("underline")&&(a|=re.Underline),n.decorations.has("strikethrough")&&(a|=re.Strikethrough),{content:n.value,offset:t[1],color:s,bgColor:o,fontStyle:a}}))}function ur(e,t,n={}){const{lang:r="text",theme:s=e.getLoadedThemes()[0]}=n;if(Gn(r)||Bn(s))return zn(t).map(e=>[{content:e[0],offset:e[1]}]);const{theme:i,colorMap:o}=e.setTheme(s);if("ansi"===r)return cr(i,t,n);const a=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==a.name)throw new F(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(i.name))throw new F(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return function(e,t,n,r,s){const i=pr(e,t,n,r,s),o=new Zn(pr(e,t,n,r,s).stateStack,t.name,n.name);return Kn(i.tokens,o),i.tokens}(t,a,i,o,n)}function pr(e,t,n,r,s){const i=Mn(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=s,l=zn(e);let c=s.grammarState?function(e,t){if(!(e instanceof Zn))throw new F("Invalid grammar state");return e.getInternalStack(t)}(s.grammarState,n.name)??it:null!=s.grammarContextCode?pr(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:it,u=[];const p=[];for(let e=0,h=l.length;e<h;e++){const[h,d]=l[e];if(""===h){u=[],p.push([]);continue}if(o>0&&h.length>=o){u=[],p.push([{content:h,offset:d,color:"",fontStyle:0}]);continue}let m,g,f;s.includeExplanation&&(m=t.tokenizeLine(h,c,a),g=m.tokens,f=0);const y=t.tokenizeLine2(h,c,a),k=y.tokens.length/2;for(let e=0;e<k;e++){const t=y.tokens[2*e],o=e+1<k?y.tokens[2*e+2]:h.length;if(t===o)continue;const a=y.tokens[2*e+1],l=$n(r[le.getForeground(a)],i),c=le.getFontStyle(a),p={content:h.substring(t,o),offset:d+t,color:l,fontStyle:c};if(s.includeExplanation){const e=[];if("scopeName"!==s.includeExplanation)for(const t of n.settings){let n;switch(typeof t.scope){case"string":n=t.scope.split(/,/).map(e=>e.trim());break;case"object":n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(/ /))})}p.explanation=[];let r=0;for(;t+r<o;){const t=g[f],n=h.substring(t.startIndex,t.endIndex);r+=n.length,p.explanation.push({content:n,scopes:"scopeName"===s.includeExplanation?hr(t.scopes):dr(e,t.scopes)}),f+=1}}u.push(p)}p.push(u),u=[],c=y.ruleStack}return{tokens:p,stateStack:c}}function hr(e){return e.map(e=>({scopeName:e}))}function dr(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const s=t[r];n[r]={scopeName:s,themeMatches:fr(e,s,t.slice(0,r))}}return n}function mr(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function gr(e,t,n){if(!mr(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)mr(e[r],n[s])&&(r-=1),s-=1;return-1===r}function fr(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const e of s)if(gr(e,t,n)){r.push(i);break}return r}function yr(e,t,n){const r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),s=r.map(r=>{const s=ur(e,t,{...n,theme:r.theme});return{tokens:s,state:Qn(s),theme:"string"==typeof r.theme?r.theme:r.theme.name}}),i=function(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map(e=>e[r]),i=t.map(()=>[]);t.forEach((e,t)=>e.push(i[t]));const o=s.map(()=>0),a=s.map(e=>e[0]);for(;a.every(e=>e);){const e=Math.min(...a.map(e=>e.content.length));for(let t=0;t<n;t++){const n=a[t];n.content.length===e?(i[t].push(n),o[t]+=1,a[t]=s[t][o[t]]):(i[t].push({...n,content:n.content.slice(0,e)}),a[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...s.map(e=>e.tokens)),o=i[0].map((e,t)=>e.map((e,s)=>{const o={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(o.explanation=e.explanation),i.forEach((e,n)=>{const{content:i,explanation:a,offset:l,...c}=e[t][s];o.variants[r[n].color]=c}),o})),a=s[0].state?new Zn(Object.fromEntries(s.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),s[0].state.lang):void 0;return a&&Kn(o,a),o}function kr(e,t,n){let r,s,i,o,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:p="css-vars"}=n,h=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===c?-1:t.color===c?1:0);if(0===h.length)throw new F("`themes` option must not be empty");const d=yr(e,t,n);if(l=Qn(d),c&&Wn!==c&&!h.find(e=>e.color===c))throw new F(`\`themes\` option must contain the defaultColor key \`${c}\``);const m=h.map(t=>e.getTheme(t.theme)),g=h.map(e=>e.color);i=d.map(e=>e.map(e=>function(e,t,n,r,s="css-vars"){const i={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>qn(e.variants[t])),a=new Set(o.flatMap(e=>Object.keys(e))),l={},c=(e,r)=>{const s="color"===r?"":"background-color"===r?"-bg":`-${r}`;return n+t[e]+("color"===r?"":s)};return o.forEach((e,n)=>{for(const i of a){const a=e[i]||"inherit";if(0===n&&r&&Hn.includes(i))if(r===Wn&&o.length>1){const e=t.findIndex(e=>"light"===e),r=t.findIndex(e=>"dark"===e);if(-1===e||-1===r)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const u=o[e][i]||"inherit",p=o[r][i]||"inherit";l[i]=`light-dark(${u}, ${p})`,"css-vars"===s&&(l[c(n,i)]=a)}else l[i]=a;else"css-vars"===s&&(l[c(n,i)]=a)}}),i.htmlStyle=l,i}(e,g,u,c,p))),l&&Kn(i,l);const f=h.map(e=>Mn(e.theme,n));s=br(h,m,f,u,c,"fg",p),r=br(h,m,f,u,c,"bg",p),o=`shiki-themes ${m.map(e=>e.name).join(" ")}`,a=c?void 0:[s,r].join(";")}else{if(!("theme"in n))throw new F("Invalid options, either `theme` or `themes` must be provided");{const a=Mn(n.theme,n);i=ur(e,t,n);const c=e.getTheme(n.theme);r=$n(c.bg,a),s=$n(c.fg,a),o=c.name,l=Qn(i)}}return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:a,grammarState:l}}function br(e,t,n,r,s,i,o){return e.map((a,l)=>{const c=$n(t[l][i],n[l])||"inherit",u=`${r+a.color}${"bg"===i?"-bg":""}:${c}`;if(0===l&&s){if(s===Wn&&e.length>1){const r=e.findIndex(e=>"light"===e.color),s=e.findIndex(e=>"dark"===e.color);if(-1===r||-1===s)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${$n(t[r][i],n[r])||"inherit"}, ${$n(t[s][i],n[s])||"inherit"});${u}`}return c}return"css-vars"===o?u:null}).filter(e=>!!e).join(";")}function wr(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>wr(e,t,n),codeToTokens:(t,n)=>kr(e,t,n)}){let s=t;for(const e of tr(n))s=e.preprocess?.call(r,s,n)||s;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:c,grammarState:u}=kr(e,s,n);const{mergeWhitespaces:p=!0,mergeSameStyleTokens:h=!1}=n;!0===p?i=function(e){return e.map(e=>{const t=[];let n="",r=0;return e.forEach((s,i)=>{const o=!(s.fontStyle&&(s.fontStyle&re.Underline||s.fontStyle&re.Strikethrough));o&&s.content.match(/^\s+$/)&&e[i+1]?(r||(r=s.offset),n+=s.content):n?(o?t.push({...s,offset:r,content:n+s.content}):t.push({content:n,offset:r},s),r=0,n=""):t.push(s)}),t})}(i):"never"===p&&(i=function(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;const t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;const[,n,r,s]=t;if(!n&&!s)return e;const i=[{...e,offset:e.offset+n.length,content:r}];return n&&i.unshift({content:n,offset:e.offset}),s&&i.push({content:s,offset:e.offset+n.length+r.length}),i}))}(i)),h&&(i=function(e){return e.map(e=>{const t=[];for(const n of e){if(0===t.length){t.push({...n});continue}const e=t[t.length-1],r=Vn(e.htmlStyle||qn(e)),s=Vn(n.htmlStyle||qn(n)),i=e.fontStyle&&(e.fontStyle&re.Underline||e.fontStyle&re.Strikethrough),o=n.fontStyle&&(n.fontStyle&re.Underline||n.fontStyle&re.Strikethrough);i||o||r!==s?t.push({...n}):e.content+=n.content}return t})}(i));const d={...r,get source(){return s}};for(const e of tr(n))i=e.tokens?.call(d,i)||i;return function(e,t,n,r=Qn(e)){const s=tr(t),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=t;let c={type:"element",tagName:"pre",properties:{class:`shiki ${t.themeName||""}`,style:t.rootStyle||`background-color:${t.bg};color:${t.fg}`,...!1!==l&&null!=l?{tabindex:l.toString()}:{},...Object.fromEntries(Array.from(Object.entries(t.meta||{})).filter(([e])=>!e.startsWith("_")))},children:[]},u={type:"element",tagName:"code",properties:{},children:i};const p=[],h={...n,structure:a,addClassToHast:Un,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return u},get lines(){return p}};if(e.forEach((e,t)=>{t&&("inline"===a?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===a&&i.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},r=0;for(const i of e){let e={type:"element",tagName:"span",properties:{...i.htmlAttrs},children:[{type:"text",value:i.content}]};const l=Vn(i.htmlStyle||qn(i));l&&(e.properties.style=l);for(const o of s)e=o?.span?.call(h,e,t+1,r,n,i)||e;"inline"===a?o.children.push(e):"classic"===a&&n.children.push(e),r+=i.content.length}if("classic"===a){for(const e of s)n=e?.line?.call(h,n,t+1)||n;p.push(n),i.push(n)}}),"classic"===a){for(const e of s)u=e?.code?.call(h,u)||u;c.children.push(u);for(const e of s)c=e?.pre?.call(h,c)||c;o.children.push(c)}let d=o;for(const e of s)d=e?.root?.call(h,d)||d;r&&Kn(d,r);return d}(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},d,u)}const Cr=function(e,t){const n=t||Ln,r=n.quote||'"',s='"'===r?"'":'"';if('"'!==r&&"'"!==r)throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Rn,all:Tn,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||ot,characterReferences:n.characterReferences||In,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?Dt:Gt,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)};const _r="#333333",Sr="#bbbbbb",vr="#fffffe",xr="#1e1e1e",Nr="__shiki_resolved";function Ar(e){if(e?.[Nr])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){const e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r="light"===t.type?_r:Sr),n||(n="light"===t.type?vr:xr),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0;const i=new Map;function o(e){if(i.has(e))return i.get(e);s+=1;const n=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(i.set(e,n),n)}t.settings=t.settings.map(e=>{const n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),r=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!r)return e;const s={...e,settings:{...e.settings}};if(n){const n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,s.settings.foreground=n}if(r){const n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,s.settings.background=n}return s});for(const e of Object.keys(t.colors||{}))if(("editor.foreground"===e||"editor.background"===e||e.startsWith("terminal.ansi"))&&!t.colors[e]?.startsWith("#")){const n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,Nr,{enumerable:!1,writable:!1,value:!0}),t}class jr extends Error{constructor(e){super(e),this.name="ShikiError"}}class Er extends st{constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=Ar(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=J.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){if(this._alias[e]){const t=new Set([e]);for(;this._alias[e];){if(e=this._alias[e],t.has(e))throw new jr(`Circular alias \`${Array.from(t).join(" -> ")} -> ${e}\``);t.add(e)}}return this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(const e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const t of e)this.resolveEmbeddedLanguages(t);const t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){const e=t.filter(([e,t])=>t&&t.embeddedLangs?.some(e=>n.map(([e])=>e).includes(e))).filter(e=>!n.includes(e));throw new jr(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(const[e,n]of t)this._resolver.addLanguage(n);for(const[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){if(this._langMap.set(e.name,e),this._langGraph.set(e.name,e),e.embeddedLangs)for(const t of e.embeddedLangs)this._langGraph.set(t,this._langMap.get(t))}}class Lr{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let e=1;e<=t.length;e++){const r=t.slice(0,e).join(".");n=[...n,...this._injections.get(r)||[]]}return n}}let Ir=0;function Pr(e){Ir+=1,!1!==e.warnings&&Ir>=10&&Ir%10==0&&console.warn(`[Shiki] ${Ir} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new jr("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Ar),s=new Lr(e.engine,n),i=new Er(s,r,n,e.langAlias);let o;function a(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();const t=i.getTheme(e);if(!t)throw new jr(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(...e){u(),i.loadLanguages(e.flat(1))}function c(...e){u();for(const t of e.flat(1))i.loadTheme(t)}function u(){if(t)throw new jr("Shiki instance has been disposed")}function p(){t||(t=!0,i.dispose(),Ir-=1)}return{setTheme:function(e){u();const t=a(e);return o!==e&&(i.setTheme(t),o=e),{theme:t,colorMap:i.getColorMap()}},getTheme:a,getLanguage:function(e){u();const t=i.getGrammar("string"==typeof e?e:e.name);if(!t)throw new jr(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),i.getLoadedThemes()},getLoadedLanguages:function(){return u(),i.getLoadedLanguages()},loadLanguage:async function(...e){return l(await async function(e){return Array.from(new Set((await Promise.all(e.filter(e=>!Dn(e)).map(async e=>await On(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}(e))},loadLanguageSync:l,loadTheme:async function(...e){return u(),c(await async function(e){return(await Promise.all(e.map(async e=>Fn(e)?null:Ar(await On(e))))).filter(e=>!!e)}(e))},loadThemeSync:c,dispose:p,[Symbol.dispose]:p}}function Rr(e){if(1!==[...e].length)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}const Tr=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),Mr=String.raw;function $r(e,t){if(null==e)throw new Error(t??"Value expected");return e}const Or=Mr`\[\^?`,Gr=`c.? | C(?:-.?)?|${Mr`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Mr`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Mr`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Mr`o\{[^\}]*\}?`}|${Mr`\d{1,3}`}`,Dr=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Br=new RegExp(Mr`
|
|
10
10
|
\\ (?:
|
|
11
|
-
${
|
|
11
|
+
${Gr}
|
|
12
12
|
| [gk]<[^>]*>?
|
|
13
13
|
| [gk]'[^']*'?
|
|
14
14
|
| .
|
|
@@ -25,19 +25,19 @@ import{$isCodeNode as e,$createCodeHighlightNode as t,CodeExtension as n,DEFAULT
|
|
|
25
25
|
)?
|
|
26
26
|
| \*[^\)]*\)?
|
|
27
27
|
)?
|
|
28
|
-
| (?:${
|
|
29
|
-
| ${
|
|
28
|
+
| (?:${Dr.source})+
|
|
29
|
+
| ${Or}
|
|
30
30
|
| .
|
|
31
|
-
`.replace(/\s+/g,""),"gsu"),
|
|
31
|
+
`.replace(/\s+/g,""),"gsu"),Fr=new RegExp(Mr`
|
|
32
32
|
\\ (?:
|
|
33
|
-
${
|
|
33
|
+
${Gr}
|
|
34
34
|
| .
|
|
35
35
|
)
|
|
36
36
|
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
37
|
-
| ${
|
|
37
|
+
| ${Or}
|
|
38
38
|
| &&
|
|
39
39
|
| .
|
|
40
|
-
`.replace(/\s+/g,""),"gsu");function Br(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if("string"!=typeof e)throw new Error("String expected as pattern");const r=function(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){const r=e[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if("y"!==r)t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0;else{if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode="g"===e[n+2]?"grapheme":"word",n+=3}}return t}(n.flags),s=[r.extended],i={captureGroup:n.rules.captureGroup,getCurrentModX:()=>s.at(-1),numOpenGroups:0,popModX(){s.pop()},pushModX(e){s.push(e)},replaceCurrentModX(e){s[s.length-1]=e},singleline:n.rules.singleline};let o,a=[];for(Gr.lastIndex=0;o=Gr.exec(e);){const t=Fr(i,e,o[0],Gr.lastIndex);t.tokens?a.push(...t.tokens):t.token&&a.push(t.token),void 0!==t.lastIndex&&(Gr.lastIndex=t.lastIndex)}const l=[];let c=0;a.filter((e=>"GroupOpen"===e.type)).forEach((e=>{"capturing"===e.kind?e.number=++c:"("===e.raw&&l.push(e)})),c||l.forEach(((e,t)=>{e.kind="capturing",e.number=t+1}));const u=c||l.length;return{tokens:a.map((e=>"EscapedNumber"===e.type?function(e,t){const{raw:n,inCharClass:r}=e,s=n.slice(1);if(!r&&("0"!==s&&1===s.length||"0"!==s[0]&&+s<=t))return[qr(n)];const i=[],o=s.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){const t=o[e];let r;if(0===e&&"8"!==t&&"9"!==t){if(r=parseInt(t,8),r>127)throw new Error(Rr`Octal encoded byte above 177 unsupported "${n}"`)}else r=Ir(t);i.push(Vr(r,(0===e?"\\":"")+t))}return i}(e,u):e)).flat(),flags:r}}function Fr(e,t,n,r){const[s,i]=n;if("["===n||"[^"===n){const e=function(e,t,n){const r=[Kr("^"===t[1],t)];let s,i=1;for(Dr.lastIndex=n;s=Dr.exec(e);){const e=s[0];if("["===e[0]&&":"!==e[1])i++,r.push(Kr("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===r.at(-1).type)r.push(Vr(93,e));else if(i--,r.push(Xr(e)),!i)break}else{const t=Ur(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:Dr.lastIndex||e.length}}(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===s){if("AbBGyYzZ".includes(i))return{token:Hr(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:es(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:qr(n)}}if("K"===i)return{token:Zr("keep",n)};if("N"===i||"R"===i)return{token:Qr("newline",n,{negate:"N"===i})};if("O"===i)return{token:Qr("any",n)};if("X"===i)return{token:Qr("text_segment",n)};const e=zr(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if("("===s){if("*"===i)return{token:ss(n)};if("(?{"===n)throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(")"!==t[r])throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:rs(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===n&&!e.captureGroup||"(?:"===n)return{token:Yr("group",n)};if("(?>"===n)return{token:Yr("atomic",n)};if("(?="===n||"(?!"===n||"(?<="===n||"(?<!"===n)return{token:Yr("<"===n[2]?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if("("===n&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:Yr("capturing",n,{..."("!==n&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if("(?~|"===n)throw new Error(`Unsupported absence function kind "${n}"`);return{token:Yr("absence_repeater",n)}}throw"(?("===n?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(")"===n){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Jr(n)}}if(e.getCurrentModX()){if("#"===n){const e=t.indexOf("\n",r);return{lastIndex:-1===e?t.length:e}}if(/^\s$/.test(n)){const e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}if("."===n)return{token:Qr("dot",n)};if("^"===n||"$"===n){return{token:Hr(e.singleline?{"^":Rr`\A`,$:Rr`\Z`}[n]:n,n)}}return"|"===n?{token:Wr(n)}:Or.test(n)?{tokens:as(n)}:{token:Vr(Ir(n),n)}}function Ur(e){if("\\"===e[0])return zr(e,{inCharClass:!0});if("["===e[0]){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Pr.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return Qr("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return"-"===e?function(e){return{type:"CharacterClassHyphen",raw:e}}(e):"&&"===e?function(e){return{type:"CharacterClassIntersector",raw:e}}(e):Vr(Ir(e),e)}function zr(e,{inCharClass:t}){const n=e[1];if("c"===n||"C"===n)return function(e){const t="c"===e[1]?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return Vr(Ir(t.toUpperCase())-64,e)}(e);if("dDhHsSwW".includes(n))return function(e){const t=e[1].toLowerCase();return Qr({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}(e);if(e.startsWith(Rr`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(3===e.length)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return function(e){const{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return Qr("property",e,{value:r,negate:"P"===t&&!n||"p"===t&&!!n})}(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{const t=e.split(/\\x/).slice(1).map((e=>parseInt(e,16))),n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map((e=>{const t=[...r.encode(e)].map((e=>`\\x${e.toString(16)}`)).join("");return Vr(Ir(e),t)}))}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===n||"x"===n)return Vr(function(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t="{"===e[2]?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}(e),e);if(ns.has(n))return Vr(ns.get(n),e);if(/\d/.test(n))return function(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}(t,e);if("\\"===e)throw new Error(Rr`Incomplete escape "\"`);if("M"===n)throw new Error(`Unsupported meta "${e}"`);if(2===[...e].length)return Vr(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function Wr(e){return{type:"Alternator",raw:e}}function Hr(e,t){return{type:"Assertion",kind:e,raw:t}}function qr(e){return{type:"Backreference",raw:e}}function Vr(e,t){return{type:"Character",value:e,raw:t}}function Xr(e){return{type:"CharacterClassClose",raw:e}}function Kr(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function Qr(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function Zr(e,t,n={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:Tr(n.flags),raw:t}}function Jr(e){return{type:"GroupClose",raw:e}}function Yr(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function es(e){return{type:"Subroutine",raw:e}}const ts=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),ns=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function rs(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??="";const s=(t.getCurrentModX()||n.includes("x"))&&!r.includes("x"),i=os(n),o=os(r),a={};if(i&&(a.enable=i),o&&(a.disable=o),e.endsWith(")"))return t.replaceCurrentModX(s),Zr("flags",e,{flags:a});if(e.endsWith(":"))return t.pushModX(s),t.numOpenGroups++,Yr("group",e,{...(i||o)&&{flags:a}});throw new Error(`Unexpected flag modifier "${e}"`)}function ss(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:n,tag:r,args:s}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(""===r)throw new Error(`Named callout tag with empty value not allowed "${e}"`);const i=s?s.split(",").filter((e=>""!==e)).map((e=>/^[+-]?\d+$/.test(e)?+e:e)):[],[o,a,l]=i,c=ts.has(n)?n.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(i.length>0)throw new Error(`Named callout arguments not allowed "${i}"`);break;case"error":if(i.length>1)throw new Error(`Named callout allows only one argument "${i}"`);if("string"==typeof o)throw new Error(`Named callout argument must be a number "${o}"`);break;case"max":if(!i.length||i.length>2)throw new Error(`Named callout must have one or two arguments "${i}"`);if("string"==typeof o&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if(2===i.length&&("number"==typeof a||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);break;case"count":case"total_count":if(i.length>1)throw new Error(`Named callout allows only one argument "${i}"`);if(1===i.length&&("number"==typeof o||!/^[<>X]$/.test(o)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case"cmp":if(3!==i.length)throw new Error(`Named callout must have three arguments "${i}"`);if("string"==typeof o&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if("number"==typeof a||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if("string"==typeof l&&!/^[A-Za-z_]\w*$/.test(l))throw new Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return function(e,t,n,r){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:r}}(c,r??null,s?.split(",")??null,e)}function is(e){let t,n,r=null;if("{"===e[0]){const{minStr:s,maxStr:i}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+s>o||i&&+i>o)throw new Error("Quantifier value unsupported in Oniguruma");if(t=+s,n=void 0===i?+s:""===i?1/0:+i,t>n&&(r="possessive",[t,n]=[n,t]),e.endsWith("?")){if("possessive"===r)throw new Error('Unsupported possessive interval quantifier chain with "?"');r="lazy"}else r||(r="greedy")}else t="+"===e[0]?1:0,n="?"===e[0]?1:1/0,r="+"===e[1]?"possessive":"?"===e[1]?"lazy":"greedy";return function(e,t,n,r){return{type:"Quantifier",kind:e,min:t,max:n,raw:r}}(r,t,n,e)}function os(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function as(e){const t=[],n=new RegExp(Or,"gy");let r;for(;r=n.exec(e);){const e=r[0];if("{"===e[0]){const r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){const{min:s,max:i}=r.groups;if(+s>+i&&e.endsWith("?")){n.lastIndex--,t.push(is(e.slice(0,-1)));continue}}}t.push(is(e))}return t}function ls(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(1!==e.body.length)return!1;const n=e.body[0];return!t||Object.keys(t).every((e=>t[e]===n[e]))}const cs=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function us(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=Br(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(e,t)=>{const n=r.tokens[i.nextIndex];switch(i.parent=e,i.nextIndex++,n.type){case"Alternator":return ms();case"Assertion":return ps(n);case"Backreference":return function({raw:e},t){const n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),s=(n,r=!1)=>{const s=t.capturingGroups.length;let i=!1;if(n>s){if(!t.skipBackrefValidation)throw new Error(`Not enough capturing groups defined to the left "${e}"`);i=!0}return t.hasNumberedRef=!0,fs(r?s+1-n:n,{orphan:i})};if(n){const n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return s(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${e}"`);return fs(r)}return s(+r)}(n,i);case"Character":return ks(n.value,{useLastValid:!!t.isCheckingRangeEnd});case"CharacterClassHyphen":return function(e,t,n){const{tokens:r,walk:s}=t,i=t.parent,o=i.body.at(-1),a=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&"CharacterClass"!==o.type&&"CharacterClassRange"!==o.type&&a&&"CharacterClassOpen"!==a.type&&"CharacterClassClose"!==a.type&&"CharacterClassIntersector"!==a.type){const e=s(i,{...n,isCheckingRangeEnd:!0});if("Character"===o.type&&"Character"===e.type)return i.body.pop(),function(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}(o,e);throw new Error("Invalid character class range")}return ks(Ir("-"))}(0,i,t);case"CharacterClassOpen":return function({negate:e},t,n){const{tokens:r,walk:s}=t,i=r[t.nextIndex],o=[bs()];let a=Ps(i);for(;"CharacterClassClose"!==a.type;){if("CharacterClassIntersector"===a.type)o.push(bs()),t.nextIndex++;else{const e=o.at(-1);e.body.push(s(e,n))}a=Ps(r[t.nextIndex],i)}const l=bs({negate:e});return 1===o.length?l.body=o[0].body:(l.kind="intersection",l.body=o.map((e=>1===e.body.length?e.body[0]:e))),t.nextIndex++,l}(n,i,t);case"CharacterSet":return hs(n,i);case"Directive":return Cs(n.kind,{flags:n.flags});case"GroupOpen":return function(e,t,n){const{tokens:r,capturingGroups:s,namedGroupsByName:i,skipLookbehindValidation:o,walk:a}=t,l=function({flags:e,kind:t,name:n,negate:r,number:s}){switch(t){case"absence_repeater":return function(e,t){return{type:"AbsenceFunction",kind:e,body:As(t?.body)}}("repeater");case"atomic":return _s({atomic:!0});case"capturing":return ys(s,{name:n});case"group":return _s({flags:e});case"lookahead":case"lookbehind":return Ss({behind:"lookbehind"===t,negate:r});default:throw new Error(`Unexpected group kind "${t}"`)}}(e),c="AbsenceFunction"===l.type,u=Ls(l),p=u&&l.negate;if("CapturingGroup"===l.type&&(s.push(l),l.name&&function(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}(i,l.name,[]).push(l)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=Rs(r[t.nextIndex]);for(;"GroupClose"!==h.type;){if("Alternator"===h.type)l.body.push(ms()),t.nextIndex++;else{const e=l.body.at(-1),t=a(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||p});if(e.body.push(t),(u||n.isInLookbehind)&&!o){const e="Lookbehind includes a pattern not allowed by Oniguruma";if(p||n.isInNegLookbehind){if(Es(t)||"CapturingGroup"===t.type)throw new Error(e)}else if(Es(t)||Ls(t)&&t.negate)throw new Error(e)}}h=Rs(r[t.nextIndex])}return t.nextIndex++,l}(n,i,t);case"NamedCallout":return function(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}(n.kind,n.tag,n.arguments);case"Quantifier":return ds(n,i);case"Subroutine":return function({raw:e},t){const{capturingGroups:n,subroutines:r}=t;let s=e.slice(3,-1);const i=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(i){const e=+i.groups.num,r=n.length;if(t.hasNumberedRef=!0,s={"":e,"+":r+e,"-":r+1-e}[i.groups.sign],s<1)throw new Error("Invalid subroutine number")}else"0"===s&&(s=0);const o=xs(s);return r.push(o),o}(n,i);default:throw new Error(`Unexpected token type "${n.type}"`)}},i={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:s},o=function(e,t){return{type:"Regex",body:As(t?.body),flags:e}}(function(e){return{type:"Flags",...e}}(r.flags));let a=o.body[0];for(;i.nextIndex<r.tokens.length;){const e=s(a,{});"Alternative"===e.type?(o.body.push(e),a=e):a.body.push(e)}const{capturingGroups:l,hasNumberedRef:c,namedGroupsByName:u,subroutines:p}=i;if(c&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:e}of p)if("number"==typeof e){if(e>l.length)throw new Error("Subroutine uses a group number that's not defined");e&&(l[e-1].isSubroutined=!0)}else{if(!u.has(e))throw new Error(Rr`Subroutine uses a group name that's not defined "\g<${e}>"`);if(u.get(e).length>1)throw new Error(Rr`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}return o}function ps({kind:e}){return gs(Tr({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===Rr`\B`||e===Rr`\Y`})}function hs({kind:e,negate:t,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:i,unicodePropertyMap:o}=r;if("property"===e){const r=Is(n);if(!Pr.has(r)||o?.has(r))return Ns(n,{negate:t,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:i,unicodePropertyMap:o});e="posix",n=r}return"posix"===e?function(e,t){const n=!!t?.negate;if(!Pr.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}(n,{negate:t}):ws(e,{negate:t})}function ds({kind:e,min:t,max:n},r){const s=r.parent,i=s.body.at(-1);if(!i||!function(e){return cs.has(e.type)}(i))throw new Error("Quantifier requires a repeatable token");const o=vs(e,t,n,i);return s.body.pop(),o}function ms(e){return{type:"Alternative",body:js(e?.body)}}function gs(e,t){const n={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(n.negate=!!t?.negate),n}function fs(e,t){const n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function ys(e,t){const n={name:void 0,isSubroutined:!1,...t};if(void 0!==n.name&&!function(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:As(t?.body)}}function ks(e,t){const n={useLastValid:!1,...t};if(e>1114111){const t=e.toString(16);if(!n.useLastValid)throw e>1310719?new Error(`Invalid code point out of range "\\x{${t}}"`):new Error(`Invalid code point out of range in JS "\\x{${t}}"`);e=1114111}return{type:"Character",value:e}}function bs(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:js(e?.body)}}function ws(e,t){const n=!!t?.negate,r={type:"CharacterSet",kind:e};return("digit"===e||"hex"===e||"newline"===e||"space"===e||"word"===e)&&(r.negate=n),("text_segment"===e||"newline"===e&&!n)&&(r.variableLength=!0),r}function Cs(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:Tr(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function _s(e){const t=e?.atomic,n=e?.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:As(e?.body)}}function Ss(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:As(e?.body)}}function vs(e,t,n,r){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:r}}function xs(e){return{type:"Subroutine",ref:e}}function Ns(e,t){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let r=n.unicodePropertyMap?.get(Is(e));if(!r)if(n.normalizeUnknownPropertyNames)r=function(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,(e=>e[0].toUpperCase()+e.slice(1).toLowerCase()))}(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(Rr`Invalid Unicode property "\p{${e}}"`);return{type:"CharacterSet",kind:"property",value:r??e,negate:n.negate}}function As(e){if(void 0===e)e=[ms()];else if(!Array.isArray(e)||!e.length||!e.every((e=>"Alternative"===e.type)))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function js(e){if(void 0===e)e=[];else if(!Array.isArray(e)||!e.every((e=>!!e.type)))throw new Error("Invalid body; expected array of nodes");return e}function Es(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function Ls(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function Is(e){return e.replace(/[- _]+/g,"").toLowerCase()}function Ps(e,t){return Tr(e,("Character"===t?.type&&93===t.value?"Empty":"Unclosed")+" character class")}function Rs(e){return Tr(e,"Unclosed group")}function Ts(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){const r=s(e[n],t,n,e);n=Math.max(-1,n+r)}}function s(i,o=null,a=null,l=null){let c=0,u=!1;const p={node:i,parent:o,key:a,container:l,root:e,remove(){Ms(l).splice(Math.max(0,$s(a)+c),1),c--,u=!0},removeAllNextSiblings:()=>Ms(l).splice($s(a)+1),removeAllPrevSiblings(){const e=$s(a)+c;return c-=e,Ms(l).splice(0,Math.max(0,e))},replaceWith(e,t={}){const n=!!t.traverse;l?l[Math.max(0,$s(a)+c)]=e:Tr(o,"Can't replace root node")[a]=e,n&&s(e,o,a,l),u=!0},replaceWithMultiple(e,t={}){const n=!!t.traverse;if(Ms(l).splice(Math.max(0,$s(a)+c),1,...e),c+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=s(e[n],o,$s(a)+n+t,l)}u=!0},skip(){u=!0}},{type:h}=i,d=t["*"],m=t[h],g="function"==typeof d?d:d?.enter,f="function"==typeof m?m:m?.enter;if(g?.(p,n),f?.(p,n),!u)switch(h){case"AbsenceFunction":case"CapturingGroup":case"Group":case"Alternative":case"CharacterClass":case"LookaroundAssertion":r(i.body,i);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(i.min,i,"min"),s(i.max,i,"max");break;case"Quantifier":s(i.body,i,"body");break;case"Regex":r(i.body,i),s(i.flags,i,"flags");break;default:throw new Error(`Unexpected node type "${h}"`)}return m?.exit?.(p,n),d?.exit?.(p,n),c}return s(e),e}function Ms(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function $s(e){if("number"!=typeof e)throw new Error("Numeric key expected");return e}const Os=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Gs(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}const Ds=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Bs(e,t,n,r){const s=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),i=[!1];let o=0,a="";for(const t of e.matchAll(s)){const{0:e,groups:{$skip:s}}=t;s||r&&r===Ds.DEFAULT!=!o?("["===e[0]?(o++,i.push("^"===e[1])):"]"===e&&o&&(o--,i.pop()),a+=e):a+=n instanceof Function?n(t,{context:o?Ds.CHAR_CLASS:Ds.DEFAULT,negated:i[i.length-1]}):n}return a}function Fs(e,t,n,r){Bs(e,t,n,r)}function Us(e,t,n){return!!function(e,t,n=0,r){if(!new RegExp(t,"su").test(e))return null;const s=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let i,o=0;for(;i=s.exec(e);){const{0:e,groups:{$skip:t}}=i;if(!(t||r&&r===Ds.DEFAULT!=!o))return i;"["===e?o++:"]"===e&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}(e,t,0,n)}function zs(e,t){const n=/\\?./gsu;n.lastIndex=t;let r,s=e.length,i=0,o=1;for(;r=n.exec(e);){const[e]=r;if("["===e)i++;else if(i)"]"===e&&i--;else if("("===e)o++;else if(")"===e&&(o--,!o)){s=r.index;break}}return e.slice(t,s)}const Ws=new RegExp(String.raw`(?<noncapturingStart>${Os})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");const Hs=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,qs=new RegExp(String.raw`
|
|
40
|
+
`.replace(/\s+/g,""),"gsu");function Ur(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if("string"!=typeof e)throw new Error("String expected as pattern");const r=function(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){const r=e[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if("y"!==r)t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0;else{if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode="g"===e[n+2]?"grapheme":"word",n+=3}}return t}(n.flags),s=[r.extended],i={captureGroup:n.rules.captureGroup,getCurrentModX:()=>s.at(-1),numOpenGroups:0,popModX(){s.pop()},pushModX(e){s.push(e)},replaceCurrentModX(e){s[s.length-1]=e},singleline:n.rules.singleline};let o,a=[];for(Br.lastIndex=0;o=Br.exec(e);){const t=zr(i,e,o[0],Br.lastIndex);t.tokens?a.push(...t.tokens):t.token&&a.push(t.token),void 0!==t.lastIndex&&(Br.lastIndex=t.lastIndex)}const l=[];let c=0;a.filter(e=>"GroupOpen"===e.type).forEach(e=>{"capturing"===e.kind?e.number=++c:"("===e.raw&&l.push(e)}),c||l.forEach((e,t)=>{e.kind="capturing",e.number=t+1});const u=c||l.length;return{tokens:a.map(e=>"EscapedNumber"===e.type?function(e,t){const{raw:n,inCharClass:r}=e,s=n.slice(1);if(!r&&("0"!==s&&1===s.length||"0"!==s[0]&&+s<=t))return[Xr(n)];const i=[],o=s.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){const t=o[e];let r;if(0===e&&"8"!==t&&"9"!==t){if(r=parseInt(t,8),r>127)throw new Error(Mr`Octal encoded byte above 177 unsupported "${n}"`)}else r=Rr(t);i.push(Kr(r,(0===e?"\\":"")+t))}return i}(e,u):e).flat(),flags:r}}function zr(e,t,n,r){const[s,i]=n;if("["===n||"[^"===n){const e=function(e,t,n){const r=[Zr("^"===t[1],t)];let s,i=1;for(Fr.lastIndex=n;s=Fr.exec(e);){const e=s[0];if("["===e[0]&&":"!==e[1])i++,r.push(Zr("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===r.at(-1).type)r.push(Kr(93,e));else if(i--,r.push(Qr(e)),!i)break}else{const t=Wr(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:Fr.lastIndex||e.length}}(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===s){if("AbBGyYzZ".includes(i))return{token:Vr(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:ns(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Xr(n)}}if("K"===i)return{token:Yr("keep",n)};if("N"===i||"R"===i)return{token:Jr("newline",n,{negate:"N"===i})};if("O"===i)return{token:Jr("any",n)};if("X"===i)return{token:Jr("text_segment",n)};const e=Hr(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if("("===s){if("*"===i)return{token:os(n)};if("(?{"===n)throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(")"!==t[r])throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:is(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===n&&!e.captureGroup||"(?:"===n)return{token:ts("group",n)};if("(?>"===n)return{token:ts("atomic",n)};if("(?="===n||"(?!"===n||"(?<="===n||"(?<!"===n)return{token:ts("<"===n[2]?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if("("===n&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:ts("capturing",n,{..."("!==n&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if("(?~|"===n)throw new Error(`Unsupported absence function kind "${n}"`);return{token:ts("absence_repeater",n)}}throw"(?("===n?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(")"===n){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:es(n)}}if(e.getCurrentModX()){if("#"===n){const e=t.indexOf("\n",r);return{lastIndex:-1===e?t.length:e}}if(/^\s$/.test(n)){const e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}if("."===n)return{token:Jr("dot",n)};if("^"===n||"$"===n){return{token:Vr(e.singleline?{"^":Mr`\A`,$:Mr`\Z`}[n]:n,n)}}return"|"===n?{token:qr(n)}:Dr.test(n)?{tokens:cs(n)}:{token:Kr(Rr(n),n)}}function Wr(e){if("\\"===e[0])return Hr(e,{inCharClass:!0});if("["===e[0]){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Tr.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return Jr("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return"-"===e?function(e){return{type:"CharacterClassHyphen",raw:e}}(e):"&&"===e?function(e){return{type:"CharacterClassIntersector",raw:e}}(e):Kr(Rr(e),e)}function Hr(e,{inCharClass:t}){const n=e[1];if("c"===n||"C"===n)return function(e){const t="c"===e[1]?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return Kr(Rr(t.toUpperCase())-64,e)}(e);if("dDhHsSwW".includes(n))return function(e){const t=e[1].toLowerCase();return Jr({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}(e);if(e.startsWith(Mr`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(3===e.length)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return function(e){const{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return Jr("property",e,{value:r,negate:"P"===t&&!n||"p"===t&&!!n})}(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{const t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{const t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join("");return Kr(Rr(e),t)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===n||"x"===n)return Kr(function(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t="{"===e[2]?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}(e),e);if(ss.has(n))return Kr(ss.get(n),e);if(/\d/.test(n))return function(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}(t,e);if("\\"===e)throw new Error(Mr`Incomplete escape "\"`);if("M"===n)throw new Error(`Unsupported meta "${e}"`);if(2===[...e].length)return Kr(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function qr(e){return{type:"Alternator",raw:e}}function Vr(e,t){return{type:"Assertion",kind:e,raw:t}}function Xr(e){return{type:"Backreference",raw:e}}function Kr(e,t){return{type:"Character",value:e,raw:t}}function Qr(e){return{type:"CharacterClassClose",raw:e}}function Zr(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function Jr(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function Yr(e,t,n={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:$r(n.flags),raw:t}}function es(e){return{type:"GroupClose",raw:e}}function ts(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function ns(e){return{type:"Subroutine",raw:e}}const rs=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),ss=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function is(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??="";const s=(t.getCurrentModX()||n.includes("x"))&&!r.includes("x"),i=ls(n),o=ls(r),a={};if(i&&(a.enable=i),o&&(a.disable=o),e.endsWith(")"))return t.replaceCurrentModX(s),Yr("flags",e,{flags:a});if(e.endsWith(":"))return t.pushModX(s),t.numOpenGroups++,ts("group",e,{...(i||o)&&{flags:a}});throw new Error(`Unexpected flag modifier "${e}"`)}function os(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:n,tag:r,args:s}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(""===r)throw new Error(`Named callout tag with empty value not allowed "${e}"`);const i=s?s.split(",").filter(e=>""!==e).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,a,l]=i,c=rs.has(n)?n.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(i.length>0)throw new Error(`Named callout arguments not allowed "${i}"`);break;case"error":if(i.length>1)throw new Error(`Named callout allows only one argument "${i}"`);if("string"==typeof o)throw new Error(`Named callout argument must be a number "${o}"`);break;case"max":if(!i.length||i.length>2)throw new Error(`Named callout must have one or two arguments "${i}"`);if("string"==typeof o&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if(2===i.length&&("number"==typeof a||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);break;case"count":case"total_count":if(i.length>1)throw new Error(`Named callout allows only one argument "${i}"`);if(1===i.length&&("number"==typeof o||!/^[<>X]$/.test(o)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case"cmp":if(3!==i.length)throw new Error(`Named callout must have three arguments "${i}"`);if("string"==typeof o&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if("number"==typeof a||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if("string"==typeof l&&!/^[A-Za-z_]\w*$/.test(l))throw new Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return function(e,t,n,r){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:r}}(c,r??null,s?.split(",")??null,e)}function as(e){let t,n,r=null;if("{"===e[0]){const{minStr:s,maxStr:i}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+s>o||i&&+i>o)throw new Error("Quantifier value unsupported in Oniguruma");if(t=+s,n=void 0===i?+s:""===i?1/0:+i,t>n&&(r="possessive",[t,n]=[n,t]),e.endsWith("?")){if("possessive"===r)throw new Error('Unsupported possessive interval quantifier chain with "?"');r="lazy"}else r||(r="greedy")}else t="+"===e[0]?1:0,n="?"===e[0]?1:1/0,r="+"===e[1]?"possessive":"?"===e[1]?"lazy":"greedy";return function(e,t,n,r){return{type:"Quantifier",kind:e,min:t,max:n,raw:r}}(r,t,n,e)}function ls(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function cs(e){const t=[],n=new RegExp(Dr,"gy");let r;for(;r=n.exec(e);){const e=r[0];if("{"===e[0]){const r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){const{min:s,max:i}=r.groups;if(+s>+i&&e.endsWith("?")){n.lastIndex--,t.push(as(e.slice(0,-1)));continue}}}t.push(as(e))}return t}function us(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(1!==e.body.length)return!1;const n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}const ps=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function hs(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=Ur(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(e,t)=>{const n=r.tokens[i.nextIndex];switch(i.parent=e,i.nextIndex++,n.type){case"Alternator":return fs();case"Assertion":return ds(n);case"Backreference":return function({raw:e},t){const n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),s=(n,r=!1)=>{const s=t.capturingGroups.length;let i=!1;if(n>s){if(!t.skipBackrefValidation)throw new Error(`Not enough capturing groups defined to the left "${e}"`);i=!0}return t.hasNumberedRef=!0,ks(r?s+1-n:n,{orphan:i})};if(n){const n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return s(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${e}"`);return ks(r)}return s(+r)}(n,i);case"Character":return ws(n.value,{useLastValid:!!t.isCheckingRangeEnd});case"CharacterClassHyphen":return function(e,t,n){const{tokens:r,walk:s}=t,i=t.parent,o=i.body.at(-1),a=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&"CharacterClass"!==o.type&&"CharacterClassRange"!==o.type&&a&&"CharacterClassOpen"!==a.type&&"CharacterClassClose"!==a.type&&"CharacterClassIntersector"!==a.type){const e=s(i,{...n,isCheckingRangeEnd:!0});if("Character"===o.type&&"Character"===e.type)return i.body.pop(),function(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}(o,e);throw new Error("Invalid character class range")}return ws(Rr("-"))}(0,i,t);case"CharacterClassOpen":return function({negate:e},t,n){const{tokens:r,walk:s}=t,i=r[t.nextIndex],o=[Cs()];let a=Ts(i);for(;"CharacterClassClose"!==a.type;){if("CharacterClassIntersector"===a.type)o.push(Cs()),t.nextIndex++;else{const e=o.at(-1);e.body.push(s(e,n))}a=Ts(r[t.nextIndex],i)}const l=Cs({negate:e});return 1===o.length?l.body=o[0].body:(l.kind="intersection",l.body=o.map(e=>1===e.body.length?e.body[0]:e)),t.nextIndex++,l}(n,i,t);case"CharacterSet":return ms(n,i);case"Directive":return Ss(n.kind,{flags:n.flags});case"GroupOpen":return function(e,t,n){const{tokens:r,capturingGroups:s,namedGroupsByName:i,skipLookbehindValidation:o,walk:a}=t,l=function({flags:e,kind:t,name:n,negate:r,number:s}){switch(t){case"absence_repeater":return function(e,t){return{type:"AbsenceFunction",kind:e,body:Es(t?.body)}}("repeater");case"atomic":return vs({atomic:!0});case"capturing":return bs(s,{name:n});case"group":return vs({flags:e});case"lookahead":case"lookbehind":return xs({behind:"lookbehind"===t,negate:r});default:throw new Error(`Unexpected group kind "${t}"`)}}(e),c="AbsenceFunction"===l.type,u=Ps(l),p=u&&l.negate;if("CapturingGroup"===l.type&&(s.push(l),l.name&&function(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}(i,l.name,[]).push(l)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=Ms(r[t.nextIndex]);for(;"GroupClose"!==h.type;){if("Alternator"===h.type)l.body.push(fs()),t.nextIndex++;else{const e=l.body.at(-1),t=a(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||p});if(e.body.push(t),(u||n.isInLookbehind)&&!o){const e="Lookbehind includes a pattern not allowed by Oniguruma";if(p||n.isInNegLookbehind){if(Is(t)||"CapturingGroup"===t.type)throw new Error(e)}else if(Is(t)||Ps(t)&&t.negate)throw new Error(e)}}h=Ms(r[t.nextIndex])}return t.nextIndex++,l}(n,i,t);case"NamedCallout":return function(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}(n.kind,n.tag,n.arguments);case"Quantifier":return gs(n,i);case"Subroutine":return function({raw:e},t){const{capturingGroups:n,subroutines:r}=t;let s=e.slice(3,-1);const i=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(i){const e=+i.groups.num,r=n.length;if(t.hasNumberedRef=!0,s={"":e,"+":r+e,"-":r+1-e}[i.groups.sign],s<1)throw new Error("Invalid subroutine number")}else"0"===s&&(s=0);const o=As(s);return r.push(o),o}(n,i);default:throw new Error(`Unexpected token type "${n.type}"`)}},i={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:s},o=function(e,t){return{type:"Regex",body:Es(t?.body),flags:e}}(function(e){return{type:"Flags",...e}}(r.flags));let a=o.body[0];for(;i.nextIndex<r.tokens.length;){const e=s(a,{});"Alternative"===e.type?(o.body.push(e),a=e):a.body.push(e)}const{capturingGroups:l,hasNumberedRef:c,namedGroupsByName:u,subroutines:p}=i;if(c&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:e}of p)if("number"==typeof e){if(e>l.length)throw new Error("Subroutine uses a group number that's not defined");e&&(l[e-1].isSubroutined=!0)}else{if(!u.has(e))throw new Error(Mr`Subroutine uses a group name that's not defined "\g<${e}>"`);if(u.get(e).length>1)throw new Error(Mr`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}return o}function ds({kind:e}){return ys($r({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===Mr`\B`||e===Mr`\Y`})}function ms({kind:e,negate:t,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:i,unicodePropertyMap:o}=r;if("property"===e){const r=Rs(n);if(!Tr.has(r)||o?.has(r))return js(n,{negate:t,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:i,unicodePropertyMap:o});e="posix",n=r}return"posix"===e?function(e,t){const n=!!t?.negate;if(!Tr.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}(n,{negate:t}):_s(e,{negate:t})}function gs({kind:e,min:t,max:n},r){const s=r.parent,i=s.body.at(-1);if(!i||!function(e){return ps.has(e.type)}(i))throw new Error("Quantifier requires a repeatable token");const o=Ns(e,t,n,i);return s.body.pop(),o}function fs(e){return{type:"Alternative",body:Ls(e?.body)}}function ys(e,t){const n={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(n.negate=!!t?.negate),n}function ks(e,t){const n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function bs(e,t){const n={name:void 0,isSubroutined:!1,...t};if(void 0!==n.name&&!function(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Es(t?.body)}}function ws(e,t){const n={useLastValid:!1,...t};if(e>1114111){const t=e.toString(16);if(!n.useLastValid)throw e>1310719?new Error(`Invalid code point out of range "\\x{${t}}"`):new Error(`Invalid code point out of range in JS "\\x{${t}}"`);e=1114111}return{type:"Character",value:e}}function Cs(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:Ls(e?.body)}}function _s(e,t){const n=!!t?.negate,r={type:"CharacterSet",kind:e};return("digit"===e||"hex"===e||"newline"===e||"space"===e||"word"===e)&&(r.negate=n),("text_segment"===e||"newline"===e&&!n)&&(r.variableLength=!0),r}function Ss(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:$r(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function vs(e){const t=e?.atomic,n=e?.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:Es(e?.body)}}function xs(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:Es(e?.body)}}function Ns(e,t,n,r){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:r}}function As(e){return{type:"Subroutine",ref:e}}function js(e,t){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let r=n.unicodePropertyMap?.get(Rs(e));if(!r)if(n.normalizeUnknownPropertyNames)r=function(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(Mr`Invalid Unicode property "\p{${e}}"`);return{type:"CharacterSet",kind:"property",value:r??e,negate:n.negate}}function Es(e){if(void 0===e)e=[fs()];else if(!Array.isArray(e)||!e.length||!e.every(e=>"Alternative"===e.type))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function Ls(e){if(void 0===e)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return e}function Is(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function Ps(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function Rs(e){return e.replace(/[- _]+/g,"").toLowerCase()}function Ts(e,t){return $r(e,("Character"===t?.type&&93===t.value?"Empty":"Unclosed")+" character class")}function Ms(e){return $r(e,"Unclosed group")}function $s(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){const r=s(e[n],t,n,e);n=Math.max(-1,n+r)}}function s(i,o=null,a=null,l=null){let c=0,u=!1;const p={node:i,parent:o,key:a,container:l,root:e,remove(){Os(l).splice(Math.max(0,Gs(a)+c),1),c--,u=!0},removeAllNextSiblings:()=>Os(l).splice(Gs(a)+1),removeAllPrevSiblings(){const e=Gs(a)+c;return c-=e,Os(l).splice(0,Math.max(0,e))},replaceWith(e,t={}){const n=!!t.traverse;l?l[Math.max(0,Gs(a)+c)]=e:$r(o,"Can't replace root node")[a]=e,n&&s(e,o,a,l),u=!0},replaceWithMultiple(e,t={}){const n=!!t.traverse;if(Os(l).splice(Math.max(0,Gs(a)+c),1,...e),c+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=s(e[n],o,Gs(a)+n+t,l)}u=!0},skip(){u=!0}},{type:h}=i,d=t["*"],m=t[h],g="function"==typeof d?d:d?.enter,f="function"==typeof m?m:m?.enter;if(g?.(p,n),f?.(p,n),!u)switch(h){case"AbsenceFunction":case"CapturingGroup":case"Group":case"Alternative":case"CharacterClass":case"LookaroundAssertion":r(i.body,i);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(i.min,i,"min"),s(i.max,i,"max");break;case"Quantifier":s(i.body,i,"body");break;case"Regex":r(i.body,i),s(i.flags,i,"flags");break;default:throw new Error(`Unexpected node type "${h}"`)}return m?.exit?.(p,n),d?.exit?.(p,n),c}return s(e),e}function Os(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function Gs(e){if("number"!=typeof e)throw new Error("Numeric key expected");return e}const Ds=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Bs(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Fs(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}const Us=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function zs(e,t,n,r){const s=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),i=[!1];let o=0,a="";for(const t of e.matchAll(s)){const{0:e,groups:{$skip:s}}=t;s||r&&r===Us.DEFAULT!=!o?("["===e[0]?(o++,i.push("^"===e[1])):"]"===e&&o&&(o--,i.pop()),a+=e):a+=n instanceof Function?n(t,{context:o?Us.CHAR_CLASS:Us.DEFAULT,negated:i[i.length-1]}):n}return a}function Ws(e,t,n,r){zs(e,t,n,r)}function Hs(e,t,n){return!!function(e,t,n=0,r){if(!new RegExp(t,"su").test(e))return null;const s=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let i,o=0;for(;i=s.exec(e);){const{0:e,groups:{$skip:t}}=i;if(!(t||r&&r===Us.DEFAULT!=!o))return i;"["===e?o++:"]"===e&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}(e,t,0,n)}function qs(e,t){const n=/\\?./gsu;n.lastIndex=t;let r,s=e.length,i=0,o=1;for(;r=n.exec(e);){const[e]=r;if("["===e)i++;else if(i)"]"===e&&i--;else if("("===e)o++;else if(")"===e&&(o--,!o)){s=r.index;break}}return e.slice(t,s)}const Vs=new RegExp(String.raw`(?<noncapturingStart>${Ds})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");const Xs=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Ks=new RegExp(String.raw`
|
|
41
41
|
\\(?: \d+
|
|
42
42
|
| c[A-Za-z]
|
|
43
43
|
| [gk]<[^>]+>
|
|
@@ -50,6 +50,6 @@ import{$isCodeNode as e,$createCodeHighlightNode as t,CodeExtension as n,DEFAULT
|
|
|
50
50
|
| [A-Za-z\-]+:
|
|
51
51
|
| \(DEFINE\)
|
|
52
52
|
))?
|
|
53
|
-
| (?<qBase>${
|
|
53
|
+
| (?<qBase>${Xs})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
54
54
|
| \\?.
|
|
55
|
-
`.replace(/\s+/g,""),"gsu");const Vs=String.raw,Xs=Vs`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Ks=Vs`\(\?R=(?<rDepth>[^\)]+)\)|${Xs}`,Qs=Vs`\(\?<(?![=!])(?<captureName>[^>]+)>`,Zs=Vs`${Qs}|(?<unnamed>\()(?!\?)`,Js=new RegExp(Vs`${Qs}|${Ks}|\(\?|\\?.`,"gsu"),Ys="Cannot use multiple overlapping recursions";function ei(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if((e=+e)<2||e>100)throw new Error(t)}function ti(e,t,n,r,s,i,o){const a=new Set;r&&Fs(e+t,Qs,(({groups:{captureName:e}})=>{a.add(e)}),Ds.DEFAULT);const l=[n,r?a:null,s,i,o];return`${e}${ni(`(?:${e}`,"forward",...l)}(?:)${ni(`${t})`,"backward",...l)}${t}`}function ni(e,t,n,r,s,i,o){const a=e=>"forward"===t?e+2:n-e+2-1;let l="";for(let t=0;t<n;t++){const n=a(t);l+=Bs(e,Vs`${Zs}|\\k<(?<backref>[^>]+)>`,(({0:e,groups:{captureName:t,unnamed:a,backref:l}})=>{if(l&&r&&!r.has(l))return e;const c=`_$${n}`;if(a||t){const n=o+i.length+1;return i.push(n),ri(s,n),a?e:`(?<${t}${c}>`}return Vs`\k<${l}${c}>`}),Ds.DEFAULT)}return l}function ri(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function si(e,t,n,r,s,i){if(e.size&&r){let o=0;Fs(t,Zs,(()=>o++),Ds.DEFAULT);const a=i-o+s,l=new Map;return e.forEach(((e,t)=>{const s=(r-o*n)/n,i=o*n,c=t>a+o?t+r:t,u=[];for(const t of e)if(t<=a)u.push(t);else if(t>a+o+s)u.push(t+r);else if(t<=a+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+i+s*e);l.set(c,u)})),l}return e}var ii=String.fromCodePoint,oi=String.raw,ai={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("","v")}catch{return!1}return!0})()};function li(e,{enable:t,disable:n}){return{dotAll:!(n?.dotAll||!t?.dotAll&&!e.dotAll),ignoreCase:!(n?.ignoreCase||!t?.ignoreCase&&!e.ignoreCase)}}function ci(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function ui(e,t){return pi[e]>=pi[t]}ai.bugFlagVLiteralHyphenIsRange=!!ai.unicodeSets&&(()=>{try{new RegExp(oi`[\d\-a]`,"v")}catch{return!0}return!1})(),ai.bugNestedClassIgnoresNegation=ai.unicodeSets&&new RegExp("[[^a]]","v").test("a");var pi={ES2025:2025,ES2024:2024,ES2018:2018},hi={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function di(e={}){if("[object Object]"!=={}.toString.call(e))throw new Error("Unexpected options");if(void 0!==e.target&&!hi[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return"auto"===t.target&&(t.target=ai.flagGroups?"ES2025":ai.unicodeSets?"ES2024":"ES2018"),t}var mi=new Set([ii(304),ii(305)]),gi=oi`[\p{L}\p{M}\p{N}\p{Pc}]`;function fi(e){if(mi.has(e))return[e];const t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),s=wi.get(n),i=ki.get(n),o=bi.get(n);return 1===[...r].length&&t.add(r),o&&t.add(o),s&&t.add(s),t.add(n),i&&t.add(i),[...t]}var yi=new Map("C Other\nCc Control cntrl\nCf Format\nCn Unassigned\nCo Private_Use\nCs Surrogate\nL Letter\nLC Cased_Letter\nLl Lowercase_Letter\nLm Modifier_Letter\nLo Other_Letter\nLt Titlecase_Letter\nLu Uppercase_Letter\nM Mark Combining_Mark\nMc Spacing_Mark\nMe Enclosing_Mark\nMn Nonspacing_Mark\nN Number\nNd Decimal_Number digit\nNl Letter_Number\nNo Other_Number\nP Punctuation punct\nPc Connector_Punctuation\nPd Dash_Punctuation\nPe Close_Punctuation\nPf Final_Punctuation\nPi Initial_Punctuation\nPo Other_Punctuation\nPs Open_Punctuation\nS Symbol\nSc Currency_Symbol\nSk Modifier_Symbol\nSm Math_Symbol\nSo Other_Symbol\nZ Separator\nZl Line_Separator\nZp Paragraph_Separator\nZs Space_Separator\nASCII\nASCII_Hex_Digit AHex\nAlphabetic Alpha\nAny\nAssigned\nBidi_Control Bidi_C\nBidi_Mirrored Bidi_M\nCase_Ignorable CI\nCased\nChanges_When_Casefolded CWCF\nChanges_When_Casemapped CWCM\nChanges_When_Lowercased CWL\nChanges_When_NFKC_Casefolded CWKCF\nChanges_When_Titlecased CWT\nChanges_When_Uppercased CWU\nDash\nDefault_Ignorable_Code_Point DI\nDeprecated Dep\nDiacritic Dia\nEmoji\nEmoji_Component EComp\nEmoji_Modifier EMod\nEmoji_Modifier_Base EBase\nEmoji_Presentation EPres\nExtended_Pictographic ExtPict\nExtender Ext\nGrapheme_Base Gr_Base\nGrapheme_Extend Gr_Ext\nHex_Digit Hex\nIDS_Binary_Operator IDSB\nIDS_Trinary_Operator IDST\nID_Continue IDC\nID_Start IDS\nIdeographic Ideo\nJoin_Control Join_C\nLogical_Order_Exception LOE\nLowercase Lower\nMath\nNoncharacter_Code_Point NChar\nPattern_Syntax Pat_Syn\nPattern_White_Space Pat_WS\nQuotation_Mark QMark\nRadical\nRegional_Indicator RI\nSentence_Terminal STerm\nSoft_Dotted SD\nTerminal_Punctuation Term\nUnified_Ideograph UIdeo\nUppercase Upper\nVariation_Selector VS\nWhite_Space space\nXID_Continue XIDC\nXID_Start XIDS".split(/\s/).map((e=>[Is(e),e]))),ki=new Map([["s",ii(383)],[ii(383),"s"]]),bi=new Map([[ii(223),ii(7838)],[ii(107),ii(8490)],[ii(229),ii(8491)],[ii(969),ii(8486)]]),wi=new Map([_i(453),_i(456),_i(459),_i(498),...Si(8072,8079),...Si(8088,8095),...Si(8104,8111),_i(8124),_i(8140),_i(8188)]),Ci=new Map([["alnum",oi`[\p{Alpha}\p{Nd}]`],["alpha",oi`\p{Alpha}`],["ascii",oi`\p{ASCII}`],["blank",oi`[\p{Zs}\t]`],["cntrl",oi`\p{Cc}`],["digit",oi`\p{Nd}`],["graph",oi`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",oi`\p{Lower}`],["print",oi`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",oi`[\p{P}\p{S}]`],["space",oi`\p{space}`],["upper",oi`\p{Upper}`],["word",oi`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",oi`\p{AHex}`]]);function _i(e){const t=ii(e);return[t.toLowerCase(),t]}function Si(e,t){return function(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}(e,t).map((e=>_i(e)))}var vi=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);var xi={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:s}=e;if("repeater"!==s)throw new Error('Unsupported absence function "(?~|"');{const e=_s();e.body[0].body.push(Ss({negate:!0,body:r}),Ns("Any"));const s=_s();s.body[0].body.push(vs("greedy",0,1/0,e)),n(Fi(s,t),{traverse:!0})}},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){const s=e.body.filter((e=>"flags"===e.kind));for(let e=n+1;e<t.body.length;e++){ci(r,t.body[e],[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=Pi(t.get(e));if(n){const t=_s({flags:n});t.body[0].body=e.body,e.body=[Fi(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:s,remove:i,replaceWith:o},a){const{kind:l,negate:c}=e,{asciiWordBoundaries:u,avoidSubclass:p,supportedGNodes:h,wordIsAscii:d}=a;if("text_segment_boundary"===l)throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if("line_end"===l)o(Fi(Ss({body:[ms({body:[gs("string_end")]}),ms({body:[ks(10)]})]}),t));else if("line_start"===l)o(Fi(Gi(oi`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if("search_start"===l)if(h.has(e))s.flags.sticky=!0,i();else{const e=r[n-1];if(e&&function(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||"Quantifier"===e.type&&e.min&&t.includes(e.body.type)}(e))o(Fi(Ss({negate:!0}),t));else{if(p)throw new Error(oi`Uses "\G" in a way that requires a subclass`);o(Bi(gs("string_start"),t)),a.strategy="clip_search"}}else if("string_end"===l||"string_start"===l);else if("string_end_newline"===l)o(Fi(Gi(oi`(?=\n?\z)`),t));else{if("word_boundary"!==l)throw new Error(`Unexpected assertion kind "${l}"`);if(!d&&!u){o(Fi(Gi(c?`(?:(?<=${gi})(?=${gi})|(?<!${gi})(?!${gi}))`:`(?:(?<=${gi})(?!${gi})|(?<!${gi})(?=${gi}))`),t))}}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||Oi(n)||(n=Ii(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!Oi(r)&&(r=Ii(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if("intersection"===t.kind){n(Fi(bs({body:[e]}),t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:i,spaceIsAscii:o,wordIsAscii:a}){const{kind:l,negate:c,value:u}=e;if(!i||"digit"!==l&&"digit"!==u)if(!o||"space"!==l&&"space"!==u)if(!a||"word"!==l&&"word"!==u)if("any"===l)n(Bi(Ns("Any"),t));else if("digit"===l)n(Bi(Ns("Nd",{negate:c}),t));else if("dot"===l);else if("text_segment"===l){if("strict"===r)throw new Error(oi`Use of "\X" requires non-strict accuracy`);const e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",i=oi`\p{RI}{2}|${e}(?:\u200D${e})*`;n(Fi(Gi(oi`(?>\r\n|${s?oi`\p{RGI_Emoji}`:i}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===l)n(Bi(Ns("AHex",{negate:c}),t));else if("newline"===l)n(Fi(Gi(c?"[^\n]":"(?>\r\n?|[\n\v\f
\u2028\u2029])"),t));else if("posix"===l)if(s||"graph"!==u&&"print"!==u)n(Fi(Di(Gi(Ci.get(u)),c),t));else{if("strict"===r)throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:"!-~",print:" -~"}[u];c&&(e=`\0-${ii(e.codePointAt(0)-1)}${ii(e.codePointAt(2)+1)}-`),n(Fi(Gi(`[${e}]`),t))}else if("property"===l)yi.has(Is(u))||(e.key="sc");else if("space"===l)n(Bi(Ns("space",{negate:c}),t));else{if("word"!==l)throw new Error(`Unexpected character set kind "${l}"`);n(Fi(Di(Gi(gi),c),t))}else n(Bi(ws("word",{negate:c}),t));else n(Fi(Di(Gi("[\t-\r ]"),c),t));else n(Bi(ws("digit",{negate:c}),t))},Directive({node:e,parent:t,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:i,removeAllNextSiblings:o}){const{kind:a,flags:l}=e;if("flags"===a)if(l.enable||l.disable){const e=_s({flags:l});e.body[0].body=o(),s(Fi(e,t),{traverse:!0})}else r();else{if("keep"!==a)throw new Error(`Unexpected directive kind "${a}"`);{const e=n.body[0],r=1===n.body.length&&ls(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw new Error(oi`Uses "\K" in a way that's unsupported`);const o=Ss({behind:!0});o.body[0].body=i(),s(Fi(o,t))}}},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if("word"===e.textSegmentMode)throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach((t=>delete e[t])),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;"lookbehind"===n&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:r}=e;if("fail"!==r)throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`);n(Fi(Ss({negate:!0}),t))},Quantifier({node:e}){if("Quantifier"===e.body.type){const t=_s();t.body[0].body.push(e.body),e.body=Fi(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let r=!1,s=!1;for(const t of e.body)if(1===t.body.length&&"search_start"===t.body[0].kind)t.body.pop();else{const e=Mi(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):s=!0}r&&!s&&n.forEach((e=>t.add(e)))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if("strict"===t&&n&&r)throw new Error(oi`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||Oi(n)||(n=Ii(n,t),e.ref=n)}},Ni={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=e;r||n.set(e,[...t.get(s).map((({node:e})=>e))])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:i,multiplexCapturesToLeftByRef:o,openRefs:a,reffedNodesByReferencer:l}){const c=s.get(e);if(c&&a.has(e.number)){const r=Bi(Li(e.number),t);return l.set(r,a.get(e.number)),void n(r)}a.set(e.number,e),o.set(e.number,[]),e.name&&ci(o,e.name,[]);const u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){const n=u[t];if(c===n.node||c&&c===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:c}),e.name&&o.get(e.name).push({node:e,origin:c}),e.name){const t=ci(i,e.name,new Map);let n=!1;if(c)n=!0;else for(const e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}i.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=li(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){const{isRecursive:s,ref:i}=e;if(s){let n=t;for(;(n=n.parent)&&("CapturingGroup"!==n.type||n.name!==i&&n.number!==i););return void r.reffedNodesByReferencer.set(e,n)}const o=r.subroutineRefMap.get(i),a=0===i,l=a?Li(0):Ei(o,r.groupOriginByCopy,null);let c=l;if(!a){const e=Pi(function(e,t){const n=[];for(;e=e.parent;)t&&!t(e)||n.push(e);return n}(o,(e=>"Group"===e.type&&!!e.flags))),t=e?li(r.globalFlags,e):r.globalFlags;(function(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase})(t,r.currentFlags)||(c=_s({flags:Ri(t)}),c.body[0].body.push(l))}n(Fi(c,t),{traverse:!a})}},Ai={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan)return void(r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref));const s=r.reffedNodesByReferencer.get(e).filter((t=>function(e,t){let n=t;do{if("Regex"===n.type)return!1;if("Alternative"===n.type)continue;if(n===e)return!1;const t=Ti(n.parent);for(const r of t){if(r===n)break;if(r===e||$i(r,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}(t,e)));if(s.length)if(s.length>1){n(Fi(_s({atomic:!0,body:s.reverse().map((e=>ms({body:[fs(e.number)]})))}),t))}else e.ref=s[0].number;else n(Fi(Ss({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){const t=ys();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function ji(e){Ts(e,{"*"({node:e,parent:t}){e.parent=t}})}function Ei(e,t,n,r){const s=Array.isArray(e)?[]:{};for(const[i,o]of Object.entries(e))"parent"===i?s.parent=Array.isArray(n)?r:n:o&&"object"==typeof o?s[i]=Ei(o,t,s,n):("type"===i&&"CapturingGroup"===o&&t.set(s,t.get(e)??e),s[i]=o);return s}function Li(e){const t=xs(e);return t.isRecursive=!0,t}function Ii(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,"_")}`;return t.set(e,n),n}function Pi(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach((({flags:e})=>{t.forEach((t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)}))})),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Ri({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),e&&t||(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Ti(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Mi(e){const t=e.find((e=>"search_start"===e.kind||function(e,t){const n={negate:null,...t};return"LookaroundAssertion"===e.type&&(null===n.negate||e.negate===n.negate)&&1===e.body.length&&ls(e.body[0],{type:"Assertion",kind:"search_start"})}(e,{negate:!1})||!function({type:e}){return"Assertion"===e||"Directive"===e||"LookaroundAssertion"===e}(e)));if(!t)return null;if("search_start"===t.kind)return t;if("LookaroundAssertion"===t.type)return t.body[0].body[0];if("CapturingGroup"===t.type||"Group"===t.type){const e=[];for(const n of t.body){const t=Mi(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function $i(e,t){const n=Ti(e)??[];for(const e of n)if(e===t||$i(e,t))return!0;return!1}function Oi(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Gi(e,t){const n=us(e,{...t,unicodePropertyMap:yi}).body;return n.length>1||n[0].body.length>1?_s({body:n}):n[0].body[0]}function Di(e,t){return e.negate=t,e}function Bi(e,t){return e.parent=t,e}function Fi(e,t){return ji(e),e.parent=t,e}function Ui(e,t){const n=di(t),r=ui(n.target,"ES2024"),s=ui(n.target,"ES2025"),i=n.rules.recursionLimit;if(!Number.isInteger(i)||i<2||i>20)throw new Error("Invalid recursionLimit; use 2-20");let o=null,a=null;if(!s){const t=[e.flags.ignoreCase];Ts(e,zi,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:a=!0}})}const l={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!o||a)};let c=e;const u={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:e._originMap,recursionLimit:i,useAppliedIgnoreCase:!(s||!o||!a),useFlagMods:s,useFlagV:r,verbose:n.verbose};function p(e){u.lastNode=c,c=e;return function(e,t){if(null==e)throw new Error(t??"Value expected");return e}(Wi[e.type],`Unexpected node type "${e.type}"`)(e,u,p)}const h={pattern:e.body.map(p).join("|"),flags:p(e.flags),options:{...e.options}};return r||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],u.captureMap.forEach(((e,t)=>{e.hidden&&h._hiddenCaptures.push(t),e.transferTo&&ci(h._captureTransfers,e.transferTo,[]).push(t)})),h}var zi={"*":{enter({node:e},t){if(Yi(e)){const n=t.getCurrentModI();t.pushModI(e.flags?li({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){Yi(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Qi(ii(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Zi(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&vi.has(e.value)&&t.setHasCasedChar()}},Wi={Alternative:({body:e},t,n)=>e.map(n).join(""),Assertion({kind:e,negate:t}){if("string_end"===e)return"$";if("string_start"===e)return"^";if("word_boundary"===e)return t?oi`\B`:oi`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if("number"!=typeof e)throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&"strict"===t.accuracy&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:r,name:s,number:i}=e,o={ignoreCase:t.currentFlags.ignoreCase},a=t.originMap.get(e);return a&&(o.hidden=!0,i>a.number&&(o.transferTo=a.number)),t.captureMap.set(i,o),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=ii(e),r=Ji(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Qi(n)){const e=fi(n);return t.inCharClass?e.join(""):e.length>1?`[${e.join("")}]`:e[0]}return n},CharacterClass(e,t,n){const{kind:r,negate:s,parent:i}=e;let{body:o}=e;if("intersection"===r&&!t.useFlagV)throw new Error("Use of class intersection requires min target ES2024");ai.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(eo)&&(o=[ks(45),...o.filter((e=>!eo(e)))]);const a=()=>`[${s?"^":""}${o.map(n).join("intersection"===r?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||ai.bugNestedClassIgnoresNegation)&&!s){const t=o.filter((e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate));if(t.length){const r=_s(),s=r.body[0];return r.parent=i,s.parent=r,o=o.filter((e=>!t.includes(e))),e.body=o,o.length?(e.parent=s,s.body.push(e)):r.body.pop(),t.forEach((e=>{const t=ms({body:[e]});e.parent=t,t.parent=r,r.body.push(t)})),n(r)}}t.inCharClass=!0;const r=a();return t.inCharClass=!1,r}const l=o[0];if("union"===r&&!s&&l&&((!t.useFlagV||!t.verbose)&&"union"===i.kind&&(!ai.bugFlagVLiteralHyphenIsRange||!t.useFlagV)||!t.verbose&&"intersection"===i.kind&&1===o.length&&"CharacterClassRange"!==l.type))return o.map(n).join("");if(!t.useFlagV&&"CharacterClass"===i.type)throw new Error("Use of nested character class requires min target ES2024");return a()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},i=Ji(n,s),o=Ji(r,s),a=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const t=function(e){const t=e.map((e=>e.codePointAt(0))).sort(((e,t)=>e-t)),n=[];let r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:null===r?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}(Zi(e));t.forEach((e=>{a.add(Array.isArray(e)?`${Ji(e[0],s)}-${Ji(e[1],s)}`:Ji(e,s))}))}return`${i}-${o}${[...a].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},s){if("dot"===e)return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":oi`[^\n]`;if("digit"===e)return t?oi`\D`:oi`\d`;if("property"===e){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&vi.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?oi`\P`:oi`\p`}{${r?`${r}=`:""}${n}}`}if("word"===e)return t?oi`\W`:oi`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags:(e,t)=>(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":""),Group({atomic:e,body:t,flags:n,parent:r},s,i){const o=s.currentFlags;n&&(s.currentFlags=li(o,n));const a=t.map(i).join("|"),l=s.verbose||1!==t.length||"Quantifier"===r.type||e||s.useFlagMods&&n?`(?${function(e,t,n){if(e)return">";let r="";if(t&&n){const{enable:e,disable:n}=t;r=(e?.ignoreCase?"i":"")+(e?.dotAll?"s":"")+(n?"-":"")+(n?.ignoreCase?"i":"")+(n?.dotAll?"s":"")}return`${r}:`}(e,n,s.useFlagMods)}${a})`:a;return s.currentFlags=o,l},LookaroundAssertion:({body:e,kind:t,negate:n},r,s)=>`(?${`${"lookahead"===t?"":"<"}${n?"!":"="}`}${e.map(s).join("|")})`,Quantifier:(e,t,n)=>n(e.body)+function({kind:e,max:t,min:n}){let r;r=n||1!==t?n||t!==1/0?1===n&&t===1/0?"+":n===t?`{${n}}`:`{${n},${t===1/0?"":t}}`:"*":"?";return r+{greedy:"",lazy:"?",possessive:"+"}[e]}(e),Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return 0===t?`(?R=${r})`:oi`\g<${t}&R=${r}>`}},Hi=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),qi=new Set(["-","\\","]","^","["]),Vi=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),Xi=new Map([[9,oi`\t`],[10,oi`\n`],[11,oi`\v`],[12,oi`\f`],[13,oi`\r`],[8232,oi`\u2028`],[8233,oi`\u2029`],[65279,oi`\uFEFF`]]),Ki=/^\p{Cased}$/u;function Qi(e){return Ki.test(e)}function Zi(e,t){const n=!!t?.firstOnly,r=e.min.value,s=e.max.value,i=[];if(r<65&&(65535===s||s>=131071)||65536===r&&s>=131071)return i;for(let e=r;e<=s;e++){const t=ii(e);if(!Qi(t))continue;const o=fi(t).filter((e=>{const t=e.codePointAt(0);return t<r||t>s}));if(o.length&&(i.push(...o),n))break}return i}function Ji(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Xi.has(e))return Xi.get(e);if(e<32||e>126&&e<160||e>262143||t&&((s=e)>47&&s<58))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;var s;const i=n?r?Vi:qi:Hi,o=ii(e);return(i.has(o)?"\\":"")+o}function Yi({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function eo({type:e,value:t}){return"Character"===e&&45===t}var to=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#s=null;rawOptions={};get source(){return this.#n||"(?:)"}constructor(t,n,r){const s=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const s=t;super(s,n),this.#n=s.source,s instanceof e&&(this.#e=s.#e,this.#r=s.#r,this.#s=s.#s,this.rawOptions=s.rawOptions)}else{const e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":t,n),this.#n=t,this.#e=function(e,t){const n=new Map;for(const t of e)n.set(t,{hidden:!0});for(const[e,r]of t)for(const t of r)ci(n,t,{}).transferTo=e;return n}(e.hiddenCaptures,e.transfers),this.#s=e.strategy,this.rawOptions=r??{}}s||(this.#t=this)}exec(t){if(!this.#t){const{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}const n=this.global||this.sticky,r=this.lastIndex;if("clip_search"===this.#s&&n&&r){this.lastIndex=0;const e=this.#i(t.slice(r));return e&&(!function(e,t,n,r){if(e.index+=t,e.input=n,r){const n=e.indices;for(let e=0;e<n.length;e++){const r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}const r=n.groups;r&&Object.keys(r).forEach((e=>{const n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])}))}}(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#i(t)}#i(e){this.#t.lastIndex=this.lastIndex;const t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;const n=[...t];let r;t.length=1,this.hasIndices&&(r=[...t.indices],t.indices.length=1);const s=[0];for(let e=1;e<n.length;e++){const{hidden:i,transferTo:o}=this.#e.get(e)??{};if(i?s.push(null):(s.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&void 0!==n[e]){const i=s[o];if(!i)throw new Error(`Invalid capture transfer to "${i}"`);if(t[i]=n[e],this.hasIndices&&(t.indices[i]=r[e]),t.groups){this.#r||(this.#r=no(this.source));const s=this.#r.get(o);s&&(t.groups[s]=n[e],this.hasIndices&&(t.indices.groups[s]=r[e]))}}}return t}};function no(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r,s=0,i=0;for(;r=t.exec(e);){const{0:e,groups:{capture:t,name:o}}=r;"["===e?s++:s?"]"===e&&s--:t&&(i++,o&&n.set(i,o))}return n}function ro(e,t){const n=function(e,t){const n=di(t),r=us(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:yi}),s=function(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};ji(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:ui(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Ts(e,xi,r);const s={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},i={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Ts(e,Ni,i),Ts(e,Ai,{groupsByName:i.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:i.reffedNodesByReferencer}),e._originMap=i.groupOriginByCopy,e._strategy=r.strategy,e}(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Ui(s,n),o=function(e,t){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...t};let s=t?.captureTransfers??new Map;if(!new RegExp(Ks,"su").test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:n};if("plugin"===r&&Us(e,Vs`\(\?\(DEFINE\)`,Ds.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const i=[],o=Us(e,Vs`\\[1-9]`,Ds.DEFAULT),a=new Map,l=[];let c,u=!1,p=0,h=0;for(Js.lastIndex=0;c=Js.exec(e);){const{0:t,groups:{captureName:d,rDepth:m,gRNameOrNum:g,gRDepth:f}}=c;if("["===t)p++;else if(p)"]"===t&&p--;else{if(m){if(ei(m),u)throw new Error(Ys);if(o)throw new Error(("external"===r?"Backrefs":"Numbered backrefs")+" cannot be used with global recursion");const t=e.slice(0,c.index),a=e.slice(Js.lastIndex);if(Us(a,Ks,Ds.DEFAULT))throw new Error(Ys);const l=+m-1;e=ti(t,a,l,!1,n,i,h),s=si(s,t,l,i.length,0,h);break}if(g){ei(f);let p=!1;for(const e of l)if(e.name===g||e.num===+g){if(p=!0,e.hasRecursedWithin)throw new Error(Ys);break}if(!p)throw new Error(Vs`Recursive \g cannot be used outside the referenced group "${"external"===r?g:Vs`\g<${g}&R=${f}>`}"`);const d=a.get(g),m=zs(e,d);if(o&&Us(m,Vs`${Qs}|\((?!\?)`,Ds.DEFAULT))throw new Error(("external"===r?"Backrefs":"Numbered backrefs")+" cannot be used with recursion of capturing groups");const y=e.slice(d,c.index),k=m.slice(y.length+t.length),b=i.length,w=+f-1,C=ti(y,k,w,!0,n,i,h);s=si(s,y,w,i.length-b,b,h);const _=e.slice(0,d),S=e.slice(d+m.length);e=`${_}${C}${S}`,Js.lastIndex+=C.length-t.length-y.length-k.length,l.forEach((e=>e.hasRecursedWithin=!0)),u=!0}else if(d)h++,a.set(String(h),Js.lastIndex),a.set(d,Js.lastIndex),l.push({num:h,name:d});else if("("===t[0]){const e="("===t;e&&(h++,a.set(String(h),Js.lastIndex)),l.push(e?{num:h}:{})}else")"===t&&l.pop()}}return n.push(...i),{pattern:e,captureTransfers:s,hiddenCaptures:n}}(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:"external"}),a=function(e,t){const n=t?.hiddenCaptures??[];let r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};const s="(?:(?=(",i=[0],o=[];let a,l=0,c=0,u=NaN;do{a=!1;let t,p=0,h=0,d=!1;for(Ws.lastIndex=Number.isNaN(u)?0:u+7;t=Ws.exec(e);){const{0:m,index:g,groups:{capturingStart:f,noncapturingStart:y}}=t;if("["===m)p++;else if(p)"]"===m&&p--;else if("(?>"!==m||d){if(d&&y)h++;else if(f)d?h++:(l++,i.push(l+c));else if(")"===m&&d){if(!h){c++;const t=l+c;if(e=`${e.slice(0,u)}${s}${e.slice(u+3,g)}))<$$${t}>)${e.slice(g+1)}`,a=!0,o.push(t),Gs(n,t),r.size){const e=new Map;r.forEach(((n,r)=>{e.set(r>=t?r+1:r,n.map((e=>e>=t?e+1:e)))})),r=e}break}h--}}else u=g,d=!0}}while(a);return n.push(...o),e=Bs(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,(({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){const n=+t;if(n>i.length-1)throw new Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`}),Ds.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}(function(e){if(!new RegExp(`${Hs}\\+`).test(e))return{pattern:e};const t=[];let n,r=null,s=null,i="",o=0;for(qs.lastIndex=0;n=qs.exec(e);){const{0:p,index:h,groups:{qBase:d,qMod:m,invalidQ:g}}=n;if("["===p)o||(s=h),o++;else if("]"===p)o?o--:s=null;else if(!o)if("+"===m&&i&&!i.startsWith("(")){if(g)throw new Error(`Invalid quantifier "${p}"`);let t=-1;if(/^\{\d+\}$/.test(d))a=e,l=h+d.length,c=m,u="",e=a.slice(0,l)+u+a.slice(l+c.length);else{if(")"===i||"]"===i){const t=")"===i?r:s;if(null===t)throw new Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,h)}${d})${e.slice(h+p.length)}`}else e=`${e.slice(0,h-i.length)}(?>${i}${d})${e.slice(h+p.length)}`;t+=4}qs.lastIndex+=t}else"("===p[0]?t.push(h):")"===p&&(r=t.length?t.pop():null);i=p}var a,l,c,u;return{pattern:e}}(o.pattern).pattern,{captureTransfers:o.captureTransfers,hiddenCaptures:o.hiddenCaptures}),l={pattern:a.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${i.flags}${i.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const e=a.hiddenCaptures.sort(((e,t)=>e-t)),t=Array.from(a.captureTransfers),r=s._strategy,i=l.pattern.length>=n.lazyCompileLength;(e.length||t.length||r||i)&&(l.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...r&&{strategy:r},...i&&{lazyCompile:i}})}return l}(e,t);return n.options?new to(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}const so=4294967295;class io{constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:n=!1,cache:r,regexConstructor:s}=t;if(!s)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map((e=>{if("string"!=typeof e)return e;const t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{const t=s(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}}))}regexps;findNextMatchSync(e,t,n){const r="string"==typeof e?e:e.content,s=[];function i(e,t,n=0){return{index:e,captureIndices:t.indices.map((e=>null==e?{start:so,end:so,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]}))}}for(let e=0;e<this.regexps.length;e++){const n=this.regexps[e];if(n)try{n.lastIndex=t;const o=n.exec(r);if(!o)continue;if(o.index===t)return i(e,o,0);s.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(s.length){const e=Math.min(...s.map((e=>e[1].index)));for(const[t,n,r]of s)if(n.index===e)return i(t,n,r)}return null}}const oo=[{id:"abap",name:"ABAP",import:()=>import("@shikijs/langs/abap")},{id:"actionscript-3",name:"ActionScript",import:()=>import("@shikijs/langs/actionscript-3")},{id:"ada",name:"Ada",import:()=>import("@shikijs/langs/ada")},{id:"angular-html",name:"Angular HTML",import:()=>import("@shikijs/langs/angular-html")},{id:"angular-ts",name:"Angular TypeScript",import:()=>import("@shikijs/langs/angular-ts")},{id:"apache",name:"Apache Conf",import:()=>import("@shikijs/langs/apache")},{id:"apex",name:"Apex",import:()=>import("@shikijs/langs/apex")},{id:"apl",name:"APL",import:()=>import("@shikijs/langs/apl")},{id:"applescript",name:"AppleScript",import:()=>import("@shikijs/langs/applescript")},{id:"ara",name:"Ara",import:()=>import("@shikijs/langs/ara")},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>import("@shikijs/langs/asciidoc")},{id:"asm",name:"Assembly",import:()=>import("@shikijs/langs/asm")},{id:"astro",name:"Astro",import:()=>import("@shikijs/langs/astro")},{id:"awk",name:"AWK",import:()=>import("@shikijs/langs/awk")},{id:"ballerina",name:"Ballerina",import:()=>import("@shikijs/langs/ballerina")},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>import("@shikijs/langs/bat")},{id:"beancount",name:"Beancount",import:()=>import("@shikijs/langs/beancount")},{id:"berry",name:"Berry",aliases:["be"],import:()=>import("@shikijs/langs/berry")},{id:"bibtex",name:"BibTeX",import:()=>import("@shikijs/langs/bibtex")},{id:"bicep",name:"Bicep",import:()=>import("@shikijs/langs/bicep")},{id:"blade",name:"Blade",import:()=>import("@shikijs/langs/blade")},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>import("@shikijs/langs/bsl")},{id:"c",name:"C",import:()=>import("@shikijs/langs/c")},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>import("@shikijs/langs/cadence")},{id:"cairo",name:"Cairo",import:()=>import("@shikijs/langs/cairo")},{id:"clarity",name:"Clarity",import:()=>import("@shikijs/langs/clarity")},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>import("@shikijs/langs/clojure")},{id:"cmake",name:"CMake",import:()=>import("@shikijs/langs/cmake")},{id:"cobol",name:"COBOL",import:()=>import("@shikijs/langs/cobol")},{id:"codeowners",name:"CODEOWNERS",import:()=>import("@shikijs/langs/codeowners")},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>import("@shikijs/langs/codeql")},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>import("@shikijs/langs/coffee")},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>import("@shikijs/langs/common-lisp")},{id:"coq",name:"Coq",import:()=>import("@shikijs/langs/coq")},{id:"cpp",name:"C++",aliases:["c++"],import:()=>import("@shikijs/langs/cpp")},{id:"crystal",name:"Crystal",import:()=>import("@shikijs/langs/crystal")},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>import("@shikijs/langs/csharp")},{id:"css",name:"CSS",import:()=>import("@shikijs/langs/css")},{id:"csv",name:"CSV",import:()=>import("@shikijs/langs/csv")},{id:"cue",name:"CUE",import:()=>import("@shikijs/langs/cue")},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>import("@shikijs/langs/cypher")},{id:"d",name:"D",import:()=>import("@shikijs/langs/d")},{id:"dart",name:"Dart",import:()=>import("@shikijs/langs/dart")},{id:"dax",name:"DAX",import:()=>import("@shikijs/langs/dax")},{id:"desktop",name:"Desktop",import:()=>import("@shikijs/langs/desktop")},{id:"diff",name:"Diff",import:()=>import("@shikijs/langs/diff")},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>import("@shikijs/langs/docker")},{id:"dotenv",name:"dotEnv",import:()=>import("@shikijs/langs/dotenv")},{id:"dream-maker",name:"Dream Maker",import:()=>import("@shikijs/langs/dream-maker")},{id:"edge",name:"Edge",import:()=>import("@shikijs/langs/edge")},{id:"elixir",name:"Elixir",import:()=>import("@shikijs/langs/elixir")},{id:"elm",name:"Elm",import:()=>import("@shikijs/langs/elm")},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>import("@shikijs/langs/emacs-lisp")},{id:"erb",name:"ERB",import:()=>import("@shikijs/langs/erb")},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>import("@shikijs/langs/erlang")},{id:"fennel",name:"Fennel",import:()=>import("@shikijs/langs/fennel")},{id:"fish",name:"Fish",import:()=>import("@shikijs/langs/fish")},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>import("@shikijs/langs/fluent")},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>import("@shikijs/langs/fortran-fixed-form")},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>import("@shikijs/langs/fortran-free-form")},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>import("@shikijs/langs/fsharp")},{id:"gdresource",name:"GDResource",import:()=>import("@shikijs/langs/gdresource")},{id:"gdscript",name:"GDScript",import:()=>import("@shikijs/langs/gdscript")},{id:"gdshader",name:"GDShader",import:()=>import("@shikijs/langs/gdshader")},{id:"genie",name:"Genie",import:()=>import("@shikijs/langs/genie")},{id:"gherkin",name:"Gherkin",import:()=>import("@shikijs/langs/gherkin")},{id:"git-commit",name:"Git Commit Message",import:()=>import("@shikijs/langs/git-commit")},{id:"git-rebase",name:"Git Rebase Message",import:()=>import("@shikijs/langs/git-rebase")},{id:"gleam",name:"Gleam",import:()=>import("@shikijs/langs/gleam")},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>import("@shikijs/langs/glimmer-js")},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>import("@shikijs/langs/glimmer-ts")},{id:"glsl",name:"GLSL",import:()=>import("@shikijs/langs/glsl")},{id:"gnuplot",name:"Gnuplot",import:()=>import("@shikijs/langs/gnuplot")},{id:"go",name:"Go",import:()=>import("@shikijs/langs/go")},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>import("@shikijs/langs/graphql")},{id:"groovy",name:"Groovy",import:()=>import("@shikijs/langs/groovy")},{id:"hack",name:"Hack",import:()=>import("@shikijs/langs/hack")},{id:"haml",name:"Ruby Haml",import:()=>import("@shikijs/langs/haml")},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>import("@shikijs/langs/handlebars")},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>import("@shikijs/langs/haskell")},{id:"haxe",name:"Haxe",import:()=>import("@shikijs/langs/haxe")},{id:"hcl",name:"HashiCorp HCL",import:()=>import("@shikijs/langs/hcl")},{id:"hjson",name:"Hjson",import:()=>import("@shikijs/langs/hjson")},{id:"hlsl",name:"HLSL",import:()=>import("@shikijs/langs/hlsl")},{id:"html",name:"HTML",import:()=>import("@shikijs/langs/html")},{id:"html-derivative",name:"HTML (Derivative)",import:()=>import("@shikijs/langs/html-derivative")},{id:"http",name:"HTTP",import:()=>import("@shikijs/langs/http")},{id:"hxml",name:"HXML",import:()=>import("@shikijs/langs/hxml")},{id:"hy",name:"Hy",import:()=>import("@shikijs/langs/hy")},{id:"imba",name:"Imba",import:()=>import("@shikijs/langs/imba")},{id:"ini",name:"INI",aliases:["properties"],import:()=>import("@shikijs/langs/ini")},{id:"java",name:"Java",import:()=>import("@shikijs/langs/java")},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>import("@shikijs/langs/javascript")},{id:"jinja",name:"Jinja",import:()=>import("@shikijs/langs/jinja")},{id:"jison",name:"Jison",import:()=>import("@shikijs/langs/jison")},{id:"json",name:"JSON",import:()=>import("@shikijs/langs/json")},{id:"json5",name:"JSON5",import:()=>import("@shikijs/langs/json5")},{id:"jsonc",name:"JSON with Comments",import:()=>import("@shikijs/langs/jsonc")},{id:"jsonl",name:"JSON Lines",import:()=>import("@shikijs/langs/jsonl")},{id:"jsonnet",name:"Jsonnet",import:()=>import("@shikijs/langs/jsonnet")},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>import("@shikijs/langs/jssm")},{id:"jsx",name:"JSX",import:()=>import("@shikijs/langs/jsx")},{id:"julia",name:"Julia",aliases:["jl"],import:()=>import("@shikijs/langs/julia")},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>import("@shikijs/langs/kotlin")},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>import("@shikijs/langs/kusto")},{id:"latex",name:"LaTeX",import:()=>import("@shikijs/langs/latex")},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>import("@shikijs/langs/lean")},{id:"less",name:"Less",import:()=>import("@shikijs/langs/less")},{id:"liquid",name:"Liquid",import:()=>import("@shikijs/langs/liquid")},{id:"llvm",name:"LLVM IR",import:()=>import("@shikijs/langs/llvm")},{id:"log",name:"Log file",import:()=>import("@shikijs/langs/log")},{id:"logo",name:"Logo",import:()=>import("@shikijs/langs/logo")},{id:"lua",name:"Lua",import:()=>import("@shikijs/langs/lua")},{id:"luau",name:"Luau",import:()=>import("@shikijs/langs/luau")},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>import("@shikijs/langs/make")},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>import("@shikijs/langs/markdown")},{id:"marko",name:"Marko",import:()=>import("@shikijs/langs/marko")},{id:"matlab",name:"MATLAB",import:()=>import("@shikijs/langs/matlab")},{id:"mdc",name:"MDC",import:()=>import("@shikijs/langs/mdc")},{id:"mdx",name:"MDX",import:()=>import("@shikijs/langs/mdx")},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>import("@shikijs/langs/mermaid")},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>import("@shikijs/langs/mipsasm")},{id:"mojo",name:"Mojo",import:()=>import("@shikijs/langs/mojo")},{id:"move",name:"Move",import:()=>import("@shikijs/langs/move")},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>import("@shikijs/langs/narrat")},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>import("@shikijs/langs/nextflow")},{id:"nginx",name:"Nginx",import:()=>import("@shikijs/langs/nginx")},{id:"nim",name:"Nim",import:()=>import("@shikijs/langs/nim")},{id:"nix",name:"Nix",import:()=>import("@shikijs/langs/nix")},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>import("@shikijs/langs/nushell")},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>import("@shikijs/langs/objective-c")},{id:"objective-cpp",name:"Objective-C++",import:()=>import("@shikijs/langs/objective-cpp")},{id:"ocaml",name:"OCaml",import:()=>import("@shikijs/langs/ocaml")},{id:"pascal",name:"Pascal",import:()=>import("@shikijs/langs/pascal")},{id:"perl",name:"Perl",import:()=>import("@shikijs/langs/perl")},{id:"php",name:"PHP",import:()=>import("@shikijs/langs/php")},{id:"plsql",name:"PL/SQL",import:()=>import("@shikijs/langs/plsql")},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>import("@shikijs/langs/po")},{id:"polar",name:"Polar",import:()=>import("@shikijs/langs/polar")},{id:"postcss",name:"PostCSS",import:()=>import("@shikijs/langs/postcss")},{id:"powerquery",name:"PowerQuery",import:()=>import("@shikijs/langs/powerquery")},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>import("@shikijs/langs/powershell")},{id:"prisma",name:"Prisma",import:()=>import("@shikijs/langs/prisma")},{id:"prolog",name:"Prolog",import:()=>import("@shikijs/langs/prolog")},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>import("@shikijs/langs/proto")},{id:"pug",name:"Pug",aliases:["jade"],import:()=>import("@shikijs/langs/pug")},{id:"puppet",name:"Puppet",import:()=>import("@shikijs/langs/puppet")},{id:"purescript",name:"PureScript",import:()=>import("@shikijs/langs/purescript")},{id:"python",name:"Python",aliases:["py"],import:()=>import("@shikijs/langs/python")},{id:"qml",name:"QML",import:()=>import("@shikijs/langs/qml")},{id:"qmldir",name:"QML Directory",import:()=>import("@shikijs/langs/qmldir")},{id:"qss",name:"Qt Style Sheets",import:()=>import("@shikijs/langs/qss")},{id:"r",name:"R",import:()=>import("@shikijs/langs/r")},{id:"racket",name:"Racket",import:()=>import("@shikijs/langs/racket")},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>import("@shikijs/langs/raku")},{id:"razor",name:"ASP.NET Razor",import:()=>import("@shikijs/langs/razor")},{id:"reg",name:"Windows Registry Script",import:()=>import("@shikijs/langs/reg")},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>import("@shikijs/langs/regexp")},{id:"rel",name:"Rel",import:()=>import("@shikijs/langs/rel")},{id:"riscv",name:"RISC-V",import:()=>import("@shikijs/langs/riscv")},{id:"rst",name:"reStructuredText",import:()=>import("@shikijs/langs/rst")},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>import("@shikijs/langs/ruby")},{id:"rust",name:"Rust",aliases:["rs"],import:()=>import("@shikijs/langs/rust")},{id:"sas",name:"SAS",import:()=>import("@shikijs/langs/sas")},{id:"sass",name:"Sass",import:()=>import("@shikijs/langs/sass")},{id:"scala",name:"Scala",import:()=>import("@shikijs/langs/scala")},{id:"scheme",name:"Scheme",import:()=>import("@shikijs/langs/scheme")},{id:"scss",name:"SCSS",import:()=>import("@shikijs/langs/scss")},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>import("@shikijs/langs/sdbl")},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>import("@shikijs/langs/shaderlab")},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>import("@shikijs/langs/shellscript")},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>import("@shikijs/langs/shellsession")},{id:"smalltalk",name:"Smalltalk",import:()=>import("@shikijs/langs/smalltalk")},{id:"solidity",name:"Solidity",import:()=>import("@shikijs/langs/solidity")},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>import("@shikijs/langs/soy")},{id:"sparql",name:"SPARQL",import:()=>import("@shikijs/langs/sparql")},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>import("@shikijs/langs/splunk")},{id:"sql",name:"SQL",import:()=>import("@shikijs/langs/sql")},{id:"ssh-config",name:"SSH Config",import:()=>import("@shikijs/langs/ssh-config")},{id:"stata",name:"Stata",import:()=>import("@shikijs/langs/stata")},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>import("@shikijs/langs/stylus")},{id:"svelte",name:"Svelte",import:()=>import("@shikijs/langs/svelte")},{id:"swift",name:"Swift",import:()=>import("@shikijs/langs/swift")},{id:"system-verilog",name:"SystemVerilog",import:()=>import("@shikijs/langs/system-verilog")},{id:"systemd",name:"Systemd Units",import:()=>import("@shikijs/langs/systemd")},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>import("@shikijs/langs/talonscript")},{id:"tasl",name:"Tasl",import:()=>import("@shikijs/langs/tasl")},{id:"tcl",name:"Tcl",import:()=>import("@shikijs/langs/tcl")},{id:"templ",name:"Templ",import:()=>import("@shikijs/langs/templ")},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>import("@shikijs/langs/terraform")},{id:"tex",name:"TeX",import:()=>import("@shikijs/langs/tex")},{id:"toml",name:"TOML",import:()=>import("@shikijs/langs/toml")},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>import("@shikijs/langs/ts-tags")},{id:"tsv",name:"TSV",import:()=>import("@shikijs/langs/tsv")},{id:"tsx",name:"TSX",import:()=>import("@shikijs/langs/tsx")},{id:"turtle",name:"Turtle",import:()=>import("@shikijs/langs/turtle")},{id:"twig",name:"Twig",import:()=>import("@shikijs/langs/twig")},{id:"typescript",name:"TypeScript",aliases:["ts"],import:()=>import("@shikijs/langs/typescript")},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>import("@shikijs/langs/typespec")},{id:"typst",name:"Typst",aliases:["typ"],import:()=>import("@shikijs/langs/typst")},{id:"v",name:"V",import:()=>import("@shikijs/langs/v")},{id:"vala",name:"Vala",import:()=>import("@shikijs/langs/vala")},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>import("@shikijs/langs/vb")},{id:"verilog",name:"Verilog",import:()=>import("@shikijs/langs/verilog")},{id:"vhdl",name:"VHDL",import:()=>import("@shikijs/langs/vhdl")},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>import("@shikijs/langs/viml")},{id:"vue",name:"Vue",import:()=>import("@shikijs/langs/vue")},{id:"vue-html",name:"Vue HTML",import:()=>import("@shikijs/langs/vue-html")},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>import("@shikijs/langs/vyper")},{id:"wasm",name:"WebAssembly",import:()=>import("@shikijs/langs/wasm")},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>import("@shikijs/langs/wenyan")},{id:"wgsl",name:"WGSL",import:()=>import("@shikijs/langs/wgsl")},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>import("@shikijs/langs/wikitext")},{id:"wit",name:"WebAssembly Interface Types",import:()=>import("@shikijs/langs/wit")},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>import("@shikijs/langs/wolfram")},{id:"xml",name:"XML",import:()=>import("@shikijs/langs/xml")},{id:"xsl",name:"XSL",import:()=>import("@shikijs/langs/xsl")},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>import("@shikijs/langs/yaml")},{id:"zenscript",name:"ZenScript",import:()=>import("@shikijs/langs/zenscript")},{id:"zig",name:"Zig",import:()=>import("@shikijs/langs/zig")}],ao=(Object.fromEntries(oo.map((e=>[e.id,e.import]))),Object.fromEntries(oo.flatMap((e=>e.aliases?.map((t=>[t,e.import]))||[]))),[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>import("@shikijs/themes/andromeeda")},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>import("@shikijs/themes/aurora-x")},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>import("@shikijs/themes/ayu-dark")},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>import("@shikijs/themes/catppuccin-frappe")},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>import("@shikijs/themes/catppuccin-latte")},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>import("@shikijs/themes/catppuccin-macchiato")},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>import("@shikijs/themes/catppuccin-mocha")},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>import("@shikijs/themes/dark-plus")},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>import("@shikijs/themes/dracula")},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>import("@shikijs/themes/dracula-soft")},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>import("@shikijs/themes/everforest-dark")},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>import("@shikijs/themes/everforest-light")},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>import("@shikijs/themes/github-dark")},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>import("@shikijs/themes/github-dark-default")},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>import("@shikijs/themes/github-dark-dimmed")},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>import("@shikijs/themes/github-dark-high-contrast")},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>import("@shikijs/themes/github-light")},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>import("@shikijs/themes/github-light-default")},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>import("@shikijs/themes/github-light-high-contrast")},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>import("@shikijs/themes/gruvbox-dark-hard")},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>import("@shikijs/themes/gruvbox-dark-medium")},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>import("@shikijs/themes/gruvbox-dark-soft")},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>import("@shikijs/themes/gruvbox-light-hard")},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>import("@shikijs/themes/gruvbox-light-medium")},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>import("@shikijs/themes/gruvbox-light-soft")},{id:"houston",displayName:"Houston",type:"dark",import:()=>import("@shikijs/themes/houston")},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>import("@shikijs/themes/kanagawa-dragon")},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>import("@shikijs/themes/kanagawa-lotus")},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>import("@shikijs/themes/kanagawa-wave")},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>import("@shikijs/themes/laserwave")},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>import("@shikijs/themes/light-plus")},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>import("@shikijs/themes/material-theme")},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>import("@shikijs/themes/material-theme-darker")},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>import("@shikijs/themes/material-theme-lighter")},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>import("@shikijs/themes/material-theme-ocean")},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>import("@shikijs/themes/material-theme-palenight")},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>import("@shikijs/themes/min-dark")},{id:"min-light",displayName:"Min Light",type:"light",import:()=>import("@shikijs/themes/min-light")},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>import("@shikijs/themes/monokai")},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>import("@shikijs/themes/night-owl")},{id:"nord",displayName:"Nord",type:"dark",import:()=>import("@shikijs/themes/nord")},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>import("@shikijs/themes/one-dark-pro")},{id:"one-light",displayName:"One Light",type:"light",import:()=>import("@shikijs/themes/one-light")},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>import("@shikijs/themes/plastic")},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>import("@shikijs/themes/poimandres")},{id:"red",displayName:"Red",type:"dark",import:()=>import("@shikijs/themes/red")},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>import("@shikijs/themes/rose-pine")},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>import("@shikijs/themes/rose-pine-dawn")},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>import("@shikijs/themes/rose-pine-moon")},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>import("@shikijs/themes/slack-dark")},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>import("@shikijs/themes/slack-ochin")},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>import("@shikijs/themes/snazzy-light")},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>import("@shikijs/themes/solarized-dark")},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>import("@shikijs/themes/solarized-light")},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>import("@shikijs/themes/synthwave-84")},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>import("@shikijs/themes/tokyo-night")},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>import("@shikijs/themes/vesper")},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>import("@shikijs/themes/vitesse-black")},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>import("@shikijs/themes/vitesse-dark")},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>import("@shikijs/themes/vitesse-light")}]);Object.fromEntries(ao.map((e=>[e.id,e.import])));const lo=function(e){const t=Lr(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return Zn(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:i=t.getLoadedThemes()[0]}=r;if(Dn(s)||Fn(i))throw new F("Plain language does not have grammar state");if("ansi"===s)throw new F("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),l=t.getLanguage(s);return new Jn(hr(n,l,o,a,r).stateStack,l.name,o.name)}(t,...e),codeToTokensBase:(e,n)=>pr(t,e,n),codeToTokensWithThemes:(e,n)=>yr(t,e,n),codeToTokens:(e,n)=>kr(t,e,n),codeToHast:(e,n)=>wr(t,e,n),codeToHtml:(e,n)=>function(e,t,n){const r={meta:{},options:n,codeToHast:(t,n)=>wr(e,t,n),codeToTokens:(t,n)=>kr(e,t,n)};let s=Cr(wr(e,t,n,r));for(const e of nr(n))s=e.postprocess?.call(r,s,n)||s;return s}(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}({engine:function(e={}){const t=Object.assign({target:"auto",cache:new Map},e);return t.regexConstructor||=e=>function(e,t){return ro(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}(e,{target:t.target}),{createScanner:e=>new io(e,t),createString:e=>({content:e})}}(),langs:[],themes:[]});function co(e){const t=/^diff-([\w-]+)/i.exec(e);return t?t[1]:null}function uo(e){const t=co(e)||e;return!!Bn(t)||lo.getLoadedLanguages().includes(t)}function po(t,n,r){const s=co(t),i=s||t;if(!uo(i)){const s=oo.find((e=>e.id===i||e.aliases&&e.aliases.includes(i)));if(s)return lo.loadLanguage(s.import()).then((()=>{n&&r&&n.update((()=>{const n=h(r);e(n)&&n.getLanguage()===t&&!n.getIsSyntaxHighlightSupported()&&n.setIsSyntaxHighlightSupported(!0)}))}))}}function ho(e){const t=e;return!!Un(t)||lo.getLoadedThemes().includes(t)}function mo(t,n,r){if(!ho(t)){const s=ao.find((e=>e.id===t));if(s)return lo.loadTheme(s.import()).then((()=>{n&&r&&n.update((()=>{const t=h(r);e(t)&&t.markDirty()}))}))}}function go(){return oo.map((e=>[e.id,e.name]))}function fo(){return ao.map((e=>[e.id,e.displayName]))}function yo(e){const t=e,n=oo.find((e=>e.id===t||e.aliases&&e.aliases.includes(t)));return n?n.id:e}function ko(e,n){const r=/^diff-([\w-]+)/i.exec(n),s=e.getTextContent(),i=lo.codeToTokens(s,{lang:r?r[1]:n,theme:e.getTheme()||"poimandres"}),{tokens:o,bg:a,fg:l}=i;let c="";return a&&(c+=`background-color: ${a};`),l&&(c+=`color: ${l};`),e.getStyle()!==c&&e.setStyle(c),function(e,n){const r=[];return e.forEach(((e,s)=>{s&&r.push(d()),e.forEach(((e,s)=>{let i=e.content;if(n&&0===s&&i.length>0){const e=["+","-",">","<"," "],n=["inserted","deleted","inserted","deleted","unchanged"],s=e.indexOf(i[0]);-1!==s&&(r.push(t(e[s],n[s])),i=i.slice(1))}i.split("\t").forEach(((n,s)=>{if(s&&r.push(m()),""!==n){const s=t(n),i=Xn(e.htmlStyle||Vn(e));s.setStyle(i),r.push(s)}}))}))})),r}(o,!!r)}const bo={$tokenize(e,t){return ko(e,t||this.defaultLanguage)},defaultLanguage:r,defaultTheme:"one-light"};function wo(t,n,r){const s=t.getParent();e(s)?So(s,n,r):o(t)&&t.replace(L(t.__text))}function Co(e,t){const n=t.getElementByKey(e.getKey());if(null===n)return;const r=e.getChildren(),s=r.length;if(s===n.__cachedChildrenLength)return;n.__cachedChildrenLength=s;let i="1",o=1;for(let e=0;e<s;e++)E(r[e])&&(i+="\n"+ ++o);n.setAttribute("data-gutter",i)}const _o=new Set;function So(t,n,r){const s=t.getKey();let i=t.getLanguage();i||(i=r.defaultLanguage,t.setLanguage(i));let o=t.getTheme();o||(o=r.defaultTheme,t.setTheme(o));let a=!1;ho(o)||(mo(o,n,s),a=!0),uo(i)?t.getIsSyntaxHighlightSupported()||t.setIsSyntaxHighlightSupported(!0):(t.getIsSyntaxHighlightSupported()&&t.setIsSyntaxHighlightSupported(!1),po(i,n,s),a=!0),a||_o.has(s)||(_o.add(s),n.update((()=>{!function(t,n){const r=h(t);if(!e(r)||!r.isAttached())return;const s=w();if(!x(s))return void n();const i=s.anchor,o=i.offset,a="element"===i.type&&E(r.getChildAtIndex(i.offset-1));let l=0;if(!a){const e=i.getNode();l=o+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}if(!n())return;if(a)return void i.getNode().select(o,o);r.getChildren().some((e=>{const t=D(e);if(t||E(e)){const n=e.getTextContentSize();if(t&&n>=l)return e.select(l,l),!0;l-=n}return!1}))}(s,(()=>{const n=h(s);if(!e(n)||!n.isAttached())return!1;const i=n.getLanguage()||r.defaultLanguage,o=r.$tokenize(n,i),a=function(e,t){let n=0;for(;n<e.length&&vo(e[n],t[n]);)n++;const r=e.length,s=t.length,i=Math.min(r,s)-n;let o=0;for(;o<i;)if(o++,!vo(e[r-o],t[s-o])){o--;break}const a=n,l=r-o,c=t.slice(n,s-o);return{from:a,nodesForReplacement:c,to:l}}(n.getChildren(),o),{from:l,to:c,nodesForReplacement:u}=a;return!(l===c&&!u.length)&&(t.splice(l,c-l,u),!0)}))}),{onUpdate:()=>{_o.delete(s)},skipTransforms:!0}))}function vo(e,t){return o(e)&&o(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType&&e.__style===t.__style||G(e)&&G(t)||E(e)&&E(t)}function xo(t){if(!x(t))return!1;const n=t.anchor.getNode(),r=e(n)?n:n.getParent(),s=t.focus.getNode(),i=e(s)?s:s.getParent();return e(r)&&r.is(i)}function No(t){const n=t.getNodes(),r=[];if(1===n.length&&e(n[0]))return r;let s=[];for(let e=0;e<n.length;e++){const t=n[e];o(t)||G(t)||E(t)||B(169),E(t)?s.length>0&&(r.push(s),s=[]):s.push(t)}if(s.length>0){const e=t.isBackward()?t.anchor:t.focus,n=I(s[0].getKey(),0,"text");e.is(n)||r.push(s)}return r}function Ao(e){const t=w();if(!x(t)||!xo(t))return!1;const n=No(t),r=n.length;if(0===r&&t.isCollapsed())return e===_&&t.insertNodes([m()]),!0;if(0===r&&e===_&&"\n"===t.getTextContent()){const e=m(),n=d(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),P(R(T(M(e,"next",0),$(O(n,"next"))),r)),!0}for(let s=0;s<r;s++){const r=n[s];if(r.length>0){let n=r[0];if(0===s&&(n=a(n)),e===_){const e=m();if(n.insertBefore(e),0===s){const r=t.isBackward()?"focus":"anchor",s=I(n.getKey(),0,"text");t[r].is(s)&&t[r].set(e.getKey(),0,"text")}}else G(n)&&n.remove()}}return!0}function jo(e,t){const n=w();if(!x(n))return!1;const{anchor:r,focus:s}=n,i=r.offset,c=s.offset,u=r.getNode(),p=s.getNode(),h=e===v;if(!xo(n)||!o(u)&&!G(u)||!o(p)&&!G(p))return!1;if(!t.altKey){if(n.isCollapsed()){const e=u.getParentOrThrow();if(h&&0===i&&null===u.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!h&&i===u.getTextContentSize()&&null===u.getNextSibling()){if(null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}}return!1}let d,m;if(u.isBefore(p)?(d=a(u),m=l(p)):(d=a(p),m=l(u)),null==d||null==m)return!1;const g=d.getNodesBetween(m);for(let e=0;e<g.length;e++){const t=g[e];if(!o(t)&&!G(t)&&!E(t))return!1}t.preventDefault(),t.stopPropagation();const f=h?d.getPreviousSibling():m.getNextSibling();if(!E(f))return!0;const y=h?f.getPreviousSibling():f.getNextSibling();if(null==y)return!0;const k=o(y)||G(y)||E(y)?h?a(y):l(y):null;let b=null!=k?k:y;return f.remove(),g.forEach((e=>e.remove())),e===v?(g.forEach((e=>b.insertBefore(e))),b.insertBefore(f)):(b.insertAfter(f),b=f,g.forEach((e=>{b.insertAfter(e),b=e}))),n.setTextNodeRange(u,i,p,c),!0}function Eo(e,t){const n=w();if(!x(n))return!1;const{anchor:r,focus:s}=n,i=r.getNode(),a=s.getNode(),l=e===A;if(!xo(n)||!o(i)&&!G(i)||!o(a)&&!G(a))return!1;if(l){const e=c(a,s.offset);if(null!==e){const{node:t,offset:r}=e;E(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else a.getParentOrThrow().selectStart()}else{u(a).select()}return t.preventDefault(),t.stopPropagation(),!0}function Lo(t,n){if(!t.hasNodes([s,i]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==n&&(n=bo);const r=[];return!0!==t._headless&&r.push(t.registerMutationListener(s,(e=>{t.update((()=>{for(const[n,r]of e)if("destroyed"!==r){const e=h(n);null!==e&&Co(e,t)}}))}),{skipInitialization:!1})),r.push(t.registerNodeTransform(s,(e=>So(e,t,n))),t.registerNodeTransform(f,(e=>wo(e,t,n))),t.registerNodeTransform(i,(e=>wo(e,t,n))),t.registerCommand(y,(e=>{const n=function(e){const t=w();if(!x(t)||!xo(t))return null;const n=e?S:_,r=e?S:b,s=t.anchor,i=t.focus;if(s.is(i))return r;const o=No(t);if(1!==o.length)return n;const c=o[0];let u,p;0===c.length&&B(285),t.isBackward()?(u=i,p=s):(u=s,p=i);const h=a(c[0]),d=l(c[0]),m=I(h.getKey(),0,"text"),g=I(d.getKey(),d.getTextContentSize(),"text");return u.isBefore(m)||g.isBefore(p)?n:m.isBefore(u)||p.isBefore(g)?r:n}(e.shiftKey);return null!==n&&(e.preventDefault(),t.dispatchCommand(n,void 0),!0)}),k),t.registerCommand(b,(()=>!!xo(w())&&(C([m()]),!0)),k),t.registerCommand(_,(e=>Ao(_)),k),t.registerCommand(S,(e=>Ao(S)),k),t.registerCommand(v,(t=>{const n=w();if(!x(n))return!1;const{anchor:r}=n,s=r.getNode();return!!xo(n)&&(n.isCollapsed()&&0===r.offset&&null===s.getPreviousSibling()&&e(s.getParentOrThrow())?(t.preventDefault(),!0):jo(v,t))}),k),t.registerCommand(N,(t=>{const n=w();if(!x(n))return!1;const{anchor:r}=n,s=r.getNode();return!!xo(n)&&(n.isCollapsed()&&r.offset===s.getTextContentSize()&&null===s.getNextSibling()&&e(s.getParentOrThrow())?(t.preventDefault(),!0):jo(N,t))}),k),t.registerCommand(A,(e=>Eo(A,e)),k),t.registerCommand(j,(e=>Eo(j,e)),k)),p(...r)}const Io=g({config:{tokenizer:bo},dependencies:[n],name:"@lexical/code-shiki",register:(e,{tokenizer:t})=>Lo(e,t)});export{Io as CodeHighlighterShikiExtension,bo as ShikiTokenizer,go as getCodeLanguageOptions,fo as getCodeThemeOptions,uo as isCodeLanguageLoaded,po as loadCodeLanguage,mo as loadCodeTheme,yo as normalizeCodeLanguage,Lo as registerCodeHighlighting};
|
|
55
|
+
`.replace(/\s+/g,""),"gsu");const Qs=String.raw,Zs=Qs`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Js=Qs`\(\?R=(?<rDepth>[^\)]+)\)|${Zs}`,Ys=Qs`\(\?<(?![=!])(?<captureName>[^>]+)>`,ei=Qs`${Ys}|(?<unnamed>\()(?!\?)`,ti=new RegExp(Qs`${Ys}|${Js}|\(\?|\\?.`,"gsu"),ni="Cannot use multiple overlapping recursions";function ri(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if((e=+e)<2||e>100)throw new Error(t)}function si(e,t,n,r,s,i,o){const a=new Set;r&&Ws(e+t,Ys,({groups:{captureName:e}})=>{a.add(e)},Us.DEFAULT);const l=[n,r?a:null,s,i,o];return`${e}${ii(`(?:${e}`,"forward",...l)}(?:)${ii(`${t})`,"backward",...l)}${t}`}function ii(e,t,n,r,s,i,o){const a=e=>"forward"===t?e+2:n-e+2-1;let l="";for(let t=0;t<n;t++){const n=a(t);l+=zs(e,Qs`${ei}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:a,backref:l}})=>{if(l&&r&&!r.has(l))return e;const c=`_$${n}`;if(a||t){const n=o+i.length+1;return i.push(n),oi(s,n),a?e:`(?<${t}${c}>`}return Qs`\k<${l}${c}>`},Us.DEFAULT)}return l}function oi(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function ai(e,t,n,r,s,i){if(e.size&&r){let o=0;Ws(t,ei,()=>o++,Us.DEFAULT);const a=i-o+s,l=new Map;return e.forEach((e,t)=>{const s=(r-o*n)/n,i=o*n,c=t>a+o?t+r:t,u=[];for(const t of e)if(t<=a)u.push(t);else if(t>a+o+s)u.push(t+r);else if(t<=a+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+i+s*e);l.set(c,u)}),l}return e}var li=String.fromCodePoint,ci=String.raw,ui={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("","v")}catch{return!1}return!0})()};function pi(e,{enable:t,disable:n}){return{dotAll:!(n?.dotAll||!t?.dotAll&&!e.dotAll),ignoreCase:!(n?.ignoreCase||!t?.ignoreCase&&!e.ignoreCase)}}function hi(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function di(e,t){return mi[e]>=mi[t]}ui.bugFlagVLiteralHyphenIsRange=!!ui.unicodeSets&&(()=>{try{new RegExp(ci`[\d\-a]`,"v")}catch{return!0}return!1})(),ui.bugNestedClassIgnoresNegation=ui.unicodeSets&&new RegExp("[[^a]]","v").test("a");var mi={ES2025:2025,ES2024:2024,ES2018:2018},gi={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function fi(e={}){if("[object Object]"!=={}.toString.call(e))throw new Error("Unexpected options");if(void 0!==e.target&&!gi[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return"auto"===t.target&&(t.target=ui.flagGroups?"ES2025":ui.unicodeSets?"ES2024":"ES2018"),t}var yi=new Set([li(304),li(305)]),ki=ci`[\p{L}\p{M}\p{N}\p{Pc}]`;function bi(e){if(yi.has(e))return[e];const t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),s=Si.get(n),i=Ci.get(n),o=_i.get(n);return 1===[...r].length&&t.add(r),o&&t.add(o),s&&t.add(s),t.add(n),i&&t.add(i),[...t]}var wi=new Map("C Other\nCc Control cntrl\nCf Format\nCn Unassigned\nCo Private_Use\nCs Surrogate\nL Letter\nLC Cased_Letter\nLl Lowercase_Letter\nLm Modifier_Letter\nLo Other_Letter\nLt Titlecase_Letter\nLu Uppercase_Letter\nM Mark Combining_Mark\nMc Spacing_Mark\nMe Enclosing_Mark\nMn Nonspacing_Mark\nN Number\nNd Decimal_Number digit\nNl Letter_Number\nNo Other_Number\nP Punctuation punct\nPc Connector_Punctuation\nPd Dash_Punctuation\nPe Close_Punctuation\nPf Final_Punctuation\nPi Initial_Punctuation\nPo Other_Punctuation\nPs Open_Punctuation\nS Symbol\nSc Currency_Symbol\nSk Modifier_Symbol\nSm Math_Symbol\nSo Other_Symbol\nZ Separator\nZl Line_Separator\nZp Paragraph_Separator\nZs Space_Separator\nASCII\nASCII_Hex_Digit AHex\nAlphabetic Alpha\nAny\nAssigned\nBidi_Control Bidi_C\nBidi_Mirrored Bidi_M\nCase_Ignorable CI\nCased\nChanges_When_Casefolded CWCF\nChanges_When_Casemapped CWCM\nChanges_When_Lowercased CWL\nChanges_When_NFKC_Casefolded CWKCF\nChanges_When_Titlecased CWT\nChanges_When_Uppercased CWU\nDash\nDefault_Ignorable_Code_Point DI\nDeprecated Dep\nDiacritic Dia\nEmoji\nEmoji_Component EComp\nEmoji_Modifier EMod\nEmoji_Modifier_Base EBase\nEmoji_Presentation EPres\nExtended_Pictographic ExtPict\nExtender Ext\nGrapheme_Base Gr_Base\nGrapheme_Extend Gr_Ext\nHex_Digit Hex\nIDS_Binary_Operator IDSB\nIDS_Trinary_Operator IDST\nID_Continue IDC\nID_Start IDS\nIdeographic Ideo\nJoin_Control Join_C\nLogical_Order_Exception LOE\nLowercase Lower\nMath\nNoncharacter_Code_Point NChar\nPattern_Syntax Pat_Syn\nPattern_White_Space Pat_WS\nQuotation_Mark QMark\nRadical\nRegional_Indicator RI\nSentence_Terminal STerm\nSoft_Dotted SD\nTerminal_Punctuation Term\nUnified_Ideograph UIdeo\nUppercase Upper\nVariation_Selector VS\nWhite_Space space\nXID_Continue XIDC\nXID_Start XIDS".split(/\s/).map(e=>[Rs(e),e])),Ci=new Map([["s",li(383)],[li(383),"s"]]),_i=new Map([[li(223),li(7838)],[li(107),li(8490)],[li(229),li(8491)],[li(969),li(8486)]]),Si=new Map([xi(453),xi(456),xi(459),xi(498),...Ni(8072,8079),...Ni(8088,8095),...Ni(8104,8111),xi(8124),xi(8140),xi(8188)]),vi=new Map([["alnum",ci`[\p{Alpha}\p{Nd}]`],["alpha",ci`\p{Alpha}`],["ascii",ci`\p{ASCII}`],["blank",ci`[\p{Zs}\t]`],["cntrl",ci`\p{Cc}`],["digit",ci`\p{Nd}`],["graph",ci`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",ci`\p{Lower}`],["print",ci`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",ci`[\p{P}\p{S}]`],["space",ci`\p{space}`],["upper",ci`\p{Upper}`],["word",ci`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",ci`\p{AHex}`]]);function xi(e){const t=li(e);return[t.toLowerCase(),t]}function Ni(e,t){return function(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}(e,t).map(e=>xi(e))}var Ai=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);var ji={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:s}=e;if("repeater"!==s)throw new Error('Unsupported absence function "(?~|"');{const e=vs();e.body[0].body.push(xs({negate:!0,body:r}),js("Any"));const s=vs();s.body[0].body.push(Ns("greedy",0,1/0,e)),n(Wi(s,t),{traverse:!0})}},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){const s=e.body.filter(e=>"flags"===e.kind);for(let e=n+1;e<t.body.length;e++){hi(r,t.body[e],[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=Mi(t.get(e));if(n){const t=vs({flags:n});t.body[0].body=e.body,e.body=[Wi(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:s,remove:i,replaceWith:o},a){const{kind:l,negate:c}=e,{asciiWordBoundaries:u,avoidSubclass:p,supportedGNodes:h,wordIsAscii:d}=a;if("text_segment_boundary"===l)throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if("line_end"===l)o(Wi(xs({body:[fs({body:[ys("string_end")]}),fs({body:[ws(10)]})]}),t));else if("line_start"===l)o(Wi(Fi(ci`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if("search_start"===l)if(h.has(e))s.flags.sticky=!0,i();else{const e=r[n-1];if(e&&function(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||"Quantifier"===e.type&&e.min&&t.includes(e.body.type)}(e))o(Wi(xs({negate:!0}),t));else{if(p)throw new Error(ci`Uses "\G" in a way that requires a subclass`);o(zi(ys("string_start"),t)),a.strategy="clip_search"}}else if("string_end"===l||"string_start"===l);else if("string_end_newline"===l)o(Wi(Fi(ci`(?=\n?\z)`),t));else{if("word_boundary"!==l)throw new Error(`Unexpected assertion kind "${l}"`);if(!d&&!u){o(Wi(Fi(c?`(?:(?<=${ki})(?=${ki})|(?<!${ki})(?!${ki}))`:`(?:(?<=${ki})(?!${ki})|(?<!${ki})(?=${ki}))`),t))}}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||Bi(n)||(n=Ti(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!Bi(r)&&(r=Ti(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if("intersection"===t.kind){n(Wi(Cs({body:[e]}),t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:i,spaceIsAscii:o,wordIsAscii:a}){const{kind:l,negate:c,value:u}=e;if(!i||"digit"!==l&&"digit"!==u)if(!o||"space"!==l&&"space"!==u)if(!a||"word"!==l&&"word"!==u)if("any"===l)n(zi(js("Any"),t));else if("digit"===l)n(zi(js("Nd",{negate:c}),t));else if("dot"===l);else if("text_segment"===l){if("strict"===r)throw new Error(ci`Use of "\X" requires non-strict accuracy`);const e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",i=ci`\p{RI}{2}|${e}(?:\u200D${e})*`;n(Wi(Fi(ci`(?>\r\n|${s?ci`\p{RGI_Emoji}`:i}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===l)n(zi(js("AHex",{negate:c}),t));else if("newline"===l)n(Wi(Fi(c?"[^\n]":"(?>\r\n?|[\n\v\f
\u2028\u2029])"),t));else if("posix"===l)if(s||"graph"!==u&&"print"!==u)n(Wi(Ui(Fi(vi.get(u)),c),t));else{if("strict"===r)throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:"!-~",print:" -~"}[u];c&&(e=`\0-${li(e.codePointAt(0)-1)}${li(e.codePointAt(2)+1)}-`),n(Wi(Fi(`[${e}]`),t))}else if("property"===l)wi.has(Rs(u))||(e.key="sc");else if("space"===l)n(zi(js("space",{negate:c}),t));else{if("word"!==l)throw new Error(`Unexpected character set kind "${l}"`);n(Wi(Ui(Fi(ki),c),t))}else n(zi(_s("word",{negate:c}),t));else n(Wi(Ui(Fi("[\t-\r ]"),c),t));else n(zi(_s("digit",{negate:c}),t))},Directive({node:e,parent:t,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:i,removeAllNextSiblings:o}){const{kind:a,flags:l}=e;if("flags"===a)if(l.enable||l.disable){const e=vs({flags:l});e.body[0].body=o(),s(Wi(e,t),{traverse:!0})}else r();else{if("keep"!==a)throw new Error(`Unexpected directive kind "${a}"`);{const e=n.body[0],r=1===n.body.length&&us(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw new Error(ci`Uses "\K" in a way that's unsupported`);const o=xs({behind:!0});o.body[0].body=i(),s(Wi(o,t))}}},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if("word"===e.textSegmentMode)throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;"lookbehind"===n&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:r}=e;if("fail"!==r)throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`);n(Wi(xs({negate:!0}),t))},Quantifier({node:e}){if("Quantifier"===e.body.type){const t=vs();t.body[0].body.push(e.body),e.body=Wi(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let r=!1,s=!1;for(const t of e.body)if(1===t.body.length&&"search_start"===t.body[0].kind)t.body.pop();else{const e=Gi(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):s=!0}r&&!s&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if("strict"===t&&n&&r)throw new Error(ci`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||Bi(n)||(n=Ti(n,t),e.ref=n)}},Ei={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=e;r||n.set(e,[...t.get(s).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:i,multiplexCapturesToLeftByRef:o,openRefs:a,reffedNodesByReferencer:l}){const c=s.get(e);if(c&&a.has(e.number)){const r=zi(Ri(e.number),t);return l.set(r,a.get(e.number)),void n(r)}a.set(e.number,e),o.set(e.number,[]),e.name&&hi(o,e.name,[]);const u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){const n=u[t];if(c===n.node||c&&c===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:c}),e.name&&o.get(e.name).push({node:e,origin:c}),e.name){const t=hi(i,e.name,new Map);let n=!1;if(c)n=!0;else for(const e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}i.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=pi(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){const{isRecursive:s,ref:i}=e;if(s){let n=t;for(;(n=n.parent)&&("CapturingGroup"!==n.type||n.name!==i&&n.number!==i););return void r.reffedNodesByReferencer.set(e,n)}const o=r.subroutineRefMap.get(i),a=0===i,l=a?Ri(0):Pi(o,r.groupOriginByCopy,null);let c=l;if(!a){const e=Mi(function(e,t){const n=[];for(;e=e.parent;)t&&!t(e)||n.push(e);return n}(o,e=>"Group"===e.type&&!!e.flags)),t=e?pi(r.globalFlags,e):r.globalFlags;(function(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase})(t,r.currentFlags)||(c=vs({flags:$i(t)}),c.body[0].body.push(l))}n(Wi(c,t),{traverse:!a})}},Li={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan)return void(r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref));const s=r.reffedNodesByReferencer.get(e).filter(t=>function(e,t){let n=t;do{if("Regex"===n.type)return!1;if("Alternative"===n.type)continue;if(n===e)return!1;const t=Oi(n.parent);for(const r of t){if(r===n)break;if(r===e||Di(r,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}(t,e));if(s.length)if(s.length>1){n(Wi(vs({atomic:!0,body:s.reverse().map(e=>fs({body:[ks(e.number)]}))}),t))}else e.ref=s[0].number;else n(Wi(xs({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){const t=bs();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Ii(e){$s(e,{"*"({node:e,parent:t}){e.parent=t}})}function Pi(e,t,n,r){const s=Array.isArray(e)?[]:{};for(const[i,o]of Object.entries(e))"parent"===i?s.parent=Array.isArray(n)?r:n:o&&"object"==typeof o?s[i]=Pi(o,t,s,n):("type"===i&&"CapturingGroup"===o&&t.set(s,t.get(e)??e),s[i]=o);return s}function Ri(e){const t=As(e);return t.isRecursive=!0,t}function Ti(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,"_")}`;return t.set(e,n),n}function Mi(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function $i({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),e&&t||(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Oi(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Gi(e){const t=e.find(e=>"search_start"===e.kind||function(e,t){const n={negate:null,...t};return"LookaroundAssertion"===e.type&&(null===n.negate||e.negate===n.negate)&&1===e.body.length&&us(e.body[0],{type:"Assertion",kind:"search_start"})}(e,{negate:!1})||!function({type:e}){return"Assertion"===e||"Directive"===e||"LookaroundAssertion"===e}(e));if(!t)return null;if("search_start"===t.kind)return t;if("LookaroundAssertion"===t.type)return t.body[0].body[0];if("CapturingGroup"===t.type||"Group"===t.type){const e=[];for(const n of t.body){const t=Gi(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Di(e,t){const n=Oi(e)??[];for(const e of n)if(e===t||Di(e,t))return!0;return!1}function Bi(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Fi(e,t){const n=hs(e,{...t,unicodePropertyMap:wi}).body;return n.length>1||n[0].body.length>1?vs({body:n}):n[0].body[0]}function Ui(e,t){return e.negate=t,e}function zi(e,t){return e.parent=t,e}function Wi(e,t){return Ii(e),e.parent=t,e}function Hi(e,t){const n=fi(t),r=di(n.target,"ES2024"),s=di(n.target,"ES2025"),i=n.rules.recursionLimit;if(!Number.isInteger(i)||i<2||i>20)throw new Error("Invalid recursionLimit; use 2-20");let o=null,a=null;if(!s){const t=[e.flags.ignoreCase];$s(e,qi,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:a=!0}})}const l={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!o||a)};let c=e;const u={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:e._originMap,recursionLimit:i,useAppliedIgnoreCase:!(s||!o||!a),useFlagMods:s,useFlagV:r,verbose:n.verbose};function p(e){u.lastNode=c,c=e;return function(e,t){if(null==e)throw new Error(t??"Value expected");return e}(Vi[e.type],`Unexpected node type "${e.type}"`)(e,u,p)}const h={pattern:e.body.map(p).join("|"),flags:p(e.flags),options:{...e.options}};return r||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&h._hiddenCaptures.push(t),e.transferTo&&hi(h._captureTransfers,e.transferTo,[]).push(t)}),h}var qi={"*":{enter({node:e},t){if(no(e)){const n=t.getCurrentModI();t.pushModI(e.flags?pi({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){no(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Yi(li(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),eo(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&Ai.has(e.value)&&t.setHasCasedChar()}},Vi={Alternative:({body:e},t,n)=>e.map(n).join(""),Assertion({kind:e,negate:t}){if("string_end"===e)return"$";if("string_start"===e)return"^";if("word_boundary"===e)return t?ci`\B`:ci`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if("number"!=typeof e)throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&"strict"===t.accuracy&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:r,name:s,number:i}=e,o={ignoreCase:t.currentFlags.ignoreCase},a=t.originMap.get(e);return a&&(o.hidden=!0,i>a.number&&(o.transferTo=a.number)),t.captureMap.set(i,o),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=li(e),r=to(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Yi(n)){const e=bi(n);return t.inCharClass?e.join(""):e.length>1?`[${e.join("")}]`:e[0]}return n},CharacterClass(e,t,n){const{kind:r,negate:s,parent:i}=e;let{body:o}=e;if("intersection"===r&&!t.useFlagV)throw new Error("Use of class intersection requires min target ES2024");ui.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(ro)&&(o=[ws(45),...o.filter(e=>!ro(e))]);const a=()=>`[${s?"^":""}${o.map(n).join("intersection"===r?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||ui.bugNestedClassIgnoresNegation)&&!s){const t=o.filter(e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate);if(t.length){const r=vs(),s=r.body[0];return r.parent=i,s.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=s,s.body.push(e)):r.body.pop(),t.forEach(e=>{const t=fs({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;const r=a();return t.inCharClass=!1,r}const l=o[0];if("union"===r&&!s&&l&&((!t.useFlagV||!t.verbose)&&"union"===i.kind&&(!ui.bugFlagVLiteralHyphenIsRange||!t.useFlagV)||!t.verbose&&"intersection"===i.kind&&1===o.length&&"CharacterClassRange"!==l.type))return o.map(n).join("");if(!t.useFlagV&&"CharacterClass"===i.type)throw new Error("Use of nested character class requires min target ES2024");return a()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},i=to(n,s),o=to(r,s),a=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const t=function(e){const t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[];let r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:null===r?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}(eo(e));t.forEach(e=>{a.add(Array.isArray(e)?`${to(e[0],s)}-${to(e[1],s)}`:to(e,s))})}return`${i}-${o}${[...a].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},s){if("dot"===e)return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":ci`[^\n]`;if("digit"===e)return t?ci`\D`:ci`\d`;if("property"===e){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&Ai.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?ci`\P`:ci`\p`}{${r?`${r}=`:""}${n}}`}if("word"===e)return t?ci`\W`:ci`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags:(e,t)=>(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":""),Group({atomic:e,body:t,flags:n,parent:r},s,i){const o=s.currentFlags;n&&(s.currentFlags=pi(o,n));const a=t.map(i).join("|"),l=s.verbose||1!==t.length||"Quantifier"===r.type||e||s.useFlagMods&&n?`(?${function(e,t,n){if(e)return">";let r="";if(t&&n){const{enable:e,disable:n}=t;r=(e?.ignoreCase?"i":"")+(e?.dotAll?"s":"")+(n?"-":"")+(n?.ignoreCase?"i":"")+(n?.dotAll?"s":"")}return`${r}:`}(e,n,s.useFlagMods)}${a})`:a;return s.currentFlags=o,l},LookaroundAssertion:({body:e,kind:t,negate:n},r,s)=>`(?${`${"lookahead"===t?"":"<"}${n?"!":"="}`}${e.map(s).join("|")})`,Quantifier:(e,t,n)=>n(e.body)+function({kind:e,max:t,min:n}){let r;r=n||1!==t?n||t!==1/0?1===n&&t===1/0?"+":n===t?`{${n}}`:`{${n},${t===1/0?"":t}}`:"*":"?";return r+{greedy:"",lazy:"?",possessive:"+"}[e]}(e),Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return 0===t?`(?R=${r})`:ci`\g<${t}&R=${r}>`}},Xi=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Ki=new Set(["-","\\","]","^","["]),Qi=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),Zi=new Map([[9,ci`\t`],[10,ci`\n`],[11,ci`\v`],[12,ci`\f`],[13,ci`\r`],[8232,ci`\u2028`],[8233,ci`\u2029`],[65279,ci`\uFEFF`]]),Ji=/^\p{Cased}$/u;function Yi(e){return Ji.test(e)}function eo(e,t){const n=!!t?.firstOnly,r=e.min.value,s=e.max.value,i=[];if(r<65&&(65535===s||s>=131071)||65536===r&&s>=131071)return i;for(let e=r;e<=s;e++){const t=li(e);if(!Yi(t))continue;const o=bi(t).filter(e=>{const t=e.codePointAt(0);return t<r||t>s});if(o.length&&(i.push(...o),n))break}return i}function to(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Zi.has(e))return Zi.get(e);if(e<32||e>126&&e<160||e>262143||t&&((s=e)>47&&s<58))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;var s;const i=n?r?Qi:Ki:Xi,o=li(e);return(i.has(o)?"\\":"")+o}function no({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function ro({type:e,value:t}){return"Character"===e&&45===t}var so=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#s=null;rawOptions={};get source(){return this.#n||"(?:)"}constructor(t,n,r){const s=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const s=t;super(s,n),this.#n=s.source,s instanceof e&&(this.#e=s.#e,this.#r=s.#r,this.#s=s.#s,this.rawOptions=s.rawOptions)}else{const e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":t,n),this.#n=t,this.#e=function(e,t){const n=new Map;for(const t of e)n.set(t,{hidden:!0});for(const[e,r]of t)for(const t of r)hi(n,t,{}).transferTo=e;return n}(e.hiddenCaptures,e.transfers),this.#s=e.strategy,this.rawOptions=r??{}}s||(this.#t=this)}exec(t){if(!this.#t){const{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}const n=this.global||this.sticky,r=this.lastIndex;if("clip_search"===this.#s&&n&&r){this.lastIndex=0;const e=this.#i(t.slice(r));return e&&(!function(e,t,n,r){if(e.index+=t,e.input=n,r){const n=e.indices;for(let e=0;e<n.length;e++){const r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}const r=n.groups;r&&Object.keys(r).forEach(e=>{const n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#i(t)}#i(e){this.#t.lastIndex=this.lastIndex;const t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;const n=[...t];let r;t.length=1,this.hasIndices&&(r=[...t.indices],t.indices.length=1);const s=[0];for(let e=1;e<n.length;e++){const{hidden:i,transferTo:o}=this.#e.get(e)??{};if(i?s.push(null):(s.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&void 0!==n[e]){const i=s[o];if(!i)throw new Error(`Invalid capture transfer to "${i}"`);if(t[i]=n[e],this.hasIndices&&(t.indices[i]=r[e]),t.groups){this.#r||(this.#r=io(this.source));const s=this.#r.get(o);s&&(t.groups[s]=n[e],this.hasIndices&&(t.indices.groups[s]=r[e]))}}}return t}};function io(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r,s=0,i=0;for(;r=t.exec(e);){const{0:e,groups:{capture:t,name:o}}=r;"["===e?s++:s?"]"===e&&s--:t&&(i++,o&&n.set(i,o))}return n}function oo(e,t){const n=function(e,t){const n=fi(t),r=hs(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:wi}),s=function(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};Ii(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:di(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};$s(e,ji,r);const s={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},i={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return $s(e,Ei,i),$s(e,Li,{groupsByName:i.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:i.reffedNodesByReferencer}),e._originMap=i.groupOriginByCopy,e._strategy=r.strategy,e}(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=Hi(s,n),o=function(e,t){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...t};let s=t?.captureTransfers??new Map;if(!new RegExp(Js,"su").test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:n};if("plugin"===r&&Hs(e,Qs`\(\?\(DEFINE\)`,Us.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const i=[],o=Hs(e,Qs`\\[1-9]`,Us.DEFAULT),a=new Map,l=[];let c,u=!1,p=0,h=0;for(ti.lastIndex=0;c=ti.exec(e);){const{0:t,groups:{captureName:d,rDepth:m,gRNameOrNum:g,gRDepth:f}}=c;if("["===t)p++;else if(p)"]"===t&&p--;else{if(m){if(ri(m),u)throw new Error(ni);if(o)throw new Error(("external"===r?"Backrefs":"Numbered backrefs")+" cannot be used with global recursion");const t=e.slice(0,c.index),a=e.slice(ti.lastIndex);if(Hs(a,Js,Us.DEFAULT))throw new Error(ni);const l=+m-1;e=si(t,a,l,!1,n,i,h),s=ai(s,t,l,i.length,0,h);break}if(g){ri(f);let p=!1;for(const e of l)if(e.name===g||e.num===+g){if(p=!0,e.hasRecursedWithin)throw new Error(ni);break}if(!p)throw new Error(Qs`Recursive \g cannot be used outside the referenced group "${"external"===r?g:Qs`\g<${g}&R=${f}>`}"`);const d=a.get(g),m=qs(e,d);if(o&&Hs(m,Qs`${Ys}|\((?!\?)`,Us.DEFAULT))throw new Error(("external"===r?"Backrefs":"Numbered backrefs")+" cannot be used with recursion of capturing groups");const y=e.slice(d,c.index),k=m.slice(y.length+t.length),b=i.length,w=+f-1,C=si(y,k,w,!0,n,i,h);s=ai(s,y,w,i.length-b,b,h);const _=e.slice(0,d),S=e.slice(d+m.length);e=`${_}${C}${S}`,ti.lastIndex+=C.length-t.length-y.length-k.length,l.forEach(e=>e.hasRecursedWithin=!0),u=!0}else if(d)h++,a.set(String(h),ti.lastIndex),a.set(d,ti.lastIndex),l.push({num:h,name:d});else if("("===t[0]){const e="("===t;e&&(h++,a.set(String(h),ti.lastIndex)),l.push(e?{num:h}:{})}else")"===t&&l.pop()}}return n.push(...i),{pattern:e,captureTransfers:s,hiddenCaptures:n}}(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:"external"}),a=function(e,t){const n=t?.hiddenCaptures??[];let r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};const s="(?:(?=(",i=[0],o=[];let a,l=0,c=0,u=NaN;do{a=!1;let t,p=0,h=0,d=!1;for(Vs.lastIndex=Number.isNaN(u)?0:u+7;t=Vs.exec(e);){const{0:m,index:g,groups:{capturingStart:f,noncapturingStart:y}}=t;if("["===m)p++;else if(p)"]"===m&&p--;else if("(?>"!==m||d){if(d&&y)h++;else if(f)d?h++:(l++,i.push(l+c));else if(")"===m&&d){if(!h){c++;const t=l+c;if(e=`${e.slice(0,u)}${s}${e.slice(u+3,g)}))<$$${t}>)${e.slice(g+1)}`,a=!0,o.push(t),Bs(n,t),r.size){const e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}h--}}else u=g,d=!0}}while(a);return n.push(...o),e=zs(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){const n=+t;if(n>i.length-1)throw new Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},Us.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}(function(e){if(!new RegExp(`${Xs}\\+`).test(e))return{pattern:e};const t=[];let n,r=null,s=null,i="",o=0;for(Ks.lastIndex=0;n=Ks.exec(e);){const{0:a,index:l,groups:{qBase:c,qMod:u,invalidQ:p}}=n;if("["===a)o||(s=l),o++;else if("]"===a)o?o--:s=null;else if(!o)if("+"===u&&i&&!i.startsWith("(")){if(p)throw new Error(`Invalid quantifier "${a}"`);let t=-1;if(/^\{\d+\}$/.test(c))e=Fs(e,l+c.length,u,"");else{if(")"===i||"]"===i){const t=")"===i?r:s;if(null===t)throw new Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,l)}${c})${e.slice(l+a.length)}`}else e=`${e.slice(0,l-i.length)}(?>${i}${c})${e.slice(l+a.length)}`;t+=4}Ks.lastIndex+=t}else"("===a[0]?t.push(l):")"===a&&(r=t.length?t.pop():null);i=a}return{pattern:e}}(o.pattern).pattern,{captureTransfers:o.captureTransfers,hiddenCaptures:o.hiddenCaptures}),l={pattern:a.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${i.flags}${i.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const e=a.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(a.captureTransfers),r=s._strategy,i=l.pattern.length>=n.lazyCompileLength;(e.length||t.length||r||i)&&(l.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...r&&{strategy:r},...i&&{lazyCompile:i}})}return l}(e,t);return n.options?new so(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}const ao=4294967295;class lo{constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:n=!1,cache:r,regexConstructor:s}=t;if(!s)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if("string"!=typeof e)return e;const t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{const t=s(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}regexps;findNextMatchSync(e,t,n){const r="string"==typeof e?e:e.content,s=[];function i(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>null==e?{start:ao,end:ao,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){const n=this.regexps[e];if(n)try{n.lastIndex=t;const o=n.exec(r);if(!o)continue;if(o.index===t)return i(e,o,0);s.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(s.length){const e=Math.min(...s.map(e=>e[1].index));for(const[t,n,r]of s)if(n.index===e)return i(t,n,r)}return null}}const co=[{id:"abap",name:"ABAP",import:()=>import("@shikijs/langs/abap")},{id:"actionscript-3",name:"ActionScript",import:()=>import("@shikijs/langs/actionscript-3")},{id:"ada",name:"Ada",import:()=>import("@shikijs/langs/ada")},{id:"angular-html",name:"Angular HTML",import:()=>import("@shikijs/langs/angular-html")},{id:"angular-ts",name:"Angular TypeScript",import:()=>import("@shikijs/langs/angular-ts")},{id:"apache",name:"Apache Conf",import:()=>import("@shikijs/langs/apache")},{id:"apex",name:"Apex",import:()=>import("@shikijs/langs/apex")},{id:"apl",name:"APL",import:()=>import("@shikijs/langs/apl")},{id:"applescript",name:"AppleScript",import:()=>import("@shikijs/langs/applescript")},{id:"ara",name:"Ara",import:()=>import("@shikijs/langs/ara")},{id:"asciidoc",name:"AsciiDoc",aliases:["adoc"],import:()=>import("@shikijs/langs/asciidoc")},{id:"asm",name:"Assembly",import:()=>import("@shikijs/langs/asm")},{id:"astro",name:"Astro",import:()=>import("@shikijs/langs/astro")},{id:"awk",name:"AWK",import:()=>import("@shikijs/langs/awk")},{id:"ballerina",name:"Ballerina",import:()=>import("@shikijs/langs/ballerina")},{id:"bat",name:"Batch File",aliases:["batch"],import:()=>import("@shikijs/langs/bat")},{id:"beancount",name:"Beancount",import:()=>import("@shikijs/langs/beancount")},{id:"berry",name:"Berry",aliases:["be"],import:()=>import("@shikijs/langs/berry")},{id:"bibtex",name:"BibTeX",import:()=>import("@shikijs/langs/bibtex")},{id:"bicep",name:"Bicep",import:()=>import("@shikijs/langs/bicep")},{id:"blade",name:"Blade",import:()=>import("@shikijs/langs/blade")},{id:"bsl",name:"1C (Enterprise)",aliases:["1c"],import:()=>import("@shikijs/langs/bsl")},{id:"c",name:"C",import:()=>import("@shikijs/langs/c")},{id:"cadence",name:"Cadence",aliases:["cdc"],import:()=>import("@shikijs/langs/cadence")},{id:"cairo",name:"Cairo",import:()=>import("@shikijs/langs/cairo")},{id:"clarity",name:"Clarity",import:()=>import("@shikijs/langs/clarity")},{id:"clojure",name:"Clojure",aliases:["clj"],import:()=>import("@shikijs/langs/clojure")},{id:"cmake",name:"CMake",import:()=>import("@shikijs/langs/cmake")},{id:"cobol",name:"COBOL",import:()=>import("@shikijs/langs/cobol")},{id:"codeowners",name:"CODEOWNERS",import:()=>import("@shikijs/langs/codeowners")},{id:"codeql",name:"CodeQL",aliases:["ql"],import:()=>import("@shikijs/langs/codeql")},{id:"coffee",name:"CoffeeScript",aliases:["coffeescript"],import:()=>import("@shikijs/langs/coffee")},{id:"common-lisp",name:"Common Lisp",aliases:["lisp"],import:()=>import("@shikijs/langs/common-lisp")},{id:"coq",name:"Coq",import:()=>import("@shikijs/langs/coq")},{id:"cpp",name:"C++",aliases:["c++"],import:()=>import("@shikijs/langs/cpp")},{id:"crystal",name:"Crystal",import:()=>import("@shikijs/langs/crystal")},{id:"csharp",name:"C#",aliases:["c#","cs"],import:()=>import("@shikijs/langs/csharp")},{id:"css",name:"CSS",import:()=>import("@shikijs/langs/css")},{id:"csv",name:"CSV",import:()=>import("@shikijs/langs/csv")},{id:"cue",name:"CUE",import:()=>import("@shikijs/langs/cue")},{id:"cypher",name:"Cypher",aliases:["cql"],import:()=>import("@shikijs/langs/cypher")},{id:"d",name:"D",import:()=>import("@shikijs/langs/d")},{id:"dart",name:"Dart",import:()=>import("@shikijs/langs/dart")},{id:"dax",name:"DAX",import:()=>import("@shikijs/langs/dax")},{id:"desktop",name:"Desktop",import:()=>import("@shikijs/langs/desktop")},{id:"diff",name:"Diff",import:()=>import("@shikijs/langs/diff")},{id:"docker",name:"Dockerfile",aliases:["dockerfile"],import:()=>import("@shikijs/langs/docker")},{id:"dotenv",name:"dotEnv",import:()=>import("@shikijs/langs/dotenv")},{id:"dream-maker",name:"Dream Maker",import:()=>import("@shikijs/langs/dream-maker")},{id:"edge",name:"Edge",import:()=>import("@shikijs/langs/edge")},{id:"elixir",name:"Elixir",import:()=>import("@shikijs/langs/elixir")},{id:"elm",name:"Elm",import:()=>import("@shikijs/langs/elm")},{id:"emacs-lisp",name:"Emacs Lisp",aliases:["elisp"],import:()=>import("@shikijs/langs/emacs-lisp")},{id:"erb",name:"ERB",import:()=>import("@shikijs/langs/erb")},{id:"erlang",name:"Erlang",aliases:["erl"],import:()=>import("@shikijs/langs/erlang")},{id:"fennel",name:"Fennel",import:()=>import("@shikijs/langs/fennel")},{id:"fish",name:"Fish",import:()=>import("@shikijs/langs/fish")},{id:"fluent",name:"Fluent",aliases:["ftl"],import:()=>import("@shikijs/langs/fluent")},{id:"fortran-fixed-form",name:"Fortran (Fixed Form)",aliases:["f","for","f77"],import:()=>import("@shikijs/langs/fortran-fixed-form")},{id:"fortran-free-form",name:"Fortran (Free Form)",aliases:["f90","f95","f03","f08","f18"],import:()=>import("@shikijs/langs/fortran-free-form")},{id:"fsharp",name:"F#",aliases:["f#","fs"],import:()=>import("@shikijs/langs/fsharp")},{id:"gdresource",name:"GDResource",import:()=>import("@shikijs/langs/gdresource")},{id:"gdscript",name:"GDScript",import:()=>import("@shikijs/langs/gdscript")},{id:"gdshader",name:"GDShader",import:()=>import("@shikijs/langs/gdshader")},{id:"genie",name:"Genie",import:()=>import("@shikijs/langs/genie")},{id:"gherkin",name:"Gherkin",import:()=>import("@shikijs/langs/gherkin")},{id:"git-commit",name:"Git Commit Message",import:()=>import("@shikijs/langs/git-commit")},{id:"git-rebase",name:"Git Rebase Message",import:()=>import("@shikijs/langs/git-rebase")},{id:"gleam",name:"Gleam",import:()=>import("@shikijs/langs/gleam")},{id:"glimmer-js",name:"Glimmer JS",aliases:["gjs"],import:()=>import("@shikijs/langs/glimmer-js")},{id:"glimmer-ts",name:"Glimmer TS",aliases:["gts"],import:()=>import("@shikijs/langs/glimmer-ts")},{id:"glsl",name:"GLSL",import:()=>import("@shikijs/langs/glsl")},{id:"gnuplot",name:"Gnuplot",import:()=>import("@shikijs/langs/gnuplot")},{id:"go",name:"Go",import:()=>import("@shikijs/langs/go")},{id:"graphql",name:"GraphQL",aliases:["gql"],import:()=>import("@shikijs/langs/graphql")},{id:"groovy",name:"Groovy",import:()=>import("@shikijs/langs/groovy")},{id:"hack",name:"Hack",import:()=>import("@shikijs/langs/hack")},{id:"haml",name:"Ruby Haml",import:()=>import("@shikijs/langs/haml")},{id:"handlebars",name:"Handlebars",aliases:["hbs"],import:()=>import("@shikijs/langs/handlebars")},{id:"haskell",name:"Haskell",aliases:["hs"],import:()=>import("@shikijs/langs/haskell")},{id:"haxe",name:"Haxe",import:()=>import("@shikijs/langs/haxe")},{id:"hcl",name:"HashiCorp HCL",import:()=>import("@shikijs/langs/hcl")},{id:"hjson",name:"Hjson",import:()=>import("@shikijs/langs/hjson")},{id:"hlsl",name:"HLSL",import:()=>import("@shikijs/langs/hlsl")},{id:"html",name:"HTML",import:()=>import("@shikijs/langs/html")},{id:"html-derivative",name:"HTML (Derivative)",import:()=>import("@shikijs/langs/html-derivative")},{id:"http",name:"HTTP",import:()=>import("@shikijs/langs/http")},{id:"hxml",name:"HXML",import:()=>import("@shikijs/langs/hxml")},{id:"hy",name:"Hy",import:()=>import("@shikijs/langs/hy")},{id:"imba",name:"Imba",import:()=>import("@shikijs/langs/imba")},{id:"ini",name:"INI",aliases:["properties"],import:()=>import("@shikijs/langs/ini")},{id:"java",name:"Java",import:()=>import("@shikijs/langs/java")},{id:"javascript",name:"JavaScript",aliases:["js"],import:()=>import("@shikijs/langs/javascript")},{id:"jinja",name:"Jinja",import:()=>import("@shikijs/langs/jinja")},{id:"jison",name:"Jison",import:()=>import("@shikijs/langs/jison")},{id:"json",name:"JSON",import:()=>import("@shikijs/langs/json")},{id:"json5",name:"JSON5",import:()=>import("@shikijs/langs/json5")},{id:"jsonc",name:"JSON with Comments",import:()=>import("@shikijs/langs/jsonc")},{id:"jsonl",name:"JSON Lines",import:()=>import("@shikijs/langs/jsonl")},{id:"jsonnet",name:"Jsonnet",import:()=>import("@shikijs/langs/jsonnet")},{id:"jssm",name:"JSSM",aliases:["fsl"],import:()=>import("@shikijs/langs/jssm")},{id:"jsx",name:"JSX",import:()=>import("@shikijs/langs/jsx")},{id:"julia",name:"Julia",aliases:["jl"],import:()=>import("@shikijs/langs/julia")},{id:"kotlin",name:"Kotlin",aliases:["kt","kts"],import:()=>import("@shikijs/langs/kotlin")},{id:"kusto",name:"Kusto",aliases:["kql"],import:()=>import("@shikijs/langs/kusto")},{id:"latex",name:"LaTeX",import:()=>import("@shikijs/langs/latex")},{id:"lean",name:"Lean 4",aliases:["lean4"],import:()=>import("@shikijs/langs/lean")},{id:"less",name:"Less",import:()=>import("@shikijs/langs/less")},{id:"liquid",name:"Liquid",import:()=>import("@shikijs/langs/liquid")},{id:"llvm",name:"LLVM IR",import:()=>import("@shikijs/langs/llvm")},{id:"log",name:"Log file",import:()=>import("@shikijs/langs/log")},{id:"logo",name:"Logo",import:()=>import("@shikijs/langs/logo")},{id:"lua",name:"Lua",import:()=>import("@shikijs/langs/lua")},{id:"luau",name:"Luau",import:()=>import("@shikijs/langs/luau")},{id:"make",name:"Makefile",aliases:["makefile"],import:()=>import("@shikijs/langs/make")},{id:"markdown",name:"Markdown",aliases:["md"],import:()=>import("@shikijs/langs/markdown")},{id:"marko",name:"Marko",import:()=>import("@shikijs/langs/marko")},{id:"matlab",name:"MATLAB",import:()=>import("@shikijs/langs/matlab")},{id:"mdc",name:"MDC",import:()=>import("@shikijs/langs/mdc")},{id:"mdx",name:"MDX",import:()=>import("@shikijs/langs/mdx")},{id:"mermaid",name:"Mermaid",aliases:["mmd"],import:()=>import("@shikijs/langs/mermaid")},{id:"mipsasm",name:"MIPS Assembly",aliases:["mips"],import:()=>import("@shikijs/langs/mipsasm")},{id:"mojo",name:"Mojo",import:()=>import("@shikijs/langs/mojo")},{id:"move",name:"Move",import:()=>import("@shikijs/langs/move")},{id:"narrat",name:"Narrat Language",aliases:["nar"],import:()=>import("@shikijs/langs/narrat")},{id:"nextflow",name:"Nextflow",aliases:["nf"],import:()=>import("@shikijs/langs/nextflow")},{id:"nginx",name:"Nginx",import:()=>import("@shikijs/langs/nginx")},{id:"nim",name:"Nim",import:()=>import("@shikijs/langs/nim")},{id:"nix",name:"Nix",import:()=>import("@shikijs/langs/nix")},{id:"nushell",name:"nushell",aliases:["nu"],import:()=>import("@shikijs/langs/nushell")},{id:"objective-c",name:"Objective-C",aliases:["objc"],import:()=>import("@shikijs/langs/objective-c")},{id:"objective-cpp",name:"Objective-C++",import:()=>import("@shikijs/langs/objective-cpp")},{id:"ocaml",name:"OCaml",import:()=>import("@shikijs/langs/ocaml")},{id:"pascal",name:"Pascal",import:()=>import("@shikijs/langs/pascal")},{id:"perl",name:"Perl",import:()=>import("@shikijs/langs/perl")},{id:"php",name:"PHP",import:()=>import("@shikijs/langs/php")},{id:"plsql",name:"PL/SQL",import:()=>import("@shikijs/langs/plsql")},{id:"po",name:"Gettext PO",aliases:["pot","potx"],import:()=>import("@shikijs/langs/po")},{id:"polar",name:"Polar",import:()=>import("@shikijs/langs/polar")},{id:"postcss",name:"PostCSS",import:()=>import("@shikijs/langs/postcss")},{id:"powerquery",name:"PowerQuery",import:()=>import("@shikijs/langs/powerquery")},{id:"powershell",name:"PowerShell",aliases:["ps","ps1"],import:()=>import("@shikijs/langs/powershell")},{id:"prisma",name:"Prisma",import:()=>import("@shikijs/langs/prisma")},{id:"prolog",name:"Prolog",import:()=>import("@shikijs/langs/prolog")},{id:"proto",name:"Protocol Buffer 3",aliases:["protobuf"],import:()=>import("@shikijs/langs/proto")},{id:"pug",name:"Pug",aliases:["jade"],import:()=>import("@shikijs/langs/pug")},{id:"puppet",name:"Puppet",import:()=>import("@shikijs/langs/puppet")},{id:"purescript",name:"PureScript",import:()=>import("@shikijs/langs/purescript")},{id:"python",name:"Python",aliases:["py"],import:()=>import("@shikijs/langs/python")},{id:"qml",name:"QML",import:()=>import("@shikijs/langs/qml")},{id:"qmldir",name:"QML Directory",import:()=>import("@shikijs/langs/qmldir")},{id:"qss",name:"Qt Style Sheets",import:()=>import("@shikijs/langs/qss")},{id:"r",name:"R",import:()=>import("@shikijs/langs/r")},{id:"racket",name:"Racket",import:()=>import("@shikijs/langs/racket")},{id:"raku",name:"Raku",aliases:["perl6"],import:()=>import("@shikijs/langs/raku")},{id:"razor",name:"ASP.NET Razor",import:()=>import("@shikijs/langs/razor")},{id:"reg",name:"Windows Registry Script",import:()=>import("@shikijs/langs/reg")},{id:"regexp",name:"RegExp",aliases:["regex"],import:()=>import("@shikijs/langs/regexp")},{id:"rel",name:"Rel",import:()=>import("@shikijs/langs/rel")},{id:"riscv",name:"RISC-V",import:()=>import("@shikijs/langs/riscv")},{id:"rst",name:"reStructuredText",import:()=>import("@shikijs/langs/rst")},{id:"ruby",name:"Ruby",aliases:["rb"],import:()=>import("@shikijs/langs/ruby")},{id:"rust",name:"Rust",aliases:["rs"],import:()=>import("@shikijs/langs/rust")},{id:"sas",name:"SAS",import:()=>import("@shikijs/langs/sas")},{id:"sass",name:"Sass",import:()=>import("@shikijs/langs/sass")},{id:"scala",name:"Scala",import:()=>import("@shikijs/langs/scala")},{id:"scheme",name:"Scheme",import:()=>import("@shikijs/langs/scheme")},{id:"scss",name:"SCSS",import:()=>import("@shikijs/langs/scss")},{id:"sdbl",name:"1C (Query)",aliases:["1c-query"],import:()=>import("@shikijs/langs/sdbl")},{id:"shaderlab",name:"ShaderLab",aliases:["shader"],import:()=>import("@shikijs/langs/shaderlab")},{id:"shellscript",name:"Shell",aliases:["bash","sh","shell","zsh"],import:()=>import("@shikijs/langs/shellscript")},{id:"shellsession",name:"Shell Session",aliases:["console"],import:()=>import("@shikijs/langs/shellsession")},{id:"smalltalk",name:"Smalltalk",import:()=>import("@shikijs/langs/smalltalk")},{id:"solidity",name:"Solidity",import:()=>import("@shikijs/langs/solidity")},{id:"soy",name:"Closure Templates",aliases:["closure-templates"],import:()=>import("@shikijs/langs/soy")},{id:"sparql",name:"SPARQL",import:()=>import("@shikijs/langs/sparql")},{id:"splunk",name:"Splunk Query Language",aliases:["spl"],import:()=>import("@shikijs/langs/splunk")},{id:"sql",name:"SQL",import:()=>import("@shikijs/langs/sql")},{id:"ssh-config",name:"SSH Config",import:()=>import("@shikijs/langs/ssh-config")},{id:"stata",name:"Stata",import:()=>import("@shikijs/langs/stata")},{id:"stylus",name:"Stylus",aliases:["styl"],import:()=>import("@shikijs/langs/stylus")},{id:"svelte",name:"Svelte",import:()=>import("@shikijs/langs/svelte")},{id:"swift",name:"Swift",import:()=>import("@shikijs/langs/swift")},{id:"system-verilog",name:"SystemVerilog",import:()=>import("@shikijs/langs/system-verilog")},{id:"systemd",name:"Systemd Units",import:()=>import("@shikijs/langs/systemd")},{id:"talonscript",name:"TalonScript",aliases:["talon"],import:()=>import("@shikijs/langs/talonscript")},{id:"tasl",name:"Tasl",import:()=>import("@shikijs/langs/tasl")},{id:"tcl",name:"Tcl",import:()=>import("@shikijs/langs/tcl")},{id:"templ",name:"Templ",import:()=>import("@shikijs/langs/templ")},{id:"terraform",name:"Terraform",aliases:["tf","tfvars"],import:()=>import("@shikijs/langs/terraform")},{id:"tex",name:"TeX",import:()=>import("@shikijs/langs/tex")},{id:"toml",name:"TOML",import:()=>import("@shikijs/langs/toml")},{id:"ts-tags",name:"TypeScript with Tags",aliases:["lit"],import:()=>import("@shikijs/langs/ts-tags")},{id:"tsv",name:"TSV",import:()=>import("@shikijs/langs/tsv")},{id:"tsx",name:"TSX",import:()=>import("@shikijs/langs/tsx")},{id:"turtle",name:"Turtle",import:()=>import("@shikijs/langs/turtle")},{id:"twig",name:"Twig",import:()=>import("@shikijs/langs/twig")},{id:"typescript",name:"TypeScript",aliases:["ts"],import:()=>import("@shikijs/langs/typescript")},{id:"typespec",name:"TypeSpec",aliases:["tsp"],import:()=>import("@shikijs/langs/typespec")},{id:"typst",name:"Typst",aliases:["typ"],import:()=>import("@shikijs/langs/typst")},{id:"v",name:"V",import:()=>import("@shikijs/langs/v")},{id:"vala",name:"Vala",import:()=>import("@shikijs/langs/vala")},{id:"vb",name:"Visual Basic",aliases:["cmd"],import:()=>import("@shikijs/langs/vb")},{id:"verilog",name:"Verilog",import:()=>import("@shikijs/langs/verilog")},{id:"vhdl",name:"VHDL",import:()=>import("@shikijs/langs/vhdl")},{id:"viml",name:"Vim Script",aliases:["vim","vimscript"],import:()=>import("@shikijs/langs/viml")},{id:"vue",name:"Vue",import:()=>import("@shikijs/langs/vue")},{id:"vue-html",name:"Vue HTML",import:()=>import("@shikijs/langs/vue-html")},{id:"vyper",name:"Vyper",aliases:["vy"],import:()=>import("@shikijs/langs/vyper")},{id:"wasm",name:"WebAssembly",import:()=>import("@shikijs/langs/wasm")},{id:"wenyan",name:"Wenyan",aliases:["文言"],import:()=>import("@shikijs/langs/wenyan")},{id:"wgsl",name:"WGSL",import:()=>import("@shikijs/langs/wgsl")},{id:"wikitext",name:"Wikitext",aliases:["mediawiki","wiki"],import:()=>import("@shikijs/langs/wikitext")},{id:"wit",name:"WebAssembly Interface Types",import:()=>import("@shikijs/langs/wit")},{id:"wolfram",name:"Wolfram",aliases:["wl"],import:()=>import("@shikijs/langs/wolfram")},{id:"xml",name:"XML",import:()=>import("@shikijs/langs/xml")},{id:"xsl",name:"XSL",import:()=>import("@shikijs/langs/xsl")},{id:"yaml",name:"YAML",aliases:["yml"],import:()=>import("@shikijs/langs/yaml")},{id:"zenscript",name:"ZenScript",import:()=>import("@shikijs/langs/zenscript")},{id:"zig",name:"Zig",import:()=>import("@shikijs/langs/zig")}],uo=(Object.fromEntries(co.map(e=>[e.id,e.import])),Object.fromEntries(co.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),[{id:"andromeeda",displayName:"Andromeeda",type:"dark",import:()=>import("@shikijs/themes/andromeeda")},{id:"aurora-x",displayName:"Aurora X",type:"dark",import:()=>import("@shikijs/themes/aurora-x")},{id:"ayu-dark",displayName:"Ayu Dark",type:"dark",import:()=>import("@shikijs/themes/ayu-dark")},{id:"catppuccin-frappe",displayName:"Catppuccin Frappé",type:"dark",import:()=>import("@shikijs/themes/catppuccin-frappe")},{id:"catppuccin-latte",displayName:"Catppuccin Latte",type:"light",import:()=>import("@shikijs/themes/catppuccin-latte")},{id:"catppuccin-macchiato",displayName:"Catppuccin Macchiato",type:"dark",import:()=>import("@shikijs/themes/catppuccin-macchiato")},{id:"catppuccin-mocha",displayName:"Catppuccin Mocha",type:"dark",import:()=>import("@shikijs/themes/catppuccin-mocha")},{id:"dark-plus",displayName:"Dark Plus",type:"dark",import:()=>import("@shikijs/themes/dark-plus")},{id:"dracula",displayName:"Dracula Theme",type:"dark",import:()=>import("@shikijs/themes/dracula")},{id:"dracula-soft",displayName:"Dracula Theme Soft",type:"dark",import:()=>import("@shikijs/themes/dracula-soft")},{id:"everforest-dark",displayName:"Everforest Dark",type:"dark",import:()=>import("@shikijs/themes/everforest-dark")},{id:"everforest-light",displayName:"Everforest Light",type:"light",import:()=>import("@shikijs/themes/everforest-light")},{id:"github-dark",displayName:"GitHub Dark",type:"dark",import:()=>import("@shikijs/themes/github-dark")},{id:"github-dark-default",displayName:"GitHub Dark Default",type:"dark",import:()=>import("@shikijs/themes/github-dark-default")},{id:"github-dark-dimmed",displayName:"GitHub Dark Dimmed",type:"dark",import:()=>import("@shikijs/themes/github-dark-dimmed")},{id:"github-dark-high-contrast",displayName:"GitHub Dark High Contrast",type:"dark",import:()=>import("@shikijs/themes/github-dark-high-contrast")},{id:"github-light",displayName:"GitHub Light",type:"light",import:()=>import("@shikijs/themes/github-light")},{id:"github-light-default",displayName:"GitHub Light Default",type:"light",import:()=>import("@shikijs/themes/github-light-default")},{id:"github-light-high-contrast",displayName:"GitHub Light High Contrast",type:"light",import:()=>import("@shikijs/themes/github-light-high-contrast")},{id:"gruvbox-dark-hard",displayName:"Gruvbox Dark Hard",type:"dark",import:()=>import("@shikijs/themes/gruvbox-dark-hard")},{id:"gruvbox-dark-medium",displayName:"Gruvbox Dark Medium",type:"dark",import:()=>import("@shikijs/themes/gruvbox-dark-medium")},{id:"gruvbox-dark-soft",displayName:"Gruvbox Dark Soft",type:"dark",import:()=>import("@shikijs/themes/gruvbox-dark-soft")},{id:"gruvbox-light-hard",displayName:"Gruvbox Light Hard",type:"light",import:()=>import("@shikijs/themes/gruvbox-light-hard")},{id:"gruvbox-light-medium",displayName:"Gruvbox Light Medium",type:"light",import:()=>import("@shikijs/themes/gruvbox-light-medium")},{id:"gruvbox-light-soft",displayName:"Gruvbox Light Soft",type:"light",import:()=>import("@shikijs/themes/gruvbox-light-soft")},{id:"houston",displayName:"Houston",type:"dark",import:()=>import("@shikijs/themes/houston")},{id:"kanagawa-dragon",displayName:"Kanagawa Dragon",type:"dark",import:()=>import("@shikijs/themes/kanagawa-dragon")},{id:"kanagawa-lotus",displayName:"Kanagawa Lotus",type:"light",import:()=>import("@shikijs/themes/kanagawa-lotus")},{id:"kanagawa-wave",displayName:"Kanagawa Wave",type:"dark",import:()=>import("@shikijs/themes/kanagawa-wave")},{id:"laserwave",displayName:"LaserWave",type:"dark",import:()=>import("@shikijs/themes/laserwave")},{id:"light-plus",displayName:"Light Plus",type:"light",import:()=>import("@shikijs/themes/light-plus")},{id:"material-theme",displayName:"Material Theme",type:"dark",import:()=>import("@shikijs/themes/material-theme")},{id:"material-theme-darker",displayName:"Material Theme Darker",type:"dark",import:()=>import("@shikijs/themes/material-theme-darker")},{id:"material-theme-lighter",displayName:"Material Theme Lighter",type:"light",import:()=>import("@shikijs/themes/material-theme-lighter")},{id:"material-theme-ocean",displayName:"Material Theme Ocean",type:"dark",import:()=>import("@shikijs/themes/material-theme-ocean")},{id:"material-theme-palenight",displayName:"Material Theme Palenight",type:"dark",import:()=>import("@shikijs/themes/material-theme-palenight")},{id:"min-dark",displayName:"Min Dark",type:"dark",import:()=>import("@shikijs/themes/min-dark")},{id:"min-light",displayName:"Min Light",type:"light",import:()=>import("@shikijs/themes/min-light")},{id:"monokai",displayName:"Monokai",type:"dark",import:()=>import("@shikijs/themes/monokai")},{id:"night-owl",displayName:"Night Owl",type:"dark",import:()=>import("@shikijs/themes/night-owl")},{id:"nord",displayName:"Nord",type:"dark",import:()=>import("@shikijs/themes/nord")},{id:"one-dark-pro",displayName:"One Dark Pro",type:"dark",import:()=>import("@shikijs/themes/one-dark-pro")},{id:"one-light",displayName:"One Light",type:"light",import:()=>import("@shikijs/themes/one-light")},{id:"plastic",displayName:"Plastic",type:"dark",import:()=>import("@shikijs/themes/plastic")},{id:"poimandres",displayName:"Poimandres",type:"dark",import:()=>import("@shikijs/themes/poimandres")},{id:"red",displayName:"Red",type:"dark",import:()=>import("@shikijs/themes/red")},{id:"rose-pine",displayName:"Rosé Pine",type:"dark",import:()=>import("@shikijs/themes/rose-pine")},{id:"rose-pine-dawn",displayName:"Rosé Pine Dawn",type:"light",import:()=>import("@shikijs/themes/rose-pine-dawn")},{id:"rose-pine-moon",displayName:"Rosé Pine Moon",type:"dark",import:()=>import("@shikijs/themes/rose-pine-moon")},{id:"slack-dark",displayName:"Slack Dark",type:"dark",import:()=>import("@shikijs/themes/slack-dark")},{id:"slack-ochin",displayName:"Slack Ochin",type:"light",import:()=>import("@shikijs/themes/slack-ochin")},{id:"snazzy-light",displayName:"Snazzy Light",type:"light",import:()=>import("@shikijs/themes/snazzy-light")},{id:"solarized-dark",displayName:"Solarized Dark",type:"dark",import:()=>import("@shikijs/themes/solarized-dark")},{id:"solarized-light",displayName:"Solarized Light",type:"light",import:()=>import("@shikijs/themes/solarized-light")},{id:"synthwave-84",displayName:"Synthwave '84",type:"dark",import:()=>import("@shikijs/themes/synthwave-84")},{id:"tokyo-night",displayName:"Tokyo Night",type:"dark",import:()=>import("@shikijs/themes/tokyo-night")},{id:"vesper",displayName:"Vesper",type:"dark",import:()=>import("@shikijs/themes/vesper")},{id:"vitesse-black",displayName:"Vitesse Black",type:"dark",import:()=>import("@shikijs/themes/vitesse-black")},{id:"vitesse-dark",displayName:"Vitesse Dark",type:"dark",import:()=>import("@shikijs/themes/vitesse-dark")},{id:"vitesse-light",displayName:"Vitesse Light",type:"light",import:()=>import("@shikijs/themes/vitesse-light")}]);Object.fromEntries(uo.map(e=>[e.id,e.import]));const po=function(e){const t=Pr(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return Qn(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:i=t.getLoadedThemes()[0]}=r;if(Gn(s)||Bn(i))throw new F("Plain language does not have grammar state");if("ansi"===s)throw new F("ANSI language does not have grammar state");const{theme:o,colorMap:a}=t.setTheme(i),l=t.getLanguage(s);return new Zn(pr(n,l,o,a,r).stateStack,l.name,o.name)}(t,...e),codeToTokensBase:(e,n)=>ur(t,e,n),codeToTokensWithThemes:(e,n)=>yr(t,e,n),codeToTokens:(e,n)=>kr(t,e,n),codeToHast:(e,n)=>wr(t,e,n),codeToHtml:(e,n)=>function(e,t,n){const r={meta:{},options:n,codeToHast:(t,n)=>wr(e,t,n),codeToTokens:(t,n)=>kr(e,t,n)};let s=Cr(wr(e,t,n,r));for(const e of tr(n))s=e.postprocess?.call(r,s,n)||s;return s}(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}({engine:function(e={}){const t=Object.assign({target:"auto",cache:new Map},e);return t.regexConstructor||=e=>function(e,t){return oo(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}(e,{target:t.target}),{createScanner:e=>new lo(e,t),createString:e=>({content:e})}}(),langs:[],themes:[]});function ho(e){const t=/^diff-([\w-]+)/i.exec(e);return t?t[1]:null}function mo(e){const t=ho(e)||e;return!!Dn(t)||po.getLoadedLanguages().includes(t)}function go(t,n,r){const s=ho(t),i=s||t;if(!mo(i)){const s=co.find(e=>e.id===i||e.aliases&&e.aliases.includes(i));if(s)return po.loadLanguage(s.import()).then(()=>{n&&r&&n.update(()=>{const n=h(r);e(n)&&n.getLanguage()===t&&!n.getIsSyntaxHighlightSupported()&&n.setIsSyntaxHighlightSupported(!0)})})}}function fo(e){const t=e;return!!Fn(t)||po.getLoadedThemes().includes(t)}function yo(t,n,r){if(!fo(t)){const s=uo.find(e=>e.id===t);if(s)return po.loadTheme(s.import()).then(()=>{n&&r&&n.update(()=>{const t=h(r);e(t)&&t.markDirty()})})}}function ko(){return co.map(e=>[e.id,e.name])}function bo(){return uo.map(e=>[e.id,e.displayName])}function wo(e){const t=e,n=co.find(e=>e.id===t||e.aliases&&e.aliases.includes(t));return n?n.id:e}function Co(e,n){const r=/^diff-([\w-]+)/i.exec(n),s=e.getTextContent(),i=po.codeToTokens(s,{lang:r?r[1]:n,theme:e.getTheme()||"poimandres"}),{tokens:o,bg:a,fg:l}=i;let c="";return a&&(c+=`background-color: ${a};`),l&&(c+=`color: ${l};`),e.getStyle()!==c&&e.setStyle(c),function(e,n){const r=[];return e.forEach((e,s)=>{s&&r.push(d()),e.forEach((e,s)=>{let i=e.content;if(n&&0===s&&i.length>0){const e=["+","-",">","<"," "],n=["inserted","deleted","inserted","deleted","unchanged"],s=e.indexOf(i[0]);-1!==s&&(r.push(t(e[s],n[s])),i=i.slice(1))}i.split("\t").forEach((n,s)=>{if(s&&r.push(m()),""!==n){const s=t(n),i=Vn(e.htmlStyle||qn(e));s.setStyle(i),r.push(s)}})})}),r}(o,!!r)}const _o={$tokenize(e,t){return Co(e,t||this.defaultLanguage)},defaultLanguage:r,defaultTheme:"one-light"};function So(t,n,r){const s=t.getParent();e(s)?No(s,n,r):o(t)&&t.replace(L(t.__text))}function vo(e,t){const n=t.getElementByKey(e.getKey());if(null===n)return;const r=e.getChildren(),s=r.length;if(s===n.__cachedChildrenLength)return;n.__cachedChildrenLength=s;let i="1",o=1;for(let e=0;e<s;e++)E(r[e])&&(i+="\n"+ ++o);n.setAttribute("data-gutter",i)}const xo=new Set;function No(t,n,r){const s=t.getKey();let i=t.getLanguage();i||(i=r.defaultLanguage,t.setLanguage(i));let o=t.getTheme();o||(o=r.defaultTheme,t.setTheme(o));let a=!1;fo(o)||(yo(o,n,s),a=!0),mo(i)?t.getIsSyntaxHighlightSupported()||t.setIsSyntaxHighlightSupported(!0):(t.getIsSyntaxHighlightSupported()&&t.setIsSyntaxHighlightSupported(!1),go(i,n,s),a=!0),a||xo.has(s)||(xo.add(s),n.update(()=>{!function(t,n){const r=h(t);if(!e(r)||!r.isAttached())return;const s=w();if(!x(s))return void n();const i=s.anchor,o=i.offset,a="element"===i.type&&E(r.getChildAtIndex(i.offset-1));let l=0;if(!a){const e=i.getNode();l=o+e.getPreviousSiblings().reduce((e,t)=>e+t.getTextContentSize(),0)}if(!n())return;if(a)return void i.getNode().select(o,o);r.getChildren().some(e=>{const t=D(e);if(t||E(e)){const n=e.getTextContentSize();if(t&&n>=l)return e.select(l,l),!0;l-=n}return!1})}(s,()=>{const n=h(s);if(!e(n)||!n.isAttached())return!1;const i=n.getLanguage()||r.defaultLanguage,o=r.$tokenize(n,i),a=function(e,t){let n=0;for(;n<e.length&&Ao(e[n],t[n]);)n++;const r=e.length,s=t.length,i=Math.min(r,s)-n;let o=0;for(;o<i;)if(o++,!Ao(e[r-o],t[s-o])){o--;break}const a=n,l=r-o,c=t.slice(n,s-o);return{from:a,nodesForReplacement:c,to:l}}(n.getChildren(),o),{from:l,to:c,nodesForReplacement:u}=a;return!(l===c&&!u.length)&&(t.splice(l,c-l,u),!0)})},{onUpdate:()=>{xo.delete(s)},skipTransforms:!0}))}function Ao(e,t){return o(e)&&o(t)&&e.__text===t.__text&&e.__highlightType===t.__highlightType&&e.__style===t.__style||G(e)&&G(t)||E(e)&&E(t)}function jo(t){if(!x(t))return!1;const n=t.anchor.getNode(),r=e(n)?n:n.getParent(),s=t.focus.getNode(),i=e(s)?s:s.getParent();return e(r)&&r.is(i)}function Eo(t){const n=t.getNodes(),r=[];if(1===n.length&&e(n[0]))return r;let s=[];for(let e=0;e<n.length;e++){const t=n[e];o(t)||G(t)||E(t)||B(169),E(t)?s.length>0&&(r.push(s),s=[]):s.push(t)}if(s.length>0){const e=t.isBackward()?t.anchor:t.focus,n=I(s[0].getKey(),0,"text");e.is(n)||r.push(s)}return r}function Lo(e){const t=w();if(!x(t)||!jo(t))return!1;const n=Eo(t),r=n.length;if(0===r&&t.isCollapsed())return e===_&&t.insertNodes([m()]),!0;if(0===r&&e===_&&"\n"===t.getTextContent()){const e=m(),n=d(),r=t.isBackward()?"previous":"next";return t.insertNodes([e,n]),P(R(T(M(e,"next",0),$(O(n,"next"))),r)),!0}for(let s=0;s<r;s++){const r=n[s];if(r.length>0){let n=r[0];if(0===s&&(n=a(n)),e===_){const e=m();if(n.insertBefore(e),0===s){const r=t.isBackward()?"focus":"anchor",s=I(n.getKey(),0,"text");t[r].is(s)&&t[r].set(e.getKey(),0,"text")}}else G(n)&&n.remove()}}return!0}function Io(e,t){const n=w();if(!x(n))return!1;const{anchor:r,focus:s}=n,i=r.offset,c=s.offset,u=r.getNode(),p=s.getNode(),h=e===v;if(!jo(n)||!o(u)&&!G(u)||!o(p)&&!G(p))return!1;if(!t.altKey){if(n.isCollapsed()){const e=u.getParentOrThrow();if(h&&0===i&&null===u.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),t.preventDefault(),!0}else if(!h&&i===u.getTextContentSize()&&null===u.getNextSibling()){if(null===e.getNextSibling())return e.selectNext(),t.preventDefault(),!0}}return!1}let d,m;if(u.isBefore(p)?(d=a(u),m=l(p)):(d=a(p),m=l(u)),null==d||null==m)return!1;const g=d.getNodesBetween(m);for(let e=0;e<g.length;e++){const t=g[e];if(!o(t)&&!G(t)&&!E(t))return!1}t.preventDefault(),t.stopPropagation();const f=h?d.getPreviousSibling():m.getNextSibling();if(!E(f))return!0;const y=h?f.getPreviousSibling():f.getNextSibling();if(null==y)return!0;const k=o(y)||G(y)||E(y)?h?a(y):l(y):null;let b=null!=k?k:y;return f.remove(),g.forEach(e=>e.remove()),e===v?(g.forEach(e=>b.insertBefore(e)),b.insertBefore(f)):(b.insertAfter(f),b=f,g.forEach(e=>{b.insertAfter(e),b=e})),n.setTextNodeRange(u,i,p,c),!0}function Po(e,t){const n=w();if(!x(n))return!1;const{anchor:r,focus:s}=n,i=r.getNode(),a=s.getNode(),l=e===A;if(!jo(n)||!o(i)&&!G(i)||!o(a)&&!G(a))return!1;if(l){const e=c(a,s.offset);if(null!==e){const{node:t,offset:r}=e;E(t)?t.selectNext(0,0):n.setTextNodeRange(t,r,t,r)}else a.getParentOrThrow().selectStart()}else{u(a).select()}return t.preventDefault(),t.stopPropagation(),!0}function Ro(t,n){if(!t.hasNodes([s,i]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==n&&(n=_o);const r=[];return!0!==t._headless&&r.push(t.registerMutationListener(s,e=>{t.update(()=>{for(const[n,r]of e)if("destroyed"!==r){const e=h(n);null!==e&&vo(e,t)}})},{skipInitialization:!1})),r.push(t.registerNodeTransform(s,e=>No(e,t,n)),t.registerNodeTransform(f,e=>So(e,t,n)),t.registerNodeTransform(i,e=>So(e,t,n)),t.registerCommand(y,e=>{const n=function(e){const t=w();if(!x(t)||!jo(t))return null;const n=e?S:_,r=e?S:b,s=t.anchor,i=t.focus;if(s.is(i))return r;const o=Eo(t);if(1!==o.length)return n;const c=o[0];let u,p;0===c.length&&B(285),t.isBackward()?(u=i,p=s):(u=s,p=i);const h=a(c[0]),d=l(c[0]),m=I(h.getKey(),0,"text"),g=I(d.getKey(),d.getTextContentSize(),"text");return u.isBefore(m)||g.isBefore(p)?n:m.isBefore(u)||p.isBefore(g)?r:n}(e.shiftKey);return null!==n&&(e.preventDefault(),t.dispatchCommand(n,void 0),!0)},k),t.registerCommand(b,()=>!!jo(w())&&(C([m()]),!0),k),t.registerCommand(_,e=>Lo(_),k),t.registerCommand(S,e=>Lo(S),k),t.registerCommand(v,t=>{const n=w();if(!x(n))return!1;const{anchor:r}=n,s=r.getNode();return!!jo(n)&&(n.isCollapsed()&&0===r.offset&&null===s.getPreviousSibling()&&e(s.getParentOrThrow())?(t.preventDefault(),!0):Io(v,t))},k),t.registerCommand(N,t=>{const n=w();if(!x(n))return!1;const{anchor:r}=n,s=r.getNode();return!!jo(n)&&(n.isCollapsed()&&r.offset===s.getTextContentSize()&&null===s.getNextSibling()&&e(s.getParentOrThrow())?(t.preventDefault(),!0):Io(N,t))},k),t.registerCommand(A,e=>Po(A,e),k),t.registerCommand(j,e=>Po(j,e),k)),p(...r)}const To=g({config:{tokenizer:_o},dependencies:[n],name:"@lexical/code-shiki",register:(e,{tokenizer:t})=>Ro(e,t)});export{To as CodeHighlighterShikiExtension,_o as ShikiTokenizer,ko as getCodeLanguageOptions,bo as getCodeThemeOptions,mo as isCodeLanguageLoaded,go as loadCodeLanguage,yo as loadCodeTheme,wo as normalizeCodeLanguage,Ro as registerCodeHighlighting};
|