@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
package/LexicalCodeShiki.prod.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
"use strict";var e=require("@lexical/code"),t=require("@lexical/utils"),n=require("lexical");function r(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 s=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function i(e){return Array.isArray(e)?function(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=i(e[n]);return t}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let t={};for(let n in e)t[n]=i(e[n]);return t}(e):e}function o(e,...t){return t.forEach((t=>{for(let n in t)e[n]=t[n]})),e}function a(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t==e.length-1?a(e.substring(0,e.length-1)):e.substr(1+~t)}var l=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,c=class{static hasCaptures(e){return null!==e&&(l.lastIndex=0,l.test(e))}static replaceCaptures(e,t,n){return e.replace(l,((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 u(e,t){return e<t?-1:e>t?1:0}function p(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=u(e[r],t[r]);if(0!==n)return n}return 0}return n-r}function h(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 d(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var m=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}},g=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&&h(i.settings.foreground)&&(a=i.settings.foreground);let l=null;"string"==typeof i.settings.background&&h(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 b(c,u,e,o,a,l)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort(((e,t)=>{let n=u(e.scope,t.scope);return 0!==n?n:(n=p(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 C(t),o=new k(n,i.getId(r),i.getId(s)),a=new v(new S(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 g(i,o,a)}(e,t)}_cachedMatchRoot=new m((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&&!y(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 k(n.fontStyle,n.foreground,n.background):null}},f=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 y(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var k=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};var b=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}},w=(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))(w||{});var C=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)}},_=Object.freeze([]),S=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,s){this.scopeDepth=e,this.parentScopes=t||_,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)}},v=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(),S.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===p(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 S(e,t,n,r,s))}else this._mainRule.acceptOverwrite(e,n,r,s)}},x=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 N(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(A(s)){const e=[];do{e.push(s),s=r.next()}while(A(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 A(e){return!!e&&!!e.match(/[\w\.:]+/)}function E(e){"function"==typeof e.dispose&&e.dispose()}var j=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},L=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},I=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))}},T=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new j(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new I;for(const n of e)$(n,this.initialScopeName,this.repo,t);for(const e of t.references)if(e instanceof j){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 $(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 j?R({baseGrammar:i,selfGrammar:s},r):P(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 j(e))}function P(e,t,n){if(t.repository&&t.repository[e]){M([t.repository[e]],t,n)}}function R(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&M(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&M(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function M(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const e=r.repository?o({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&M(r.patterns,{...t,repository:e},n);const s=r.include;if(!s)continue;const i=U(s);switch(i.kind){case 0:R({...t,selfGrammar:t.baseGrammar},n);break;case 1:R(t,n);break;case 2:P(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?P(i.ruleName,s,n):R(s,n)}else 4===i.kind?n.add(new L(i.scopeName,i.ruleName)):n.add(new j(i.scopeName))}}}var O=class{kind=0},D=class{kind=1},B=class{constructor(e){this.ruleName=e}kind=2},G=class{constructor(e){this.scopeName=e}kind=3},F=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function U(e){if("$base"===e)return new O;if("$self"===e)return new D;const t=e.indexOf("#");if(-1===t)return new G(e);if(0===t)return new B(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new F(n,r)}}var W=/\\(\d+)/,z=/\\(\d+)/g,H=-1,q=-2;var V=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=c.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=c.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${a(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?c.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?c.replaceCaptures(this._contentName,e,t):this._contentName}},K=class extends V{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!")}},X=class extends V{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new ee(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 te,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Y=class extends V{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 te,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Q=class extends V{_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 ee(s,this.id),this.beginCaptures=i,this._end=new ee(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 te;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}},Z=class extends V{_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 ee(s,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new ee(o,q),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 te;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 te,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},J=class e{static createCaptureRule(e,t,n,r,s){return e.registerRule((e=>new K(t,e,n,r,s)))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule((s=>{if(t.id=s,t.match)return new X(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(void 0===t.begin){t.repository&&(r=o({},r,t.repository));let s=t.patterns;return void 0===s&&t.include&&(s=[{include:t.include}]),new Y(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(s,n,r))}return t.while?new Z(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 Q(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=U(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 Y||e instanceof Q||e instanceof Z)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},ee=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=W.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 z.lastIndex=0,this.source.replace(z,((e,t)=>d(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}},te=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 ne(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 ne(e,r,this._items.map((e=>e.ruleId)))}},ne=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}},re=class{constructor(e,t){this.languageId=e,this.tokenType=t}},se=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new re(e,8),this._embeddedLanguagesMatcher=new ie(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 re(0,0);_getBasicScopeAttributes=new m((e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new re(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/},ie=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])=>d(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 oe=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function ae(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 Z&&a.push({rule:n,stack:t})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:a,findOptions:c}=ce(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!==q){s=l.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(i.produce(l.stack,u.captureIndices[0].start),ue(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 oe(s,!0)}h()}return new oe(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}=le(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}=le(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===H){const o=s.getRule(e);i.produce(s,a[0].start),s=s.withContentNameScopesList(s.nameScopesList),ue(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 Q){const r=o;ue(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 Z){const r=o;ue(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(ue(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 le(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function ce(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function ue(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));ae(e,d,n&&0===p.start,p.start,h,s,!1,0),E(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 pe(t,p.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var pe=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function he(e,t,n,r,s){const i=N(t,de),o=J.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 de(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(me(t[r],e))return n=r+1,!0;return!1}))}function me(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 ge=class{constructor(e,t,n,r,s,i,o,a){if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new se(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=fe(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const e of Object.keys(s)){const t=N(e,de);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)he(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&&he(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]=fe(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=J.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==ke.NULL)s=!1,t.reset();else{s=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=x.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 ke(null,this._rootId,-1,-1,!1,null,o,o)}e+="\n";const i=this.createOnigString(e),o=i.content.length,a=new we(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=ae(this,i,s,0,t,a,!0,r);return E(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function fe(e,t){return(e=i(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=f.push(s,t.scopeNames),r=new e(r,s,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new f(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new f(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),x.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}},ke=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))}},be=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap((e=>"*"===e?(this.allowAny=!0,[]):N(e,de).map((e=>e.matcher)))),this.unbalancedBracketScopes=t.flatMap((e=>N(e,de).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}},we=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=x.set(n,0,e.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}return r&&(n=x.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}},Ce=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 ge(e,t,n,r,s,i,o,a)}(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},_e=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Ce(g.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(g.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 be(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,s){const i=new T(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)}},Se=ke.NULL;const ve=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class xe{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function Ne(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new xe(n,r,t)}function Ae(e){return e.toLowerCase()}xe.prototype.normal={},xe.prototype.property={},xe.prototype.space=void 0;class Ee{constructor(e,t){this.attribute=t,this.property=e}}Ee.prototype.attribute="",Ee.prototype.booleanish=!1,Ee.prototype.boolean=!1,Ee.prototype.commaOrSpaceSeparated=!1,Ee.prototype.commaSeparated=!1,Ee.prototype.defined=!1,Ee.prototype.mustUseProperty=!1,Ee.prototype.number=!1,Ee.prototype.overloadedBoolean=!1,Ee.prototype.property="",Ee.prototype.spaceSeparated=!1,Ee.prototype.space=void 0;let je=0;const Le=Oe(),Ie=Oe(),Te=Oe(),$e=Oe(),Pe=Oe(),Re=Oe(),Me=Oe();function Oe(){return 2**++je}var De={__proto__:null,boolean:Le,booleanish:Ie,commaOrSpaceSeparated:Me,commaSeparated:Re,number:$e,overloadedBoolean:Te,spaceSeparated:Pe};const Be=Object.keys(De);class Ge extends Ee{constructor(e,t,n,r){let s=-1;if(super(e,t),Fe(this,"space",r),"number"==typeof n)for(;++s<Be.length;){const e=Be[s];Fe(this,Be[s],(n&De[e])===De[e])}}}function Fe(e,t,n){n&&(e[t]=n)}function Ue(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Ge(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Ae(r)]=r,n[Ae(i.attribute)]=r}return new xe(t,n,e.space)}Ge.prototype.defined=!0;const We=Ue({properties:{ariaActiveDescendant:null,ariaAtomic:Ie,ariaAutoComplete:null,ariaBusy:Ie,ariaChecked:Ie,ariaColCount:$e,ariaColIndex:$e,ariaColSpan:$e,ariaControls:Pe,ariaCurrent:null,ariaDescribedBy:Pe,ariaDetails:null,ariaDisabled:Ie,ariaDropEffect:Pe,ariaErrorMessage:null,ariaExpanded:Ie,ariaFlowTo:Pe,ariaGrabbed:Ie,ariaHasPopup:null,ariaHidden:Ie,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Pe,ariaLevel:$e,ariaLive:null,ariaModal:Ie,ariaMultiLine:Ie,ariaMultiSelectable:Ie,ariaOrientation:null,ariaOwns:Pe,ariaPlaceholder:null,ariaPosInSet:$e,ariaPressed:Ie,ariaReadOnly:Ie,ariaRelevant:null,ariaRequired:Ie,ariaRoleDescription:Pe,ariaRowCount:$e,ariaRowIndex:$e,ariaRowSpan:$e,ariaSelected:Ie,ariaSetSize:$e,ariaSort:null,ariaValueMax:$e,ariaValueMin:$e,ariaValueNow:$e,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function ze(e,t){return t in e?e[t]:t}function He(e,t){return ze(e,t.toLowerCase())}const qe=Ue({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Re,acceptCharset:Pe,accessKey:Pe,action:null,allow:null,allowFullScreen:Le,allowPaymentRequest:Le,allowUserMedia:Le,alt:null,as:null,async:Le,autoCapitalize:null,autoComplete:Pe,autoFocus:Le,autoPlay:Le,blocking:Pe,capture:null,charSet:null,checked:Le,cite:null,className:Pe,cols:$e,colSpan:null,content:null,contentEditable:Ie,controls:Le,controlsList:Pe,coords:$e|Re,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Le,defer:Le,dir:null,dirName:null,disabled:Le,download:Te,draggable:Ie,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Le,formTarget:null,headers:Pe,height:$e,hidden:Te,high:$e,href:null,hrefLang:null,htmlFor:Pe,httpEquiv:Pe,id:null,imageSizes:null,imageSrcSet:null,inert:Le,inputMode:null,integrity:null,is:null,isMap:Le,itemId:null,itemProp:Pe,itemRef:Pe,itemScope:Le,itemType:Pe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Le,low:$e,manifest:null,max:null,maxLength:$e,media:null,method:null,min:null,minLength:$e,multiple:Le,muted:Le,name:null,nonce:null,noModule:Le,noValidate:Le,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:Le,optimum:$e,pattern:null,ping:Pe,placeholder:null,playsInline:Le,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Le,referrerPolicy:null,rel:Pe,required:Le,reversed:Le,rows:$e,rowSpan:$e,sandbox:Pe,scope:null,scoped:Le,seamless:Le,selected:Le,shadowRootClonable:Le,shadowRootDelegatesFocus:Le,shadowRootMode:null,shape:null,size:$e,sizes:null,slot:null,span:$e,spellCheck:Ie,src:null,srcDoc:null,srcLang:null,srcSet:null,start:$e,step:null,style:null,tabIndex:$e,target:null,title:null,translate:null,type:null,typeMustMatch:Le,useMap:null,value:Ie,width:$e,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Pe,axis:null,background:null,bgColor:null,border:$e,borderColor:null,bottomMargin:$e,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Le,declare:Le,event:null,face:null,frame:null,frameBorder:null,hSpace:$e,leftMargin:$e,link:null,longDesc:null,lowSrc:null,marginHeight:$e,marginWidth:$e,noResize:Le,noHref:Le,noShade:Le,noWrap:Le,object:null,profile:null,prompt:null,rev:null,rightMargin:$e,rules:null,scheme:null,scrolling:Ie,standby:null,summary:null,text:null,topMargin:$e,valueType:null,version:null,vAlign:null,vLink:null,vSpace:$e,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Le,disableRemotePlayback:Le,prefix:null,property:null,results:$e,security:null,unselectable:null},space:"html",transform:He}),Ve=Ue({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:Me,accentHeight:$e,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:$e,amplitude:$e,arabicForm:null,ascent:$e,attributeName:null,attributeType:null,azimuth:$e,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:$e,by:null,calcMode:null,capHeight:$e,className:Pe,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:$e,diffuseConstant:$e,direction:null,display:null,dur:null,divisor:$e,dominantBaseline:null,download:Le,dx:null,dy:null,edgeMode:null,editable:null,elevation:$e,enableBackground:null,end:null,event:null,exponent:$e,externalResourcesRequired:null,fill:null,fillOpacity:$e,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:Re,g2:Re,glyphName:Re,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:$e,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:$e,horizOriginX:$e,horizOriginY:$e,id:null,ideographic:$e,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:$e,k:$e,k1:$e,k2:$e,k3:$e,k4:$e,kernelMatrix:Me,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:$e,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:$e,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:$e,overlineThickness:$e,paintOrder:null,panose1:null,path:null,pathLength:$e,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Pe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:$e,pointsAtY:$e,pointsAtZ:$e,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Me,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Me,rev:Me,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Me,requiredFeatures:Me,requiredFonts:Me,requiredFormats:Me,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:$e,specularExponent:$e,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:$e,strikethroughThickness:$e,string:null,stroke:null,strokeDashArray:Me,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:$e,strokeOpacity:$e,strokeWidth:null,style:null,surfaceScale:$e,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Me,tabIndex:$e,tableValues:null,target:null,targetX:$e,targetY:$e,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Me,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:$e,underlineThickness:$e,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:$e,values:null,vAlphabetic:$e,vMathematical:$e,vectorEffect:null,vHanging:$e,vIdeographic:$e,version:null,vertAdvY:$e,vertOriginX:$e,vertOriginY:$e,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:$e,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:ze}),Ke=Ue({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()}),Xe=Ue({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:He}),Ye=Ue({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),Qe=/[A-Z]/g,Ze=/-[a-z]/g,Je=/^data[-\w.:]+$/i;function et(e){return"-"+e.toLowerCase()}function tt(e){return e.charAt(1).toUpperCase()}const nt=Ne([We,qe,Ke,Xe,Ye],"html"),rt=Ne([We,Ve,Ke,Xe,Ye],"svg"),st={}.hasOwnProperty;const it=/["&'<>`]/g,ot=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,at=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,lt=/[|\\{}()[\]^$+*?.]/g,ct=new WeakMap;function ut(e,t){return e=e.replace(t.subset?function(e){let t=ct.get(e);t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(lt,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),ct.set(e,t));return t}(t.subset):it,n),t.subset||t.escapeOnly?e:e.replace(ot,(function(e,n,r){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)})).replace(at,n);function n(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}const pt=/[\dA-Fa-f]/;const ht=/\d/;const dt=["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"],mt={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:"€"},gt=["cent","copy","divide","gt","lt","not","para","times"],ft={}.hasOwnProperty,yt={};let kt;for(kt in mt)ft.call(mt,kt)&&(yt[mt[kt]]=kt);const bt=/[^\dA-Za-z]/;function wt(e,t,n){let r,s=function(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!pt.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(ft.call(yt,s)){const e=yt[s],i="&"+e;return n&&dt.includes(e)&&!gt.includes(e)&&(!r||t&&61!==t&&bt.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&&!ht.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 Ct(e,t){return ut(e,Object.assign({format:wt},t))}const _t=/^>|^->|<!--|-->|--!>|<!-$/g,St=[">"],vt=["<",">"];function xt(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 Nt(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}function At(e){return e.join(" ").trim()}const Et=/[ \t\n\f\r]/g;function jt(e){return"object"==typeof e?"text"===e.type&&Lt(e.value):Lt(e)}function Lt(e){return""===e.replace(Et,"")}const It=Pt(1),Tt=Pt(-1),$t=[];function Pt(e){return function(t,n,r){const s=t?t.children:$t;let i=(n||0)+e,o=s[i];if(!r)for(;o&&jt(o);)i+=e,o=s[i];return o}}const Rt={}.hasOwnProperty;function Mt(e){return function(t,n,r){return Rt.call(e,t.tagName)&&e[t.tagName](t,n,r)}}const Ot=Mt({body:function(e,t,n){const r=It(n,t);return!r||"comment"!==r.type},caption:Dt,colgroup:Dt,dd:function(e,t,n){const r=It(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){const r=It(n,t);return Boolean(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:Dt,html:function(e,t,n){const r=It(n,t);return!r||"comment"!==r.type},li:function(e,t,n){const r=It(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){const r=It(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){const r=It(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){const r=It(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:Bt,rt:Bt,tbody:function(e,t,n){const r=It(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:Gt,tfoot:function(e,t,n){return!It(n,t)},th:Gt,thead:function(e,t,n){const r=It(n,t);return Boolean(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){const r=It(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function Dt(e,t,n){const r=It(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&jt(r.value.charAt(0)))}function Bt(e,t,n){const r=It(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function Gt(e,t,n){const r=It(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}const Ft=Mt({body:function(e){const t=It(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&jt(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=Tt(n,t),s=It(e,-1,!0);if(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&Ot(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=It(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const r=Tt(n,t),s=It(e,-1);if(n&&r&&"element"===r.type&&("thead"===r.tagName||"tbody"===r.tagName)&&Ot(r,n.children.indexOf(r),n))return!1;return Boolean(s&&"element"===s.type&&"tr"===s.tagName)}});const Ut={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 Wt(e,t,n){const r=function(e,t){const n=Ae(t);let r=t,s=Ee;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&Je.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Ze,tt);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Ze.test(e)){let n=e.replace(Qe,et);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}s=Ge}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=Ct(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Ut.name[s][i]}));return!0===n?l:(n=Array.isArray(n)?(r.commaSeparated?Nt:At)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?l:(e.settings.preferUnquoted&&(o=Ct(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Ut.unquoted[s][i]}))),o!==n&&(e.settings.quoteSmart&&xt(n,a)>xt(n,e.alternative)&&(a=e.alternative),o=a+Ct(n,Object.assign({},e.settings.characterReferences,{subset:("'"===a?Ut.single:Ut.double)[s][i],attribute:!0}))+a),l+(o?"="+o:o)))}const zt=["<","&"];function Ht(e,t,n,r){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?Ct(e.value,Object.assign({},r.settings.characterReferences,{subset:zt})):e.value}const qt=function(e,t){const n=t||{};function r(t,...n){let s=r.invalid;const i=r.handlers;if(t&&st.call(t,e)){const n=String(t[e]);s=st.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?"<?"+Ct(e.value,Object.assign({},r.settings.characterReferences,{subset:St}))+">":"\x3c!--"+e.value.replace(_t,(function(e){return Ct(e,Object.assign({},r.settings.characterReferences,{subset:vt}))}))+"--\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=rt);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=Wt(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&&Ft(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&&Ot(e,t,n)||a.push("</"+e.tagName+">"),a.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Ht(e,0,n,r)},root:function(e,t,n,r){return r.all(e)},text:Ht}});const Vt={},Kt={},Xt=[];function Yt(e,t,n){return qt(e,t,n,this)}function Qt(e){const t=[],n=e&&e.children||Xt;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function Zt(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 Jt(e,t){return e&&t?.[e?.toLowerCase()]||e}async function en(e){return Promise.resolve("function"==typeof e?e():e).then((e=>e.default||e))}function tn(e){return!e||["plaintext","txt","text","plain"].includes(e)}function nn(e){return"ansi"===e||tn(e)}function rn(e){return"none"===e}function sn(e){return rn(e)}function on(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 an(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 ln="light-dark()",cn=["color","background-color"];function un(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&w.Italic&&(t["font-style"]="italic"),e.fontStyle&w.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&w.Underline&&n.push("underline"),e.fontStyle&w.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function pn(e){return"string"==typeof e?e:Object.entries(e).map((([e,t])=>`${e}:${t}`)).join(";")}const hn=new WeakMap;function dn(e,t){hn.set(e,t)}function mn(e){return hn.get(e)}class gn{_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 gn(Object.fromEntries(function(e){return Array.isArray(e)?e:[e]}(t).map((e=>[e,Se]))),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 fn(){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 s(`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 s(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);if(e.character<0||e.character>t.length)throw new s(`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=an(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),i=(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 s(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,o=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,a=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,l=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||o||a||l){if(i&&o)continue;if(a&&l)continue;throw new s(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}(i),e.set(t.meta,{decorations:i,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 s(`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 i(e,t,n,i){const o=r[e];let l="",c=-1,u=-1;if(0===t&&(c=0),0===n&&(u=0),n===Number.POSITIVE_INFINITY&&(u=o.children.length),-1===c||-1===u)for(let e=0;e<o.children.length;e++)l+=yn(o.children[e]),-1===c&&l.length===t&&(c=e+1),-1===u&&l.length===n&&(u=e+1);if(-1===c)throw new s(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(-1===u)throw new s(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);const p=o.children.slice(c,u);if(i.alwaysWrap||p.length!==o.children.length)if(i.alwaysWrap||1!==p.length||"element"!==p[0].type){const e={type:"element",tagName:"span",properties:{},children:p};a(e,i,"wrapper"),o.children.splice(c,p.length,e)}else a(p[0],i,"token");else a(o,i,"line")}function o(e,t){r[e]=a(r[e],t,"line")}function a(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&&on(e,t.properties.class),e=s(e,n)||e}const l=[],c=n.decorations.sort(((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset));for(const e of c){const{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,Number.POSITIVE_INFINITY,e);for(let r=t.line+1;r<n.line;r++)l.unshift((()=>o(r,e)));i(n.line,0,n.character,e)}}l.forEach((e=>e()))}}}function yn(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(yn).join(""):""}const kn=[fn()];function bn(e){return[...e.transformers||[],...kn]}var wn=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Cn={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function _n(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 Sn(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 vn(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){Cn[r]&&t.push({type:"setDecoration",value:Cn[r]})}else if(r<=29){const e=Cn[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:wn[r-30]}});else if(38===r){const n=Sn(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:wn[r-40]}});else if(48===r){const n=Sn(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:wn[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:wn[r-100+8]}})}return t}var xn={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 Nn(e=xn){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<wn.length;e++)r.push(t(wn[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 An(e,t,n){const r=Zt(e,n),s=an(t),i=Nn(Object.fromEntries(wn.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=_n(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=vn(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=Jt(s,r),o=Jt(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=w.None;return n.decorations.has("bold")&&(a|=w.Bold),n.decorations.has("italic")&&(a|=w.Italic),n.decorations.has("underline")&&(a|=w.Underline),n.decorations.has("strikethrough")&&(a|=w.Strikethrough),{content:n.value,offset:t[1],color:s,bgColor:o,fontStyle:a}}))))}function En(e,t,n={}){const{lang:r="text",theme:i=e.getLoadedThemes()[0]}=n;if(tn(r)||rn(i))return an(t).map((e=>[{content:e[0],offset:e[1]}]));const{theme:o,colorMap:a}=e.setTheme(i);if("ansi"===r)return An(o,t,n);const l=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==l.name)throw new s(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${l.name}"`);if(!n.grammarState.themes.includes(o.name))throw new s(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return function(e,t,n,r,s){const i=jn(e,t,n,r,s),o=new gn(jn(e,t,n,r,s).stateStack,t.name,n.name);return dn(i.tokens,o),i.tokens}(t,l,o,a,n)}function jn(e,t,n,r,i){const o=Zt(n,i),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:l=500}=i,c=an(e);let u=i.grammarState?function(e,t){if(!(e instanceof gn))throw new s("Invalid grammar state");return e.getInternalStack(t)}(i.grammarState,n.name)??Se:null!=i.grammarContextCode?jn(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:Se,p=[];const h=[];for(let e=0,s=c.length;e<s;e++){const[s,m]=c[e];if(""===s){p=[],h.push([]);continue}if(a>0&&s.length>=a){p=[],h.push([{content:s,offset:m,color:"",fontStyle:0}]);continue}let g,f,y;i.includeExplanation&&(g=t.tokenizeLine(s,u,l),f=g.tokens,y=0);const k=t.tokenizeLine2(s,u,l),b=k.tokens.length/2;for(let e=0;e<b;e++){const t=k.tokens[2*e],a=e+1<b?k.tokens[2*e+2]:s.length;if(t===a)continue;const l=k.tokens[2*e+1],c=Jt(r[x.getForeground(l)],o),u=x.getFontStyle(l),h={content:s.substring(t,a),offset:m+t,color:c,fontStyle:u};if(i.includeExplanation){const e=[];if("scopeName"!==i.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(/ /)))})}h.explanation=[];let r=0;for(;t+r<a;){const t=f[y],n=s.substring(t.startIndex,t.endIndex);r+=n.length,h.explanation.push({content:n,scopes:"scopeName"===i.includeExplanation?(d=t.scopes,d.map((e=>({scopeName:e})))):Ln(e,t.scopes)}),y+=1}}p.push(h)}h.push(p),p=[],u=k.ruleStack}var d;return{tokens:h,stateStack:u}}function Ln(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const s=t[r];n[r]={scopeName:s,themeMatches:$n(e,s,t.slice(0,r))}}return n}function In(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function Tn(e,t,n){if(!In(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)In(e[r],n[s])&&(r-=1),s-=1;return-1===r}function $n(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const e of s)if(Tn(e,t,n)){r.push(i);break}return r}function Pn(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=En(e,t,{...n,theme:r.theme});return{tokens:s,state:mn(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 gn(Object.fromEntries(s.map((e=>[e.theme,e.state?.getInternalStack(e.theme)]))),s[0].state.lang):void 0;return a&&dn(o,a),o}function Rn(e,t,n){let r,i,o,a,l,c;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:p="--shiki-",colorsRendering:h="css-vars"}=n,d=Object.entries(n.themes).filter((e=>e[1])).map((e=>({color:e[0],theme:e[1]}))).sort(((e,t)=>e.color===u?-1:t.color===u?1:0));if(0===d.length)throw new s("`themes` option must not be empty");const m=Pn(e,t,n);if(c=mn(m),u&&ln!==u&&!d.find((e=>e.color===u)))throw new s(`\`themes\` option must contain the defaultColor key \`${u}\``);const g=d.map((t=>e.getTheme(t.theme))),f=d.map((e=>e.color));o=m.map((e=>e.map((e=>function(e,t,n,r,i="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},a=t.map((t=>un(e.variants[t]))),l=new Set(a.flatMap((e=>Object.keys(e)))),c={},u=(e,r)=>{const s="color"===r?"":"background-color"===r?"-bg":`-${r}`;return n+t[e]+("color"===r?"":s)};return a.forEach(((e,n)=>{for(const o of l){const l=e[o]||"inherit";if(0===n&&r&&cn.includes(o))if(r===ln&&a.length>1){const e=t.findIndex((e=>"light"===e)),r=t.findIndex((e=>"dark"===e));if(-1===e||-1===r)throw new s('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=a[e][o]||"inherit",h=a[r][o]||"inherit";c[o]=`light-dark(${p}, ${h})`,"css-vars"===i&&(c[u(n,o)]=l)}else c[o]=l;else"css-vars"===i&&(c[u(n,o)]=l)}})),o.htmlStyle=c,o}(e,f,p,u,h))))),c&&dn(o,c);const y=d.map((e=>Zt(e.theme,n)));i=Mn(d,g,y,p,u,"fg",h),r=Mn(d,g,y,p,u,"bg",h),a=`shiki-themes ${g.map((e=>e.name)).join(" ")}`,l=u?void 0:[i,r].join(";")}else{if(!("theme"in n))throw new s("Invalid options, either `theme` or `themes` must be provided");{const s=Zt(n.theme,n);o=En(e,t,n);const l=e.getTheme(n.theme);r=Jt(l.bg,s),i=Jt(l.fg,s),a=l.name,c=mn(o)}}return{tokens:o,fg:i,bg:r,themeName:a,rootStyle:l,grammarState:c}}function Mn(e,t,n,r,i,o,a){return e.map(((l,c)=>{const u=Jt(t[c][o],n[c])||"inherit",p=`${r+l.color}${"bg"===o?"-bg":""}:${u}`;if(0===c&&i){if(i===ln&&e.length>1){const r=e.findIndex((e=>"light"===e.color)),i=e.findIndex((e=>"dark"===e.color));if(-1===r||-1===i)throw new s('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Jt(t[r][o],n[r])||"inherit"}, ${Jt(t[i][o],n[i])||"inherit"});${p}`}return u}return"css-vars"===a?p:null})).filter((e=>!!e)).join(";")}function On(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>On(e,t,n),codeToTokens:(t,n)=>Rn(e,t,n)}){let s=t;for(const e of bn(n))s=e.preprocess?.call(r,s,n)||s;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:c,grammarState:u}=Rn(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&w.Underline||s.fontStyle&w.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=pn(e.htmlStyle||un(e)),s=pn(n.htmlStyle||un(n)),i=e.fontStyle&&(e.fontStyle&w.Underline||e.fontStyle&w.Strikethrough),o=n.fontStyle&&(n.fontStyle&w.Underline||n.fontStyle&w.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 bn(n))i=e.tokens?.call(d,i)||i;return function(e,t,n,r=mn(e)){const s=bn(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:on,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=pn(i.htmlStyle||un(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&&dn(d,r);return d}(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},d,u)}const Dn=function(e,t){const n=t||Vt,r=n.quote||'"',s='"'===r?"'":'"';if('"'!==r&&"'"!==r)throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Yt,all:Qt,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||ve,characterReferences:n.characterReferences||Kt,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?rt:nt,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)};const Bn={light:"#333333",dark:"#bbbbbb"},Gn={light:"#fffffe",dark:"#1e1e1e"},Fn="__shiki_resolved";function Un(e){if(e?.[Fn])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?Bn.light:Bn.dark),n||(n="light"===t.type?Gn.light:Gn.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,Fn,{enumerable:!1,writable:!1,value:!0}),t}class Wn extends Error{constructor(e){super(e),this.name="ShikiError"}}class zn extends _e{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=Un(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=g.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 Wn(`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 Wn(`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 Hn{_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 qn=0;function Vn(e){qn+=1,!1!==e.warnings&&qn>=10&&qn%10==0&&console.warn(`[Shiki] ${qn} 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 Wn("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Un),s=new Hn(e.engine,n),i=new zn(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 Wn(`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 Wn("Shiki instance has been disposed")}function p(){t||(t=!0,i.dispose(),qn-=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 Wn(`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=>!nn(e))).map((async e=>await en(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=>sn(e)?null:Un(await en(e)))))).filter((e=>!!e))}(e))},loadThemeSync:c,dispose:p,[Symbol.dispose]:p}}function Kn(e){if(1!==[...e].length)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}const Xn=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),Yn=String.raw;function Qn(e,t){if(null==e)throw new Error(t??"Value expected");return e}const Zn=Yn`\[\^?`,Jn=`c.? | C(?:-.?)?|${Yn`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Yn`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Yn`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Yn`o\{[^\}]*\}?`}|${Yn`\d{1,3}`}`,er=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,tr=new RegExp(Yn`
|
|
9
|
+
"use strict";var e=require("@lexical/code"),t=require("@lexical/utils"),n=require("lexical");function r(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 s=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function i(e){return Array.isArray(e)?function(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=i(e[n]);return t}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let t={};for(let n in e)t[n]=i(e[n]);return t}(e):e}function o(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function a(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t===e.length-1?a(e.substring(0,e.length-1)):e.substr(1+~t)}var l=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,c=class{static hasCaptures(e){return null!==e&&(l.lastIndex=0,l.test(e))}static replaceCaptures(e,t,n){return e.replace(l,(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 u(e,t){return e<t?-1:e>t?1:0}function p(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=u(e[r],t[r]);if(0!==n)return n}return 0}return n-r}function h(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 d(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var m=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}},g=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&&h(i.settings.foreground)&&(a=i.settings.foreground);let l=null;"string"==typeof i.settings.background&&h(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 b(c,u,e,o,a,l)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{let n=u(e.scope,t.scope);return 0!==n?n:(n=p(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 C(t),o=new k(n,i.getId(r),i.getId(s)),a=new v(new S(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 g(i,o,a)}(e,t)}_cachedMatchRoot=new m(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&&!y(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 k(n.fontStyle,n.foreground,n.background):null}},f=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 y(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var k=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};var b=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}},w=(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))(w||{});var C=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)}},_=Object.freeze([]),S=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,s){this.scopeDepth=e,this.parentScopes=t||_,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)}},v=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(),S.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===p(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 S(e,t,n,r,s))}else this._mainRule.acceptOverwrite(e,n,r,s)}},x=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 N(e){return e}function A(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(E(s)){const e=[];do{e.push(s),s=r.next()}while(E(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 E(e){return!!e&&!!e.match(/[\w\.:]+/)}function j(e){"function"==typeof e.dispose&&e.dispose()}var L=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},I=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},T=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))}},$=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new L(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new T;for(const n of e)P(n,this.initialScopeName,this.repo,t);for(const e of t.references)if(e instanceof L){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 P(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 L?M({baseGrammar:i,selfGrammar:s},r):R(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 L(e))}function R(e,t,n){if(t.repository&&t.repository[e]){O([t.repository[e]],t,n)}}function M(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&O(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&O(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function O(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const e=r.repository?o({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&O(r.patterns,{...t,repository:e},n);const s=r.include;if(!s)continue;const i=W(s);switch(i.kind){case 0:M({...t,selfGrammar:t.baseGrammar},n);break;case 1:M(t,n);break;case 2:R(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?R(i.ruleName,s,n):M(s,n)}else 4===i.kind?n.add(new I(i.scopeName,i.ruleName)):n.add(new L(i.scopeName))}}}var D=class{kind=0},B=class{kind=1},G=class{constructor(e){this.ruleName=e}kind=2},F=class{constructor(e){this.scopeName=e}kind=3},U=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function W(e){if("$base"===e)return new D;if("$self"===e)return new B;const t=e.indexOf("#");if(-1===t)return new F(e);if(0===t)return new G(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new U(n,r)}}var z=/\\(\d+)/,H=/\\(\d+)/g;var q=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=c.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=c.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${a(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?c.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?c.replaceCaptures(this._contentName,e,t):this._contentName}},V=class extends q{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!")}},K=class extends q{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new J(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 ee,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},X=class extends q{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 ee,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Y=class extends q{_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 J(s,this.id),this.beginCaptures=i,this._end=new J(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 ee;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}},Q=class extends q{_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 J(s,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new J(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 ee;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 ee,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},Z=class e{static createCaptureRule(e,t,n,r,s){return e.registerRule(e=>new V(t,e,n,r,s))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new K(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(void 0===t.begin){t.repository&&(r=o({},r,t.repository));let s=t.patterns;return void 0===s&&t.include&&(s=[{include:t.include}]),new X(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(s,n,r))}return t.while?new Q(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 Y(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=W(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 X||e instanceof Y||e instanceof Q)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},J=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=z.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 H.lastIndex=0,this.source.replace(H,(e,t)=>d(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}},ee=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 te(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 te(e,r,this._items.map(e=>e.ruleId))}},te=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}},ne=class{constructor(e,t){this.languageId=e,this.tokenType=t}},re=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new ne(e,8),this._embeddedLanguagesMatcher=new se(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 ne(0,0);_getBasicScopeAttributes=new m(e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new ne(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/},se=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])=>d(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 ie=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function oe(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 Q&&a.push({rule:n,stack:t})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:a,findOptions:c}=le(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),ce(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 ie(s,!0)}h()}return new ie(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}=ae(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}=ae(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),ce(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 Y){const r=o;ce(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 Q){const r=o;ce(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(ce(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 ae(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function le(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function ce(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));oe(e,d,n&&0===p.start,p.start,h,s,!1,0),j(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 ue(t,p.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var ue=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function pe(e,t,n,r,s){const i=A(t,he),o=Z.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 he(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(de(t[r],e))return n=r+1,!0;return!1})}function de(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 me=class{constructor(e,t,n,r,s,i,o,a){if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new re(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=ge(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const e of Object.keys(s)){const t=A(e,he);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)pe(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&&pe(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]=ge(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=Z.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==ye.NULL)s=!1,t.reset();else{s=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=x.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?fe.createRootAndLookUpScopeName(i,r,this):fe.createRoot("unknown",r),t=new ye(null,this._rootId,-1,-1,!1,null,o,o)}e+="\n";const i=this.createOnigString(e),o=i.content.length,a=new be(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=oe(this,i,s,0,t,a,!0,r);return j(i),{lineLength:o,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function ge(e,t){return(e=i(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 fe=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=f.push(s,t.scopeNames),r=new e(r,s,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new f(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),i=new f(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),x.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}},ye=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)&&fe.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=fe.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,fe.fromExtension(r,n.contentNameScopesList))}},ke=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):A(e,he).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>A(e,he).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}},be=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=x.set(n,0,N(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}return r&&(n=x.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}},we=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 me(e,t,n,r,s,i,o,a)}(e,i,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},Ce=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new we(g.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(g.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 ke(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,s){const i=new $(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)}},_e=ye.NULL;const Se=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class ve{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function xe(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new ve(n,r,t)}function Ne(e){return e.toLowerCase()}ve.prototype.normal={},ve.prototype.property={},ve.prototype.space=void 0;class Ae{constructor(e,t){this.attribute=t,this.property=e}}Ae.prototype.attribute="",Ae.prototype.booleanish=!1,Ae.prototype.boolean=!1,Ae.prototype.commaOrSpaceSeparated=!1,Ae.prototype.commaSeparated=!1,Ae.prototype.defined=!1,Ae.prototype.mustUseProperty=!1,Ae.prototype.number=!1,Ae.prototype.overloadedBoolean=!1,Ae.prototype.property="",Ae.prototype.spaceSeparated=!1,Ae.prototype.space=void 0;let Ee=0;const je=Me(),Le=Me(),Ie=Me(),Te=Me(),$e=Me(),Pe=Me(),Re=Me();function Me(){return 2**++Ee}var Oe={__proto__:null,boolean:je,booleanish:Le,commaOrSpaceSeparated:Re,commaSeparated:Pe,number:Te,overloadedBoolean:Ie,spaceSeparated:$e};const De=Object.keys(Oe);class Be extends Ae{constructor(e,t,n,r){let s=-1;if(super(e,t),Ge(this,"space",r),"number"==typeof n)for(;++s<De.length;){const e=De[s];Ge(this,De[s],(n&Oe[e])===Oe[e])}}}function Ge(e,t,n){n&&(e[t]=n)}function Fe(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Be(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Ne(r)]=r,n[Ne(i.attribute)]=r}return new ve(t,n,e.space)}Be.prototype.defined=!0;const Ue=Fe({properties:{ariaActiveDescendant:null,ariaAtomic:Le,ariaAutoComplete:null,ariaBusy:Le,ariaChecked:Le,ariaColCount:Te,ariaColIndex:Te,ariaColSpan:Te,ariaControls:$e,ariaCurrent:null,ariaDescribedBy:$e,ariaDetails:null,ariaDisabled:Le,ariaDropEffect:$e,ariaErrorMessage:null,ariaExpanded:Le,ariaFlowTo:$e,ariaGrabbed:Le,ariaHasPopup:null,ariaHidden:Le,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:$e,ariaLevel:Te,ariaLive:null,ariaModal:Le,ariaMultiLine:Le,ariaMultiSelectable:Le,ariaOrientation:null,ariaOwns:$e,ariaPlaceholder:null,ariaPosInSet:Te,ariaPressed:Le,ariaReadOnly:Le,ariaRelevant:null,ariaRequired:Le,ariaRoleDescription:$e,ariaRowCount:Te,ariaRowIndex:Te,ariaRowSpan:Te,ariaSelected:Le,ariaSetSize:Te,ariaSort:null,ariaValueMax:Te,ariaValueMin:Te,ariaValueNow:Te,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function We(e,t){return t in e?e[t]:t}function ze(e,t){return We(e,t.toLowerCase())}const He=Fe({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Pe,acceptCharset:$e,accessKey:$e,action:null,allow:null,allowFullScreen:je,allowPaymentRequest:je,allowUserMedia:je,alt:null,as:null,async:je,autoCapitalize:null,autoComplete:$e,autoFocus:je,autoPlay:je,blocking:$e,capture:null,charSet:null,checked:je,cite:null,className:$e,cols:Te,colSpan:null,content:null,contentEditable:Le,controls:je,controlsList:$e,coords:Te|Pe,crossOrigin:null,data:null,dateTime:null,decoding:null,default:je,defer:je,dir:null,dirName:null,disabled:je,download:Ie,draggable:Le,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:je,formTarget:null,headers:$e,height:Te,hidden:Ie,high:Te,href:null,hrefLang:null,htmlFor:$e,httpEquiv:$e,id:null,imageSizes:null,imageSrcSet:null,inert:je,inputMode:null,integrity:null,is:null,isMap:je,itemId:null,itemProp:$e,itemRef:$e,itemScope:je,itemType:$e,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:je,low:Te,manifest:null,max:null,maxLength:Te,media:null,method:null,min:null,minLength:Te,multiple:je,muted:je,name:null,nonce:null,noModule:je,noValidate:je,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:je,optimum:Te,pattern:null,ping:$e,placeholder:null,playsInline:je,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:je,referrerPolicy:null,rel:$e,required:je,reversed:je,rows:Te,rowSpan:Te,sandbox:$e,scope:null,scoped:je,seamless:je,selected:je,shadowRootClonable:je,shadowRootDelegatesFocus:je,shadowRootMode:null,shape:null,size:Te,sizes:null,slot:null,span:Te,spellCheck:Le,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Te,step:null,style:null,tabIndex:Te,target:null,title:null,translate:null,type:null,typeMustMatch:je,useMap:null,value:Le,width:Te,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:$e,axis:null,background:null,bgColor:null,border:Te,borderColor:null,bottomMargin:Te,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:je,declare:je,event:null,face:null,frame:null,frameBorder:null,hSpace:Te,leftMargin:Te,link:null,longDesc:null,lowSrc:null,marginHeight:Te,marginWidth:Te,noResize:je,noHref:je,noShade:je,noWrap:je,object:null,profile:null,prompt:null,rev:null,rightMargin:Te,rules:null,scheme:null,scrolling:Le,standby:null,summary:null,text:null,topMargin:Te,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Te,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:je,disableRemotePlayback:je,prefix:null,property:null,results:Te,security:null,unselectable:null},space:"html",transform:ze}),qe=Fe({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:Re,accentHeight:Te,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Te,amplitude:Te,arabicForm:null,ascent:Te,attributeName:null,attributeType:null,azimuth:Te,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Te,by:null,calcMode:null,capHeight:Te,className:$e,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:Te,diffuseConstant:Te,direction:null,display:null,dur:null,divisor:Te,dominantBaseline:null,download:je,dx:null,dy:null,edgeMode:null,editable:null,elevation:Te,enableBackground:null,end:null,event:null,exponent:Te,externalResourcesRequired:null,fill:null,fillOpacity:Te,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:Pe,g2:Pe,glyphName:Pe,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Te,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Te,horizOriginX:Te,horizOriginY:Te,id:null,ideographic:Te,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Te,k:Te,k1:Te,k2:Te,k3:Te,k4:Te,kernelMatrix:Re,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Te,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:Te,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:Te,overlineThickness:Te,paintOrder:null,panose1:null,path:null,pathLength:Te,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:$e,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Te,pointsAtY:Te,pointsAtZ:Te,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Re,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Re,rev:Re,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Re,requiredFeatures:Re,requiredFonts:Re,requiredFormats:Re,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:Te,specularExponent:Te,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Te,strikethroughThickness:Te,string:null,stroke:null,strokeDashArray:Re,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Te,strokeOpacity:Te,strokeWidth:null,style:null,surfaceScale:Te,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Re,tabIndex:Te,tableValues:null,target:null,targetX:Te,targetY:Te,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Re,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Te,underlineThickness:Te,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Te,values:null,vAlphabetic:Te,vMathematical:Te,vectorEffect:null,vHanging:Te,vIdeographic:Te,version:null,vertAdvY:Te,vertOriginX:Te,vertOriginY:Te,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Te,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:We}),Ve=Fe({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()}),Ke=Fe({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ze}),Xe=Fe({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),Ye=/[A-Z]/g,Qe=/-[a-z]/g,Ze=/^data[-\w.:]+$/i;function Je(e){return"-"+e.toLowerCase()}function et(e){return e.charAt(1).toUpperCase()}const tt=xe([Ue,He,Ve,Ke,Xe],"html"),nt=xe([Ue,qe,Ve,Ke,Xe],"svg"),rt={}.hasOwnProperty;const st=/["&'<>`]/g,it=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ot=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,at=/[|\\{}()[\]^$+*?.]/g,lt=new WeakMap;function ct(e,t){return e=e.replace(t.subset?function(e){let t=lt.get(e);t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(at,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),lt.set(e,t));return t}(t.subset):st,n),t.subset||t.escapeOnly?e:e.replace(it,function(e,n,r){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}).replace(ot,n);function n(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}const ut=/[\dA-Fa-f]/;const pt=/\d/;const ht=["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"],dt={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:"€"},mt=["cent","copy","divide","gt","lt","not","para","times"],gt={}.hasOwnProperty,ft={};let yt;for(yt in dt)gt.call(dt,yt)&&(ft[dt[yt]]=yt);const kt=/[^\dA-Za-z]/;function bt(e,t,n){let r,s=function(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!ut.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(gt.call(ft,s)){const e=ft[s],i="&"+e;return n&&ht.includes(e)&&!mt.includes(e)&&(!r||t&&61!==t&&kt.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&&!pt.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 wt(e,t){return ct(e,Object.assign({format:bt},t))}const Ct=/^>|^->|<!--|-->|--!>|<!-$/g,_t=[">"],St=["<",">"];function vt(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 xt(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}function Nt(e){return e.join(" ").trim()}const At=/[ \t\n\f\r]/g;function Et(e){return"object"==typeof e?"text"===e.type&&jt(e.value):jt(e)}function jt(e){return""===e.replace(At,"")}const Lt=$t(1),It=$t(-1),Tt=[];function $t(e){return function(t,n,r){const s=t?t.children:Tt;let i=(n||0)+e,o=s[i];if(!r)for(;o&&Et(o);)i+=e,o=s[i];return o}}const Pt={}.hasOwnProperty;function Rt(e){return function(t,n,r){return Pt.call(e,t.tagName)&&e[t.tagName](t,n,r)}}const Mt=Rt({body:function(e,t,n){const r=Lt(n,t);return!r||"comment"!==r.type},caption:Ot,colgroup:Ot,dd:function(e,t,n){const r=Lt(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){const r=Lt(n,t);return Boolean(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:Ot,html:function(e,t,n){const r=Lt(n,t);return!r||"comment"!==r.type},li:function(e,t,n){const r=Lt(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){const r=Lt(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){const r=Lt(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){const r=Lt(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:Dt,rt:Dt,tbody:function(e,t,n){const r=Lt(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:Bt,tfoot:function(e,t,n){return!Lt(n,t)},th:Bt,thead:function(e,t,n){const r=Lt(n,t);return Boolean(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){const r=Lt(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function Ot(e,t,n){const r=Lt(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&Et(r.value.charAt(0)))}function Dt(e,t,n){const r=Lt(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function Bt(e,t,n){const r=Lt(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}const Gt=Rt({body:function(e){const t=Lt(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&Et(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=It(n,t),s=Lt(e,-1,!0);if(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&Mt(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=Lt(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const r=It(n,t),s=Lt(e,-1);if(n&&r&&"element"===r.type&&("thead"===r.tagName||"tbody"===r.tagName)&&Mt(r,n.children.indexOf(r),n))return!1;return Boolean(s&&"element"===s.type&&"tr"===s.tagName)}});const Ft={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 Ut(e,t,n){const r=function(e,t){const n=Ne(t);let r=t,s=Ae;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&Ze.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Qe,et);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Qe.test(e)){let n=e.replace(Ye,Je);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}s=Be}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=wt(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Ft.name[s][i]}));return!0===n?l:(n=Array.isArray(n)?(r.commaSeparated?xt:Nt)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?l:(e.settings.preferUnquoted&&(o=wt(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Ft.unquoted[s][i]}))),o!==n&&(e.settings.quoteSmart&&vt(n,a)>vt(n,e.alternative)&&(a=e.alternative),o=a+wt(n,Object.assign({},e.settings.characterReferences,{subset:("'"===a?Ft.single:Ft.double)[s][i],attribute:!0}))+a),l+(o?"="+o:o)))}const Wt=["<","&"];function zt(e,t,n,r){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?wt(e.value,Object.assign({},r.settings.characterReferences,{subset:Wt})):e.value}const Ht=function(e,t){const n=t||{};function r(t,...n){let s=r.invalid;const i=r.handlers;if(t&&rt.call(t,e)){const n=String(t[e]);s=rt.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?"<?"+wt(e.value,Object.assign({},r.settings.characterReferences,{subset:_t}))+">":"\x3c!--"+e.value.replace(Ct,function(e){return wt(e,Object.assign({},r.settings.characterReferences,{subset:St}))})+"--\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=nt);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=Ut(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&&Gt(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&&Mt(e,t,n)||a.push("</"+e.tagName+">"),a.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:zt(e,0,n,r)},root:function(e,t,n,r){return r.all(e)},text:zt}});const qt={},Vt={},Kt=[];function Xt(e,t,n){return Ht(e,t,n,this)}function Yt(e){const t=[],n=e&&e.children||Kt;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function Qt(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 Zt(e,t){return e&&t?.[e?.toLowerCase()]||e}async function Jt(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function en(e){return!e||["plaintext","txt","text","plain"].includes(e)}function tn(e){return"ansi"===e||en(e)}function nn(e){return"none"===e}function rn(e){return nn(e)}function sn(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 on(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 an="light-dark()",ln=["color","background-color"];function cn(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&w.Italic&&(t["font-style"]="italic"),e.fontStyle&w.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&w.Underline&&n.push("underline"),e.fontStyle&w.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function un(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}const pn=new WeakMap;function hn(e,t){pn.set(e,t)}function dn(e){return pn.get(e)}class mn{_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 mn(Object.fromEntries(function(e){return Array.isArray(e)?e:[e]}(t).map(e=>[e,_e])),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 gn(){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 s(`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 s(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);if(e.character<0||e.character>t.length)throw new s(`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=on(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),i=(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 s(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,o=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,a=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,l=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||o||a||l){if(i&&o)continue;if(a&&l)continue;throw new s(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}(i),e.set(t.meta,{decorations:i,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 s(`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 i(e,t,n,i){const o=r[e];let l="",c=-1,u=-1;if(0===t&&(c=0),0===n&&(u=0),n===Number.POSITIVE_INFINITY&&(u=o.children.length),-1===c||-1===u)for(let e=0;e<o.children.length;e++)l+=fn(o.children[e]),-1===c&&l.length===t&&(c=e+1),-1===u&&l.length===n&&(u=e+1);if(-1===c)throw new s(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(-1===u)throw new s(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);const p=o.children.slice(c,u);if(i.alwaysWrap||p.length!==o.children.length)if(i.alwaysWrap||1!==p.length||"element"!==p[0].type){const e={type:"element",tagName:"span",properties:{},children:p};a(e,i,"wrapper"),o.children.splice(c,p.length,e)}else a(p[0],i,"token");else a(o,i,"line")}function o(e,t){r[e]=a(r[e],t,"line")}function a(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&&sn(e,t.properties.class),e=s(e,n)||e}const l=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(const e of c){const{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,Number.POSITIVE_INFINITY,e);for(let r=t.line+1;r<n.line;r++)l.unshift(()=>o(r,e));i(n.line,0,n.character,e)}}l.forEach(e=>e())}}}function fn(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(fn).join(""):""}const yn=[gn()];function kn(e){return[...e.transformers||[],...yn]}var bn=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],wn={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Cn(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 _n(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 Sn(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){wn[r]&&t.push({type:"setDecoration",value:wn[r]})}else if(r<=29){const e=wn[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:bn[r-30]}});else if(38===r){const n=_n(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:bn[r-40]}});else if(48===r){const n=_n(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:bn[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:bn[r-100+8]}})}return t}var vn={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 xn(e=vn){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<bn.length;e++)r.push(t(bn[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 Nn(e,t,n){const r=Qt(e,n),s=on(t),i=xn(Object.fromEntries(bn.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=Cn(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=Sn(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=Zt(s,r),o=Zt(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=w.None;return n.decorations.has("bold")&&(a|=w.Bold),n.decorations.has("italic")&&(a|=w.Italic),n.decorations.has("underline")&&(a|=w.Underline),n.decorations.has("strikethrough")&&(a|=w.Strikethrough),{content:n.value,offset:t[1],color:s,bgColor:o,fontStyle:a}}))}function An(e,t,n={}){const{lang:r="text",theme:i=e.getLoadedThemes()[0]}=n;if(en(r)||nn(i))return on(t).map(e=>[{content:e[0],offset:e[1]}]);const{theme:o,colorMap:a}=e.setTheme(i);if("ansi"===r)return Nn(o,t,n);const l=e.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==l.name)throw new s(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${l.name}"`);if(!n.grammarState.themes.includes(o.name))throw new s(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return function(e,t,n,r,s){const i=En(e,t,n,r,s),o=new mn(En(e,t,n,r,s).stateStack,t.name,n.name);return hn(i.tokens,o),i.tokens}(t,l,o,a,n)}function En(e,t,n,r,i){const o=Qt(n,i),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:l=500}=i,c=on(e);let u=i.grammarState?function(e,t){if(!(e instanceof mn))throw new s("Invalid grammar state");return e.getInternalStack(t)}(i.grammarState,n.name)??_e:null!=i.grammarContextCode?En(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack:_e,p=[];const h=[];for(let e=0,s=c.length;e<s;e++){const[s,d]=c[e];if(""===s){p=[],h.push([]);continue}if(a>0&&s.length>=a){p=[],h.push([{content:s,offset:d,color:"",fontStyle:0}]);continue}let m,g,f;i.includeExplanation&&(m=t.tokenizeLine(s,u,l),g=m.tokens,f=0);const y=t.tokenizeLine2(s,u,l),k=y.tokens.length/2;for(let e=0;e<k;e++){const t=y.tokens[2*e],a=e+1<k?y.tokens[2*e+2]:s.length;if(t===a)continue;const l=y.tokens[2*e+1],c=Zt(r[x.getForeground(l)],o),u=x.getFontStyle(l),h={content:s.substring(t,a),offset:d+t,color:c,fontStyle:u};if(i.includeExplanation){const e=[];if("scopeName"!==i.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(/ /))})}h.explanation=[];let r=0;for(;t+r<a;){const t=g[f],n=s.substring(t.startIndex,t.endIndex);r+=n.length,h.explanation.push({content:n,scopes:"scopeName"===i.includeExplanation?jn(t.scopes):Ln(e,t.scopes)}),f+=1}}p.push(h)}h.push(p),p=[],u=y.ruleStack}return{tokens:h,stateStack:u}}function jn(e){return e.map(e=>({scopeName:e}))}function Ln(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const s=t[r];n[r]={scopeName:s,themeMatches:$n(e,s,t.slice(0,r))}}return n}function In(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function Tn(e,t,n){if(!In(e[e.length-1],t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)In(e[r],n[s])&&(r-=1),s-=1;return-1===r}function $n(e,t,n){const r=[];for(const{selectors:s,settings:i}of e)for(const e of s)if(Tn(e,t,n)){r.push(i);break}return r}function Pn(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=An(e,t,{...n,theme:r.theme});return{tokens:s,state:dn(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 mn(Object.fromEntries(s.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),s[0].state.lang):void 0;return a&&hn(o,a),o}function Rn(e,t,n){let r,i,o,a,l,c;if("themes"in n){const{defaultColor:u="light",cssVariablePrefix:p="--shiki-",colorsRendering:h="css-vars"}=n,d=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===u?-1:t.color===u?1:0);if(0===d.length)throw new s("`themes` option must not be empty");const m=Pn(e,t,n);if(c=dn(m),u&&an!==u&&!d.find(e=>e.color===u))throw new s(`\`themes\` option must contain the defaultColor key \`${u}\``);const g=d.map(t=>e.getTheme(t.theme)),f=d.map(e=>e.color);o=m.map(e=>e.map(e=>function(e,t,n,r,i="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},a=t.map(t=>cn(e.variants[t])),l=new Set(a.flatMap(e=>Object.keys(e))),c={},u=(e,r)=>{const s="color"===r?"":"background-color"===r?"-bg":`-${r}`;return n+t[e]+("color"===r?"":s)};return a.forEach((e,n)=>{for(const o of l){const l=e[o]||"inherit";if(0===n&&r&&ln.includes(o))if(r===an&&a.length>1){const e=t.findIndex(e=>"light"===e),r=t.findIndex(e=>"dark"===e);if(-1===e||-1===r)throw new s('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=a[e][o]||"inherit",h=a[r][o]||"inherit";c[o]=`light-dark(${p}, ${h})`,"css-vars"===i&&(c[u(n,o)]=l)}else c[o]=l;else"css-vars"===i&&(c[u(n,o)]=l)}}),o.htmlStyle=c,o}(e,f,p,u,h))),c&&hn(o,c);const y=d.map(e=>Qt(e.theme,n));i=Mn(d,g,y,p,u,"fg",h),r=Mn(d,g,y,p,u,"bg",h),a=`shiki-themes ${g.map(e=>e.name).join(" ")}`,l=u?void 0:[i,r].join(";")}else{if(!("theme"in n))throw new s("Invalid options, either `theme` or `themes` must be provided");{const s=Qt(n.theme,n);o=An(e,t,n);const l=e.getTheme(n.theme);r=Zt(l.bg,s),i=Zt(l.fg,s),a=l.name,c=dn(o)}}return{tokens:o,fg:i,bg:r,themeName:a,rootStyle:l,grammarState:c}}function Mn(e,t,n,r,i,o,a){return e.map((l,c)=>{const u=Zt(t[c][o],n[c])||"inherit",p=`${r+l.color}${"bg"===o?"-bg":""}:${u}`;if(0===c&&i){if(i===an&&e.length>1){const r=e.findIndex(e=>"light"===e.color),i=e.findIndex(e=>"dark"===e.color);if(-1===r||-1===i)throw new s('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Zt(t[r][o],n[r])||"inherit"}, ${Zt(t[i][o],n[i])||"inherit"});${p}`}return u}return"css-vars"===a?p:null}).filter(e=>!!e).join(";")}function On(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>On(e,t,n),codeToTokens:(t,n)=>Rn(e,t,n)}){let s=t;for(const e of kn(n))s=e.preprocess?.call(r,s,n)||s;let{tokens:i,fg:o,bg:a,themeName:l,rootStyle:c,grammarState:u}=Rn(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&w.Underline||s.fontStyle&w.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=un(e.htmlStyle||cn(e)),s=un(n.htmlStyle||cn(n)),i=e.fontStyle&&(e.fontStyle&w.Underline||e.fontStyle&w.Strikethrough),o=n.fontStyle&&(n.fontStyle&w.Underline||n.fontStyle&w.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 kn(n))i=e.tokens?.call(d,i)||i;return function(e,t,n,r=dn(e)){const s=kn(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:sn,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=un(i.htmlStyle||cn(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&&hn(d,r);return d}(i,{...n,fg:o,bg:a,themeName:l,rootStyle:c},d,u)}const Dn=function(e,t){const n=t||qt,r=n.quote||'"',s='"'===r?"'":'"';if('"'!==r&&"'"!==r)throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Xt,all:Yt,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||Se,characterReferences:n.characterReferences||Vt,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?nt:tt,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)};const Bn="#333333",Gn="#bbbbbb",Fn="#fffffe",Un="#1e1e1e",Wn="__shiki_resolved";function zn(e){if(e?.[Wn])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?Bn:Gn),n||(n="light"===t.type?Fn:Un),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,Wn,{enumerable:!1,writable:!1,value:!0}),t}class Hn extends Error{constructor(e){super(e),this.name="ShikiError"}}class qn extends Ce{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=zn(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=g.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 Hn(`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 Hn(`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 Vn{_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 Kn=0;function Xn(e){Kn+=1,!1!==e.warnings&&Kn>=10&&Kn%10==0&&console.warn(`[Shiki] ${Kn} 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 Hn("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(zn),s=new Vn(e.engine,n),i=new qn(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 Hn(`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 Hn("Shiki instance has been disposed")}function p(){t||(t=!0,i.dispose(),Kn-=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 Hn(`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=>!tn(e)).map(async e=>await Jt(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=>rn(e)?null:zn(await Jt(e))))).filter(e=>!!e)}(e))},loadThemeSync:c,dispose:p,[Symbol.dispose]:p}}function Yn(e){if(1!==[...e].length)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}const Qn=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),Zn=String.raw;function Jn(e,t){if(null==e)throw new Error(t??"Value expected");return e}const er=Zn`\[\^?`,tr=`c.? | C(?:-.?)?|${Zn`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Zn`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Zn`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Zn`o\{[^\}]*\}?`}|${Zn`\d{1,3}`}`,nr=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,rr=new RegExp(Zn`
|
|
10
10
|
\\ (?:
|
|
11
|
-
${
|
|
11
|
+
${tr}
|
|
12
12
|
| [gk]<[^>]*>?
|
|
13
13
|
| [gk]'[^']*'?
|
|
14
14
|
| .
|
|
@@ -25,19 +25,19 @@
|
|
|
25
25
|
)?
|
|
26
26
|
| \*[^\)]*\)?
|
|
27
27
|
)?
|
|
28
|
-
| (?:${
|
|
29
|
-
| ${
|
|
28
|
+
| (?:${nr.source})+
|
|
29
|
+
| ${er}
|
|
30
30
|
| .
|
|
31
|
-
`.replace(/\s+/g,""),"gsu"),
|
|
31
|
+
`.replace(/\s+/g,""),"gsu"),sr=new RegExp(Zn`
|
|
32
32
|
\\ (?:
|
|
33
|
-
${
|
|
33
|
+
${tr}
|
|
34
34
|
| .
|
|
35
35
|
)
|
|
36
36
|
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
37
|
-
| ${
|
|
37
|
+
| ${er}
|
|
38
38
|
| &&
|
|
39
39
|
| .
|
|
40
|
-
`.replace(/\s+/g,""),"gsu");function rr(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(tr.lastIndex=0;o=tr.exec(e);){const t=sr(i,e,o[0],tr.lastIndex);t.tokens?a.push(...t.tokens):t.token&&a.push(t.token),void 0!==t.lastIndex&&(tr.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[cr(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(Yn`Octal encoded byte above 177 unsupported "${n}"`)}else r=Kn(t);i.push(ur(r,(0===e?"\\":"")+t))}return i}(e,u):e)).flat(),flags:r}}function sr(e,t,n,r){const[s,i]=n;if("["===n||"[^"===n){const e=function(e,t,n){const r=[hr("^"===t[1],t)];let s,i=1;for(nr.lastIndex=n;s=nr.exec(e);){const e=s[0];if("["===e[0]&&":"!==e[1])i++,r.push(hr("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===r.at(-1).type)r.push(ur(93,e));else if(i--,r.push(pr(e)),!i)break}else{const t=ir(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:nr.lastIndex||e.length}}(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===s){if("AbBGyYzZ".includes(i))return{token:lr(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:yr(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:cr(n)}}if("K"===i)return{token:mr("keep",n)};if("N"===i||"R"===i)return{token:dr("newline",n,{negate:"N"===i})};if("O"===i)return{token:dr("any",n)};if("X"===i)return{token:dr("text_segment",n)};const e=or(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if("("===s){if("*"===i)return{token:Cr(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:wr(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===n&&!e.captureGroup||"(?:"===n)return{token:fr("group",n)};if("(?>"===n)return{token:fr("atomic",n)};if("(?="===n||"(?!"===n||"(?<="===n||"(?<!"===n)return{token:fr("<"===n[2]?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if("("===n&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:fr("capturing",n,{..."("!==n&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if("(?~|"===n)throw new Error(`Unsupported absence function kind "${n}"`);return{token:fr("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:gr(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:dr("dot",n)};if("^"===n||"$"===n){return{token:lr(e.singleline?{"^":Yn`\A`,$:Yn`\Z`}[n]:n,n)}}return"|"===n?{token:ar(n)}:er.test(n)?{tokens:vr(n)}:{token:ur(Kn(n),n)}}function ir(e){if("\\"===e[0])return or(e,{inCharClass:!0});if("["===e[0]){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Xn.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return dr("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):ur(Kn(e),e)}function or(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 ur(Kn(t.toUpperCase())-64,e)}(e);if("dDhHsSwW".includes(n))return function(e){const t=e[1].toLowerCase();return dr({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}(e);if(e.startsWith(Yn`\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 dr("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 ur(Kn(e),t)}))}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===n||"x"===n)return ur(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(br.has(n))return ur(br.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(Yn`Incomplete escape "\"`);if("M"===n)throw new Error(`Unsupported meta "${e}"`);if(2===[...e].length)return ur(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function ar(e){return{type:"Alternator",raw:e}}function lr(e,t){return{type:"Assertion",kind:e,raw:t}}function cr(e){return{type:"Backreference",raw:e}}function ur(e,t){return{type:"Character",value:e,raw:t}}function pr(e){return{type:"CharacterClassClose",raw:e}}function hr(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function dr(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function mr(e,t,n={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:Qn(n.flags),raw:t}}function gr(e){return{type:"GroupClose",raw:e}}function fr(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function yr(e){return{type:"Subroutine",raw:e}}const kr=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),br=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function wr(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=Sr(n),o=Sr(r),a={};if(i&&(a.enable=i),o&&(a.disable=o),e.endsWith(")"))return t.replaceCurrentModX(s),mr("flags",e,{flags:a});if(e.endsWith(":"))return t.pushModX(s),t.numOpenGroups++,fr("group",e,{...(i||o)&&{flags:a}});throw new Error(`Unexpected flag modifier "${e}"`)}function Cr(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=kr.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 _r(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 Sr(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 vr(e){const t=[],n=new RegExp(er,"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(_r(e.slice(0,-1)));continue}}}t.push(_r(e))}return t}function xr(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 Nr=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function Ar(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=rr(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 Ir();case"Assertion":return Er(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,$r(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 $r(r)}return s(+r)}(n,i);case"Character":return Rr(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 Rr(Kn("-"))}(0,i,t);case"CharacterClassOpen":return function({negate:e},t,n){const{tokens:r,walk:s}=t,i=r[t.nextIndex],o=[Mr()];let a=Xr(i);for(;"CharacterClassClose"!==a.type;){if("CharacterClassIntersector"===a.type)o.push(Mr()),t.nextIndex++;else{const e=o.at(-1);e.body.push(s(e,n))}a=Xr(r[t.nextIndex],i)}const l=Mr({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 jr(n,i);case"Directive":return Dr(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:zr(t?.body)}}("repeater");case"atomic":return Br({atomic:!0});case"capturing":return Pr(s,{name:n});case"group":return Br({flags:e});case"lookahead":case"lookbehind":return Gr({behind:"lookbehind"===t,negate:r});default:throw new Error(`Unexpected group kind "${t}"`)}}(e),c="AbsenceFunction"===l.type,u=Vr(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=Yr(r[t.nextIndex]);for(;"GroupClose"!==h.type;){if("Alternator"===h.type)l.body.push(Ir()),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(qr(t)||"CapturingGroup"===t.type)throw new Error(e)}else if(qr(t)||Vr(t)&&t.negate)throw new Error(e)}}h=Yr(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 Lr(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=Ur(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:zr(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(Yn`Subroutine uses a group name that's not defined "\g<${e}>"`);if(u.get(e).length>1)throw new Error(Yn`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}return o}function Er({kind:e}){return Tr(Qn({"^":"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===Yn`\B`||e===Yn`\Y`})}function jr({kind:e,negate:t,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:i,unicodePropertyMap:o}=r;if("property"===e){const r=Kr(n);if(!Xn.has(r)||o?.has(r))return Wr(n,{negate:t,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:i,unicodePropertyMap:o});e="posix",n=r}return"posix"===e?function(e,t){const n=!!t?.negate;if(!Xn.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}(n,{negate:t}):Or(e,{negate:t})}function Lr({kind:e,min:t,max:n},r){const s=r.parent,i=s.body.at(-1);if(!i||!function(e){return Nr.has(e.type)}(i))throw new Error("Quantifier requires a repeatable token");const o=Fr(e,t,n,i);return s.body.pop(),o}function Ir(e){return{type:"Alternative",body:Hr(e?.body)}}function Tr(e,t){const n={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(n.negate=!!t?.negate),n}function $r(e,t){const n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function Pr(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:zr(t?.body)}}function Rr(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 Mr(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:Hr(e?.body)}}function Or(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 Dr(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:Qn(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function Br(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:zr(e?.body)}}function Gr(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:zr(e?.body)}}function Fr(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 Ur(e){return{type:"Subroutine",ref:e}}function Wr(e,t){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let r=n.unicodePropertyMap?.get(Kr(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(Yn`Invalid Unicode property "\p{${e}}"`);return{type:"CharacterSet",kind:"property",value:r??e,negate:n.negate}}function zr(e){if(void 0===e)e=[Ir()];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 Hr(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 qr(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function Vr(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function Kr(e){return e.replace(/[- _]+/g,"").toLowerCase()}function Xr(e,t){return Qn(e,("Character"===t?.type&&93===t.value?"Empty":"Unclosed")+" character class")}function Yr(e){return Qn(e,"Unclosed group")}function Qr(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(){Zr(l).splice(Math.max(0,Jr(a)+c),1),c--,u=!0},removeAllNextSiblings:()=>Zr(l).splice(Jr(a)+1),removeAllPrevSiblings(){const e=Jr(a)+c;return c-=e,Zr(l).splice(0,Math.max(0,e))},replaceWith(e,t={}){const n=!!t.traverse;l?l[Math.max(0,Jr(a)+c)]=e:Qn(o,"Can't replace root node")[a]=e,n&&s(e,o,a,l),u=!0},replaceWithMultiple(e,t={}){const n=!!t.traverse;if(Zr(l).splice(Math.max(0,Jr(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,Jr(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 Zr(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function Jr(e){if("number"!=typeof e)throw new Error("Numeric key expected");return e}const es=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function ts(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}const ns=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function rs(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===ns.DEFAULT!=!o?("["===e[0]?(o++,i.push("^"===e[1])):"]"===e&&o&&(o--,i.pop()),a+=e):a+=n instanceof Function?n(t,{context:o?ns.CHAR_CLASS:ns.DEFAULT,negated:i[i.length-1]}):n}return a}function ss(e,t,n,r){rs(e,t,n,r)}function is(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===ns.DEFAULT!=!o))return i;"["===e?o++:"]"===e&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}(e,t,0,n)}function os(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 as=new RegExp(String.raw`(?<noncapturingStart>${es})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");const ls=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,cs=new RegExp(String.raw`
|
|
40
|
+
`.replace(/\s+/g,""),"gsu");function ir(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(rr.lastIndex=0;o=rr.exec(e);){const t=or(i,e,o[0],rr.lastIndex);t.tokens?a.push(...t.tokens):t.token&&a.push(t.token),void 0!==t.lastIndex&&(rr.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[pr(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(Zn`Octal encoded byte above 177 unsupported "${n}"`)}else r=Yn(t);i.push(hr(r,(0===e?"\\":"")+t))}return i}(e,u):e).flat(),flags:r}}function or(e,t,n,r){const[s,i]=n;if("["===n||"[^"===n){const e=function(e,t,n){const r=[mr("^"===t[1],t)];let s,i=1;for(sr.lastIndex=n;s=sr.exec(e);){const e=s[0];if("["===e[0]&&":"!==e[1])i++,r.push(mr("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===r.at(-1).type)r.push(hr(93,e));else if(i--,r.push(dr(e)),!i)break}else{const t=ar(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:sr.lastIndex||e.length}}(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===s){if("AbBGyYzZ".includes(i))return{token:ur(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:br(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:pr(n)}}if("K"===i)return{token:fr("keep",n)};if("N"===i||"R"===i)return{token:gr("newline",n,{negate:"N"===i})};if("O"===i)return{token:gr("any",n)};if("X"===i)return{token:gr("text_segment",n)};const e=lr(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if("("===s){if("*"===i)return{token:Sr(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:_r(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===n&&!e.captureGroup||"(?:"===n)return{token:kr("group",n)};if("(?>"===n)return{token:kr("atomic",n)};if("(?="===n||"(?!"===n||"(?<="===n||"(?<!"===n)return{token:kr("<"===n[2]?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if("("===n&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:kr("capturing",n,{..."("!==n&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if("(?~|"===n)throw new Error(`Unsupported absence function kind "${n}"`);return{token:kr("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:yr(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:gr("dot",n)};if("^"===n||"$"===n){return{token:ur(e.singleline?{"^":Zn`\A`,$:Zn`\Z`}[n]:n,n)}}return"|"===n?{token:cr(n)}:nr.test(n)?{tokens:Nr(n)}:{token:hr(Yn(n),n)}}function ar(e){if("\\"===e[0])return lr(e,{inCharClass:!0});if("["===e[0]){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Qn.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return gr("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):hr(Yn(e),e)}function lr(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 hr(Yn(t.toUpperCase())-64,e)}(e);if("dDhHsSwW".includes(n))return function(e){const t=e[1].toLowerCase();return gr({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}(e);if(e.startsWith(Zn`\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 gr("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 hr(Yn(e),t)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===n||"x"===n)return hr(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(Cr.has(n))return hr(Cr.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(Zn`Incomplete escape "\"`);if("M"===n)throw new Error(`Unsupported meta "${e}"`);if(2===[...e].length)return hr(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function cr(e){return{type:"Alternator",raw:e}}function ur(e,t){return{type:"Assertion",kind:e,raw:t}}function pr(e){return{type:"Backreference",raw:e}}function hr(e,t){return{type:"Character",value:e,raw:t}}function dr(e){return{type:"CharacterClassClose",raw:e}}function mr(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function gr(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function fr(e,t,n={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:Jn(n.flags),raw:t}}function yr(e){return{type:"GroupClose",raw:e}}function kr(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function br(e){return{type:"Subroutine",raw:e}}const wr=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),Cr=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function _r(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=xr(n),o=xr(r),a={};if(i&&(a.enable=i),o&&(a.disable=o),e.endsWith(")"))return t.replaceCurrentModX(s),fr("flags",e,{flags:a});if(e.endsWith(":"))return t.pushModX(s),t.numOpenGroups++,kr("group",e,{...(i||o)&&{flags:a}});throw new Error(`Unexpected flag modifier "${e}"`)}function Sr(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=wr.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 vr(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 xr(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 Nr(e){const t=[],n=new RegExp(nr,"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(vr(e.slice(0,-1)));continue}}}t.push(vr(e))}return t}function Ar(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 Er=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function jr(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=ir(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 $r();case"Assertion":return Lr(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,Rr(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 Rr(r)}return s(+r)}(n,i);case"Character":return Or(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 Or(Yn("-"))}(0,i,t);case"CharacterClassOpen":return function({negate:e},t,n){const{tokens:r,walk:s}=t,i=r[t.nextIndex],o=[Dr()];let a=Qr(i);for(;"CharacterClassClose"!==a.type;){if("CharacterClassIntersector"===a.type)o.push(Dr()),t.nextIndex++;else{const e=o.at(-1);e.body.push(s(e,n))}a=Qr(r[t.nextIndex],i)}const l=Dr({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 Ir(n,i);case"Directive":return Gr(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:qr(t?.body)}}("repeater");case"atomic":return Fr({atomic:!0});case"capturing":return Mr(s,{name:n});case"group":return Fr({flags:e});case"lookahead":case"lookbehind":return Ur({behind:"lookbehind"===t,negate:r});default:throw new Error(`Unexpected group kind "${t}"`)}}(e),c="AbsenceFunction"===l.type,u=Xr(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=Zr(r[t.nextIndex]);for(;"GroupClose"!==h.type;){if("Alternator"===h.type)l.body.push($r()),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(Kr(t)||"CapturingGroup"===t.type)throw new Error(e)}else if(Kr(t)||Xr(t)&&t.negate)throw new Error(e)}}h=Zr(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 Tr(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=zr(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:qr(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(Zn`Subroutine uses a group name that's not defined "\g<${e}>"`);if(u.get(e).length>1)throw new Error(Zn`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}return o}function Lr({kind:e}){return Pr(Jn({"^":"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===Zn`\B`||e===Zn`\Y`})}function Ir({kind:e,negate:t,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:i,unicodePropertyMap:o}=r;if("property"===e){const r=Yr(n);if(!Qn.has(r)||o?.has(r))return Hr(n,{negate:t,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:i,unicodePropertyMap:o});e="posix",n=r}return"posix"===e?function(e,t){const n=!!t?.negate;if(!Qn.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}(n,{negate:t}):Br(e,{negate:t})}function Tr({kind:e,min:t,max:n},r){const s=r.parent,i=s.body.at(-1);if(!i||!function(e){return Er.has(e.type)}(i))throw new Error("Quantifier requires a repeatable token");const o=Wr(e,t,n,i);return s.body.pop(),o}function $r(e){return{type:"Alternative",body:Vr(e?.body)}}function Pr(e,t){const n={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(n.negate=!!t?.negate),n}function Rr(e,t){const n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function Mr(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:qr(t?.body)}}function Or(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 Dr(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:Vr(e?.body)}}function Br(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 Gr(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:Jn(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function Fr(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:qr(e?.body)}}function Ur(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:qr(e?.body)}}function Wr(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 zr(e){return{type:"Subroutine",ref:e}}function Hr(e,t){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let r=n.unicodePropertyMap?.get(Yr(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(Zn`Invalid Unicode property "\p{${e}}"`);return{type:"CharacterSet",kind:"property",value:r??e,negate:n.negate}}function qr(e){if(void 0===e)e=[$r()];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 Vr(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 Kr(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function Xr(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function Yr(e){return e.replace(/[- _]+/g,"").toLowerCase()}function Qr(e,t){return Jn(e,("Character"===t?.type&&93===t.value?"Empty":"Unclosed")+" character class")}function Zr(e){return Jn(e,"Unclosed group")}function Jr(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(){es(l).splice(Math.max(0,ts(a)+c),1),c--,u=!0},removeAllNextSiblings:()=>es(l).splice(ts(a)+1),removeAllPrevSiblings(){const e=ts(a)+c;return c-=e,es(l).splice(0,Math.max(0,e))},replaceWith(e,t={}){const n=!!t.traverse;l?l[Math.max(0,ts(a)+c)]=e:Jn(o,"Can't replace root node")[a]=e,n&&s(e,o,a,l),u=!0},replaceWithMultiple(e,t={}){const n=!!t.traverse;if(es(l).splice(Math.max(0,ts(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,ts(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 es(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function ts(e){if("number"!=typeof e)throw new Error("Numeric key expected");return e}const ns=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function rs(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function ss(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}const is=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function os(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===is.DEFAULT!=!o?("["===e[0]?(o++,i.push("^"===e[1])):"]"===e&&o&&(o--,i.pop()),a+=e):a+=n instanceof Function?n(t,{context:o?is.CHAR_CLASS:is.DEFAULT,negated:i[i.length-1]}):n}return a}function as(e,t,n,r){os(e,t,n,r)}function ls(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===is.DEFAULT!=!o))return i;"["===e?o++:"]"===e&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}(e,t,0,n)}function cs(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 us=new RegExp(String.raw`(?<noncapturingStart>${ns})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");const ps=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,hs=new RegExp(String.raw`
|
|
41
41
|
\\(?: \d+
|
|
42
42
|
| c[A-Za-z]
|
|
43
43
|
| [gk]<[^>]+>
|
|
@@ -50,6 +50,6 @@
|
|
|
50
50
|
| [A-Za-z\-]+:
|
|
51
51
|
| \(DEFINE\)
|
|
52
52
|
))?
|
|
53
|
-
| (?<qBase>${
|
|
53
|
+
| (?<qBase>${ps})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
54
54
|
| \\?.
|
|
55
|
-
`.replace(/\s+/g,""),"gsu");const us=String.raw,ps=us`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,hs=us`\(\?R=(?<rDepth>[^\)]+)\)|${ps}`,ds=us`\(\?<(?![=!])(?<captureName>[^>]+)>`,ms=us`${ds}|(?<unnamed>\()(?!\?)`,gs=new RegExp(us`${ds}|${hs}|\(\?|\\?.`,"gsu"),fs="Cannot use multiple overlapping recursions";function ys(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 ks(e,t,n,r,s,i,o){const a=new Set;r&&ss(e+t,ds,(({groups:{captureName:e}})=>{a.add(e)}),ns.DEFAULT);const l=[n,r?a:null,s,i,o];return`${e}${bs(`(?:${e}`,"forward",...l)}(?:)${bs(`${t})`,"backward",...l)}${t}`}function bs(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+=rs(e,us`${ms}|\\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),ws(s,n),a?e:`(?<${t}${c}>`}return us`\k<${l}${c}>`}),ns.DEFAULT)}return l}function ws(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Cs(e,t,n,r,s,i){if(e.size&&r){let o=0;ss(t,ms,(()=>o++),ns.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 _s=String.fromCodePoint,Ss=String.raw,vs={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("","v")}catch{return!1}return!0})()};function xs(e,{enable:t,disable:n}){return{dotAll:!(n?.dotAll||!t?.dotAll&&!e.dotAll),ignoreCase:!(n?.ignoreCase||!t?.ignoreCase&&!e.ignoreCase)}}function Ns(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function As(e,t){return Es[e]>=Es[t]}vs.bugFlagVLiteralHyphenIsRange=!!vs.unicodeSets&&(()=>{try{new RegExp(Ss`[\d\-a]`,"v")}catch{return!0}return!1})(),vs.bugNestedClassIgnoresNegation=vs.unicodeSets&&new RegExp("[[^a]]","v").test("a");var Es={ES2025:2025,ES2024:2024,ES2018:2018},js={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Ls(e={}){if("[object Object]"!=={}.toString.call(e))throw new Error("Unexpected options");if(void 0!==e.target&&!js[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=vs.flagGroups?"ES2025":vs.unicodeSets?"ES2024":"ES2018"),t}var Is=new Set([_s(304),_s(305)]),Ts=Ss`[\p{L}\p{M}\p{N}\p{Pc}]`;function $s(e){if(Is.has(e))return[e];const t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),s=Os.get(n),i=Rs.get(n),o=Ms.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 Ps=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=>[Kr(e),e]))),Rs=new Map([["s",_s(383)],[_s(383),"s"]]),Ms=new Map([[_s(223),_s(7838)],[_s(107),_s(8490)],[_s(229),_s(8491)],[_s(969),_s(8486)]]),Os=new Map([Bs(453),Bs(456),Bs(459),Bs(498),...Gs(8072,8079),...Gs(8088,8095),...Gs(8104,8111),Bs(8124),Bs(8140),Bs(8188)]),Ds=new Map([["alnum",Ss`[\p{Alpha}\p{Nd}]`],["alpha",Ss`\p{Alpha}`],["ascii",Ss`\p{ASCII}`],["blank",Ss`[\p{Zs}\t]`],["cntrl",Ss`\p{Cc}`],["digit",Ss`\p{Nd}`],["graph",Ss`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",Ss`\p{Lower}`],["print",Ss`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",Ss`[\p{P}\p{S}]`],["space",Ss`\p{space}`],["upper",Ss`\p{Upper}`],["word",Ss`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",Ss`\p{AHex}`]]);function Bs(e){const t=_s(e);return[t.toLowerCase(),t]}function Gs(e,t){return function(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}(e,t).map((e=>Bs(e)))}var Fs=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);var Us={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:s}=e;if("repeater"!==s)throw new Error('Unsupported absence function "(?~|"');{const e=Br();e.body[0].body.push(Gr({negate:!0,body:r}),Wr("Any"));const s=Br();s.body[0].body.push(Fr("greedy",0,1/0,e)),n(si(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++){Ns(r,t.body[e],[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=Xs(t.get(e));if(n){const t=Br({flags:n});t.body[0].body=e.body,e.body=[si(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(si(Gr({body:[Ir({body:[Tr("string_end")]}),Ir({body:[Rr(10)]})]}),t));else if("line_start"===l)o(si(ti(Ss`(?<=\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(si(Gr({negate:!0}),t));else{if(p)throw new Error(Ss`Uses "\G" in a way that requires a subclass`);o(ri(Tr("string_start"),t)),a.strategy="clip_search"}}else if("string_end"===l||"string_start"===l);else if("string_end_newline"===l)o(si(ti(Ss`(?=\n?\z)`),t));else{if("word_boundary"!==l)throw new Error(`Unexpected assertion kind "${l}"`);if(!d&&!u){o(si(ti(c?`(?:(?<=${Ts})(?=${Ts})|(?<!${Ts})(?!${Ts}))`:`(?:(?<=${Ts})(?!${Ts})|(?<!${Ts})(?=${Ts}))`),t))}}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||ei(n)||(n=Ks(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!ei(r)&&(r=Ks(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(si(Mr({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(ri(Wr("Any"),t));else if("digit"===l)n(ri(Wr("Nd",{negate:c}),t));else if("dot"===l);else if("text_segment"===l){if("strict"===r)throw new Error(Ss`Use of "\X" requires non-strict accuracy`);const e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",i=Ss`\p{RI}{2}|${e}(?:\u200D${e})*`;n(si(ti(Ss`(?>\r\n|${s?Ss`\p{RGI_Emoji}`:i}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===l)n(ri(Wr("AHex",{negate:c}),t));else if("newline"===l)n(si(ti(c?"[^\n]":"(?>\r\n?|[\n\v\f
\u2028\u2029])"),t));else if("posix"===l)if(s||"graph"!==u&&"print"!==u)n(si(ni(ti(Ds.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-${_s(e.codePointAt(0)-1)}${_s(e.codePointAt(2)+1)}-`),n(si(ti(`[${e}]`),t))}else if("property"===l)Ps.has(Kr(u))||(e.key="sc");else if("space"===l)n(ri(Wr("space",{negate:c}),t));else{if("word"!==l)throw new Error(`Unexpected character set kind "${l}"`);n(si(ni(ti(Ts),c),t))}else n(ri(Or("word",{negate:c}),t));else n(si(ni(ti("[\t-\r ]"),c),t));else n(ri(Or("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=Br({flags:l});e.body[0].body=o(),s(si(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&&xr(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw new Error(Ss`Uses "\K" in a way that's unsupported`);const o=Gr({behind:!0});o.body[0].body=i(),s(si(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(si(Gr({negate:!0}),t))},Quantifier({node:e}){if("Quantifier"===e.body.type){const t=Br();t.body[0].body.push(e.body),e.body=si(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=Zs(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(Ss`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||ei(n)||(n=Ks(n,t),e.ref=n)}},Ws={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=ri(Vs(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&&Ns(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=Ns(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=xs(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?Vs(0):qs(o,r.groupOriginByCopy,null);let c=l;if(!a){const e=Xs(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?xs(r.globalFlags,e):r.globalFlags;(function(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase})(t,r.currentFlags)||(c=Br({flags:Ys(t)}),c.body[0].body.push(l))}n(si(c,t),{traverse:!a})}},zs={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=Qs(n.parent);for(const r of t){if(r===n)break;if(r===e||Js(r,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}(t,e)));if(s.length)if(s.length>1){n(si(Br({atomic:!0,body:s.reverse().map((e=>Ir({body:[$r(e.number)]})))}),t))}else e.ref=s[0].number;else n(si(Gr({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=Pr();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Hs(e){Qr(e,{"*"({node:e,parent:t}){e.parent=t}})}function qs(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]=qs(o,t,s,n):("type"===i&&"CapturingGroup"===o&&t.set(s,t.get(e)??e),s[i]=o);return s}function Vs(e){const t=Ur(e);return t.isRecursive=!0,t}function Ks(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 Xs(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 Ys({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 Qs(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Zs(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&&xr(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=Zs(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Js(e,t){const n=Qs(e)??[];for(const e of n)if(e===t||Js(e,t))return!0;return!1}function ei(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function ti(e,t){const n=Ar(e,{...t,unicodePropertyMap:Ps}).body;return n.length>1||n[0].body.length>1?Br({body:n}):n[0].body[0]}function ni(e,t){return e.negate=t,e}function ri(e,t){return e.parent=t,e}function si(e,t){return Hs(e),e.parent=t,e}function ii(e,t){const n=Ls(t),r=As(n.target,"ES2024"),s=As(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];Qr(e,oi,{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}(ai[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&&Ns(h._captureTransfers,e.transferTo,[]).push(t)})),h}var oi={"*":{enter({node:e},t){if(fi(e)){const n=t.getCurrentModI();t.pushModI(e.flags?xs({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){fi(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){di(_s(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),mi(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&Fs.has(e.value)&&t.setHasCasedChar()}},ai={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?Ss`\B`:Ss`\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=_s(e),r=gi(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&di(n)){const e=$s(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");vs.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(yi)&&(o=[Rr(45),...o.filter((e=>!yi(e)))]);const a=()=>`[${s?"^":""}${o.map(n).join("intersection"===r?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||vs.bugNestedClassIgnoresNegation)&&!s){const t=o.filter((e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate));if(t.length){const r=Br(),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=Ir({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&&(!vs.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=gi(n,s),o=gi(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}(mi(e));t.forEach((e=>{a.add(Array.isArray(e)?`${gi(e[0],s)}-${gi(e[1],s)}`:gi(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?".":"[^]":Ss`[^\n]`;if("digit"===e)return t?Ss`\D`:Ss`\d`;if("property"===e){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&Fs.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?Ss`\P`:Ss`\p`}{${r?`${r}=`:""}${n}}`}if("word"===e)return t?Ss`\W`:Ss`\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=xs(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})`:Ss`\g<${t}&R=${r}>`}},li=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),ci=new Set(["-","\\","]","^","["]),ui=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),pi=new Map([[9,Ss`\t`],[10,Ss`\n`],[11,Ss`\v`],[12,Ss`\f`],[13,Ss`\r`],[8232,Ss`\u2028`],[8233,Ss`\u2029`],[65279,Ss`\uFEFF`]]),hi=/^\p{Cased}$/u;function di(e){return hi.test(e)}function mi(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=_s(e);if(!di(t))continue;const o=$s(t).filter((e=>{const t=e.codePointAt(0);return t<r||t>s}));if(o.length&&(i.push(...o),n))break}return i}function gi(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(pi.has(e))return pi.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?ui:ci:li,o=_s(e);return(i.has(o)?"\\":"")+o}function fi({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function yi({type:e,value:t}){return"Character"===e&&45===t}var ki=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)Ns(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=bi(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 bi(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 wi(e,t){const n=function(e,t){const n=Ls(t),r=Ar(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Ps}),s=function(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};Hs(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:As(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};Qr(e,Us,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 Qr(e,Ws,i),Qr(e,zs,{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=ii(s,n),o=function(e,t){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...t};let s=t?.captureTransfers??new Map;if(!new RegExp(hs,"su").test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:n};if("plugin"===r&&is(e,us`\(\?\(DEFINE\)`,ns.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const i=[],o=is(e,us`\\[1-9]`,ns.DEFAULT),a=new Map,l=[];let c,u=!1,p=0,h=0;for(gs.lastIndex=0;c=gs.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(ys(m),u)throw new Error(fs);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(gs.lastIndex);if(is(a,hs,ns.DEFAULT))throw new Error(fs);const l=+m-1;e=ks(t,a,l,!1,n,i,h),s=Cs(s,t,l,i.length,0,h);break}if(g){ys(f);let p=!1;for(const e of l)if(e.name===g||e.num===+g){if(p=!0,e.hasRecursedWithin)throw new Error(fs);break}if(!p)throw new Error(us`Recursive \g cannot be used outside the referenced group "${"external"===r?g:us`\g<${g}&R=${f}>`}"`);const d=a.get(g),m=os(e,d);if(o&&is(m,us`${ds}|\((?!\?)`,ns.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=ks(y,k,w,!0,n,i,h);s=Cs(s,y,w,i.length-b,b,h);const _=e.slice(0,d),S=e.slice(d+m.length);e=`${_}${C}${S}`,gs.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),gs.lastIndex),a.set(d,gs.lastIndex),l.push({num:h,name:d});else if("("===t[0]){const e="("===t;e&&(h++,a.set(String(h),gs.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(as.lastIndex=Number.isNaN(u)?0:u+7;t=as.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),ts(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=rs(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}`}),ns.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}(function(e){if(!new RegExp(`${ls}\\+`).test(e))return{pattern:e};const t=[];let n,r=null,s=null,i="",o=0;for(cs.lastIndex=0;n=cs.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}cs.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 ki(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}const Ci=4294967295;class _i{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:Ci,end:Ci,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 Si=[{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")}],vi=(Object.fromEntries(Si.map((e=>[e.id,e.import]))),Object.fromEntries(Si.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(vi.map((e=>[e.id,e.import])));const xi=function(e){const t=Vn(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return mn(e[1]);const[t,n,r={}]=e,{lang:i="text",theme:o=t.getLoadedThemes()[0]}=r;if(tn(i)||rn(o))throw new s("Plain language does not have grammar state");if("ansi"===i)throw new s("ANSI language does not have grammar state");const{theme:a,colorMap:l}=t.setTheme(o),c=t.getLanguage(i);return new gn(jn(n,c,a,l,r).stateStack,c.name,a.name)}(t,...e),codeToTokensBase:(e,n)=>En(t,e,n),codeToTokensWithThemes:(e,n)=>Pn(t,e,n),codeToTokens:(e,n)=>Rn(t,e,n),codeToHast:(e,n)=>On(t,e,n),codeToHtml:(e,n)=>function(e,t,n){const r={meta:{},options:n,codeToHast:(t,n)=>On(e,t,n),codeToTokens:(t,n)=>Rn(e,t,n)};let s=Dn(On(e,t,n,r));for(const e of bn(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 wi(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 _i(e,t),createString:e=>({content:e})}}(),langs:[],themes:[]});function Ni(e){const t=/^diff-([\w-]+)/i.exec(e);return t?t[1]:null}function Ai(e){const t=Ni(e)||e;return!!nn(t)||xi.getLoadedLanguages().includes(t)}function Ei(t,r,s){const i=Ni(t),o=i||t;if(!Ai(o)){const i=Si.find((e=>e.id===o||e.aliases&&e.aliases.includes(o)));if(i)return xi.loadLanguage(i.import()).then((()=>{r&&s&&r.update((()=>{const r=n.$getNodeByKey(s);e.$isCodeNode(r)&&r.getLanguage()===t&&!r.getIsSyntaxHighlightSupported()&&r.setIsSyntaxHighlightSupported(!0)}))}))}}function ji(e){const t=e;return!!sn(t)||xi.getLoadedThemes().includes(t)}function Li(t,r,s){if(!ji(t)){const i=vi.find((e=>e.id===t));if(i)return xi.loadTheme(i.import()).then((()=>{r&&s&&r.update((()=>{const t=n.$getNodeByKey(s);e.$isCodeNode(t)&&t.markDirty()}))}))}}function Ii(t,r){const s=[];return t.forEach(((t,i)=>{i&&s.push(n.$createLineBreakNode()),t.forEach(((t,i)=>{let o=t.content;if(r&&0===i&&o.length>0){const t=["+","-",">","<"," "],n=["inserted","deleted","inserted","deleted","unchanged"],r=t.indexOf(o[0]);-1!==r&&(s.push(e.$createCodeHighlightNode(t[r],n[r])),o=o.slice(1))}o.split("\t").forEach(((r,i)=>{if(i&&s.push(n.$createTabNode()),""!==r){const n=e.$createCodeHighlightNode(r),i=pn(t.htmlStyle||un(t));n.setStyle(i),s.push(n)}}))}))})),s}const Ti={$tokenize(e,t){return function(e,t){const n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent(),s=xi.codeToTokens(r,{lang:n?n[1]:t,theme:e.getTheme()||"poimandres"}),{tokens:i,bg:o,fg:a}=s;let l="";return o&&(l+=`background-color: ${o};`),a&&(l+=`color: ${a};`),e.getStyle()!==l&&e.setStyle(l),Ii(i,!!n)}(e,t||this.defaultLanguage)},defaultLanguage:e.DEFAULT_CODE_LANGUAGE,defaultTheme:"one-light"};function $i(t,r,s){const i=t.getParent();e.$isCodeNode(i)?Mi(i,r,s):e.$isCodeHighlightNode(t)&&t.replace(n.$createTextNode(t.__text))}function Pi(e,t){const r=t.getElementByKey(e.getKey());if(null===r)return;const s=e.getChildren(),i=s.length;if(i===r.__cachedChildrenLength)return;r.__cachedChildrenLength=i;let o="1",a=1;for(let e=0;e<i;e++)n.$isLineBreakNode(s[e])&&(o+="\n"+ ++a);r.setAttribute("data-gutter",o)}const Ri=new Set;function Mi(t,r,s){const i=t.getKey();let o=t.getLanguage();o||(o=s.defaultLanguage,t.setLanguage(o));let a=t.getTheme();a||(a=s.defaultTheme,t.setTheme(a));let l=!1;ji(a)||(Li(a,r,i),l=!0),Ai(o)?t.getIsSyntaxHighlightSupported()||t.setIsSyntaxHighlightSupported(!0):(t.getIsSyntaxHighlightSupported()&&t.setIsSyntaxHighlightSupported(!1),Ei(o,r,i),l=!0),l||Ri.has(i)||(Ri.add(i),r.update((()=>{!function(t,r){const s=n.$getNodeByKey(t);if(!e.$isCodeNode(s)||!s.isAttached())return;const i=n.$getSelection();if(!n.$isRangeSelection(i))return void r();const o=i.anchor,a=o.offset,l="element"===o.type&&n.$isLineBreakNode(s.getChildAtIndex(o.offset-1));let c=0;if(!l){const e=o.getNode();c=a+e.getPreviousSiblings().reduce(((e,t)=>e+t.getTextContentSize()),0)}if(!r())return;if(l)return void o.getNode().select(a,a);s.getChildren().some((e=>{const t=n.$isTextNode(e);if(t||n.$isLineBreakNode(e)){const n=e.getTextContentSize();if(t&&n>=c)return e.select(c,c),!0;c-=n}return!1}))}(i,(()=>{const r=n.$getNodeByKey(i);if(!e.$isCodeNode(r)||!r.isAttached())return!1;const o=r.getLanguage()||s.defaultLanguage,a=s.$tokenize(r,o),l=function(e,t){let n=0;for(;n<e.length&&Oi(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++,!Oi(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}}(r.getChildren(),a),{from:c,to:u,nodesForReplacement:p}=l;return!(c===u&&!p.length)&&(t.splice(c,u-c,p),!0)}))}),{onUpdate:()=>{Ri.delete(i)},skipTransforms:!0}))}function Oi(t,r){return e.$isCodeHighlightNode(t)&&e.$isCodeHighlightNode(r)&&t.__text===r.__text&&t.__highlightType===r.__highlightType&&t.__style===r.__style||n.$isTabNode(t)&&n.$isTabNode(r)||n.$isLineBreakNode(t)&&n.$isLineBreakNode(r)}function Di(t){if(!n.$isRangeSelection(t))return!1;const r=t.anchor.getNode(),s=e.$isCodeNode(r)?r:r.getParent(),i=t.focus.getNode(),o=e.$isCodeNode(i)?i:i.getParent();return e.$isCodeNode(s)&&s.is(o)}function Bi(t){const s=t.getNodes(),i=[];if(1===s.length&&e.$isCodeNode(s[0]))return i;let o=[];for(let t=0;t<s.length;t++){const a=s[t];e.$isCodeHighlightNode(a)||n.$isTabNode(a)||n.$isLineBreakNode(a)||r(169),n.$isLineBreakNode(a)?o.length>0&&(i.push(o),o=[]):o.push(a)}if(o.length>0){const e=t.isBackward()?t.anchor:t.focus,r=n.$createPoint(o[0].getKey(),0,"text");e.is(r)||i.push(o)}return i}function Gi(t){const r=n.$getSelection();if(!n.$isRangeSelection(r)||!Di(r))return!1;const s=Bi(r),i=s.length;if(0===i&&r.isCollapsed())return t===n.INDENT_CONTENT_COMMAND&&r.insertNodes([n.$createTabNode()]),!0;if(0===i&&t===n.INDENT_CONTENT_COMMAND&&"\n"===r.getTextContent()){const e=n.$createTabNode(),t=n.$createLineBreakNode(),s=r.isBackward()?"previous":"next";return r.insertNodes([e,t]),n.$setSelectionFromCaretRange(n.$getCaretRangeInDirection(n.$getCaretRange(n.$getTextPointCaret(e,"next",0),n.$normalizeCaret(n.$getSiblingCaret(t,"next"))),s)),!0}for(let o=0;o<i;o++){const i=s[o];if(i.length>0){let s=i[0];if(0===o&&(s=e.$getFirstCodeNodeOfLine(s)),t===n.INDENT_CONTENT_COMMAND){const e=n.$createTabNode();if(s.insertBefore(e),0===o){const t=r.isBackward()?"focus":"anchor",i=n.$createPoint(s.getKey(),0,"text");r[t].is(i)&&r[t].set(e.getKey(),0,"text")}}else n.$isTabNode(s)&&s.remove()}}return!0}function Fi(t,r){const s=n.$getSelection();if(!n.$isRangeSelection(s))return!1;const{anchor:i,focus:o}=s,a=i.offset,l=o.offset,c=i.getNode(),u=o.getNode(),p=t===n.KEY_ARROW_UP_COMMAND;if(!Di(s)||!e.$isCodeHighlightNode(c)&&!n.$isTabNode(c)||!e.$isCodeHighlightNode(u)&&!n.$isTabNode(u))return!1;if(!r.altKey){if(s.isCollapsed()){const e=c.getParentOrThrow();if(p&&0===a&&null===c.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),r.preventDefault(),!0}else if(!p&&a===c.getTextContentSize()&&null===c.getNextSibling()){if(null===e.getNextSibling())return e.selectNext(),r.preventDefault(),!0}}return!1}let h,d;if(c.isBefore(u)?(h=e.$getFirstCodeNodeOfLine(c),d=e.$getLastCodeNodeOfLine(u)):(h=e.$getFirstCodeNodeOfLine(u),d=e.$getLastCodeNodeOfLine(c)),null==h||null==d)return!1;const m=h.getNodesBetween(d);for(let t=0;t<m.length;t++){const r=m[t];if(!e.$isCodeHighlightNode(r)&&!n.$isTabNode(r)&&!n.$isLineBreakNode(r))return!1}r.preventDefault(),r.stopPropagation();const g=p?h.getPreviousSibling():d.getNextSibling();if(!n.$isLineBreakNode(g))return!0;const f=p?g.getPreviousSibling():g.getNextSibling();if(null==f)return!0;const y=e.$isCodeHighlightNode(f)||n.$isTabNode(f)||n.$isLineBreakNode(f)?p?e.$getFirstCodeNodeOfLine(f):e.$getLastCodeNodeOfLine(f):null;let k=null!=y?y:f;return g.remove(),m.forEach((e=>e.remove())),t===n.KEY_ARROW_UP_COMMAND?(m.forEach((e=>k.insertBefore(e))),k.insertBefore(g)):(k.insertAfter(g),k=g,m.forEach((e=>{k.insertAfter(e),k=e}))),s.setTextNodeRange(c,a,u,l),!0}function Ui(t,r){const s=n.$getSelection();if(!n.$isRangeSelection(s))return!1;const{anchor:i,focus:o}=s,a=i.getNode(),l=o.getNode(),c=t===n.MOVE_TO_START;if(!Di(s)||!e.$isCodeHighlightNode(a)&&!n.$isTabNode(a)||!e.$isCodeHighlightNode(l)&&!n.$isTabNode(l))return!1;if(c){const t=e.$getStartOfCodeInLine(l,o.offset);if(null!==t){const{node:e,offset:r}=t;n.$isLineBreakNode(e)?e.selectNext(0,0):s.setTextNodeRange(e,r,e,r)}else l.getParentOrThrow().selectStart()}else{e.$getEndOfCodeInLine(l).select()}return r.preventDefault(),r.stopPropagation(),!0}function Wi(s,i){if(!s.hasNodes([e.CodeNode,e.CodeHighlightNode]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==i&&(i=Ti);const o=[];return!0!==s._headless&&o.push(s.registerMutationListener(e.CodeNode,(e=>{s.update((()=>{for(const[t,r]of e)if("destroyed"!==r){const e=n.$getNodeByKey(t);null!==e&&Pi(e,s)}}))}),{skipInitialization:!1})),o.push(s.registerNodeTransform(e.CodeNode,(e=>Mi(e,s,i))),s.registerNodeTransform(n.TextNode,(e=>$i(e,s,i))),s.registerNodeTransform(e.CodeHighlightNode,(e=>$i(e,s,i))),s.registerCommand(n.KEY_TAB_COMMAND,(t=>{const i=function(t){const s=n.$getSelection();if(!n.$isRangeSelection(s)||!Di(s))return null;const i=t?n.OUTDENT_CONTENT_COMMAND:n.INDENT_CONTENT_COMMAND,o=t?n.OUTDENT_CONTENT_COMMAND:n.INSERT_TAB_COMMAND,a=s.anchor,l=s.focus;if(a.is(l))return o;const c=Bi(s);if(1!==c.length)return i;const u=c[0];let p,h;0===u.length&&r(285),s.isBackward()?(p=l,h=a):(p=a,h=l);const d=e.$getFirstCodeNodeOfLine(u[0]),m=e.$getLastCodeNodeOfLine(u[0]),g=n.$createPoint(d.getKey(),0,"text"),f=n.$createPoint(m.getKey(),m.getTextContentSize(),"text");return p.isBefore(g)||f.isBefore(h)?i:g.isBefore(p)||h.isBefore(f)?o:i}(t.shiftKey);return null!==i&&(t.preventDefault(),s.dispatchCommand(i,void 0),!0)}),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.INSERT_TAB_COMMAND,(()=>!!Di(n.$getSelection())&&(n.$insertNodes([n.$createTabNode()]),!0)),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.INDENT_CONTENT_COMMAND,(e=>Gi(n.INDENT_CONTENT_COMMAND)),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.OUTDENT_CONTENT_COMMAND,(e=>Gi(n.OUTDENT_CONTENT_COMMAND)),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.KEY_ARROW_UP_COMMAND,(t=>{const r=n.$getSelection();if(!n.$isRangeSelection(r))return!1;const{anchor:s}=r,i=s.getNode();return!!Di(r)&&(r.isCollapsed()&&0===s.offset&&null===i.getPreviousSibling()&&e.$isCodeNode(i.getParentOrThrow())?(t.preventDefault(),!0):Fi(n.KEY_ARROW_UP_COMMAND,t))}),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.KEY_ARROW_DOWN_COMMAND,(t=>{const r=n.$getSelection();if(!n.$isRangeSelection(r))return!1;const{anchor:s}=r,i=s.getNode();return!!Di(r)&&(r.isCollapsed()&&s.offset===i.getTextContentSize()&&null===i.getNextSibling()&&e.$isCodeNode(i.getParentOrThrow())?(t.preventDefault(),!0):Fi(n.KEY_ARROW_DOWN_COMMAND,t))}),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.MOVE_TO_START,(e=>Ui(n.MOVE_TO_START,e)),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.MOVE_TO_END,(e=>Ui(n.MOVE_TO_END,e)),n.COMMAND_PRIORITY_LOW)),t.mergeRegister(...o)}const zi=n.defineExtension({config:{tokenizer:Ti},dependencies:[e.CodeExtension],name:"@lexical/code-shiki",register:(e,{tokenizer:t})=>Wi(e,t)});exports.CodeHighlighterShikiExtension=zi,exports.ShikiTokenizer=Ti,exports.getCodeLanguageOptions=function(){return Si.map((e=>[e.id,e.name]))},exports.getCodeThemeOptions=function(){return vi.map((e=>[e.id,e.displayName]))},exports.isCodeLanguageLoaded=Ai,exports.loadCodeLanguage=Ei,exports.loadCodeTheme=Li,exports.normalizeCodeLanguage=function(e){const t=e,n=Si.find((e=>e.id===t||e.aliases&&e.aliases.includes(t)));return n?n.id:e},exports.registerCodeHighlighting=Wi;
|
|
55
|
+
`.replace(/\s+/g,""),"gsu");const ds=String.raw,ms=ds`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,gs=ds`\(\?R=(?<rDepth>[^\)]+)\)|${ms}`,fs=ds`\(\?<(?![=!])(?<captureName>[^>]+)>`,ys=ds`${fs}|(?<unnamed>\()(?!\?)`,ks=new RegExp(ds`${fs}|${gs}|\(\?|\\?.`,"gsu"),bs="Cannot use multiple overlapping recursions";function ws(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 Cs(e,t,n,r,s,i,o){const a=new Set;r&&as(e+t,fs,({groups:{captureName:e}})=>{a.add(e)},is.DEFAULT);const l=[n,r?a:null,s,i,o];return`${e}${_s(`(?:${e}`,"forward",...l)}(?:)${_s(`${t})`,"backward",...l)}${t}`}function _s(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+=os(e,ds`${ys}|\\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),Ss(s,n),a?e:`(?<${t}${c}>`}return ds`\k<${l}${c}>`},is.DEFAULT)}return l}function Ss(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function vs(e,t,n,r,s,i){if(e.size&&r){let o=0;as(t,ys,()=>o++,is.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 xs=String.fromCodePoint,Ns=String.raw,As={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("","v")}catch{return!1}return!0})()};function Es(e,{enable:t,disable:n}){return{dotAll:!(n?.dotAll||!t?.dotAll&&!e.dotAll),ignoreCase:!(n?.ignoreCase||!t?.ignoreCase&&!e.ignoreCase)}}function js(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Ls(e,t){return Is[e]>=Is[t]}As.bugFlagVLiteralHyphenIsRange=!!As.unicodeSets&&(()=>{try{new RegExp(Ns`[\d\-a]`,"v")}catch{return!0}return!1})(),As.bugNestedClassIgnoresNegation=As.unicodeSets&&new RegExp("[[^a]]","v").test("a");var Is={ES2025:2025,ES2024:2024,ES2018:2018},Ts={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function $s(e={}){if("[object Object]"!=={}.toString.call(e))throw new Error("Unexpected options");if(void 0!==e.target&&!Ts[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=As.flagGroups?"ES2025":As.unicodeSets?"ES2024":"ES2018"),t}var Ps=new Set([xs(304),xs(305)]),Rs=Ns`[\p{L}\p{M}\p{N}\p{Pc}]`;function Ms(e){if(Ps.has(e))return[e];const t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),s=Gs.get(n),i=Ds.get(n),o=Bs.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 Os=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=>[Yr(e),e])),Ds=new Map([["s",xs(383)],[xs(383),"s"]]),Bs=new Map([[xs(223),xs(7838)],[xs(107),xs(8490)],[xs(229),xs(8491)],[xs(969),xs(8486)]]),Gs=new Map([Us(453),Us(456),Us(459),Us(498),...Ws(8072,8079),...Ws(8088,8095),...Ws(8104,8111),Us(8124),Us(8140),Us(8188)]),Fs=new Map([["alnum",Ns`[\p{Alpha}\p{Nd}]`],["alpha",Ns`\p{Alpha}`],["ascii",Ns`\p{ASCII}`],["blank",Ns`[\p{Zs}\t]`],["cntrl",Ns`\p{Cc}`],["digit",Ns`\p{Nd}`],["graph",Ns`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",Ns`\p{Lower}`],["print",Ns`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",Ns`[\p{P}\p{S}]`],["space",Ns`\p{space}`],["upper",Ns`\p{Upper}`],["word",Ns`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",Ns`\p{AHex}`]]);function Us(e){const t=xs(e);return[t.toLowerCase(),t]}function Ws(e,t){return function(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}(e,t).map(e=>Us(e))}var zs=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);var Hs={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:s}=e;if("repeater"!==s)throw new Error('Unsupported absence function "(?~|"');{const e=Fr();e.body[0].body.push(Ur({negate:!0,body:r}),Hr("Any"));const s=Fr();s.body[0].body.push(Wr("greedy",0,1/0,e)),n(ai(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++){js(r,t.body[e],[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=Zs(t.get(e));if(n){const t=Fr({flags:n});t.body[0].body=e.body,e.body=[ai(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(ai(Ur({body:[$r({body:[Pr("string_end")]}),$r({body:[Or(10)]})]}),t));else if("line_start"===l)o(ai(si(Ns`(?<=\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(ai(Ur({negate:!0}),t));else{if(p)throw new Error(Ns`Uses "\G" in a way that requires a subclass`);o(oi(Pr("string_start"),t)),a.strategy="clip_search"}}else if("string_end"===l||"string_start"===l);else if("string_end_newline"===l)o(ai(si(Ns`(?=\n?\z)`),t));else{if("word_boundary"!==l)throw new Error(`Unexpected assertion kind "${l}"`);if(!d&&!u){o(ai(si(c?`(?:(?<=${Rs})(?=${Rs})|(?<!${Rs})(?!${Rs}))`:`(?:(?<=${Rs})(?!${Rs})|(?<!${Rs})(?=${Rs}))`),t))}}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||ri(n)||(n=Qs(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!ri(r)&&(r=Qs(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(ai(Dr({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(oi(Hr("Any"),t));else if("digit"===l)n(oi(Hr("Nd",{negate:c}),t));else if("dot"===l);else if("text_segment"===l){if("strict"===r)throw new Error(Ns`Use of "\X" requires non-strict accuracy`);const e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",i=Ns`\p{RI}{2}|${e}(?:\u200D${e})*`;n(ai(si(Ns`(?>\r\n|${s?Ns`\p{RGI_Emoji}`:i}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===l)n(oi(Hr("AHex",{negate:c}),t));else if("newline"===l)n(ai(si(c?"[^\n]":"(?>\r\n?|[\n\v\f
\u2028\u2029])"),t));else if("posix"===l)if(s||"graph"!==u&&"print"!==u)n(ai(ii(si(Fs.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-${xs(e.codePointAt(0)-1)}${xs(e.codePointAt(2)+1)}-`),n(ai(si(`[${e}]`),t))}else if("property"===l)Os.has(Yr(u))||(e.key="sc");else if("space"===l)n(oi(Hr("space",{negate:c}),t));else{if("word"!==l)throw new Error(`Unexpected character set kind "${l}"`);n(ai(ii(si(Rs),c),t))}else n(oi(Br("word",{negate:c}),t));else n(ai(ii(si("[\t-\r ]"),c),t));else n(oi(Br("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=Fr({flags:l});e.body[0].body=o(),s(ai(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&&Ar(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw new Error(Ns`Uses "\K" in a way that's unsupported`);const o=Ur({behind:!0});o.body[0].body=i(),s(ai(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(ai(Ur({negate:!0}),t))},Quantifier({node:e}){if("Quantifier"===e.body.type){const t=Fr();t.body[0].body.push(e.body),e.body=ai(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=ti(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(Ns`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||ri(n)||(n=Qs(n,t),e.ref=n)}},qs={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=oi(Ys(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&&js(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=js(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=Es(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?Ys(0):Xs(o,r.groupOriginByCopy,null);let c=l;if(!a){const e=Zs(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?Es(r.globalFlags,e):r.globalFlags;(function(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase})(t,r.currentFlags)||(c=Fr({flags:Js(t)}),c.body[0].body.push(l))}n(ai(c,t),{traverse:!a})}},Vs={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=ei(n.parent);for(const r of t){if(r===n)break;if(r===e||ni(r,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}(t,e));if(s.length)if(s.length>1){n(ai(Fr({atomic:!0,body:s.reverse().map(e=>$r({body:[Rr(e.number)]}))}),t))}else e.ref=s[0].number;else n(ai(Ur({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=Mr();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Ks(e){Jr(e,{"*"({node:e,parent:t}){e.parent=t}})}function Xs(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]=Xs(o,t,s,n):("type"===i&&"CapturingGroup"===o&&t.set(s,t.get(e)??e),s[i]=o);return s}function Ys(e){const t=zr(e);return t.isRecursive=!0,t}function Qs(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 Zs(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 Js({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 ei(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function ti(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&&Ar(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=ti(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function ni(e,t){const n=ei(e)??[];for(const e of n)if(e===t||ni(e,t))return!0;return!1}function ri(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function si(e,t){const n=jr(e,{...t,unicodePropertyMap:Os}).body;return n.length>1||n[0].body.length>1?Fr({body:n}):n[0].body[0]}function ii(e,t){return e.negate=t,e}function oi(e,t){return e.parent=t,e}function ai(e,t){return Ks(e),e.parent=t,e}function li(e,t){const n=$s(t),r=Ls(n.target,"ES2024"),s=Ls(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];Jr(e,ci,{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}(ui[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&&js(h._captureTransfers,e.transferTo,[]).push(t)}),h}var ci={"*":{enter({node:e},t){if(bi(e)){const n=t.getCurrentModI();t.pushModI(e.flags?Es({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){bi(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){fi(xs(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),yi(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&zs.has(e.value)&&t.setHasCasedChar()}},ui={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?Ns`\B`:Ns`\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=xs(e),r=ki(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&fi(n)){const e=Ms(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");As.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(wi)&&(o=[Or(45),...o.filter(e=>!wi(e))]);const a=()=>`[${s?"^":""}${o.map(n).join("intersection"===r?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||As.bugNestedClassIgnoresNegation)&&!s){const t=o.filter(e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate);if(t.length){const r=Fr(),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=$r({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&&(!As.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=ki(n,s),o=ki(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}(yi(e));t.forEach(e=>{a.add(Array.isArray(e)?`${ki(e[0],s)}-${ki(e[1],s)}`:ki(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?".":"[^]":Ns`[^\n]`;if("digit"===e)return t?Ns`\D`:Ns`\d`;if("property"===e){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&zs.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?Ns`\P`:Ns`\p`}{${r?`${r}=`:""}${n}}`}if("word"===e)return t?Ns`\W`:Ns`\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=Es(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})`:Ns`\g<${t}&R=${r}>`}},pi=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),hi=new Set(["-","\\","]","^","["]),di=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),mi=new Map([[9,Ns`\t`],[10,Ns`\n`],[11,Ns`\v`],[12,Ns`\f`],[13,Ns`\r`],[8232,Ns`\u2028`],[8233,Ns`\u2029`],[65279,Ns`\uFEFF`]]),gi=/^\p{Cased}$/u;function fi(e){return gi.test(e)}function yi(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=xs(e);if(!fi(t))continue;const o=Ms(t).filter(e=>{const t=e.codePointAt(0);return t<r||t>s});if(o.length&&(i.push(...o),n))break}return i}function ki(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(mi.has(e))return mi.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?di:hi:pi,o=xs(e);return(i.has(o)?"\\":"")+o}function bi({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function wi({type:e,value:t}){return"Character"===e&&45===t}var Ci=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)js(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=_i(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 _i(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 Si(e,t){const n=function(e,t){const n=$s(t),r=jr(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Os}),s=function(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};Ks(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Ls(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};Jr(e,Hs,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 Jr(e,qs,i),Jr(e,Vs,{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=li(s,n),o=function(e,t){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...t};let s=t?.captureTransfers??new Map;if(!new RegExp(gs,"su").test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:n};if("plugin"===r&&ls(e,ds`\(\?\(DEFINE\)`,is.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const i=[],o=ls(e,ds`\\[1-9]`,is.DEFAULT),a=new Map,l=[];let c,u=!1,p=0,h=0;for(ks.lastIndex=0;c=ks.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(ws(m),u)throw new Error(bs);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(ks.lastIndex);if(ls(a,gs,is.DEFAULT))throw new Error(bs);const l=+m-1;e=Cs(t,a,l,!1,n,i,h),s=vs(s,t,l,i.length,0,h);break}if(g){ws(f);let p=!1;for(const e of l)if(e.name===g||e.num===+g){if(p=!0,e.hasRecursedWithin)throw new Error(bs);break}if(!p)throw new Error(ds`Recursive \g cannot be used outside the referenced group "${"external"===r?g:ds`\g<${g}&R=${f}>`}"`);const d=a.get(g),m=cs(e,d);if(o&&ls(m,ds`${fs}|\((?!\?)`,is.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=Cs(y,k,w,!0,n,i,h);s=vs(s,y,w,i.length-b,b,h);const _=e.slice(0,d),S=e.slice(d+m.length);e=`${_}${C}${S}`,ks.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),ks.lastIndex),a.set(d,ks.lastIndex),l.push({num:h,name:d});else if("("===t[0]){const e="("===t;e&&(h++,a.set(String(h),ks.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(us.lastIndex=Number.isNaN(u)?0:u+7;t=us.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),rs(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=os(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}`},is.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}(function(e){if(!new RegExp(`${ps}\\+`).test(e))return{pattern:e};const t=[];let n,r=null,s=null,i="",o=0;for(hs.lastIndex=0;n=hs.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=ss(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}hs.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 Ci(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}const vi=4294967295;class xi{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:vi,end:vi,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 Ni=[{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")}],Ai=(Object.fromEntries(Ni.map(e=>[e.id,e.import])),Object.fromEntries(Ni.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(Ai.map(e=>[e.id,e.import]));const Ei=function(e){const t=Xn(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return dn(e[1]);const[t,n,r={}]=e,{lang:i="text",theme:o=t.getLoadedThemes()[0]}=r;if(en(i)||nn(o))throw new s("Plain language does not have grammar state");if("ansi"===i)throw new s("ANSI language does not have grammar state");const{theme:a,colorMap:l}=t.setTheme(o),c=t.getLanguage(i);return new mn(En(n,c,a,l,r).stateStack,c.name,a.name)}(t,...e),codeToTokensBase:(e,n)=>An(t,e,n),codeToTokensWithThemes:(e,n)=>Pn(t,e,n),codeToTokens:(e,n)=>Rn(t,e,n),codeToHast:(e,n)=>On(t,e,n),codeToHtml:(e,n)=>function(e,t,n){const r={meta:{},options:n,codeToHast:(t,n)=>On(e,t,n),codeToTokens:(t,n)=>Rn(e,t,n)};let s=Dn(On(e,t,n,r));for(const e of kn(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 Si(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 xi(e,t),createString:e=>({content:e})}}(),langs:[],themes:[]});function ji(e){const t=/^diff-([\w-]+)/i.exec(e);return t?t[1]:null}function Li(e){const t=ji(e)||e;return!!tn(t)||Ei.getLoadedLanguages().includes(t)}function Ii(t,r,s){const i=ji(t),o=i||t;if(!Li(o)){const i=Ni.find(e=>e.id===o||e.aliases&&e.aliases.includes(o));if(i)return Ei.loadLanguage(i.import()).then(()=>{r&&s&&r.update(()=>{const r=n.$getNodeByKey(s);e.$isCodeNode(r)&&r.getLanguage()===t&&!r.getIsSyntaxHighlightSupported()&&r.setIsSyntaxHighlightSupported(!0)})})}}function Ti(e){const t=e;return!!rn(t)||Ei.getLoadedThemes().includes(t)}function $i(t,r,s){if(!Ti(t)){const i=Ai.find(e=>e.id===t);if(i)return Ei.loadTheme(i.import()).then(()=>{r&&s&&r.update(()=>{const t=n.$getNodeByKey(s);e.$isCodeNode(t)&&t.markDirty()})})}}function Pi(t,r){const s=[];return t.forEach((t,i)=>{i&&s.push(n.$createLineBreakNode()),t.forEach((t,i)=>{let o=t.content;if(r&&0===i&&o.length>0){const t=["+","-",">","<"," "],n=["inserted","deleted","inserted","deleted","unchanged"],r=t.indexOf(o[0]);-1!==r&&(s.push(e.$createCodeHighlightNode(t[r],n[r])),o=o.slice(1))}o.split("\t").forEach((r,i)=>{if(i&&s.push(n.$createTabNode()),""!==r){const n=e.$createCodeHighlightNode(r),i=un(t.htmlStyle||cn(t));n.setStyle(i),s.push(n)}})})}),s}const Ri={$tokenize(e,t){return function(e,t){const n=/^diff-([\w-]+)/i.exec(t),r=e.getTextContent(),s=Ei.codeToTokens(r,{lang:n?n[1]:t,theme:e.getTheme()||"poimandres"}),{tokens:i,bg:o,fg:a}=s;let l="";return o&&(l+=`background-color: ${o};`),a&&(l+=`color: ${a};`),e.getStyle()!==l&&e.setStyle(l),Pi(i,!!n)}(e,t||this.defaultLanguage)},defaultLanguage:e.DEFAULT_CODE_LANGUAGE,defaultTheme:"one-light"};function Mi(t,r,s){const i=t.getParent();e.$isCodeNode(i)?Bi(i,r,s):e.$isCodeHighlightNode(t)&&t.replace(n.$createTextNode(t.__text))}function Oi(e,t){const r=t.getElementByKey(e.getKey());if(null===r)return;const s=e.getChildren(),i=s.length;if(i===r.__cachedChildrenLength)return;r.__cachedChildrenLength=i;let o="1",a=1;for(let e=0;e<i;e++)n.$isLineBreakNode(s[e])&&(o+="\n"+ ++a);r.setAttribute("data-gutter",o)}const Di=new Set;function Bi(t,r,s){const i=t.getKey();let o=t.getLanguage();o||(o=s.defaultLanguage,t.setLanguage(o));let a=t.getTheme();a||(a=s.defaultTheme,t.setTheme(a));let l=!1;Ti(a)||($i(a,r,i),l=!0),Li(o)?t.getIsSyntaxHighlightSupported()||t.setIsSyntaxHighlightSupported(!0):(t.getIsSyntaxHighlightSupported()&&t.setIsSyntaxHighlightSupported(!1),Ii(o,r,i),l=!0),l||Di.has(i)||(Di.add(i),r.update(()=>{!function(t,r){const s=n.$getNodeByKey(t);if(!e.$isCodeNode(s)||!s.isAttached())return;const i=n.$getSelection();if(!n.$isRangeSelection(i))return void r();const o=i.anchor,a=o.offset,l="element"===o.type&&n.$isLineBreakNode(s.getChildAtIndex(o.offset-1));let c=0;if(!l){const e=o.getNode();c=a+e.getPreviousSiblings().reduce((e,t)=>e+t.getTextContentSize(),0)}if(!r())return;if(l)return void o.getNode().select(a,a);s.getChildren().some(e=>{const t=n.$isTextNode(e);if(t||n.$isLineBreakNode(e)){const n=e.getTextContentSize();if(t&&n>=c)return e.select(c,c),!0;c-=n}return!1})}(i,()=>{const r=n.$getNodeByKey(i);if(!e.$isCodeNode(r)||!r.isAttached())return!1;const o=r.getLanguage()||s.defaultLanguage,a=s.$tokenize(r,o),l=function(e,t){let n=0;for(;n<e.length&&Gi(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++,!Gi(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}}(r.getChildren(),a),{from:c,to:u,nodesForReplacement:p}=l;return!(c===u&&!p.length)&&(t.splice(c,u-c,p),!0)})},{onUpdate:()=>{Di.delete(i)},skipTransforms:!0}))}function Gi(t,r){return e.$isCodeHighlightNode(t)&&e.$isCodeHighlightNode(r)&&t.__text===r.__text&&t.__highlightType===r.__highlightType&&t.__style===r.__style||n.$isTabNode(t)&&n.$isTabNode(r)||n.$isLineBreakNode(t)&&n.$isLineBreakNode(r)}function Fi(t){if(!n.$isRangeSelection(t))return!1;const r=t.anchor.getNode(),s=e.$isCodeNode(r)?r:r.getParent(),i=t.focus.getNode(),o=e.$isCodeNode(i)?i:i.getParent();return e.$isCodeNode(s)&&s.is(o)}function Ui(t){const s=t.getNodes(),i=[];if(1===s.length&&e.$isCodeNode(s[0]))return i;let o=[];for(let t=0;t<s.length;t++){const a=s[t];e.$isCodeHighlightNode(a)||n.$isTabNode(a)||n.$isLineBreakNode(a)||r(169),n.$isLineBreakNode(a)?o.length>0&&(i.push(o),o=[]):o.push(a)}if(o.length>0){const e=t.isBackward()?t.anchor:t.focus,r=n.$createPoint(o[0].getKey(),0,"text");e.is(r)||i.push(o)}return i}function Wi(t){const r=n.$getSelection();if(!n.$isRangeSelection(r)||!Fi(r))return!1;const s=Ui(r),i=s.length;if(0===i&&r.isCollapsed())return t===n.INDENT_CONTENT_COMMAND&&r.insertNodes([n.$createTabNode()]),!0;if(0===i&&t===n.INDENT_CONTENT_COMMAND&&"\n"===r.getTextContent()){const e=n.$createTabNode(),t=n.$createLineBreakNode(),s=r.isBackward()?"previous":"next";return r.insertNodes([e,t]),n.$setSelectionFromCaretRange(n.$getCaretRangeInDirection(n.$getCaretRange(n.$getTextPointCaret(e,"next",0),n.$normalizeCaret(n.$getSiblingCaret(t,"next"))),s)),!0}for(let o=0;o<i;o++){const i=s[o];if(i.length>0){let s=i[0];if(0===o&&(s=e.$getFirstCodeNodeOfLine(s)),t===n.INDENT_CONTENT_COMMAND){const e=n.$createTabNode();if(s.insertBefore(e),0===o){const t=r.isBackward()?"focus":"anchor",i=n.$createPoint(s.getKey(),0,"text");r[t].is(i)&&r[t].set(e.getKey(),0,"text")}}else n.$isTabNode(s)&&s.remove()}}return!0}function zi(t,r){const s=n.$getSelection();if(!n.$isRangeSelection(s))return!1;const{anchor:i,focus:o}=s,a=i.offset,l=o.offset,c=i.getNode(),u=o.getNode(),p=t===n.KEY_ARROW_UP_COMMAND;if(!Fi(s)||!e.$isCodeHighlightNode(c)&&!n.$isTabNode(c)||!e.$isCodeHighlightNode(u)&&!n.$isTabNode(u))return!1;if(!r.altKey){if(s.isCollapsed()){const e=c.getParentOrThrow();if(p&&0===a&&null===c.getPreviousSibling()){if(null===e.getPreviousSibling())return e.selectPrevious(),r.preventDefault(),!0}else if(!p&&a===c.getTextContentSize()&&null===c.getNextSibling()){if(null===e.getNextSibling())return e.selectNext(),r.preventDefault(),!0}}return!1}let h,d;if(c.isBefore(u)?(h=e.$getFirstCodeNodeOfLine(c),d=e.$getLastCodeNodeOfLine(u)):(h=e.$getFirstCodeNodeOfLine(u),d=e.$getLastCodeNodeOfLine(c)),null==h||null==d)return!1;const m=h.getNodesBetween(d);for(let t=0;t<m.length;t++){const r=m[t];if(!e.$isCodeHighlightNode(r)&&!n.$isTabNode(r)&&!n.$isLineBreakNode(r))return!1}r.preventDefault(),r.stopPropagation();const g=p?h.getPreviousSibling():d.getNextSibling();if(!n.$isLineBreakNode(g))return!0;const f=p?g.getPreviousSibling():g.getNextSibling();if(null==f)return!0;const y=e.$isCodeHighlightNode(f)||n.$isTabNode(f)||n.$isLineBreakNode(f)?p?e.$getFirstCodeNodeOfLine(f):e.$getLastCodeNodeOfLine(f):null;let k=null!=y?y:f;return g.remove(),m.forEach(e=>e.remove()),t===n.KEY_ARROW_UP_COMMAND?(m.forEach(e=>k.insertBefore(e)),k.insertBefore(g)):(k.insertAfter(g),k=g,m.forEach(e=>{k.insertAfter(e),k=e})),s.setTextNodeRange(c,a,u,l),!0}function Hi(t,r){const s=n.$getSelection();if(!n.$isRangeSelection(s))return!1;const{anchor:i,focus:o}=s,a=i.getNode(),l=o.getNode(),c=t===n.MOVE_TO_START;if(!Fi(s)||!e.$isCodeHighlightNode(a)&&!n.$isTabNode(a)||!e.$isCodeHighlightNode(l)&&!n.$isTabNode(l))return!1;if(c){const t=e.$getStartOfCodeInLine(l,o.offset);if(null!==t){const{node:e,offset:r}=t;n.$isLineBreakNode(e)?e.selectNext(0,0):s.setTextNodeRange(e,r,e,r)}else l.getParentOrThrow().selectStart()}else{e.$getEndOfCodeInLine(l).select()}return r.preventDefault(),r.stopPropagation(),!0}function qi(s,i){if(!s.hasNodes([e.CodeNode,e.CodeHighlightNode]))throw new Error("CodeHighlightPlugin: CodeNode or CodeHighlightNode not registered on editor");null==i&&(i=Ri);const o=[];return!0!==s._headless&&o.push(s.registerMutationListener(e.CodeNode,e=>{s.update(()=>{for(const[t,r]of e)if("destroyed"!==r){const e=n.$getNodeByKey(t);null!==e&&Oi(e,s)}})},{skipInitialization:!1})),o.push(s.registerNodeTransform(e.CodeNode,e=>Bi(e,s,i)),s.registerNodeTransform(n.TextNode,e=>Mi(e,s,i)),s.registerNodeTransform(e.CodeHighlightNode,e=>Mi(e,s,i)),s.registerCommand(n.KEY_TAB_COMMAND,t=>{const i=function(t){const s=n.$getSelection();if(!n.$isRangeSelection(s)||!Fi(s))return null;const i=t?n.OUTDENT_CONTENT_COMMAND:n.INDENT_CONTENT_COMMAND,o=t?n.OUTDENT_CONTENT_COMMAND:n.INSERT_TAB_COMMAND,a=s.anchor,l=s.focus;if(a.is(l))return o;const c=Ui(s);if(1!==c.length)return i;const u=c[0];let p,h;0===u.length&&r(285),s.isBackward()?(p=l,h=a):(p=a,h=l);const d=e.$getFirstCodeNodeOfLine(u[0]),m=e.$getLastCodeNodeOfLine(u[0]),g=n.$createPoint(d.getKey(),0,"text"),f=n.$createPoint(m.getKey(),m.getTextContentSize(),"text");return p.isBefore(g)||f.isBefore(h)?i:g.isBefore(p)||h.isBefore(f)?o:i}(t.shiftKey);return null!==i&&(t.preventDefault(),s.dispatchCommand(i,void 0),!0)},n.COMMAND_PRIORITY_LOW),s.registerCommand(n.INSERT_TAB_COMMAND,()=>!!Fi(n.$getSelection())&&(n.$insertNodes([n.$createTabNode()]),!0),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.INDENT_CONTENT_COMMAND,e=>Wi(n.INDENT_CONTENT_COMMAND),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.OUTDENT_CONTENT_COMMAND,e=>Wi(n.OUTDENT_CONTENT_COMMAND),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.KEY_ARROW_UP_COMMAND,t=>{const r=n.$getSelection();if(!n.$isRangeSelection(r))return!1;const{anchor:s}=r,i=s.getNode();return!!Fi(r)&&(r.isCollapsed()&&0===s.offset&&null===i.getPreviousSibling()&&e.$isCodeNode(i.getParentOrThrow())?(t.preventDefault(),!0):zi(n.KEY_ARROW_UP_COMMAND,t))},n.COMMAND_PRIORITY_LOW),s.registerCommand(n.KEY_ARROW_DOWN_COMMAND,t=>{const r=n.$getSelection();if(!n.$isRangeSelection(r))return!1;const{anchor:s}=r,i=s.getNode();return!!Fi(r)&&(r.isCollapsed()&&s.offset===i.getTextContentSize()&&null===i.getNextSibling()&&e.$isCodeNode(i.getParentOrThrow())?(t.preventDefault(),!0):zi(n.KEY_ARROW_DOWN_COMMAND,t))},n.COMMAND_PRIORITY_LOW),s.registerCommand(n.MOVE_TO_START,e=>Hi(n.MOVE_TO_START,e),n.COMMAND_PRIORITY_LOW),s.registerCommand(n.MOVE_TO_END,e=>Hi(n.MOVE_TO_END,e),n.COMMAND_PRIORITY_LOW)),t.mergeRegister(...o)}const Vi=n.defineExtension({config:{tokenizer:Ri},dependencies:[e.CodeExtension],name:"@lexical/code-shiki",register:(e,{tokenizer:t})=>qi(e,t)});exports.CodeHighlighterShikiExtension=Vi,exports.ShikiTokenizer=Ri,exports.getCodeLanguageOptions=function(){return Ni.map(e=>[e.id,e.name])},exports.getCodeThemeOptions=function(){return Ai.map(e=>[e.id,e.displayName])},exports.isCodeLanguageLoaded=Li,exports.loadCodeLanguage=Ii,exports.loadCodeTheme=$i,exports.normalizeCodeLanguage=function(e){const t=e,n=Ni.find(e=>e.id===t||e.aliases&&e.aliases.includes(t));return n?n.id:e},exports.registerCodeHighlighting=qi;
|