UNPKG

@nuxt/devtools

Version:

The Nuxt DevTools gives you insights and transparency about your Nuxt App.

3 lines 741 kB
let F=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function is(t){return Gt(t)}function Gt(t){return Array.isArray(t)?os(t):t instanceof RegExp?t:typeof t=="object"?ls(t):t}function os(t){let e=[];for(let n=0,a=t.length;n<a;n++)e[n]=Gt(t[n]);return e}function ls(t){let e={};for(let n in t)e[n]=Gt(t[n]);return e}function Wn(t,...e){return e.forEach(n=>{for(let a in n)t[a]=n[a]}),t}function Zn(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?Zn(t.substring(0,t.length-1)):t.substr(~e+1)}var ut=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Re=class{static hasCaptures(t){return t===null?!1:(ut.lastIndex=0,ut.test(t))}static replaceCaptures(t,e,n){return t.replace(ut,(a,s,r,i)=>{let o=n[parseInt(s||r,10)];if(o){let l=e.substring(o.start,o.end);for(;l[0]===".";)l=l.substring(1);switch(i){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return a})}};function Vn(t,e){return t<e?-1:t>e?1:0}function Xn(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,a=e.length;if(n===a){for(let s=0;s<n;s++){let r=Vn(t[s],e[s]);if(r!==0)return r}return 0}return n-a}function sn(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function Yn(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Jn=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},De=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(ms(t),e)}static createFromParsedTheme(t,e){return ps(t,e)}_cachedMatchRoot=new Jn(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,a=this._cachedMatchRoot.get(e).find(s=>cs(t.parent,s.parentScopes));return a?new Kn(a.fontStyle,a.foreground,a.background):null}},mt=class Oe{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const a of n)e=new Oe(e,a);return e}static from(...e){let n=null;for(let a=0;a<e.length;a++)n=new Oe(n,e[a]);return n}push(e){return new Oe(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let a=this;for(;a&&a!==e;)n.push(a.scopeName),a=a.parent;return a===e?n.reverse():void 0}};function cs(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let a=e[n],s=!1;if(a===">"){if(n===e.length-1)return!1;a=e[++n],s=!0}for(;t&&!us(t.scopeName,a);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function us(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var Kn=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function ms(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],a=0;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(!i.settings)continue;let o;if(typeof i.scope=="string"){let m=i.scope;m=m.replace(/^[,]+/,""),m=m.replace(/[,]+$/,""),o=m.split(",")}else Array.isArray(i.scope)?o=i.scope:o=[""];let l=-1;if(typeof i.settings.fontStyle=="string"){l=0;let m=i.settings.fontStyle.split(" ");for(let d=0,g=m.length;d<g;d++)switch(m[d]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let c=null;typeof i.settings.foreground=="string"&&sn(i.settings.foreground)&&(c=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&sn(i.settings.background)&&(u=i.settings.background);for(let m=0,d=o.length;m<d;m++){let p=o[m].trim().split(" "),_=p[p.length-1],h=null;p.length>1&&(h=p.slice(0,p.length-1),h.reverse()),n[a++]=new ds(_,h,s,l,c,u)}}return n}var ds=class{constructor(t,e,n,a,s,r){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=a,this.foreground=s,this.background=r}},I=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(I||{});function ps(t,e){t.sort((l,c)=>{let u=Vn(l.scope,c.scope);return u!==0||(u=Xn(l.parentScopes,c.parentScopes),u!==0)?u:l.index-c.index});let n=0,a="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let l=t.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(a=l.foreground),l.background!==null&&(s=l.background)}let r=new gs(e),i=new Kn(n,r.getId(a),r.getId(s)),o=new fs(new xt(0,null,-1,0,0),[]);for(let l=0,c=t.length;l<c;l++){let u=t[l];o.insert(0,u.scope,u.parentScopes,u.fontStyle,r.getId(u.foreground),r.getId(u.background))}return new De(r,i,o)}var gs=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},hs=Object.freeze([]),xt=class Qn{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,a,s,r){this.scopeDepth=e,this.parentScopes=n||hs,this.fontStyle=a,this.foreground=s,this.background=r}clone(){return new Qn(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let a=0,s=e.length;a<s;a++)n[a]=e[a].clone();return n}acceptOverwrite(e,n,a,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),a!==0&&(this.foreground=a),s!==0&&(this.background=s)}},fs=class Ct{constructor(e,n=[],a={}){this._mainRule=e,this._children=a,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let a=0,s=0;for(;e.parentScopes[a]===">"&&a++,n.parentScopes[s]===">"&&s++,!(a>=e.parentScopes.length||s>=n.parentScopes.length);){const r=n.parentScopes[s].length-e.parentScopes[a].length;if(r!==0)return r;a++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let a=e.indexOf("."),s,r;if(a===-1?(s=e,r=""):(s=e.substring(0,a),r=e.substring(a+1)),this._children.hasOwnProperty(s))return this._children[s].match(r)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Ct._cmpBySpecificity),n}insert(e,n,a,s,r,i){if(n===""){this._doInsertHere(e,a,s,r,i);return}let o=n.indexOf("."),l,c;o===-1?(l=n,c=""):(l=n.substring(0,o),c=n.substring(o+1));let u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new Ct(this._mainRule.clone(),xt.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(e+1,c,a,s,r,i)}_doInsertHere(e,n,a,s,r){if(n===null){this._mainRule.acceptOverwrite(e,a,s,r);return}for(let i=0,o=this._rulesWithParentScopes.length;i<o;i++){let l=this._rulesWithParentScopes[i];if(Xn(l.parentScopes,n)===0){l.acceptOverwrite(e,a,s,r);return}}a===-1&&(a=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),r===0&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new xt(e,n,a,s,r))}},ge=class P{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=P.getLanguageId(e),a=P.getTokenType(e),s=P.getFontStyle(e),r=P.getForeground(e),i=P.getBackground(e);console.log({languageId:n,tokenType:a,fontStyle:s,foreground:r,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,a,s,r,i,o){let l=P.getLanguageId(e),c=P.getTokenType(e),u=P.containsBalancedBrackets(e)?1:0,m=P.getFontStyle(e),d=P.getForeground(e),g=P.getBackground(e);return n!==0&&(l=n),a!==8&&(c=a),s!==null&&(u=s?1:0),r!==-1&&(m=r),i!==0&&(d=i),o!==0&&(g=o),(l<<0|c<<8|u<<10|m<<11|d<<15|g<<24)>>>0}};function Ue(t,e){const n=[],a=bs(t);let s=a.next();for(;s!==null;){let l=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=a.next()}let c=i();if(n.push({matcher:c,priority:l}),s!==",")break;s=a.next()}return n;function r(){if(s==="-"){s=a.next();const l=r();return c=>!!l&&!l(c)}if(s==="("){s=a.next();const l=o();return s===")"&&(s=a.next()),l}if(rn(s)){const l=[];do l.push(s),s=a.next();while(rn(s));return c=>e(l,c)}return null}function i(){const l=[];let c=r();for(;c;)l.push(c),c=r();return u=>l.every(m=>m(u))}function o(){const l=[];let c=i();for(;c&&(l.push(c),s==="|"||s===",");){do s=a.next();while(s==="|"||s===",");c=i()}return u=>l.some(m=>m(u))}}function rn(t){return!!t&&!!t.match(/[\w\.:]+/)}function bs(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const a=n[0];return n=e.exec(t),a}}}function ea(t){typeof t.dispose=="function"&&t.dispose()}var Ce=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},ys=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},_s=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},$s=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ce(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new _s;for(const n of t)ws(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Ce){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function ws(t,e,n,a){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const r=n.lookup(e);t instanceof Ce?Ge({baseGrammar:r,selfGrammar:s},a):jt(t.ruleName,{baseGrammar:r,selfGrammar:s,repository:s.repository},a);const i=n.injections(t.scopeName);if(i)for(const o of i)a.add(new Ce(o))}function jt(t,e,n){if(e.repository&&e.repository[t]){const a=e.repository[t];He([a],e,n)}}function Ge(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&He(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&He(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function He(t,e,n){for(const a of t){if(n.visitedRule.has(a))continue;n.visitedRule.add(a);const s=a.repository?Wn({},e.repository,a.repository):e.repository;Array.isArray(a.patterns)&&He(a.patterns,{...e,repository:s},n);const r=a.include;if(!r)continue;const i=ta(r);switch(i.kind){case 0:Ge({...e,selfGrammar:e.baseGrammar},n);break;case 1:Ge(e,n);break;case 2:jt(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const o=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(o){const l={baseGrammar:e.baseGrammar,selfGrammar:o,repository:s};i.kind===4?jt(i.ruleName,l,n):Ge(l,n)}else i.kind===4?n.add(new ys(i.scopeName,i.ruleName)):n.add(new Ce(i.scopeName));break}}}var ks=class{kind=0},vs=class{kind=1},xs=class{constructor(t){this.ruleName=t}kind=2},Cs=class{constructor(t){this.scopeName=t}kind=3},js=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function ta(t){if(t==="$base")return new ks;if(t==="$self")return new vs;const e=t.indexOf("#");if(e===-1)return new Cs(t);if(e===0)return new xs(t.substring(1));{const n=t.substring(0,e),a=t.substring(e+1);return new js(n,a)}}var Ss=/\\(\d+)/,on=/\\(\d+)/g,Es=-1,na=-2;var Fe=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,a){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=Re.hasCaptures(this._name),this._contentName=a||null,this._contentNameIsCapturing=Re.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${Zn(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:Re.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Re.replaceCaptures(this._contentName,t,e)}},As=class extends Fe{retokenizeCapturedWithRuleId;constructor(t,e,n,a,s){super(t,e,n,a),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,a){throw new Error("Not supported!")}},Fs=class extends Fe{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,a,s){super(t,e,n,null),this._match=new je(a,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,a){return this._getCachedCompiledPatterns(t).compileAG(t,n,a)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Se,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},ln=class extends Fe{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,a,s){super(t,e,n,a),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,a){return this._getCachedCompiledPatterns(t).compileAG(t,n,a)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Se,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},St=class extends Fe{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,a,s,r,i,o,l,c){super(t,e,n,a),this._begin=new je(s,this.id),this.beginCaptures=r,this._end=new je(i||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,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(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,a){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,a)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Se;for(const n of this.patterns)t.getRule(n).collectPatterns(t,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,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},We=class extends Fe{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,a,s,r,i,o,l){super(t,e,n,a),this._begin=new je(s,this.id),this.beginCaptures=r,this.whileCaptures=o,this._while=new je(i,na),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(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,a){return this._getCachedCompiledPatterns(t).compileAG(t,n,a)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Se;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,a){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,a)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Se,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},aa=class B{static createCaptureRule(e,n,a,s,r){return e.registerRule(i=>new As(n,i,a,s,r))}static getCompiledRuleId(e,n,a){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new Fs(e.$vscodeTextmateLocation,e.id,e.name,e.match,B._compileCaptures(e.captures,n,a));if(typeof e.begin>"u"){e.repository&&(a=Wn({},a,e.repository));let r=e.patterns;return typeof r>"u"&&e.include&&(r=[{include:e.include}]),new ln(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,B._compilePatterns(r,n,a))}return e.while?new We(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,B._compileCaptures(e.beginCaptures||e.captures,n,a),e.while,B._compileCaptures(e.whileCaptures||e.captures,n,a),B._compilePatterns(e.patterns,n,a)):new St(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,B._compileCaptures(e.beginCaptures||e.captures,n,a),e.end,B._compileCaptures(e.endCaptures||e.captures,n,a),e.applyEndPatternLast,B._compilePatterns(e.patterns,n,a))}),e.id}static _compileCaptures(e,n,a){let s=[];if(e){let r=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);o>r&&(r=o)}for(let i=0;i<=r;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);let l=0;e[i].patterns&&(l=B.getCompiledRuleId(e[i],n,a)),s[o]=B.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,l)}}return s}static _compilePatterns(e,n,a){let s=[];if(e)for(let r=0,i=e.length;r<i;r++){const o=e[r];let l=-1;if(o.include){const c=ta(o.include);switch(c.kind){case 0:case 1:l=B.getCompiledRuleId(a[o.include],n,a);break;case 2:let u=a[c.ruleName];u&&(l=B.getCompiledRuleId(u,n,a));break;case 3:case 4:const m=c.scopeName,d=c.kind===4?c.ruleName:null,g=n.getExternalGrammar(m,a);if(g)if(d){let p=g.repository[d];p&&(l=B.getCompiledRuleId(p,n,g.repository))}else l=B.getCompiledRuleId(g.repository.$self,n,g.repository);break}}else l=B.getCompiledRuleId(o,n,a);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof ln||c instanceof St||c instanceof We)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},je=class sa{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const a=e.length;let s=0,r=[],i=!1;for(let o=0;o<a;o++)if(e.charAt(o)==="\\"&&o+1<a){const c=e.charAt(o+1);c==="z"?(r.push(e.substring(s,o)),r.push("$(?!\\n)(?<!\\n)"),s=o+2):(c==="A"||c==="G")&&(i=!0),o++}this.hasAnchor=i,s===0?this.source=e:(r.push(e.substring(s,a)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=Ss.test(this.source):this.hasBackReferences=!1}clone(){return new sa(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let a=n.map(s=>e.substring(s.start,s.end));return on.lastIndex=0,this.source.replace(on,(s,r)=>Yn(a[parseInt(r,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],a=[],s=[],r,i,o,l;for(r=0,i=this.source.length;r<i;r++)o=this.source.charAt(r),e[r]=o,n[r]=o,a[r]=o,s[r]=o,o==="\\"&&r+1<i&&(l=this.source.charAt(r+1),l==="A"?(e[r+1]="￿",n[r+1]="￿",a[r+1]="A",s[r+1]="A"):l==="G"?(e[r+1]="￿",n[r+1]="G",a[r+1]="￿",s[r+1]="G"):(e[r+1]=l,n[r+1]=l,a[r+1]=l,s[r+1]=l),r++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:a.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Se=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(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new cn(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let a=this._items.map(s=>s.resolveAnchors(e,n));return new cn(t,a,this._items.map(s=>s.ruleId))}},cn=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(` `)}findNextMatchSync(t,e,n){const a=this.scanner.findNextMatchSync(t,e,n);return a?{ruleId:this.rules[a.index],captureIndices:a.captureIndices}:null}},dt=class{constructor(t,e){this.languageId=t,this.tokenType=e}},Ns=class Et{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new dt(e,8),this._embeddedLanguagesMatcher=new Bs(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?Et._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new dt(0,0);_getBasicScopeAttributes=new Jn(e=>{const n=this._scopeToLanguage(e),a=this._toStandardTokenType(e);return new dt(n,a)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(Et.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/},Bs=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,a])=>Yn(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},un=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function ra(t,e,n,a,s,r,i,o){const l=e.content.length;let c=!1,u=-1;if(i){const g=Is(t,e,n,a,s,r);s=g.stack,a=g.linePos,n=g.isFirstLine,u=g.anchorPosition}const m=Date.now();for(;!c;){if(o!==0&&Date.now()-m>o)return new un(s,!0);d()}return new un(s,!1);function d(){const g=Rs(t,e,n,a,s,u);if(!g){r.produce(s,l),c=!0;return}const p=g.captureIndices,_=g.matchedRuleId,h=p&&p.length>0?p[0].end>a:!1;if(_===Es){const y=s.getRule(t);r.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),ke(t,e,n,s,r,y.endCaptures,p),r.produce(s,p[0].end);const b=s;if(s=s.parent,u=b.getAnchorPos(),!h&&b.getEnterPos()===a){s=b,r.produce(s,l),c=!0;return}}else{const y=t.getRule(_);r.produce(s,p[0].start);const b=s,$=y.getName(e.content,p),x=s.contentNameScopesList.pushAttributed($,t);if(s=s.push(_,a,u,p[0].end===l,null,x,x),y instanceof St){const v=y;ke(t,e,n,s,r,v.beginCaptures,p),r.produce(s,p[0].end),u=p[0].end;const T=v.getContentName(e.content,p),R=x.pushAttributed(T,t);if(s=s.withContentNameScopesList(R),v.endHasBackReferences&&(s=s.withEndRule(v.getEndWithResolvedBackReferences(e.content,p))),!h&&b.hasSameRuleAs(s)){s=s.pop(),r.produce(s,l),c=!0;return}}else if(y instanceof We){const v=y;ke(t,e,n,s,r,v.beginCaptures,p),r.produce(s,p[0].end),u=p[0].end;const T=v.getContentName(e.content,p),R=x.pushAttributed(T,t);if(s=s.withContentNameScopesList(R),v.whileHasBackReferences&&(s=s.withEndRule(v.getWhileWithResolvedBackReferences(e.content,p))),!h&&b.hasSameRuleAs(s)){s=s.pop(),r.produce(s,l),c=!0;return}}else if(ke(t,e,n,s,r,y.captures,p),r.produce(s,p[0].end),s=s.pop(),!h){s=s.safePop(),r.produce(s,l),c=!0;return}}p[0].end>a&&(a=p[0].end,n=!1)}}function Is(t,e,n,a,s,r){let i=s.beginRuleCapturedEOL?0:-1;const o=[];for(let l=s;l;l=l.pop()){const c=l.getRule(t);c instanceof We&&o.push({rule:c,stack:l})}for(let l=o.pop();l;l=o.pop()){const{ruleScanner:c,findOptions:u}=Ls(l.rule,t,l.stack.endRule,n,a===i),m=c.findNextMatchSync(e,a,u);if(m){if(m.ruleId!==na){s=l.stack.pop();break}m.captureIndices&&m.captureIndices.length&&(r.produce(l.stack,m.captureIndices[0].start),ke(t,e,n,l.stack,r,l.rule.whileCaptures,m.captureIndices),r.produce(l.stack,m.captureIndices[0].end),i=m.captureIndices[0].end,m.captureIndices[0].end>a&&(a=m.captureIndices[0].end,n=!1))}else{s=l.stack.pop();break}}return{stack:s,linePos:a,anchorPosition:i,isFirstLine:n}}function Rs(t,e,n,a,s,r){const i=qs(t,e,n,a,s,r),o=t.getInjections();if(o.length===0)return i;const l=Ts(o,t,e,n,a,s,r);if(!l)return i;if(!i)return l;const c=i.captureIndices[0].start,u=l.captureIndices[0].start;return u<c||l.priorityMatch&&u===c?l:i}function qs(t,e,n,a,s,r){const i=s.getRule(t),{ruleScanner:o,findOptions:l}=ia(i,t,s.endRule,n,a===r),c=o.findNextMatchSync(e,a,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Ts(t,e,n,a,s,r,i){let o=Number.MAX_VALUE,l=null,c,u=0;const m=r.contentNameScopesList.getScopeNames();for(let d=0,g=t.length;d<g;d++){const p=t[d];if(!p.matcher(m))continue;const _=e.getRule(p.ruleId),{ruleScanner:h,findOptions:y}=ia(_,e,null,a,s===i),b=h.findNextMatchSync(n,s,y);if(!b)continue;const $=b.captureIndices[0].start;if(!($>=o)&&(o=$,l=b.captureIndices,c=b.ruleId,u=p.priority,o===s))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function ia(t,e,n,a,s){return{ruleScanner:t.compileAG(e,n,a,s),findOptions:0}}function Ls(t,e,n,a,s){return{ruleScanner:t.compileWhileAG(e,n,a,s),findOptions:0}}function ke(t,e,n,a,s,r,i){if(r.length===0)return;const o=e.content,l=Math.min(r.length,i.length),c=[],u=i[0].end;for(let m=0;m<l;m++){const d=r[m];if(d===null)continue;const g=i[m];if(g.length===0)continue;if(g.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=g.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,g.start):s.produce(a,g.start),d.retokenizeCapturedWithRuleId){const _=d.getName(o,i),h=a.contentNameScopesList.pushAttributed(_,t),y=d.getContentName(o,i),b=h.pushAttributed(y,t),$=a.push(d.retokenizeCapturedWithRuleId,g.start,-1,!1,null,h,b),x=t.createOnigString(o.substring(0,g.end));ra(t,x,n&&g.start===0,g.start,$,s,!1,0),ea(x);continue}const p=d.getName(o,i);if(p!==null){const h=(c.length>0?c[c.length-1].scopes:a.contentNameScopesList).pushAttributed(p,t);c.push(new Ps(h,g.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var Ps=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function zs(t,e,n,a,s,r,i,o){return new Gs(t,e,n,a,s,r,i,o)}function mn(t,e,n,a,s){const r=Ue(e,Ze),i=aa.getCompiledRuleId(n,a,s.repository);for(const o of r)t.push({debugSelector:e,matcher:o.matcher,ruleId:i,grammar:s,priority:o.priority})}function Ze(t,e){if(e.length<t.length)return!1;let n=0;return t.every(a=>{for(let s=n;s<e.length;s++)if(Os(e[s],a))return n=s+1,!0;return!1})}function Os(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var Gs=class{constructor(t,e,n,a,s,r,i,o){if(this._rootScopeName=t,this.balancedBracketSelectors=r,this._onigLib=o,this._basicScopeAttributesProvider=new Ns(n,a),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=dn(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=Ue(l,Ze);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,a=t.lookup(n);if(a){const s=a.injections;if(s)for(let i in s)mn(e,i,s[i],this,a);const r=this._grammarRepository.injections(n);r&&r.forEach(i=>{const o=this.getExternalGrammar(i);if(o){const l=o.injectionSelector;l&&mn(e,l,o,this,o)}})}return e.sort((s,r)=>s.priority-r.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=dn(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const a=this._tokenize(t,e,!1,n);return{tokens:a.lineTokens.getResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}tokenizeLine2(t,e,n=0){const a=this._tokenize(t,e,!0,n);return{tokens:a.lineTokens.getBinaryResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}_tokenize(t,e,n,a){this._rootId===-1&&(this._rootId=aa.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===At.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),m=ge.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),d=this.getRule(this._rootId).getName(null,null);let g;d?g=ve.createRootAndLookUpScopeName(d,m,this):g=ve.createRoot("unknown",m),e=new At(null,this._rootId,-1,-1,!1,null,g,g)}else s=!1,e.reset();t=t+` `;const r=this.createOnigString(t),i=r.content.length,o=new Ds(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),l=ra(this,r,s,0,e,o,!0,a);return ea(r),{lineLength:i,lineTokens:o,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function dn(t,e){return t=is(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var ve=class M{constructor(e,n,a){this.parent=e,this.scopePath=n,this.tokenAttributes=a}static fromExtension(e,n){let a=e,s=e?.scopePath??null;for(const r of n)s=mt.push(s,r.scopeNames),a=new M(a,s,r.encodedTokenAttributes);return a}static createRoot(e,n){return new M(null,new mt(null,e),n)}static createRootAndLookUpScopeName(e,n,a){const s=a.getMetadataForScope(e),r=new mt(null,e),i=a.themeProvider.themeMatch(r),o=M.mergeAttributes(n,s,i);return new M(null,r,o)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return M.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,a){let s=-1,r=0,i=0;return a!==null&&(s=a.fontStyle,r=a.foregroundId,i=a.backgroundId),ge.set(e,n.languageId,n.tokenType,null,s,r,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return M._pushAttributed(this,e,n);const a=e.split(/ /g);let s=this;for(const r of a)s=M._pushAttributed(s,r,n);return s}static _pushAttributed(e,n,a){const s=a.getMetadataForScope(n),r=e.scopePath.push(n),i=a.themeProvider.themeMatch(r),o=M.mergeAttributes(e.tokenAttributes,s,i);return new M(e,r,o)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let a=this;for(;a&&a!==e;)n.push({encodedTokenAttributes:a.tokenAttributes,scopeNames:a.scopePath.getExtensionIfDefined(a.parent?.scopePath??null)}),a=a.parent;return a===e?n.reverse():void 0}},At=class Q{constructor(e,n,a,s,r,i,o,l){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=r,this.endRule=i,this.nameScopesList=o,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=a,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new Q(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:Q._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?ve.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){Q._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,a,s,r,i,o){return new Q(this,e,n,a,s,r,i,o)}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,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new Q(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.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(e,n){const a=ve.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new Q(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,a,ve.fromExtension(a,n.contentNameScopesList))}},Ms=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Ue(n,Ze).map(a=>a.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>Ue(n,Ze).map(a=>a.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},Ds=class{constructor(t,e,n,a){this.balancedBracketSelectors=a,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let a=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const r=t?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(r)&&(a=ge.set(a,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(r))}if(s&&(a=ge.set(a,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===a){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(a),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let a=0,s=this._binaryTokens.length;a<s;a++)n[a]=this._binaryTokens[a];return n}},Us=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,a,s){if(!this._grammars.has(t)){let r=this._rawGrammars.get(t);if(!r)return null;this._grammars.set(t,zs(t,r,e,n,a,s,this,this._onigLib))}return this._grammars.get(t)}},Hs=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Us(De.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(De.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,a){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:a})}loadGrammarWithConfiguration(e,n,a){return this._loadGrammar(e,n,a.embeddedLanguages,a.tokenTypes,new Ms(a.balancedBracketSelectors||[],a.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,a,s,r){const i=new $s(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(o=>this._loadSingleGrammar(o.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,a,s,r)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const a=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,a)}}addGrammar(e,n=[],a=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,a,s)}_grammarForScopeName(e,n=0,a=null,s=null,r=null){return this._syncRegistry.grammarForScopeName(e,n,a,s,r)}},Ft=At.NULL;const Ws=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Ne{constructor(e,n,a){this.normal=n,this.property=e,a&&(this.space=a)}}Ne.prototype.normal={};Ne.prototype.property={};Ne.prototype.space=void 0;function oa(t,e){const n={},a={};for(const s of t)Object.assign(n,s.property),Object.assign(a,s.normal);return new Ne(n,a,e)}function Nt(t){return t.toLowerCase()}class q{constructor(e,n){this.attribute=n,this.property=e}}q.prototype.attribute="";q.prototype.booleanish=!1;q.prototype.boolean=!1;q.prototype.commaOrSpaceSeparated=!1;q.prototype.commaSeparated=!1;q.prototype.defined=!1;q.prototype.mustUseProperty=!1;q.prototype.number=!1;q.prototype.overloadedBoolean=!1;q.prototype.property="";q.prototype.spaceSeparated=!1;q.prototype.space=void 0;let Zs=0;const k=re(),S=re(),la=re(),f=re(),C=re(),de=re(),L=re();function re(){return 2**++Zs}const Bt=Object.freeze(Object.defineProperty({__proto__:null,boolean:k,booleanish:S,commaOrSpaceSeparated:L,commaSeparated:de,number:f,overloadedBoolean:la,spaceSeparated:C},Symbol.toStringTag,{value:"Module"})),pt=Object.keys(Bt);class Mt extends q{constructor(e,n,a,s){let r=-1;if(super(e,n),pn(this,"space",s),typeof a=="number")for(;++r<pt.length;){const i=pt[r];pn(this,pt[r],(a&Bt[i])===Bt[i])}}}Mt.prototype.defined=!0;function pn(t,e,n){n&&(t[e]=n)}function he(t){const e={},n={};for(const[a,s]of Object.entries(t.properties)){const r=new Mt(a,t.transform(t.attributes||{},a),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(a)&&(r.mustUseProperty=!0),e[a]=r,n[Nt(a)]=a,n[Nt(r.attribute)]=a}return new Ne(e,n,t.space)}const ca=he({properties:{ariaActiveDescendant:null,ariaAtomic:S,ariaAutoComplete:null,ariaBusy:S,ariaChecked:S,ariaColCount:f,ariaColIndex:f,ariaColSpan:f,ariaControls:C,ariaCurrent:null,ariaDescribedBy:C,ariaDetails:null,ariaDisabled:S,ariaDropEffect:C,ariaErrorMessage:null,ariaExpanded:S,ariaFlowTo:C,ariaGrabbed:S,ariaHasPopup:null,ariaHidden:S,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:C,ariaLevel:f,ariaLive:null,ariaModal:S,ariaMultiLine:S,ariaMultiSelectable:S,ariaOrientation:null,ariaOwns:C,ariaPlaceholder:null,ariaPosInSet:f,ariaPressed:S,ariaReadOnly:S,ariaRelevant:null,ariaRequired:S,ariaRoleDescription:C,ariaRowCount:f,ariaRowIndex:f,ariaRowSpan:f,ariaSelected:S,ariaSetSize:f,ariaSort:null,ariaValueMax:f,ariaValueMin:f,ariaValueNow:f,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function ua(t,e){return e in t?t[e]:e}function ma(t,e){return ua(t,e.toLowerCase())}const Vs=he({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:de,acceptCharset:C,accessKey:C,action:null,allow:null,allowFullScreen:k,allowPaymentRequest:k,allowUserMedia:k,alt:null,as:null,async:k,autoCapitalize:null,autoComplete:C,autoFocus:k,autoPlay:k,blocking:C,capture:null,charSet:null,checked:k,cite:null,className:C,cols:f,colSpan:null,content:null,contentEditable:S,controls:k,controlsList:C,coords:f|de,crossOrigin:null,data:null,dateTime:null,decoding:null,default:k,defer:k,dir:null,dirName:null,disabled:k,download:la,draggable:S,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:k,formTarget:null,headers:C,height:f,hidden:k,high:f,href:null,hrefLang:null,htmlFor:C,httpEquiv:C,id:null,imageSizes:null,imageSrcSet:null,inert:k,inputMode:null,integrity:null,is:null,isMap:k,itemId:null,itemProp:C,itemRef:C,itemScope:k,itemType:C,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:k,low:f,manifest:null,max:null,maxLength:f,media:null,method:null,min:null,minLength:f,multiple:k,muted:k,name:null,nonce:null,noModule:k,noValidate:k,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:k,optimum:f,pattern:null,ping:C,placeholder:null,playsInline:k,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:k,referrerPolicy:null,rel:C,required:k,reversed:k,rows:f,rowSpan:f,sandbox:C,scope:null,scoped:k,seamless:k,selected:k,shadowRootClonable:k,shadowRootDelegatesFocus:k,shadowRootMode:null,shape:null,size:f,sizes:null,slot:null,span:f,spellCheck:S,src:null,srcDoc:null,srcLang:null,srcSet:null,start:f,step:null,style:null,tabIndex:f,target:null,title:null,translate:null,type:null,typeMustMatch:k,useMap:null,value:S,width:f,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:C,axis:null,background:null,bgColor:null,border:f,borderColor:null,bottomMargin:f,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:k,declare:k,event:null,face:null,frame:null,frameBorder:null,hSpace:f,leftMargin:f,link:null,longDesc:null,lowSrc:null,marginHeight:f,marginWidth:f,noResize:k,noHref:k,noShade:k,noWrap:k,object:null,profile:null,prompt:null,rev:null,rightMargin:f,rules:null,scheme:null,scrolling:S,standby:null,summary:null,text:null,topMargin:f,valueType:null,version:null,vAlign:null,vLink:null,vSpace:f,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:k,disableRemotePlayback:k,prefix:null,property:null,results:f,security:null,unselectable:null},space:"html",transform:ma}),Xs=he({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:"