@duckmind/duckmind-darwin-x64 1.3.8 → 1.3.10

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.
Files changed (50) hide show
  1. package/.duckmind/plugins/.duckmind-managed-plugins.json +2 -2
  2. package/.duckmind/plugins/context-optimizing-plugin.js +309 -0
  3. package/.duckmind/web/assets/{dialog-connect-provider-jjqkH3fb.js → dialog-connect-provider-CRQUO9He.js} +2 -2
  4. package/.duckmind/web/assets/dialog-edit-project-CpiVZTJ-.js +1 -0
  5. package/.duckmind/web/assets/dialog-fork-CloFkX1M.js +1 -0
  6. package/.duckmind/web/assets/dialog-manage-models-Bq0UrM20.js +1 -0
  7. package/.duckmind/web/assets/{dialog-select-directory-CzrpEaT8.js → dialog-select-directory-Db0c-gQl.js} +3 -3
  8. package/.duckmind/web/assets/dialog-select-file-B-WcV9bA.js +1 -0
  9. package/.duckmind/web/assets/dialog-select-mcp-dA8UDgah.js +1 -0
  10. package/.duckmind/web/assets/dialog-select-model-unpaid-NZ41fVE_.js +2 -0
  11. package/.duckmind/web/assets/dialog-select-provider-CKvDgZkl.js +1 -0
  12. package/.duckmind/web/assets/dialog-select-server-BmCX76VX.js +1 -0
  13. package/.duckmind/web/assets/dialog-settings-BOysoQ60.js +1 -0
  14. package/.duckmind/web/assets/file-icon-By0OPIsC.js +1 -0
  15. package/.duckmind/web/assets/{ghostty-web-o_xRAlFy.js → ghostty-web-BOleg_ST.js} +1 -1
  16. package/.duckmind/web/assets/home-D8eKClgK.js +1 -0
  17. package/.duckmind/web/assets/index-C1_o3AOA.js +1 -0
  18. package/.duckmind/web/assets/index-CIniE1sM.js +2423 -0
  19. package/.duckmind/web/assets/index-ytVPOPlW.css +1 -0
  20. package/.duckmind/web/assets/list-Bd_lG005.js +1 -0
  21. package/.duckmind/web/assets/{provider-icon-CbXUEYMU.js → provider-icon-DzvEuHl8.js} +1 -1
  22. package/.duckmind/web/assets/select-CsoVU8kZ.js +1 -0
  23. package/.duckmind/web/assets/server-row-CfBZdm7h.js +1 -0
  24. package/.duckmind/web/assets/session-CuMpLG8c.js +56 -0
  25. package/.duckmind/web/assets/status-popover-body-BwKWyFvL.js +2 -0
  26. package/.duckmind/web/assets/switch-BZ-0S1HQ.js +1 -0
  27. package/.duckmind/web/assets/{worker-DXsJPwkg.js → worker-BDowWIry.js} +19 -19
  28. package/.duckmind/web/index.html +2 -2
  29. package/bin/duckmind +0 -0
  30. package/package.json +1 -1
  31. package/.duckmind/plugins/duckmind-websearch-cited.js +0 -1483
  32. package/.duckmind/web/assets/dialog-edit-project-DOemY3AL.js +0 -1
  33. package/.duckmind/web/assets/dialog-fork-BmnqME4F.js +0 -1
  34. package/.duckmind/web/assets/dialog-manage-models-D4NfKd0g.js +0 -1
  35. package/.duckmind/web/assets/dialog-select-file-Di34JDys.js +0 -1
  36. package/.duckmind/web/assets/dialog-select-mcp-CfzzoOQ0.js +0 -1
  37. package/.duckmind/web/assets/dialog-select-model-unpaid-BVinN3w5.js +0 -2
  38. package/.duckmind/web/assets/dialog-select-provider-DNa_XLNK.js +0 -1
  39. package/.duckmind/web/assets/dialog-select-server-CXhQWGJN.js +0 -1
  40. package/.duckmind/web/assets/dialog-settings-BZcMt_Zh.js +0 -1
  41. package/.duckmind/web/assets/file-icon-B_-1whMc.js +0 -1
  42. package/.duckmind/web/assets/home-XqeLA6yi.js +0 -1
  43. package/.duckmind/web/assets/index-D-WWa_X8.js +0 -2371
  44. package/.duckmind/web/assets/index-jvk-T241.css +0 -1
  45. package/.duckmind/web/assets/list-Dk_vU1zd.js +0 -1
  46. package/.duckmind/web/assets/select-iTRCZro5.js +0 -1
  47. package/.duckmind/web/assets/server-row-LxKRQxMm.js +0 -1
  48. package/.duckmind/web/assets/session-BmqyKO6_.js +0 -44
  49. package/.duckmind/web/assets/status-popover-body-D8K1NeBF.js +0 -2
  50. package/.duckmind/web/assets/switch-CiVaw2SH.js +0 -1
@@ -1,6 +1,6 @@
1
- let F=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Rs(t){return sn(t)}function sn(t){return Array.isArray(t)?Ns(t):t instanceof RegExp?t:typeof t=="object"?Ps(t):t}function Ns(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=sn(t[n]);return e}function Ps(t){let e={};for(let n in t)e[n]=sn(t[n]);return e}function br(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function wr(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?wr(t.substring(0,t.length-1)):t.substr(~e+1)}var _t=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,He=class{static hasCaptures(t){return t===null?!1:(_t.lastIndex=0,_t.test(t))}static replaceCaptures(t,e,n){return t.replace(_t,(r,s,o,i)=>{let a=n[parseInt(s||o,10)];if(a){let l=e.substring(a.start,a.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 r})}};function Cr(t,e){return t<e?-1:t>e?1:0}function _r(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let o=Cr(t[s],e[s]);if(o!==0)return o}return 0}return n-r}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 Sr(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var kr=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}},nt=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 Ds(t,e)}_cachedMatchRoot=new kr(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,r=this._cachedMatchRoot.get(e).find(s=>$s(t.parent,s.parentScopes));return r?new xr(r.fontStyle,r.foreground,r.background):null}},St=class Je{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Je(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Je(n,e[r]);return n}push(e){return new Je(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 r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function $s(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!Ts(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Ts(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var xr=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=[],r=0;for(let s=0,o=e.length;s<o;s++){let i=e[s];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let f=i.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),a=f.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let l=-1;if(typeof i.settings.fontStyle=="string"){l=0;let f=i.settings.fontStyle.split(" ");for(let h=0,d=f.length;h<d;h++)switch(f[h]){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 f=0,h=a.length;f<h;f++){let p=a[f].trim().split(" "),b=p[p.length-1],w=null;p.length>1&&(w=p.slice(0,p.length-1),w.reverse()),n[r++]=new Os(b,w,s,l,c,u)}}return n}var Os=class{constructor(t,e,n,r,s,o){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},W=(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))(W||{});function Ds(t,e){t.sort((l,c)=>{let u=Cr(l.scope,c.scope);return u!==0||(u=_r(l.parentScopes,c.parentScopes),u!==0)?u:l.index-c.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let l=t.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(s=l.background)}let o=new Gs(e),i=new xr(n,o.getId(r),o.getId(s)),a=new Fs(new Gt(0,null,-1,0,0),[]);for(let l=0,c=t.length;l<c;l++){let u=t[l];a.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new nt(o,i,a)}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)}},Bs=Object.freeze([]),Gt=class vr{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,o){this.scopeDepth=e,this.parentScopes=n||Bs,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new vr(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Fs=class Bt{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-e.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,o;if(r===-1?(s=e,o=""):(s=e.substring(0,r),o=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Bt._cmpBySpecificity),n}insert(e,n,r,s,o,i){if(n===""){this._doInsertHere(e,r,s,o,i);return}let a=n.indexOf("."),l,c;a===-1?(l=n,c=""):(l=n.substring(0,a),c=n.substring(a+1));let u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new Bt(this._mainRule.clone(),Gt.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(e+1,c,r,s,o,i)}_doInsertHere(e,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(e,r,s,o);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let l=this._rulesWithParentScopes[i];if(_r(l.parentScopes,n)===0){l.acceptOverwrite(e,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new Gt(e,n,r,s,o))}},ke=class K{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=K.getLanguageId(e),r=K.getTokenType(e),s=K.getFontStyle(e),o=K.getForeground(e),i=K.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,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,r,s,o,i,a){let l=K.getLanguageId(e),c=K.getTokenType(e),u=K.containsBalancedBrackets(e)?1:0,f=K.getFontStyle(e),h=K.getForeground(e),d=K.getBackground(e);return n!==0&&(l=n),r!==8&&(c=r),s!==null&&(u=s?1:0),o!==-1&&(f=o),i!==0&&(h=i),a!==0&&(d=a),(l<<0|c<<8|u<<10|f<<11|h<<15|d<<24)>>>0}};function rt(t,e){const n=[],r=Us(t);let s=r.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=r.next()}let c=i();if(n.push({matcher:c,priority:l}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const l=o();return c=>!!l&&!l(c)}if(s==="("){s=r.next();const l=a();return s===")"&&(s=r.next()),l}if(kn(s)){const l=[];do l.push(s),s=r.next();while(kn(s));return c=>e(l,c)}return null}function i(){const l=[];let c=o();for(;c;)l.push(c),c=o();return u=>l.every(f=>f(u))}function a(){const l=[];let c=i();for(;c&&(l.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=i()}return u=>l.some(f=>f(u))}}function kn(t){return!!t&&!!t.match(/[\w\.:]+/)}function Us(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Ir(t){typeof t.dispose=="function"&&t.dispose()}var Me=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},js=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ws=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))}},zs=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Me(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new Ws;for(const n of t)Hs(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Me){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 Hs(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const o=n.lookup(e);t instanceof Me?et({baseGrammar:o,selfGrammar:s},r):Ft(t.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const a of i)r.add(new Me(a))}function Ft(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];st([r],e,n)}}function et(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&st(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&st(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function st(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?br({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&st(r.patterns,{...e,repository:s},n);const o=r.include;if(!o)continue;const i=Er(o);switch(i.kind){case 0:et({...e,selfGrammar:e.baseGrammar},n);break;case 1:et(e,n);break;case 2:Ft(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const a=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){const l={baseGrammar:e.baseGrammar,selfGrammar:a,repository:s};i.kind===4?Ft(i.ruleName,l,n):et(l,n)}else i.kind===4?n.add(new js(i.scopeName,i.ruleName)):n.add(new Me(i.scopeName));break}}}var qs=class{kind=0},Vs=class{kind=1},Xs=class{constructor(t){this.ruleName=t}kind=2},Ks=class{constructor(t){this.scopeName=t}kind=3},Zs=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Er(t){if(t==="$base")return new qs;if(t==="$self")return new Vs;const e=t.indexOf("#");if(e===-1)return new Ks(t);if(e===0)return new Xs(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new Zs(n,r)}}var Qs=/\\(\d+)/,xn=/\\(\d+)/g,Ys=-1,Ar=-2;var Ue=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=He.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=He.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${wr(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:He.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:He.replaceCaptures(this._contentName,t,e)}},Js=class extends Ue{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},eo=class extends Ue{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new Oe(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new De,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},vn=class extends Ue{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),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,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new De,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ut=class extends Ue{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,o,i,a,l,c){super(t,e,n,r),this._begin=new Oe(s,this.id),this.beginCaptures=o,this._end=new Oe(i||"￿",-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(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,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new De;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}},ot=class extends Ue{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,o,i,a,l){super(t,e,n,r),this._begin=new Oe(s,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new Oe(i,Ar),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,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new De;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,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new De,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},Lr=class j{static createCaptureRule(e,n,r,s,o){return e.registerRule(i=>new Js(n,i,r,s,o))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new eo(e.$vscodeTextmateLocation,e.id,e.name,e.match,j._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=br({},r,e.repository));let o=e.patterns;return typeof o>"u"&&e.include&&(o=[{include:e.include}]),new vn(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,j._compilePatterns(o,n,r))}return e.while?new ot(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,j._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,j._compileCaptures(e.whileCaptures||e.captures,n,r),j._compilePatterns(e.patterns,n,r)):new Ut(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,j._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,j._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,j._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let o=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>o&&(o=a)}for(let i=0;i<=o;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let l=0;e[i].patterns&&(l=j.getCompiledRuleId(e[i],n,r)),s[a]=j.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,l)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let o=0,i=e.length;o<i;o++){const a=e[o];let l=-1;if(a.include){const c=Er(a.include);switch(c.kind){case 0:case 1:l=j.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=j.getCompiledRuleId(u,n,r));break;case 3:case 4:const f=c.scopeName,h=c.kind===4?c.ruleName:null,d=n.getExternalGrammar(f,r);if(d)if(h){let p=d.repository[h];p&&(l=j.getCompiledRuleId(p,n,d.repository))}else l=j.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else l=j.getCompiledRuleId(a,n,r);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof vn||c instanceof Ut||c instanceof ot)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},Oe=class Rr{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,o=[],i=!1;for(let a=0;a<r;a++)if(e.charAt(a)==="\\"&&a+1<r){const c=e.charAt(a+1);c==="z"?(o.push(e.substring(s,a)),o.push("$(?!\\n)(?<!\\n)"),s=a+2):(c==="A"||c==="G")&&(i=!0),a++}this.hasAnchor=i,s===0?this.source=e:(o.push(e.substring(s,r)),this.source=o.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=Qs.test(this.source):this.hasBackReferences=!1}clone(){return new Rr(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 r=n.map(s=>e.substring(s.start,s.end));return xn.lastIndex=0,this.source.replace(xn,(s,o)=>Sr(r[parseInt(o,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=[],r=[],s=[],o,i,a,l;for(o=0,i=this.source.length;o<i;o++)a=this.source.charAt(o),e[o]=a,n[o]=a,r[o]=a,s[o]=a,a==="\\"&&o+1<i&&(l=this.source.charAt(o+1),l==="A"?(e[o+1]="￿",n[o+1]="￿",r[o+1]="A",s[o+1]="A"):l==="G"?(e[o+1]="￿",n[o+1]="G",r[o+1]="￿",s[o+1]="G"):(e[o+1]=l,n[o+1]=l,r[o+1]=l,s[o+1]=l),o++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.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}},De=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 In(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 r=this._items.map(s=>s.resolveAnchors(e,n));return new In(t,r,this._items.map(s=>s.ruleId))}},In=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(`
2
- `)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},kt=class{constructor(t,e){this.languageId=t,this.tokenType=e}},to=class jt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new kt(e,8),this._embeddedLanguagesMatcher=new no(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?jt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new kt(0,0);_getBasicScopeAttributes=new kr(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new kt(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(jt.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/},no=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,r])=>Sr(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])}},En=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Nr(t,e,n,r,s,o,i,a){const l=e.content.length;let c=!1,u=-1;if(i){const d=ro(t,e,n,r,s,o);s=d.stack,r=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const f=Date.now();for(;!c;){if(a!==0&&Date.now()-f>a)return new En(s,!0);h()}return new En(s,!1);function h(){const d=so(t,e,n,r,s,u);if(!d){o.produce(s,l),c=!0;return}const p=d.captureIndices,b=d.matchedRuleId,w=p&&p.length>0?p[0].end>r:!1;if(b===Ys){const y=s.getRule(t);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),Pe(t,e,n,s,o,y.endCaptures,p),o.produce(s,p[0].end);const m=s;if(s=s.parent,u=m.getAnchorPos(),!w&&m.getEnterPos()===r){s=m,o.produce(s,l),c=!0;return}}else{const y=t.getRule(b);o.produce(s,p[0].start);const m=s,g=y.getName(e.content,p),_=s.contentNameScopesList.pushAttributed(g,t);if(s=s.push(b,r,u,p[0].end===l,null,_,_),y instanceof Ut){const S=y;Pe(t,e,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const x=S.getContentName(e.content,p),A=_.pushAttributed(x,t);if(s=s.withContentNameScopesList(A),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(e.content,p))),!w&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,l),c=!0;return}}else if(y instanceof ot){const S=y;Pe(t,e,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const x=S.getContentName(e.content,p),A=_.pushAttributed(x,t);if(s=s.withContentNameScopesList(A),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(e.content,p))),!w&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,l),c=!0;return}}else if(Pe(t,e,n,s,o,y.captures,p),o.produce(s,p[0].end),s=s.pop(),!w){s=s.safePop(),o.produce(s,l),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function ro(t,e,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const a=[];for(let l=s;l;l=l.pop()){const c=l.getRule(t);c instanceof ot&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:u}=ao(l.rule,t,l.stack.endRule,n,r===i),f=c.findNextMatchSync(e,r,u);if(f){if(f.ruleId!==Ar){s=l.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(o.produce(l.stack,f.captureIndices[0].start),Pe(t,e,n,l.stack,o,l.rule.whileCaptures,f.captureIndices),o.produce(l.stack,f.captureIndices[0].end),i=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{s=l.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function so(t,e,n,r,s,o){const i=oo(t,e,n,r,s,o),a=t.getInjections();if(a.length===0)return i;const l=io(a,t,e,n,r,s,o);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 oo(t,e,n,r,s,o){const i=s.getRule(t),{ruleScanner:a,findOptions:l}=Pr(i,t,s.endRule,n,r===o),c=a.findNextMatchSync(e,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function io(t,e,n,r,s,o,i){let a=Number.MAX_VALUE,l=null,c,u=0;const f=o.contentNameScopesList.getScopeNames();for(let h=0,d=t.length;h<d;h++){const p=t[h];if(!p.matcher(f))continue;const b=e.getRule(p.ruleId),{ruleScanner:w,findOptions:y}=Pr(b,e,null,r,s===i),m=w.findNextMatchSync(n,s,y);if(!m)continue;const g=m.captureIndices[0].start;if(!(g>=a)&&(a=g,l=m.captureIndices,c=m.ruleId,u=p.priority,a===s))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function Pr(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function ao(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function Pe(t,e,n,r,s,o,i){if(o.length===0)return;const a=e.content,l=Math.min(o.length,i.length),c=[],u=i[0].end;for(let f=0;f<l;f++){const h=o[f];if(h===null)continue;const d=i[f];if(d.length===0)continue;if(d.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=d.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,d.start):s.produce(r,d.start),h.retokenizeCapturedWithRuleId){const b=h.getName(a,i),w=r.contentNameScopesList.pushAttributed(b,t),y=h.getContentName(a,i),m=w.pushAttributed(y,t),g=r.push(h.retokenizeCapturedWithRuleId,d.start,-1,!1,null,w,m),_=t.createOnigString(a.substring(0,d.end));Nr(t,_,n&&d.start===0,d.start,g,s,!1,0),Ir(_);continue}const p=h.getName(a,i);if(p!==null){const w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);c.push(new lo(w,d.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var lo=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function co(t,e,n,r,s,o,i,a){return new fo(t,e,n,r,s,o,i,a)}function An(t,e,n,r,s){const o=rt(e,it),i=Lr.getCompiledRuleId(n,r,s.repository);for(const a of o)t.push({debugSelector:e,matcher:a.matcher,ruleId:i,grammar:s,priority:a.priority})}function it(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(uo(e[s],r))return n=s+1,!0;return!1})}function uo(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 fo=class{constructor(t,e,n,r,s,o,i,a){if(this._rootScopeName=t,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new to(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Ln(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=rt(l,it);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,r=t.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)An(e,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const a=this.getExternalGrammar(i);if(a){const l=a.injectionSelector;l&&An(e,l,a,this,a)}})}return e.sort((s,o)=>s.priority-o.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]=Ln(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=Lr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===Wt.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),f=ke.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),h=this.getRule(this._rootId).getName(null,null);let d;h?d=$e.createRootAndLookUpScopeName(h,f,this):d=$e.createRoot("unknown",f),e=new Wt(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,e.reset();t=t+`
3
- `;const o=this.createOnigString(t),i=o.content.length,a=new po(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Nr(this,o,s,0,e,a,!0,r);return Ir(o),{lineLength:i,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Ln(t,e){return t=Rs(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 $e=class J{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(const o of n)s=St.push(s,o.scopeNames),r=new J(r,s,o.encodedTokenAttributes);return r}static createRoot(e,n){return new J(null,new St(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),o=new St(null,e),i=r.themeProvider.themeMatch(o),a=J.mergeAttributes(n,s,i);return new J(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return J.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,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),ke.set(e,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return J._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const o of r)s=J._pushAttributed(s,o,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),o=e.scopePath.push(n),i=r.themeProvider.themeMatch(o),a=J.mergeAttributes(e.tokenAttributes,s,i);return new J(e,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},Wt=class ce{constructor(e,n,r,s,o,i,a,l){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new ce(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:ce._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?$e.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(){ce._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,o,i,a){return new ce(this,e,n,r,s,o,i,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,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 ce(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 r=$e.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new ce(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,$e.fromExtension(r,n.contentNameScopesList))}},ho=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):rt(n,it).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>rt(n,it).map(r=>r.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}},po=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,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 r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=t?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(o)&&(r=ke.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=ke.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),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 r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},go=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,r,s){if(!this._grammars.has(t)){let o=this._rawGrammars.get(t);if(!o)return null;this._grammars.set(t,co(t,o,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},mo=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new go(nt.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(nt.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new ho(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,s,o){const i=new zs(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(a=>this._loadSingleGrammar(a.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,r,s,o)}_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 r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(e,n,r,s,o)}},zt=Wt.NULL;const yo=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class je{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}je.prototype.normal={};je.prototype.property={};je.prototype.space=void 0;function $r(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new je(n,r,e)}function Ht(t){return t.toLowerCase()}class H{constructor(e,n){this.attribute=n,this.property=e}}H.prototype.attribute="";H.prototype.booleanish=!1;H.prototype.boolean=!1;H.prototype.commaOrSpaceSeparated=!1;H.prototype.commaSeparated=!1;H.prototype.defined=!1;H.prototype.mustUseProperty=!1;H.prototype.number=!1;H.prototype.overloadedBoolean=!1;H.prototype.property="";H.prototype.spaceSeparated=!1;H.prototype.space=void 0;let bo=0;const I=pe(),M=pe(),qt=pe(),C=pe(),P=pe(),_e=pe(),q=pe();function pe(){return 2**++bo}var Vt=Object.freeze({__proto__:null,boolean:I,booleanish:M,commaOrSpaceSeparated:q,commaSeparated:_e,number:C,overloadedBoolean:qt,spaceSeparated:P});const xt=Object.keys(Vt);class on extends H{constructor(e,n,r,s){let o=-1;if(super(e,n),Rn(this,"space",s),typeof r=="number")for(;++o<xt.length;){const i=xt[o];Rn(this,xt[o],(r&Vt[i])===Vt[i])}}}on.prototype.defined=!0;function Rn(t,e,n){n&&(t[e]=n)}function ve(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const o=new on(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),e[r]=o,n[Ht(r)]=r,n[Ht(o.attribute)]=r}return new je(e,n,t.space)}const Tr=ve({properties:{ariaActiveDescendant:null,ariaAtomic:M,ariaAutoComplete:null,ariaBusy:M,ariaChecked:M,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:P,ariaCurrent:null,ariaDescribedBy:P,ariaDetails:null,ariaDisabled:M,ariaDropEffect:P,ariaErrorMessage:null,ariaExpanded:M,ariaFlowTo:P,ariaGrabbed:M,ariaHasPopup:null,ariaHidden:M,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:P,ariaLevel:C,ariaLive:null,ariaModal:M,ariaMultiLine:M,ariaMultiSelectable:M,ariaOrientation:null,ariaOwns:P,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:M,ariaReadOnly:M,ariaRelevant:null,ariaRequired:M,ariaRoleDescription:P,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:M,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Mr(t,e){return e in t?t[e]:e}function Or(t,e){return Mr(t,e.toLowerCase())}const wo=ve({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_e,acceptCharset:P,accessKey:P,action:null,allow:null,allowFullScreen:I,allowPaymentRequest:I,allowUserMedia:I,alt:null,as:null,async:I,autoCapitalize:null,autoComplete:P,autoFocus:I,autoPlay:I,blocking:P,capture:null,charSet:null,checked:I,cite:null,className:P,cols:C,colSpan:null,content:null,contentEditable:M,controls:I,controlsList:P,coords:C|_e,crossOrigin:null,data:null,dateTime:null,decoding:null,default:I,defer:I,dir:null,dirName:null,disabled:I,download:qt,draggable:M,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:I,formTarget:null,headers:P,height:C,hidden:qt,high:C,href:null,hrefLang:null,htmlFor:P,httpEquiv:P,id:null,imageSizes:null,imageSrcSet:null,inert:I,inputMode:null,integrity:null,is:null,isMap:I,itemId:null,itemProp:P,itemRef:P,itemScope:I,itemType:P,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:I,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:I,muted:I,name:null,nonce:null,noModule:I,noValidate:I,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:I,optimum:C,pattern:null,ping:P,placeholder:null,playsInline:I,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:I,referrerPolicy:null,rel:P,required:I,reversed:I,rows:C,rowSpan:C,sandbox:P,scope:null,scoped:I,seamless:I,selected:I,shadowRootClonable:I,shadowRootDelegatesFocus:I,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:M,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:I,useMap:null,value:M,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:P,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:I,declare:I,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:I,noHref:I,noShade:I,noWrap:I,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:M,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:I,disableRemotePlayback:I,prefix:null,property:null,results:C,security:null,unselectable:null},space:"html",transform:Or}),Co=ve({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:q,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:P,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:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:I,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,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:_e,g2:_e,glyphName:_e,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:q,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,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:C,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:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:P,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:q,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:q,rev:q,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:q,requiredFeatures:q,requiredFonts:q,requiredFormats:q,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:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:q,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:q,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:q,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Mr}),Dr=ve({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),Gr=ve({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Or}),Br=ve({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),_o=/[A-Z]/g,Nn=/-[a-z]/g,So=/^data[-\w.:]+$/i;function ko(t,e){const n=Ht(e);let r=e,s=H;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&So.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(Nn,vo);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!Nn.test(o)){let i=o.replace(_o,xo);i.charAt(0)!=="-"&&(i="-"+i),e="data"+i}}s=on}return new s(r,e)}function xo(t){return"-"+t.toLowerCase()}function vo(t){return t.charAt(1).toUpperCase()}const Io=$r([Tr,wo,Dr,Gr,Br],"html"),Fr=$r([Tr,Co,Dr,Gr,Br],"svg"),Pn={}.hasOwnProperty;function Eo(t,e){const n=e||{};function r(s,...o){let i=r.invalid;const a=r.handlers;if(s&&Pn.call(s,t)){const l=String(s[t]);i=Pn.call(a,l)?a[l]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Ao=/["&'<>`]/g,Lo=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ro=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,No=/[|\\{}()[\]^$+*?.]/g,$n=new WeakMap;function Po(t,e){if(t=t.replace(e.subset?$o(e.subset):Ao,r),e.subset||e.escapeOnly)return t;return t.replace(Lo,n).replace(Ro,r);function n(s,o,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),e)}function r(s,o,i){return e.format(s.charCodeAt(0),i.charCodeAt(o+1),e)}}function $o(t){let e=$n.get(t);return e||(e=To(t),$n.set(t,e)),e}function To(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(No,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const Mo=/[\dA-Fa-f]/;function Oo(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!Mo.test(String.fromCharCode(e))?r:r+";"}const Do=/\d/;function Go(t,e,n){const r="&#"+String(t);return n&&e&&!Do.test(String.fromCharCode(e))?r:r+";"}const Bo=["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"],vt={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:"€"},Fo=["cent","copy","divide","gt","lt","not","para","times"],Ur={}.hasOwnProperty,Xt={};let qe;for(qe in vt)Ur.call(vt,qe)&&(Xt[vt[qe]]=qe);const Uo=/[^\dA-Za-z]/;function jo(t,e,n,r){const s=String.fromCharCode(t);if(Ur.call(Xt,s)){const o=Xt[s],i="&"+o;return n&&Bo.includes(o)&&!Fo.includes(o)&&(!r||e&&e!==61&&Uo.test(String.fromCharCode(e)))?i:i+";"}return""}function Wo(t,e,n){let r=Oo(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=jo(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=Go(t,e,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Se(t,e){return Po(t,Object.assign({format:Wo},e))}const zo=/^>|^->|<!--|-->|--!>|<!-$/g,Ho=[">"],qo=["<",">"];function Vo(t,e,n,r){return r.settings.bogusComments?"<?"+Se(t.value,Object.assign({},r.settings.characterReferences,{subset:Ho}))+">":"<!--"+t.value.replace(zo,s)+"-->";function s(o){return Se(o,Object.assign({},r.settings.characterReferences,{subset:qo}))}}function Xo(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function Tn(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function Ko(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Zo(t){return t.join(" ").trim()}const Qo=/[ \t\n\f\r]/g;function an(t){return typeof t=="object"?t.type==="text"?Mn(t.value):!1:Mn(t)}function Mn(t){return t.replace(Qo,"")===""}const G=Wr(1),jr=Wr(-1),Yo=[];function Wr(t){return e;function e(n,r,s){const o=n?n.children:Yo;let i=(r||0)+t,a=o[i];if(!s)for(;a&&an(a);)i+=t,a=o[i];return a}}const Jo={}.hasOwnProperty;function zr(t){return e;function e(n,r,s){return Jo.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const ln=zr({body:ti,caption:It,colgroup:It,dd:oi,dt:si,head:It,html:ei,li:ri,optgroup:ii,option:ai,p:ni,rp:On,rt:On,tbody:ci,td:Dn,tfoot:ui,th:Dn,thead:li,tr:fi});function It(t,e,n){const r=G(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&an(r.value.charAt(0)))}function ei(t,e,n){const r=G(n,e);return!r||r.type!=="comment"}function ti(t,e,n){const r=G(n,e);return!r||r.type!=="comment"}function ni(t,e,n){const r=G(n,e);return r?r.type==="element"&&(r.tagName==="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"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function ri(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="li"}function si(t,e,n){const r=G(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function oi(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function On(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function ii(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function ai(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function li(t,e,n){const r=G(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function ci(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function ui(t,e,n){return!G(n,e)}function fi(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Dn(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const hi=zr({body:gi,colgroup:mi,head:pi,html:di,tbody:yi});function di(t){const e=G(t,-1);return!e||e.type!=="comment"}function pi(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function gi(t){const e=G(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&an(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function mi(t,e,n){const r=jr(n,e),s=G(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&ln(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function yi(t,e,n){const r=jr(n,e),s=G(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&ln(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Ve={name:[[`
1
+ let F=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Ns(t){return on(t)}function on(t){return Array.isArray(t)?Ps(t):t instanceof RegExp?t:typeof t=="object"?$s(t):t}function Ps(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=on(t[n]);return e}function $s(t){let e={};for(let n in t)e[n]=on(t[n]);return e}function wr(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function Cr(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?Cr(t.substring(0,t.length-1)):t.substr(~e+1)}var St=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,He=class{static hasCaptures(t){return t===null?!1:(St.lastIndex=0,St.test(t))}static replaceCaptures(t,e,n){return t.replace(St,(r,s,o,i)=>{let a=n[parseInt(s||o,10)];if(a){let l=e.substring(a.start,a.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 r})}};function _r(t,e){return t<e?-1:t>e?1:0}function Sr(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let o=_r(t[s],e[s]);if(o!==0)return o}return 0}return n-r}function kn(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 kr(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var xr=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}},nt=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Os(t),e)}static createFromParsedTheme(t,e){return Gs(t,e)}_cachedMatchRoot=new xr(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,r=this._cachedMatchRoot.get(e).find(s=>Ts(t.parent,s.parentScopes));return r?new vr(r.fontStyle,r.foreground,r.background):null}},kt=class Je{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Je(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Je(n,e[r]);return n}push(e){return new Je(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 r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function Ts(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!Ms(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Ms(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var vr=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Os(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,o=e.length;s<o;s++){let i=e[s];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let f=i.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),a=f.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let l=-1;if(typeof i.settings.fontStyle=="string"){l=0;let f=i.settings.fontStyle.split(" ");for(let h=0,d=f.length;h<d;h++)switch(f[h]){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"&&kn(i.settings.foreground)&&(c=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&kn(i.settings.background)&&(u=i.settings.background);for(let f=0,h=a.length;f<h;f++){let p=a[f].trim().split(" "),b=p[p.length-1],w=null;p.length>1&&(w=p.slice(0,p.length-1),w.reverse()),n[r++]=new Ds(b,w,s,l,c,u)}}return n}var Ds=class{constructor(t,e,n,r,s,o){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},W=(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))(W||{});function Gs(t,e){t.sort((l,c)=>{let u=_r(l.scope,c.scope);return u!==0||(u=Sr(l.parentScopes,c.parentScopes),u!==0)?u:l.index-c.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let l=t.shift();l.fontStyle!==-1&&(n=l.fontStyle),l.foreground!==null&&(r=l.foreground),l.background!==null&&(s=l.background)}let o=new Bs(e),i=new vr(n,o.getId(r),o.getId(s)),a=new Us(new Bt(0,null,-1,0,0),[]);for(let l=0,c=t.length;l<c;l++){let u=t[l];a.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new nt(o,i,a)}var Bs=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)}},Fs=Object.freeze([]),Bt=class Ir{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,o){this.scopeDepth=e,this.parentScopes=n||Fs,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new Ir(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Us=class Ft{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-e.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,o;if(r===-1?(s=e,o=""):(s=e.substring(0,r),o=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Ft._cmpBySpecificity),n}insert(e,n,r,s,o,i){if(n===""){this._doInsertHere(e,r,s,o,i);return}let a=n.indexOf("."),l,c;a===-1?(l=n,c=""):(l=n.substring(0,a),c=n.substring(a+1));let u;this._children.hasOwnProperty(l)?u=this._children[l]:(u=new Ft(this._mainRule.clone(),Bt.cloneArr(this._rulesWithParentScopes)),this._children[l]=u),u.insert(e+1,c,r,s,o,i)}_doInsertHere(e,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(e,r,s,o);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let l=this._rulesWithParentScopes[i];if(Sr(l.parentScopes,n)===0){l.acceptOverwrite(e,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new Bt(e,n,r,s,o))}},ke=class K{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=K.getLanguageId(e),r=K.getTokenType(e),s=K.getFontStyle(e),o=K.getForeground(e),i=K.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,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,r,s,o,i,a){let l=K.getLanguageId(e),c=K.getTokenType(e),u=K.containsBalancedBrackets(e)?1:0,f=K.getFontStyle(e),h=K.getForeground(e),d=K.getBackground(e);return n!==0&&(l=n),r!==8&&(c=r),s!==null&&(u=s?1:0),o!==-1&&(f=o),i!==0&&(h=i),a!==0&&(d=a),(l<<0|c<<8|u<<10|f<<11|h<<15|d<<24)>>>0}};function rt(t,e){const n=[],r=js(t);let s=r.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=r.next()}let c=i();if(n.push({matcher:c,priority:l}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const l=o();return c=>!!l&&!l(c)}if(s==="("){s=r.next();const l=a();return s===")"&&(s=r.next()),l}if(xn(s)){const l=[];do l.push(s),s=r.next();while(xn(s));return c=>e(l,c)}return null}function i(){const l=[];let c=o();for(;c;)l.push(c),c=o();return u=>l.every(f=>f(u))}function a(){const l=[];let c=i();for(;c&&(l.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=i()}return u=>l.some(f=>f(u))}}function xn(t){return!!t&&!!t.match(/[\w\.:]+/)}function js(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Er(t){typeof t.dispose=="function"&&t.dispose()}var Me=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},Ws=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},zs=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))}},Hs=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Me(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new zs;for(const n of t)qs(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Me){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 qs(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const o=n.lookup(e);t instanceof Me?et({baseGrammar:o,selfGrammar:s},r):Ut(t.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const a of i)r.add(new Me(a))}function Ut(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];st([r],e,n)}}function et(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&st(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&st(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function st(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?wr({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&st(r.patterns,{...e,repository:s},n);const o=r.include;if(!o)continue;const i=Ar(o);switch(i.kind){case 0:et({...e,selfGrammar:e.baseGrammar},n);break;case 1:et(e,n);break;case 2:Ut(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const a=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){const l={baseGrammar:e.baseGrammar,selfGrammar:a,repository:s};i.kind===4?Ut(i.ruleName,l,n):et(l,n)}else i.kind===4?n.add(new Ws(i.scopeName,i.ruleName)):n.add(new Me(i.scopeName));break}}}var Vs=class{kind=0},Xs=class{kind=1},Ks=class{constructor(t){this.ruleName=t}kind=2},Zs=class{constructor(t){this.scopeName=t}kind=3},Qs=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Ar(t){if(t==="$base")return new Vs;if(t==="$self")return new Xs;const e=t.indexOf("#");if(e===-1)return new Zs(t);if(e===0)return new Ks(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new Qs(n,r)}}var Ys=/\\(\d+)/,vn=/\\(\d+)/g,Js=-1,Lr=-2;var Ue=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=He.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=He.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${Cr(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:He.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:He.replaceCaptures(this._contentName,t,e)}},eo=class extends Ue{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},to=class extends Ue{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new Oe(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new De,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},In=class extends Ue{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),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,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new De,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},jt=class extends Ue{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,o,i,a,l,c){super(t,e,n,r),this._begin=new Oe(s,this.id),this.beginCaptures=o,this._end=new Oe(i||"￿",-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(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,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new De;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}},ot=class extends Ue{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,o,i,a,l){super(t,e,n,r),this._begin=new Oe(s,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new Oe(i,Lr),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,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new De;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,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new De,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},Rr=class j{static createCaptureRule(e,n,r,s,o){return e.registerRule(i=>new eo(n,i,r,s,o))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new to(e.$vscodeTextmateLocation,e.id,e.name,e.match,j._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=wr({},r,e.repository));let o=e.patterns;return typeof o>"u"&&e.include&&(o=[{include:e.include}]),new In(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,j._compilePatterns(o,n,r))}return e.while?new ot(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,j._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,j._compileCaptures(e.whileCaptures||e.captures,n,r),j._compilePatterns(e.patterns,n,r)):new jt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,j._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,j._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,j._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let o=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>o&&(o=a)}for(let i=0;i<=o;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let l=0;e[i].patterns&&(l=j.getCompiledRuleId(e[i],n,r)),s[a]=j.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,l)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let o=0,i=e.length;o<i;o++){const a=e[o];let l=-1;if(a.include){const c=Ar(a.include);switch(c.kind){case 0:case 1:l=j.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[c.ruleName];u&&(l=j.getCompiledRuleId(u,n,r));break;case 3:case 4:const f=c.scopeName,h=c.kind===4?c.ruleName:null,d=n.getExternalGrammar(f,r);if(d)if(h){let p=d.repository[h];p&&(l=j.getCompiledRuleId(p,n,d.repository))}else l=j.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else l=j.getCompiledRuleId(a,n,r);if(l!==-1){const c=n.getRule(l);let u=!1;if((c instanceof In||c instanceof jt||c instanceof ot)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},Oe=class Nr{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,o=[],i=!1;for(let a=0;a<r;a++)if(e.charAt(a)==="\\"&&a+1<r){const c=e.charAt(a+1);c==="z"?(o.push(e.substring(s,a)),o.push("$(?!\\n)(?<!\\n)"),s=a+2):(c==="A"||c==="G")&&(i=!0),a++}this.hasAnchor=i,s===0?this.source=e:(o.push(e.substring(s,r)),this.source=o.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=Ys.test(this.source):this.hasBackReferences=!1}clone(){return new Nr(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 r=n.map(s=>e.substring(s.start,s.end));return vn.lastIndex=0,this.source.replace(vn,(s,o)=>kr(r[parseInt(o,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=[],r=[],s=[],o,i,a,l;for(o=0,i=this.source.length;o<i;o++)a=this.source.charAt(o),e[o]=a,n[o]=a,r[o]=a,s[o]=a,a==="\\"&&o+1<i&&(l=this.source.charAt(o+1),l==="A"?(e[o+1]="￿",n[o+1]="￿",r[o+1]="A",s[o+1]="A"):l==="G"?(e[o+1]="￿",n[o+1]="G",r[o+1]="￿",s[o+1]="G"):(e[o+1]=l,n[o+1]=l,r[o+1]=l,s[o+1]=l),o++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.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}},De=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 En(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 r=this._items.map(s=>s.resolveAnchors(e,n));return new En(t,r,this._items.map(s=>s.ruleId))}},En=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(`
2
+ `)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},xt=class{constructor(t,e){this.languageId=t,this.tokenType=e}},no=class Wt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new xt(e,8),this._embeddedLanguagesMatcher=new ro(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?Wt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new xt(0,0);_getBasicScopeAttributes=new xr(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new xt(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(Wt.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/},ro=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,r])=>kr(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])}},An=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Pr(t,e,n,r,s,o,i,a){const l=e.content.length;let c=!1,u=-1;if(i){const d=so(t,e,n,r,s,o);s=d.stack,r=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const f=Date.now();for(;!c;){if(a!==0&&Date.now()-f>a)return new An(s,!0);h()}return new An(s,!1);function h(){const d=oo(t,e,n,r,s,u);if(!d){o.produce(s,l),c=!0;return}const p=d.captureIndices,b=d.matchedRuleId,w=p&&p.length>0?p[0].end>r:!1;if(b===Js){const y=s.getRule(t);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),Pe(t,e,n,s,o,y.endCaptures,p),o.produce(s,p[0].end);const m=s;if(s=s.parent,u=m.getAnchorPos(),!w&&m.getEnterPos()===r){s=m,o.produce(s,l),c=!0;return}}else{const y=t.getRule(b);o.produce(s,p[0].start);const m=s,g=y.getName(e.content,p),_=s.contentNameScopesList.pushAttributed(g,t);if(s=s.push(b,r,u,p[0].end===l,null,_,_),y instanceof jt){const S=y;Pe(t,e,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const x=S.getContentName(e.content,p),A=_.pushAttributed(x,t);if(s=s.withContentNameScopesList(A),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(e.content,p))),!w&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,l),c=!0;return}}else if(y instanceof ot){const S=y;Pe(t,e,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const x=S.getContentName(e.content,p),A=_.pushAttributed(x,t);if(s=s.withContentNameScopesList(A),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(e.content,p))),!w&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,l),c=!0;return}}else if(Pe(t,e,n,s,o,y.captures,p),o.produce(s,p[0].end),s=s.pop(),!w){s=s.safePop(),o.produce(s,l),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function so(t,e,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const a=[];for(let l=s;l;l=l.pop()){const c=l.getRule(t);c instanceof ot&&a.push({rule:c,stack:l})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:c,findOptions:u}=lo(l.rule,t,l.stack.endRule,n,r===i),f=c.findNextMatchSync(e,r,u);if(f){if(f.ruleId!==Lr){s=l.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(o.produce(l.stack,f.captureIndices[0].start),Pe(t,e,n,l.stack,o,l.rule.whileCaptures,f.captureIndices),o.produce(l.stack,f.captureIndices[0].end),i=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{s=l.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function oo(t,e,n,r,s,o){const i=io(t,e,n,r,s,o),a=t.getInjections();if(a.length===0)return i;const l=ao(a,t,e,n,r,s,o);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 io(t,e,n,r,s,o){const i=s.getRule(t),{ruleScanner:a,findOptions:l}=$r(i,t,s.endRule,n,r===o),c=a.findNextMatchSync(e,r,l);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function ao(t,e,n,r,s,o,i){let a=Number.MAX_VALUE,l=null,c,u=0;const f=o.contentNameScopesList.getScopeNames();for(let h=0,d=t.length;h<d;h++){const p=t[h];if(!p.matcher(f))continue;const b=e.getRule(p.ruleId),{ruleScanner:w,findOptions:y}=$r(b,e,null,r,s===i),m=w.findNextMatchSync(n,s,y);if(!m)continue;const g=m.captureIndices[0].start;if(!(g>=a)&&(a=g,l=m.captureIndices,c=m.ruleId,u=p.priority,a===s))break}return l?{priorityMatch:u===-1,captureIndices:l,matchedRuleId:c}:null}function $r(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function lo(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function Pe(t,e,n,r,s,o,i){if(o.length===0)return;const a=e.content,l=Math.min(o.length,i.length),c=[],u=i[0].end;for(let f=0;f<l;f++){const h=o[f];if(h===null)continue;const d=i[f];if(d.length===0)continue;if(d.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=d.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,d.start):s.produce(r,d.start),h.retokenizeCapturedWithRuleId){const b=h.getName(a,i),w=r.contentNameScopesList.pushAttributed(b,t),y=h.getContentName(a,i),m=w.pushAttributed(y,t),g=r.push(h.retokenizeCapturedWithRuleId,d.start,-1,!1,null,w,m),_=t.createOnigString(a.substring(0,d.end));Pr(t,_,n&&d.start===0,d.start,g,s,!1,0),Er(_);continue}const p=h.getName(a,i);if(p!==null){const w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);c.push(new co(w,d.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var co=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function uo(t,e,n,r,s,o,i,a){return new ho(t,e,n,r,s,o,i,a)}function Ln(t,e,n,r,s){const o=rt(e,it),i=Rr.getCompiledRuleId(n,r,s.repository);for(const a of o)t.push({debugSelector:e,matcher:a.matcher,ruleId:i,grammar:s,priority:a.priority})}function it(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(fo(e[s],r))return n=s+1,!0;return!1})}function fo(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 ho=class{constructor(t,e,n,r,s,o,i,a){if(this._rootScopeName=t,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new no(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Rn(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const l of Object.keys(s)){const c=rt(l,it);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,r=t.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)Ln(e,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const a=this.getExternalGrammar(i);if(a){const l=a.injectionSelector;l&&Ln(e,l,a,this,a)}})}return e.sort((s,o)=>s.priority-o.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]=Rn(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=Rr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===zt.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),f=ke.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),h=this.getRule(this._rootId).getName(null,null);let d;h?d=$e.createRootAndLookUpScopeName(h,f,this):d=$e.createRoot("unknown",f),e=new zt(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,e.reset();t=t+`
3
+ `;const o=this.createOnigString(t),i=o.content.length,a=new go(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Pr(this,o,s,0,e,a,!0,r);return Er(o),{lineLength:i,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Rn(t,e){return t=Ns(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 $e=class ee{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(const o of n)s=kt.push(s,o.scopeNames),r=new ee(r,s,o.encodedTokenAttributes);return r}static createRoot(e,n){return new ee(null,new kt(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),o=new kt(null,e),i=r.themeProvider.themeMatch(o),a=ee.mergeAttributes(n,s,i);return new ee(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return ee.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,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),ke.set(e,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return ee._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const o of r)s=ee._pushAttributed(s,o,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),o=e.scopePath.push(n),i=r.themeProvider.themeMatch(o),a=ee.mergeAttributes(e.tokenAttributes,s,i);return new ee(e,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},zt=class ce{constructor(e,n,r,s,o,i,a,l){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new ce(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:ce._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?$e.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(){ce._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,o,i,a){return new ce(this,e,n,r,s,o,i,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,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 ce(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 r=$e.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new ce(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,$e.fromExtension(r,n.contentNameScopesList))}},po=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):rt(n,it).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>rt(n,it).map(r=>r.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}},go=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,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 r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=t?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(o)&&(r=ke.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=ke.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),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 r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},mo=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,r,s){if(!this._grammars.has(t)){let o=this._rawGrammars.get(t);if(!o)return null;this._grammars.set(t,uo(t,o,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},yo=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new mo(nt.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(nt.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new po(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,s,o){const i=new Hs(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(a=>this._loadSingleGrammar(a.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,r,s,o)}_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 r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(e,n,r,s,o)}},Ht=zt.NULL;const bo=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class je{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}je.prototype.normal={};je.prototype.property={};je.prototype.space=void 0;function Tr(t,e){const n={},r={};for(const s of t)Object.assign(n,s.property),Object.assign(r,s.normal);return new je(n,r,e)}function qt(t){return t.toLowerCase()}class H{constructor(e,n){this.attribute=n,this.property=e}}H.prototype.attribute="";H.prototype.booleanish=!1;H.prototype.boolean=!1;H.prototype.commaOrSpaceSeparated=!1;H.prototype.commaSeparated=!1;H.prototype.defined=!1;H.prototype.mustUseProperty=!1;H.prototype.number=!1;H.prototype.overloadedBoolean=!1;H.prototype.property="";H.prototype.spaceSeparated=!1;H.prototype.space=void 0;let wo=0;const I=pe(),M=pe(),Vt=pe(),C=pe(),P=pe(),_e=pe(),q=pe();function pe(){return 2**++wo}var Xt=Object.freeze({__proto__:null,boolean:I,booleanish:M,commaOrSpaceSeparated:q,commaSeparated:_e,number:C,overloadedBoolean:Vt,spaceSeparated:P});const vt=Object.keys(Xt);class an extends H{constructor(e,n,r,s){let o=-1;if(super(e,n),Nn(this,"space",s),typeof r=="number")for(;++o<vt.length;){const i=vt[o];Nn(this,vt[o],(r&Xt[i])===Xt[i])}}}an.prototype.defined=!0;function Nn(t,e,n){n&&(t[e]=n)}function ve(t){const e={},n={};for(const[r,s]of Object.entries(t.properties)){const o=new an(r,t.transform(t.attributes||{},r),s,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),e[r]=o,n[qt(r)]=r,n[qt(o.attribute)]=r}return new je(e,n,t.space)}const Mr=ve({properties:{ariaActiveDescendant:null,ariaAtomic:M,ariaAutoComplete:null,ariaBusy:M,ariaChecked:M,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:P,ariaCurrent:null,ariaDescribedBy:P,ariaDetails:null,ariaDisabled:M,ariaDropEffect:P,ariaErrorMessage:null,ariaExpanded:M,ariaFlowTo:P,ariaGrabbed:M,ariaHasPopup:null,ariaHidden:M,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:P,ariaLevel:C,ariaLive:null,ariaModal:M,ariaMultiLine:M,ariaMultiSelectable:M,ariaOrientation:null,ariaOwns:P,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:M,ariaReadOnly:M,ariaRelevant:null,ariaRequired:M,ariaRoleDescription:P,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:M,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Or(t,e){return e in t?t[e]:e}function Dr(t,e){return Or(t,e.toLowerCase())}const Co=ve({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:_e,acceptCharset:P,accessKey:P,action:null,allow:null,allowFullScreen:I,allowPaymentRequest:I,allowUserMedia:I,alt:null,as:null,async:I,autoCapitalize:null,autoComplete:P,autoFocus:I,autoPlay:I,blocking:P,capture:null,charSet:null,checked:I,cite:null,className:P,cols:C,colSpan:null,content:null,contentEditable:M,controls:I,controlsList:P,coords:C|_e,crossOrigin:null,data:null,dateTime:null,decoding:null,default:I,defer:I,dir:null,dirName:null,disabled:I,download:Vt,draggable:M,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:I,formTarget:null,headers:P,height:C,hidden:Vt,high:C,href:null,hrefLang:null,htmlFor:P,httpEquiv:P,id:null,imageSizes:null,imageSrcSet:null,inert:I,inputMode:null,integrity:null,is:null,isMap:I,itemId:null,itemProp:P,itemRef:P,itemScope:I,itemType:P,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:I,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:I,muted:I,name:null,nonce:null,noModule:I,noValidate:I,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:I,optimum:C,pattern:null,ping:P,placeholder:null,playsInline:I,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:I,referrerPolicy:null,rel:P,required:I,reversed:I,rows:C,rowSpan:C,sandbox:P,scope:null,scoped:I,seamless:I,selected:I,shadowRootClonable:I,shadowRootDelegatesFocus:I,shadowRootMode:null,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:M,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:I,useMap:null,value:M,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:P,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:I,declare:I,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:I,noHref:I,noShade:I,noWrap:I,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:M,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:I,disableRemotePlayback:I,prefix:null,property:null,results:C,security:null,unselectable:null},space:"html",transform:Dr}),_o=ve({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:q,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:P,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:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:I,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,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:_e,g2:_e,glyphName:_e,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:q,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,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:C,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:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:P,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:q,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:q,rev:q,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:q,requiredFeatures:q,requiredFonts:q,requiredFormats:q,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:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:q,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:q,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:q,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Or}),Gr=ve({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),Br=ve({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Dr}),Fr=ve({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),So=/[A-Z]/g,Pn=/-[a-z]/g,ko=/^data[-\w.:]+$/i;function xo(t,e){const n=qt(e);let r=e,s=H;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ko.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(Pn,Io);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!Pn.test(o)){let i=o.replace(So,vo);i.charAt(0)!=="-"&&(i="-"+i),e="data"+i}}s=an}return new s(r,e)}function vo(t){return"-"+t.toLowerCase()}function Io(t){return t.charAt(1).toUpperCase()}const Eo=Tr([Mr,Co,Gr,Br,Fr],"html"),Ur=Tr([Mr,_o,Gr,Br,Fr],"svg"),$n={}.hasOwnProperty;function Ao(t,e){const n=e||{};function r(s,...o){let i=r.invalid;const a=r.handlers;if(s&&$n.call(s,t)){const l=String(s[t]);i=$n.call(a,l)?a[l]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const Lo=/["&'<>`]/g,Ro=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,No=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Po=/[|\\{}()[\]^$+*?.]/g,Tn=new WeakMap;function $o(t,e){if(t=t.replace(e.subset?To(e.subset):Lo,r),e.subset||e.escapeOnly)return t;return t.replace(Ro,n).replace(No,r);function n(s,o,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),e)}function r(s,o,i){return e.format(s.charCodeAt(0),i.charCodeAt(o+1),e)}}function To(t){let e=Tn.get(t);return e||(e=Mo(t),Tn.set(t,e)),e}function Mo(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Po,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const Oo=/[\dA-Fa-f]/;function Do(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!Oo.test(String.fromCharCode(e))?r:r+";"}const Go=/\d/;function Bo(t,e,n){const r="&#"+String(t);return n&&e&&!Go.test(String.fromCharCode(e))?r:r+";"}const Fo=["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"],It={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:"€"},Uo=["cent","copy","divide","gt","lt","not","para","times"],jr={}.hasOwnProperty,Kt={};let qe;for(qe in It)jr.call(It,qe)&&(Kt[It[qe]]=qe);const jo=/[^\dA-Za-z]/;function Wo(t,e,n,r){const s=String.fromCharCode(t);if(jr.call(Kt,s)){const o=Kt[s],i="&"+o;return n&&Fo.includes(o)&&!Uo.includes(o)&&(!r||e&&e!==61&&jo.test(String.fromCharCode(e)))?i:i+";"}return""}function zo(t,e,n){let r=Do(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Wo(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=Bo(t,e,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Se(t,e){return $o(t,Object.assign({format:zo},e))}const Ho=/^>|^->|<!--|-->|--!>|<!-$/g,qo=[">"],Vo=["<",">"];function Xo(t,e,n,r){return r.settings.bogusComments?"<?"+Se(t.value,Object.assign({},r.settings.characterReferences,{subset:qo}))+">":"<!--"+t.value.replace(Ho,s)+"-->";function s(o){return Se(o,Object.assign({},r.settings.characterReferences,{subset:Vo}))}}function Ko(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function Mn(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(e);for(;s!==-1;)r++,s=n.indexOf(e,s+e.length);return r}function Zo(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Qo(t){return t.join(" ").trim()}const Yo=/[ \t\n\f\r]/g;function ln(t){return typeof t=="object"?t.type==="text"?On(t.value):!1:On(t)}function On(t){return t.replace(Yo,"")===""}const G=zr(1),Wr=zr(-1),Jo=[];function zr(t){return e;function e(n,r,s){const o=n?n.children:Jo;let i=(r||0)+t,a=o[i];if(!s)for(;a&&ln(a);)i+=t,a=o[i];return a}}const ei={}.hasOwnProperty;function Hr(t){return e;function e(n,r,s){return ei.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const cn=Hr({body:ni,caption:Et,colgroup:Et,dd:ii,dt:oi,head:Et,html:ti,li:si,optgroup:ai,option:li,p:ri,rp:Dn,rt:Dn,tbody:ui,td:Gn,tfoot:fi,th:Gn,thead:ci,tr:hi});function Et(t,e,n){const r=G(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&ln(r.value.charAt(0)))}function ti(t,e,n){const r=G(n,e);return!r||r.type!=="comment"}function ni(t,e,n){const r=G(n,e);return!r||r.type!=="comment"}function ri(t,e,n){const r=G(n,e);return r?r.type==="element"&&(r.tagName==="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"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function si(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="li"}function oi(t,e,n){const r=G(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function ii(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Dn(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function ai(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function li(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function ci(t,e,n){const r=G(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function ui(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function fi(t,e,n){return!G(n,e)}function hi(t,e,n){const r=G(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Gn(t,e,n){const r=G(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const di=Hr({body:mi,colgroup:yi,head:gi,html:pi,tbody:bi});function pi(t){const e=G(t,-1);return!e||e.type!=="comment"}function gi(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function mi(t){const e=G(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&ln(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function yi(t,e,n){const r=Wr(n,e),s=G(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&cn(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function bi(t,e,n){const r=Wr(n,e),s=G(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&cn(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Ve={name:[[`
4
4
  \f\r &/=>`.split(""),`
5
5
  \f\r "&'/=>\``.split("")],[`\0
6
6
  \f\r "&'/<=>`.split(""),`\0
@@ -8,10 +8,10 @@ let F=class extends Error{constructor(e){super(e),this.name="ShikiError"}};funct
8
8
  \f\r &>`.split(""),`\0
9
9
  \f\r "&'<=>\``.split("")],[`\0
10
10
  \f\r "&'<=>\``.split(""),`\0
11
- \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function bi(t,e,n,r){const s=r.schema,o=s.space==="svg"?!1:r.settings.omitOptionalTags;let i=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;s.space==="html"&&t.tagName==="svg"&&(r.schema=Fr);const c=wi(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(i=!1),(c||!o||!hi(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),i&&(s.space==="svg"||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),!i&&(!o||!ln(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function wi(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const o=Ci(t,s,e[s]);o&&n.push(o)}}for(;++r<n.length;){const o=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function Ci(t,e,n){const r=ko(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,o=t.settings.allowDangerousCharacters?0:1;let i=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Se(r.attribute,Object.assign({},t.settings.characterReferences,{subset:Ve.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Ko:Zo)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=Se(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Ve.unquoted[s][o]}))),a!==n&&(t.settings.quoteSmart&&Tn(n,i)>Tn(n,t.alternative)&&(i=t.alternative),a=i+Se(n,Object.assign({},t.settings.characterReferences,{subset:(i==="'"?Ve.single:Ve.double)[s][o],attribute:!0}))+i),l+(a&&"="+a))}const _i=["<","&"];function Hr(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:Se(t.value,Object.assign({},r.settings.characterReferences,{subset:_i}))}function Si(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Hr(t,e,n,r)}function ki(t,e,n,r){return r.all(t)}const xi=Eo("type",{invalid:vi,unknown:Ii,handlers:{comment:Vo,doctype:Xo,element:bi,raw:Si,root:ki,text:Hr}});function vi(t){throw new Error("Expected node, not `"+t+"`")}function Ii(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Ei={},Ai={},Li=[];function Ri(t,e){const n=e||Ei,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Ni,all:Pi,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||yo,characterReferences:n.characterReferences||Ai,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Fr:Io,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Ni(t,e,n){return xi(t,e,n,this)}function Pi(t){const e=[],n=t&&t.children||Li;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function at(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[s,o]of Object.entries(e?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function ae(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function $i(t){return Array.isArray(t)?t:[t]}async function qr(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function cn(t){return!t||["plaintext","txt","text","plain"].includes(t)}function Ti(t){return t==="ansi"||cn(t)}function un(t){return t==="none"}function Mi(t){return un(t)}function Vr(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const r of n)r&&!t.properties.class.includes(r)&&t.properties.class.push(r);return t}function dt(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const i=e?n[o]+(n[o+1]||""):n[o];s.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}function Oi(t){const e=dt(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e[e.length-1].length};let o=s,i=0;for(const a of e){if(o<a.length)break;o-=a.length,i++}return{line:i,character:o}}function r(s,o){let i=0;for(let a=0;a<s;a++)i+=e[a].length;return i+=o,i}return{lines:e,indexToPos:n,posToIndex:r}}const fn="light-dark()",Di=["color","background-color"];function Gi(t,e){let n=0;const r=[];for(const s of e)s>n&&r.push({...t,content:t.content.slice(n,s),offset:t.offset+n}),n=s;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function Bi(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return n.length?t.map(r=>r.flatMap(s=>{const o=n.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,a)=>i-a);return o.length?Gi(s,o):s})):t}function Fi(t,e,n,r,s="css-vars"){const o={content:t.content,explanation:t.explanation,offset:t.offset},i=e.map(u=>lt(t.variants[u])),a=new Set(i.flatMap(u=>Object.keys(u))),l={},c=(u,f)=>{const h=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+e[u]+(f==="color"?"":h)};return i.forEach((u,f)=>{for(const h of a){const d=u[h]||"inherit";if(f===0&&r&&Di.includes(h))if(r===fn&&i.length>1){const p=e.findIndex(m=>m==="light"),b=e.findIndex(m=>m==="dark");if(p===-1||b===-1)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const w=i[p][h]||"inherit",y=i[b][h]||"inherit";l[h]=`light-dark(${w}, ${y})`,s==="css-vars"&&(l[c(f,h)]=d)}else l[h]=d;else s==="css-vars"&&(l[c(f,h)]=d)}}),o.htmlStyle=l,o}function lt(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&W.Italic&&(e["font-style"]="italic"),t.fontStyle&W.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&W.Underline&&n.push("underline"),t.fontStyle&W.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function Kt(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}const Xr=new WeakMap;function pt(t,e){Xr.set(t,e)}function Ge(t){return Xr.get(t)}class Ie{_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,n){return new Ie(Object.fromEntries($i(n).map(r=>[r,zt])),e)}constructor(...e){if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Ui(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Ui(t){const e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(t),e}function ji(t,e){if(!(t instanceof Ie))throw new F("Invalid grammar state");return t.getInternalStack(e)}function Wi(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new F(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...s.indexToPos(i),offset:i}}else{const a=s.lines[i.line];if(a===void 0)throw new F(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${s.lines.length}`);let l=i.character;if(l<0&&(l=a.length+l),l<0||l>a.length)throw new F(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${a.length}`);return{...i,character:l,offset:s.posToIndex(i.line,l)}}};const s=Oi(n.source),o=(n.options.decorations||[]).map(i=>({...i,start:r(i.start),end:r(i.end)}));zi(o),t.set(n.meta,{decorations:o,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(i=>[i.start.offset,i.end.offset]);return Bi(n,s)},code(n){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(n.children).filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new F(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function o(u,f,h,d){const p=s[u];let b="",w=-1,y=-1;if(f===0&&(w=0),h===0&&(y=0),h===Number.POSITIVE_INFINITY&&(y=p.children.length),w===-1||y===-1)for(let g=0;g<p.children.length;g++)b+=Kr(p.children[g]),w===-1&&b.length===f&&(w=g+1),y===-1&&b.length===h&&(y=g+1);if(w===-1)throw new F(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(y===-1)throw new F(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const m=p.children.slice(w,y);if(!d.alwaysWrap&&m.length===p.children.length)a(p,d,"line");else if(!d.alwaysWrap&&m.length===1&&m[0].type==="element")a(m[0],d,"token");else{const g={type:"element",tagName:"span",properties:{},children:m};a(g,d,"wrapper"),p.children.splice(w,m.length,g)}}function i(u,f){s[u]=a(s[u],f,"line")}function a(u,f,h){const d=f.properties||{},p=f.transform||(b=>b);return u.tagName=f.tagName||"span",u.properties={...u.properties,...d,class:u.properties.class},f.properties?.class&&Vr(u,f.properties.class),u=p(u,h)||u,u}const l=[],c=r.decorations.sort((u,f)=>f.start.offset-u.start.offset||u.end.offset-f.end.offset);for(const u of c){const{start:f,end:h}=u;if(f.line===h.line)o(f.line,f.character,h.character,u);else if(f.line<h.line){o(f.line,f.character,Number.POSITIVE_INFINITY,u);for(let d=f.line+1;d<h.line;d++)l.unshift(()=>i(d,u));o(h.line,0,h.character,u)}}l.forEach(u=>u())}}}function zi(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new F(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){const s=t[r],o=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,i=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,a=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,l=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||i||a||l){if(o&&i||a&&l||a&&n.start.offset===n.end.offset||i&&s.start.offset===s.end.offset)continue;throw new F(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Kr(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(Kr).join(""):""}const Hi=[Wi()];function ct(t){const e=qi(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...Hi]}function qi(t){const e=[],n=[],r=[];for(const s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var fe=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Et={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Vi(t,e){const n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){const r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function Gn(t){const e=t.shift();if(e==="2"){const n=t.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function Xi(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)e.push({type:"resetAll"});else if(r<=9)Et[r]&&e.push({type:"setDecoration",value:Et[r]});else if(r<=29){const s=Et[r-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:fe[r-30]}});else if(r===38){const s=Gn(t);s&&e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:fe[r-40]}});else if(r===48){const s=Gn(t);s&&e.push({type:"setBackgroundColor",value:s})}else r===49?e.push({type:"resetBackgroundColor"}):r===53?e.push({type:"setDecoration",value:"overline"}):r===55?e.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?e.push({type:"setForegroundColor",value:{type:"named",name:fe[r-90+8]}}):r>=100&&r<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:fe[r-100+8]}})}return e}function Ki(){let t=null,e=null,n=new Set;return{parse(r){const s=[];let o=0;do{const i=Vi(r,o),a=i.sequence?r.substring(o,i.startPosition):r.substring(o);if(a.length>0&&s.push({value:a,foreground:t,background:e,decorations:new Set(n)}),i.sequence){const l=Xi(i.sequence);for(const c of l)c.type==="resetAll"?(t=null,e=null,n.clear()):c.type==="resetForegroundColor"?t=null:c.type==="resetBackgroundColor"?e=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?t=c.value:c.type==="setBackgroundColor"?e=c.value:c.type==="setDecoration"&&n.add(c.value)}o=i.position}while(o<r.length);return s}}}var Zi={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 Qi(t=Zi){function e(a){return t[a]}function n(a){return`#${a.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let c=0;c<fe.length;c++)r.push(e(fe[c]));let a=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let f=0;f<6;f++)r.push(n([a[c],a[u],a[f]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function o(a){return s()[a]}function i(a){switch(a.type){case"named":return e(a.name);case"rgb":return n(a.rgb);case"table":return o(a.index)}}return{value:i}}const Yi={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function Ji(t,e,n){const r=at(t,n),s=dt(e),o=Object.fromEntries(fe.map(l=>{const c=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`,u=t.colors?.[c];return[l,u||Yi[l]]})),i=Qi(o),a=Ki();return s.map(l=>a.parse(l[0]).map(c=>{let u,f;c.decorations.has("reverse")?(u=c.background?i.value(c.background):t.bg,f=c.foreground?i.value(c.foreground):t.fg):(u=c.foreground?i.value(c.foreground):t.fg,f=c.background?i.value(c.background):void 0),u=ae(u,r),f=ae(f,r),c.decorations.has("dim")&&(u=ea(u));let h=W.None;return c.decorations.has("bold")&&(h|=W.Bold),c.decorations.has("italic")&&(h|=W.Italic),c.decorations.has("underline")&&(h|=W.Underline),c.decorations.has("strikethrough")&&(h|=W.Strikethrough),{content:c.value,offset:l[1],color:u,bgColor:f,fontStyle:h}}))}function ea(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const r=e[1];if(r.length===8){const s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const s=r[0],o=r[1],i=r[2],a=r[3],l=Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0");return`#${s}${s}${o}${o}${i}${i}${l}`}else if(r.length===3){const s=r[0],o=r[1],i=r[2];return`#${s}${s}${o}${o}${i}${i}80`}}}const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function hn(t,e,n={}){const{theme:r=t.getLoadedThemes()[0]}=n,s=t.resolveLangAlias(n.lang||"text");if(cn(s)||un(r))return dt(e).map(l=>[{content:l[0],offset:l[1]}]);const{theme:o,colorMap:i}=t.setTheme(r);if(s==="ansi")return Ji(o,e,n);const a=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==a.name)throw new F(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(o.name))throw new F(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return na(e,a,o,i,n)}function ta(...t){if(t.length===2)return Ge(t[1]);const[e,n,r={}]=t,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(cn(s)||un(o))throw new F("Plain language does not have grammar state");if(s==="ansi")throw new F("ANSI language does not have grammar state");const{theme:i,colorMap:a}=e.setTheme(o),l=e.getLanguage(s);return new Ie(dn(n,l,i,a,r).stateStack,l.name,i.name)}function na(t,e,n,r,s){const o=dn(t,e,n,r,s),i=new Ie(o.stateStack,e.name,n.name);return pt(o.tokens,i),o.tokens}function dn(t,e,n,r,s){const o=at(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500}=s,l=dt(t);let c=s.grammarState?ji(s.grammarState,n.name)??zt:s.grammarContextCode!=null?dn(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:zt,u=[];const f=[];for(let h=0,d=l.length;h<d;h++){const[p,b]=l[h];if(p===""){u=[],f.push([]);continue}if(i>0&&p.length>=i){u=[],f.push([{content:p,offset:b,color:"",fontStyle:0}]);continue}let w,y,m;s.includeExplanation&&(w=e.tokenizeLine(p,c,a),y=w.tokens,m=0);const g=e.tokenizeLine2(p,c,a),_=g.tokens.length/2;for(let S=0;S<_;S++){const x=g.tokens[2*S],A=S+1<_?g.tokens[2*S+2]:p.length;if(x===A)continue;const k=g.tokens[2*S+1],N=ae(r[ke.getForeground(k)],o),L=ke.getFontStyle(k),T={content:p.substring(x,A),offset:b+x,color:N,fontStyle:L};if(s.includeExplanation){const R=[];if(s.includeExplanation!=="scopeName")for(const E of n.settings){let X;switch(typeof E.scope){case"string":X=E.scope.split(/,/).map(Le=>Le.trim());break;case"object":X=E.scope;break;default:continue}R.push({settings:E,selectors:X.map(Le=>Le.split(/ /))})}T.explanation=[];let z=0;for(;x+z<A;){const E=y[m],X=p.substring(E.startIndex,E.endIndex);z+=X.length,T.explanation.push({content:X,scopes:s.includeExplanation==="scopeName"?ra(E.scopes):sa(R,E.scopes)}),m+=1}}u.push(T)}f.push(u),u=[],c=g.ruleStack}return{tokens:f,stateStack:c}}function ra(t){return t.map(e=>({scopeName:e}))}function sa(t,e){const n=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];n[r]={scopeName:o,themeMatches:ia(t,o,e.slice(0,r))}}return n}function Bn(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function oa(t,e,n){if(!Bn(t[t.length-1],e))return!1;let r=t.length-2,s=n.length-1;for(;r>=0&&s>=0;)Bn(t[r],n[s])&&(r-=1),s-=1;return r===-1}function ia(t,e,n){const r=[];for(const{selectors:s,settings:o}of t)for(const i of s)if(oa(i,e,n)){r.push(o);break}return r}function Zr(t,e,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),s=r.map(l=>{const c=hn(t,e,{...n,theme:l.theme}),u=Ge(c),f=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:f}}),o=aa(...s.map(l=>l.tokens)),i=o[0].map((l,c)=>l.map((u,f)=>{const h={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=u.explanation),o.forEach((d,p)=>{const{content:b,explanation:w,offset:y,...m}=d[c][f];h.variants[r[p].color]=m}),h})),a=s[0].state?new Ie(Object.fromEntries(s.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),s[0].state.lang):void 0;return a&&pt(i,a),i}function aa(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){const s=t.map(l=>l[r]),o=e.map(()=>[]);e.forEach((l,c)=>l.push(o[c]));const i=s.map(()=>0),a=s.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(c=>c.content.length));for(let c=0;c<n;c++){const u=a[c];u.content.length===l?(o[c].push(u),i[c]+=1,a[c]=s[c][i[c]]):(o[c].push({...u,content:u.content.slice(0,l)}),a[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return e}function ut(t,e,n){let r,s,o,i,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:f="css-vars"}=n,h=Object.entries(n.themes).filter(y=>y[1]).map(y=>({color:y[0],theme:y[1]})).sort((y,m)=>y.color===c?-1:m.color===c?1:0);if(h.length===0)throw new F("`themes` option must not be empty");const d=Zr(t,e,n);if(l=Ge(d),c&&fn!==c&&!h.find(y=>y.color===c))throw new F(`\`themes\` option must contain the defaultColor key \`${c}\``);const p=h.map(y=>t.getTheme(y.theme)),b=h.map(y=>y.color);o=d.map(y=>y.map(m=>Fi(m,b,u,c,f))),l&&pt(o,l);const w=h.map(y=>at(y.theme,n));s=Fn(h,p,w,u,c,"fg",f),r=Fn(h,p,w,u,c,"bg",f),i=`shiki-themes ${p.map(y=>y.name).join(" ")}`,a=c?void 0:[s,r].join(";")}else if("theme"in n){const c=at(n.theme,n);o=hn(t,e,n);const u=t.getTheme(n.theme);r=ae(u.bg,c),s=ae(u.fg,c),i=u.name,l=Ge(o)}else throw new F("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:i,rootStyle:a,grammarState:l}}function Fn(t,e,n,r,s,o,i){return t.map((a,l)=>{const c=ae(e[l][o],n[l])||"inherit",u=`${r+a.color}${o==="bg"?"-bg":""}:${c}`;if(l===0&&s){if(s===fn&&t.length>1){const f=t.findIndex(b=>b.color==="light"),h=t.findIndex(b=>b.color==="dark");if(f===-1||h===-1)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const d=ae(e[f][o],n[f])||"inherit",p=ae(e[h][o],n[h])||"inherit";return`light-dark(${d}, ${p});${u}`}return c}return i==="css-vars"?u:null}).filter(a=>!!a).join(";")}function ft(t,e,n,r={meta:{},options:n,codeToHast:(s,o)=>ft(t,s,o),codeToTokens:(s,o)=>ut(t,s,o)}){let s=e;for(const p of ct(n))s=p.preprocess?.call(r,s,n)||s;let{tokens:o,fg:i,bg:a,themeName:l,rootStyle:c,grammarState:u}=ut(t,s,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:h=!1}=n;f===!0?o=ca(o):f==="never"&&(o=ua(o)),h&&(o=fa(o));const d={...r,get source(){return s}};for(const p of ct(n))o=p.tokens?.call(d,o)||o;return la(o,{...n,fg:i,bg:a,themeName:l,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},d,u)}function la(t,e,n,r=Ge(t)){const s=ct(e),o=[],i={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=e,c={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?c.style=e.rootStyle:c.style=`background-color:${e.bg};color:${e.fg}`),l!==!1&&l!=null&&(c.tabindex=l.toString());for(const[b,w]of Object.entries(e.meta||{}))b.startsWith("_")||(c[b]=w);let u={type:"element",tagName:"pre",properties:c,children:[]},f={type:"element",tagName:"code",properties:{},children:o};const h=[],d={...n,structure:a,addClassToHast:Vr,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return i},get pre(){return u},get code(){return f},get lines(){return h}};if(t.forEach((b,w)=>{w&&(a==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&o.push({type:"text",value:`
12
- `}));let y={type:"element",tagName:"span",properties:{class:"line"},children:[]},m=0;for(const g of b){let _={type:"element",tagName:"span",properties:{...g.htmlAttrs},children:[{type:"text",value:g.content}]};const S=Kt(g.htmlStyle||lt(g));S&&(_.properties.style=S);for(const x of s)_=x?.span?.call(d,_,w+1,m,y,g)||_;a==="inline"?i.children.push(_):a==="classic"&&y.children.push(_),m+=g.content.length}if(a==="classic"){for(const g of s)y=g?.line?.call(d,y,w+1)||y;h.push(y),o.push(y)}else a==="inline"&&h.push(y)}),a==="classic"){for(const b of s)f=b?.code?.call(d,f)||f;u.children.push(f);for(const b of s)u=b?.pre?.call(d,u)||u;i.children.push(u)}else if(a==="inline"){const b=[];let w={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const g of i.children)g.type==="element"&&g.tagName==="br"?(b.push(w),w={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(g.type==="element"||g.type==="text")&&w.children.push(g);b.push(w);let m={type:"element",tagName:"code",properties:{},children:b};for(const g of s)m=g?.code?.call(d,m)||m;i.children=[];for(let g=0;g<m.children.length;g++){g>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const _=m.children[g];_.type==="element"&&i.children.push(..._.children)}}let p=i;for(const b of s)p=b?.root?.call(d,p)||p;return r&&pt(p,r),p}function ca(t){return t.map(e=>{const n=[];let r="",s;return e.forEach((o,i)=>{const l=!(o.fontStyle&&(o.fontStyle&W.Underline||o.fontStyle&W.Strikethrough));l&&o.content.match(/^\s+$/)&&e[i+1]?(s===void 0&&(s=o.offset),r+=o.content):r?(l?n.push({...o,offset:s,content:r+o.content}):n.push({content:r,offset:s},o),s=void 0,r=""):n.push(o)}),n})}function ua(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,o,i]=r;if(!s&&!i)return n;const a=[{...n,offset:n.offset+s.length,content:o}];return s&&a.unshift({content:s,offset:n.offset}),i&&a.push({content:i,offset:n.offset+s.length+o.length}),a}))}function fa(t){return t.map(e=>{const n=[];for(const r of e){if(n.length===0){n.push({...r});continue}const s=n[n.length-1],o=Kt(s.htmlStyle||lt(s)),i=Kt(r.htmlStyle||lt(r)),a=s.fontStyle&&(s.fontStyle&W.Underline||s.fontStyle&W.Strikethrough),l=r.fontStyle&&(r.fontStyle&W.Underline||r.fontStyle&W.Strikethrough);!a&&!l&&o===i?s.content+=r.content:n.push({...r})}return n})}const ha=Ri;function da(t,e,n){const r={meta:{},options:n,codeToHast:(o,i)=>ft(t,o,i),codeToTokens:(o,i)=>ut(t,o,i)};let s=ha(ft(t,e,n,r));for(const o of ct(n))s=o.postprocess?.call(r,s,n)||s;return s}const Un={light:"#333333",dark:"#bbbbbb"},jn={light:"#fffffe",dark:"#1e1e1e"},Wn="__shiki_resolved";function pn(t){if(t?.[Wn])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){const a=e.settings?e.settings.find(l=>!l.name&&!l.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?Un.light:Un.dark),n||(n=e.type==="light"?jn.light:jn.dark),e.fg=r,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const o=new Map;function i(a){if(o.has(a))return o.get(a);s+=1;const l=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${l}`]?i(a):(o.set(a,l),l)}e.settings=e.settings.map(a=>{const l=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),c=a.settings?.background&&!a.settings.background.startsWith("#");if(!l&&!c)return a;const u={...a,settings:{...a.settings}};if(l){const f=i(a.settings.foreground);e.colorReplacements[f]=a.settings.foreground,u.settings.foreground=f}if(c){const f=i(a.settings.background);e.colorReplacements[f]=a.settings.background,u.settings.background=f}return u});for(const a of Object.keys(e.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!e.colors[a]?.startsWith("#")){const l=i(e.colors[a]);e.colorReplacements[l]=e.colors[a],e.colors[a]=l}return Object.defineProperty(e,Wn,{enumerable:!1,writable:!1,value:!0}),e}async function Qr(t){return Array.from(new Set((await Promise.all(t.filter(e=>!Ti(e)).map(async e=>await qr(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Yr(t){return(await Promise.all(t.map(async n=>Mi(n)?null:pn(await qr(n))))).filter(n=>!!n)}let pa=3;function ga(t,e=3){e>pa||console.trace(`[SHIKI DEPRECATE]: ${t}`)}let Ce=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Jr(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new Ce(`Circular alias \`${Array.from(n).join(" -> ")} -> ${t}\``);n.add(t)}}return t}class ma extends mo{constructor(e,n,r,s={}){super(e),this._resolver=e,this._themes=n,this._langs=r,this._alias=s,this._themes.map(o=>this.loadTheme(o)),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 typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const n=pn(e);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let n=this._textmateThemeCache.get(e);n||(n=nt.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){return e=Jr(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const n=new Set([...this._langMap.values()].filter(o=>o.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(o=>{this._alias[o]=e.name}),this._loadedLanguagesCache=null,n.size)for(const o of n)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const n=Array.from(this._langGraph.entries()),r=n.filter(([s,o])=>!o);if(r.length){const s=n.filter(([o,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(l=>r.map(([c])=>c).includes(l)):!1).filter(o=>!r.includes(o));throw new Ce(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${s.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[s,o]of n)this._resolver.addLanguage(o);for(const[s,o]of n)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const n=e.embeddedLanguages??e.embeddedLangs;if(n)for(const r of n)this._langGraph.set(r,this._langMap.get(r))}}class ya{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,n){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.forEach(r=>this.addLanguage(r))}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(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let s=1;s<=n.length;s++){const o=n.slice(0,s).join(".");r=[...r,...this._injections.get(o)||[]]}return r}}let Re=0;function ba(t){Re+=1,t.warnings!==!1&&Re>=10&&Re%10===0&&console.warn(`[Shiki] ${Re} 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 e=!1;if(!t.engine)throw new Ce("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(pn),s=new ya(t.engine,n),o=new ma(s,r,n,t.langAlias);let i;function a(g){return Jr(g,t.langAlias)}function l(g){y();const _=o.getGrammar(typeof g=="string"?g:g.name);if(!_)throw new Ce(`Language \`${g}\` not found, you may need to load it first`);return _}function c(g){if(g==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};y();const _=o.getTheme(g);if(!_)throw new Ce(`Theme \`${g}\` not found, you may need to load it first`);return _}function u(g){y();const _=c(g);i!==g&&(o.setTheme(_),i=g);const S=o.getColorMap();return{theme:_,colorMap:S}}function f(){return y(),o.getLoadedThemes()}function h(){return y(),o.getLoadedLanguages()}function d(...g){y(),o.loadLanguages(g.flat(1))}async function p(...g){return d(await Qr(g))}function b(...g){y();for(const _ of g.flat(1))o.loadTheme(_)}async function w(...g){return y(),b(await Yr(g))}function y(){if(e)throw new Ce("Shiki instance has been disposed")}function m(){e||(e=!0,o.dispose(),Re-=1)}return{setTheme:u,getTheme:c,getLanguage:l,getLoadedThemes:f,getLoadedLanguages:h,resolveLangAlias:a,loadLanguage:p,loadLanguageSync:d,loadTheme:w,loadThemeSync:b,dispose:m,[Symbol.dispose]:m}}async function wa(t){t.engine||ga("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,r]=await Promise.all([Yr(t.themes||[]),Qr(t.langs||[]),t.engine]);return ba({...t,themes:e,langs:n,engine:r})}async function Ca(t){const e=await wa(t);return{getLastGrammarState:(...n)=>ta(e,...n),codeToTokensBase:(n,r)=>hn(e,n,r),codeToTokensWithThemes:(n,r)=>Zr(e,n,r),codeToTokens:(n,r)=>ut(e,n,r),codeToHast:(n,r)=>ft(e,n,r),codeToHtml:(n,r)=>da(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function Ee(t){if([...t].length!==1)throw new Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}function _a(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}const gn=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),U=String.raw;function Ae(t,e){if(t==null)throw new Error(e??"Value expected");return t}const es=U`\[\^?`,ts=`c.? | C(?:-.?)?|${U`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${U`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${U`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${U`o\{[^\}]*\}?`}|${U`\d{1,3}`}`,mn=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Xe=new RegExp(U`
11
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function wi(t,e,n,r){const s=r.schema,o=s.space==="svg"?!1:r.settings.omitOptionalTags;let i=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;s.space==="html"&&t.tagName==="svg"&&(r.schema=Ur);const c=Ci(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(i=!1),(c||!o||!di(t,e,n))&&(a.push("<",t.tagName,c?" "+c:""),i&&(s.space==="svg"||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),!i&&(!o||!cn(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function Ci(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const o=_i(t,s,e[s]);o&&n.push(o)}}for(;++r<n.length;){const o=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function _i(t,e,n){const r=xo(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,o=t.settings.allowDangerousCharacters?0:1;let i=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Se(r.attribute,Object.assign({},t.settings.characterReferences,{subset:Ve.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Zo:Qo)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=Se(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Ve.unquoted[s][o]}))),a!==n&&(t.settings.quoteSmart&&Mn(n,i)>Mn(n,t.alternative)&&(i=t.alternative),a=i+Se(n,Object.assign({},t.settings.characterReferences,{subset:(i==="'"?Ve.single:Ve.double)[s][o],attribute:!0}))+i),l+(a&&"="+a))}const Si=["<","&"];function qr(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:Se(t.value,Object.assign({},r.settings.characterReferences,{subset:Si}))}function ki(t,e,n,r){return r.settings.allowDangerousHtml?t.value:qr(t,e,n,r)}function xi(t,e,n,r){return r.all(t)}const vi=Ao("type",{invalid:Ii,unknown:Ei,handlers:{comment:Xo,doctype:Ko,element:wi,raw:ki,root:xi,text:qr}});function Ii(t){throw new Error("Expected node, not `"+t+"`")}function Ei(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Ai={},Li={},Ri=[];function Ni(t,e){const n=e||Ai,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Pi,all:$i,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||bo,characterReferences:n.characterReferences||Li,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Ur:Eo,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function Pi(t,e,n){return vi(t,e,n,this)}function $i(t){const e=[],n=t&&t.children||Ri;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function at(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[s,o]of Object.entries(e?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function ae(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function Ti(t){return Array.isArray(t)?t:[t]}async function Vr(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function un(t){return!t||["plaintext","txt","text","plain"].includes(t)}function Mi(t){return t==="ansi"||un(t)}function fn(t){return t==="none"}function Oi(t){return fn(t)}function Xr(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const r of n)r&&!t.properties.class.includes(r)&&t.properties.class.push(r);return t}function dt(t,e=!1){if(t.length===0)return[["",0]];const n=t.split(/(\r?\n)/g);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const i=e?n[o]+(n[o+1]||""):n[o];s.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}function Di(t){const e=dt(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e[e.length-1].length};let o=s,i=0;for(const a of e){if(o<a.length)break;o-=a.length,i++}return{line:i,character:o}}function r(s,o){let i=0;for(let a=0;a<s;a++)i+=e[a].length;return i+=o,i}return{lines:e,indexToPos:n,posToIndex:r}}const hn="light-dark()",Gi=["color","background-color"];function Bi(t,e){let n=0;const r=[];for(const s of e)s>n&&r.push({...t,content:t.content.slice(n,s),offset:t.offset+n}),n=s;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function Fi(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return n.length?t.map(r=>r.flatMap(s=>{const o=n.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,a)=>i-a);return o.length?Bi(s,o):s})):t}function Ui(t,e,n,r,s="css-vars"){const o={content:t.content,explanation:t.explanation,offset:t.offset},i=e.map(u=>lt(t.variants[u])),a=new Set(i.flatMap(u=>Object.keys(u))),l={},c=(u,f)=>{const h=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+e[u]+(f==="color"?"":h)};return i.forEach((u,f)=>{for(const h of a){const d=u[h]||"inherit";if(f===0&&r&&Gi.includes(h))if(r===hn&&i.length>1){const p=e.findIndex(m=>m==="light"),b=e.findIndex(m=>m==="dark");if(p===-1||b===-1)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const w=i[p][h]||"inherit",y=i[b][h]||"inherit";l[h]=`light-dark(${w}, ${y})`,s==="css-vars"&&(l[c(f,h)]=d)}else l[h]=d;else s==="css-vars"&&(l[c(f,h)]=d)}}),o.htmlStyle=l,o}function lt(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&W.Italic&&(e["font-style"]="italic"),t.fontStyle&W.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&W.Underline&&n.push("underline"),t.fontStyle&W.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function Zt(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}const Kr=new WeakMap;function pt(t,e){Kr.set(t,e)}function Ge(t){return Kr.get(t)}class Ie{_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,n){return new Ie(Object.fromEntries(Ti(n).map(r=>[r,Ht])),e)}constructor(...e){if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return ji(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function ji(t){const e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(t),e}function Wi(t,e){if(!(t instanceof Ie))throw new F("Invalid grammar state");return t.getInternalStack(e)}function zi(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new F(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...s.indexToPos(i),offset:i}}else{const a=s.lines[i.line];if(a===void 0)throw new F(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${s.lines.length}`);let l=i.character;if(l<0&&(l=a.length+l),l<0||l>a.length)throw new F(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${a.length}`);return{...i,character:l,offset:s.posToIndex(i.line,l)}}};const s=Di(n.source),o=(n.options.decorations||[]).map(i=>({...i,start:r(i.start),end:r(i.end)}));Hi(o),t.set(n.meta,{decorations:o,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(i=>[i.start.offset,i.end.offset]);return Fi(n,s)},code(n){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(n.children).filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new F(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function o(u,f,h,d){const p=s[u];let b="",w=-1,y=-1;if(f===0&&(w=0),h===0&&(y=0),h===Number.POSITIVE_INFINITY&&(y=p.children.length),w===-1||y===-1)for(let g=0;g<p.children.length;g++)b+=Zr(p.children[g]),w===-1&&b.length===f&&(w=g+1),y===-1&&b.length===h&&(y=g+1);if(w===-1)throw new F(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(y===-1)throw new F(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const m=p.children.slice(w,y);if(!d.alwaysWrap&&m.length===p.children.length)a(p,d,"line");else if(!d.alwaysWrap&&m.length===1&&m[0].type==="element")a(m[0],d,"token");else{const g={type:"element",tagName:"span",properties:{},children:m};a(g,d,"wrapper"),p.children.splice(w,m.length,g)}}function i(u,f){s[u]=a(s[u],f,"line")}function a(u,f,h){const d=f.properties||{},p=f.transform||(b=>b);return u.tagName=f.tagName||"span",u.properties={...u.properties,...d,class:u.properties.class},f.properties?.class&&Xr(u,f.properties.class),u=p(u,h)||u,u}const l=[],c=r.decorations.sort((u,f)=>f.start.offset-u.start.offset||u.end.offset-f.end.offset);for(const u of c){const{start:f,end:h}=u;if(f.line===h.line)o(f.line,f.character,h.character,u);else if(f.line<h.line){o(f.line,f.character,Number.POSITIVE_INFINITY,u);for(let d=f.line+1;d<h.line;d++)l.unshift(()=>i(d,u));o(h.line,0,h.character,u)}}l.forEach(u=>u())}}}function Hi(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new F(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){const s=t[r],o=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,i=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,a=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,l=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||i||a||l){if(o&&i||a&&l||a&&n.start.offset===n.end.offset||i&&s.start.offset===s.end.offset)continue;throw new F(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Zr(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(Zr).join(""):""}const qi=[zi()];function ct(t){const e=Vi(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...qi]}function Vi(t){const e=[],n=[],r=[];for(const s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var fe=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],At={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Xi(t,e){const n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){const r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function Bn(t){const e=t.shift();if(e==="2"){const n=t.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function Ki(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)e.push({type:"resetAll"});else if(r<=9)At[r]&&e.push({type:"setDecoration",value:At[r]});else if(r<=29){const s=At[r-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:fe[r-30]}});else if(r===38){const s=Bn(t);s&&e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:fe[r-40]}});else if(r===48){const s=Bn(t);s&&e.push({type:"setBackgroundColor",value:s})}else r===49?e.push({type:"resetBackgroundColor"}):r===53?e.push({type:"setDecoration",value:"overline"}):r===55?e.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?e.push({type:"setForegroundColor",value:{type:"named",name:fe[r-90+8]}}):r>=100&&r<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:fe[r-100+8]}})}return e}function Zi(){let t=null,e=null,n=new Set;return{parse(r){const s=[];let o=0;do{const i=Xi(r,o),a=i.sequence?r.substring(o,i.startPosition):r.substring(o);if(a.length>0&&s.push({value:a,foreground:t,background:e,decorations:new Set(n)}),i.sequence){const l=Ki(i.sequence);for(const c of l)c.type==="resetAll"?(t=null,e=null,n.clear()):c.type==="resetForegroundColor"?t=null:c.type==="resetBackgroundColor"?e=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of l)c.type==="setForegroundColor"?t=c.value:c.type==="setBackgroundColor"?e=c.value:c.type==="setDecoration"&&n.add(c.value)}o=i.position}while(o<r.length);return s}}}var Qi={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 Yi(t=Qi){function e(a){return t[a]}function n(a){return`#${a.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let c=0;c<fe.length;c++)r.push(e(fe[c]));let a=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let f=0;f<6;f++)r.push(n([a[c],a[u],a[f]]));let l=8;for(let c=0;c<24;c++,l+=10)r.push(n([l,l,l]));return r}function o(a){return s()[a]}function i(a){switch(a.type){case"named":return e(a.name);case"rgb":return n(a.rgb);case"table":return o(a.index)}}return{value:i}}const Ji={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function ea(t,e,n){const r=at(t,n),s=dt(e),o=Object.fromEntries(fe.map(l=>{const c=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`,u=t.colors?.[c];return[l,u||Ji[l]]})),i=Yi(o),a=Zi();return s.map(l=>a.parse(l[0]).map(c=>{let u,f;c.decorations.has("reverse")?(u=c.background?i.value(c.background):t.bg,f=c.foreground?i.value(c.foreground):t.fg):(u=c.foreground?i.value(c.foreground):t.fg,f=c.background?i.value(c.background):void 0),u=ae(u,r),f=ae(f,r),c.decorations.has("dim")&&(u=ta(u));let h=W.None;return c.decorations.has("bold")&&(h|=W.Bold),c.decorations.has("italic")&&(h|=W.Italic),c.decorations.has("underline")&&(h|=W.Underline),c.decorations.has("strikethrough")&&(h|=W.Strikethrough),{content:c.value,offset:l[1],color:u,bgColor:f,fontStyle:h}}))}function ta(t){const e=t.match(/#([0-9a-f]{3,8})/i);if(e){const r=e[1];if(r.length===8){const s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const s=r[0],o=r[1],i=r[2],a=r[3],l=Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0");return`#${s}${s}${o}${o}${i}${i}${l}`}else if(r.length===3){const s=r[0],o=r[1],i=r[2];return`#${s}${s}${o}${o}${i}${i}80`}}}const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function dn(t,e,n={}){const{theme:r=t.getLoadedThemes()[0]}=n,s=t.resolveLangAlias(n.lang||"text");if(un(s)||fn(r))return dt(e).map(l=>[{content:l[0],offset:l[1]}]);const{theme:o,colorMap:i}=t.setTheme(r);if(s==="ansi")return ea(o,e,n);const a=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==a.name)throw new F(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(o.name))throw new F(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return ra(e,a,o,i,n)}function na(...t){if(t.length===2)return Ge(t[1]);const[e,n,r={}]=t,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(un(s)||fn(o))throw new F("Plain language does not have grammar state");if(s==="ansi")throw new F("ANSI language does not have grammar state");const{theme:i,colorMap:a}=e.setTheme(o),l=e.getLanguage(s);return new Ie(pn(n,l,i,a,r).stateStack,l.name,i.name)}function ra(t,e,n,r,s){const o=pn(t,e,n,r,s),i=new Ie(o.stateStack,e.name,n.name);return pt(o.tokens,i),o.tokens}function pn(t,e,n,r,s){const o=at(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500}=s,l=dt(t);let c=s.grammarState?Wi(s.grammarState,n.name)??Ht:s.grammarContextCode!=null?pn(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Ht,u=[];const f=[];for(let h=0,d=l.length;h<d;h++){const[p,b]=l[h];if(p===""){u=[],f.push([]);continue}if(i>0&&p.length>=i){u=[],f.push([{content:p,offset:b,color:"",fontStyle:0}]);continue}let w,y,m;s.includeExplanation&&(w=e.tokenizeLine(p,c,a),y=w.tokens,m=0);const g=e.tokenizeLine2(p,c,a),_=g.tokens.length/2;for(let S=0;S<_;S++){const x=g.tokens[2*S],A=S+1<_?g.tokens[2*S+2]:p.length;if(x===A)continue;const k=g.tokens[2*S+1],N=ae(r[ke.getForeground(k)],o),L=ke.getFontStyle(k),T={content:p.substring(x,A),offset:b+x,color:N,fontStyle:L};if(s.includeExplanation){const R=[];if(s.includeExplanation!=="scopeName")for(const E of n.settings){let X;switch(typeof E.scope){case"string":X=E.scope.split(/,/).map(Le=>Le.trim());break;case"object":X=E.scope;break;default:continue}R.push({settings:E,selectors:X.map(Le=>Le.split(/ /))})}T.explanation=[];let z=0;for(;x+z<A;){const E=y[m],X=p.substring(E.startIndex,E.endIndex);z+=X.length,T.explanation.push({content:X,scopes:s.includeExplanation==="scopeName"?sa(E.scopes):oa(R,E.scopes)}),m+=1}}u.push(T)}f.push(u),u=[],c=g.ruleStack}return{tokens:f,stateStack:c}}function sa(t){return t.map(e=>({scopeName:e}))}function oa(t,e){const n=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];n[r]={scopeName:o,themeMatches:aa(t,o,e.slice(0,r))}}return n}function Fn(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function ia(t,e,n){if(!Fn(t[t.length-1],e))return!1;let r=t.length-2,s=n.length-1;for(;r>=0&&s>=0;)Fn(t[r],n[s])&&(r-=1),s-=1;return r===-1}function aa(t,e,n){const r=[];for(const{selectors:s,settings:o}of t)for(const i of s)if(ia(i,e,n)){r.push(o);break}return r}function Qr(t,e,n){const r=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),s=r.map(l=>{const c=dn(t,e,{...n,theme:l.theme}),u=Ge(c),f=typeof l.theme=="string"?l.theme:l.theme.name;return{tokens:c,state:u,theme:f}}),o=la(...s.map(l=>l.tokens)),i=o[0].map((l,c)=>l.map((u,f)=>{const h={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(h.explanation=u.explanation),o.forEach((d,p)=>{const{content:b,explanation:w,offset:y,...m}=d[c][f];h.variants[r[p].color]=m}),h})),a=s[0].state?new Ie(Object.fromEntries(s.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),s[0].state.lang):void 0;return a&&pt(i,a),i}function la(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){const s=t.map(l=>l[r]),o=e.map(()=>[]);e.forEach((l,c)=>l.push(o[c]));const i=s.map(()=>0),a=s.map(l=>l[0]);for(;a.every(l=>l);){const l=Math.min(...a.map(c=>c.content.length));for(let c=0;c<n;c++){const u=a[c];u.content.length===l?(o[c].push(u),i[c]+=1,a[c]=s[c][i[c]]):(o[c].push({...u,content:u.content.slice(0,l)}),a[c]={...u,content:u.content.slice(l),offset:u.offset+l})}}}return e}function ut(t,e,n){let r,s,o,i,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:f="css-vars"}=n,h=Object.entries(n.themes).filter(y=>y[1]).map(y=>({color:y[0],theme:y[1]})).sort((y,m)=>y.color===c?-1:m.color===c?1:0);if(h.length===0)throw new F("`themes` option must not be empty");const d=Qr(t,e,n);if(l=Ge(d),c&&hn!==c&&!h.find(y=>y.color===c))throw new F(`\`themes\` option must contain the defaultColor key \`${c}\``);const p=h.map(y=>t.getTheme(y.theme)),b=h.map(y=>y.color);o=d.map(y=>y.map(m=>Ui(m,b,u,c,f))),l&&pt(o,l);const w=h.map(y=>at(y.theme,n));s=Un(h,p,w,u,c,"fg",f),r=Un(h,p,w,u,c,"bg",f),i=`shiki-themes ${p.map(y=>y.name).join(" ")}`,a=c?void 0:[s,r].join(";")}else if("theme"in n){const c=at(n.theme,n);o=dn(t,e,n);const u=t.getTheme(n.theme);r=ae(u.bg,c),s=ae(u.fg,c),i=u.name,l=Ge(o)}else throw new F("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:i,rootStyle:a,grammarState:l}}function Un(t,e,n,r,s,o,i){return t.map((a,l)=>{const c=ae(e[l][o],n[l])||"inherit",u=`${r+a.color}${o==="bg"?"-bg":""}:${c}`;if(l===0&&s){if(s===hn&&t.length>1){const f=t.findIndex(b=>b.color==="light"),h=t.findIndex(b=>b.color==="dark");if(f===-1||h===-1)throw new F('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const d=ae(e[f][o],n[f])||"inherit",p=ae(e[h][o],n[h])||"inherit";return`light-dark(${d}, ${p});${u}`}return c}return i==="css-vars"?u:null}).filter(a=>!!a).join(";")}function ft(t,e,n,r={meta:{},options:n,codeToHast:(s,o)=>ft(t,s,o),codeToTokens:(s,o)=>ut(t,s,o)}){let s=e;for(const p of ct(n))s=p.preprocess?.call(r,s,n)||s;let{tokens:o,fg:i,bg:a,themeName:l,rootStyle:c,grammarState:u}=ut(t,s,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:h=!1}=n;f===!0?o=ua(o):f==="never"&&(o=fa(o)),h&&(o=ha(o));const d={...r,get source(){return s}};for(const p of ct(n))o=p.tokens?.call(d,o)||o;return ca(o,{...n,fg:i,bg:a,themeName:l,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},d,u)}function ca(t,e,n,r=Ge(t)){const s=ct(e),o=[],i={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=e,c={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?c.style=e.rootStyle:c.style=`background-color:${e.bg};color:${e.fg}`),l!==!1&&l!=null&&(c.tabindex=l.toString());for(const[b,w]of Object.entries(e.meta||{}))b.startsWith("_")||(c[b]=w);let u={type:"element",tagName:"pre",properties:c,children:[]},f={type:"element",tagName:"code",properties:{},children:o};const h=[],d={...n,structure:a,addClassToHast:Xr,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return i},get pre(){return u},get code(){return f},get lines(){return h}};if(t.forEach((b,w)=>{w&&(a==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&o.push({type:"text",value:`
12
+ `}));let y={type:"element",tagName:"span",properties:{class:"line"},children:[]},m=0;for(const g of b){let _={type:"element",tagName:"span",properties:{...g.htmlAttrs},children:[{type:"text",value:g.content}]};const S=Zt(g.htmlStyle||lt(g));S&&(_.properties.style=S);for(const x of s)_=x?.span?.call(d,_,w+1,m,y,g)||_;a==="inline"?i.children.push(_):a==="classic"&&y.children.push(_),m+=g.content.length}if(a==="classic"){for(const g of s)y=g?.line?.call(d,y,w+1)||y;h.push(y),o.push(y)}else a==="inline"&&h.push(y)}),a==="classic"){for(const b of s)f=b?.code?.call(d,f)||f;u.children.push(f);for(const b of s)u=b?.pre?.call(d,u)||u;i.children.push(u)}else if(a==="inline"){const b=[];let w={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const g of i.children)g.type==="element"&&g.tagName==="br"?(b.push(w),w={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(g.type==="element"||g.type==="text")&&w.children.push(g);b.push(w);let m={type:"element",tagName:"code",properties:{},children:b};for(const g of s)m=g?.code?.call(d,m)||m;i.children=[];for(let g=0;g<m.children.length;g++){g>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const _=m.children[g];_.type==="element"&&i.children.push(..._.children)}}let p=i;for(const b of s)p=b?.root?.call(d,p)||p;return r&&pt(p,r),p}function ua(t){return t.map(e=>{const n=[];let r="",s;return e.forEach((o,i)=>{const l=!(o.fontStyle&&(o.fontStyle&W.Underline||o.fontStyle&W.Strikethrough));l&&o.content.match(/^\s+$/)&&e[i+1]?(s===void 0&&(s=o.offset),r+=o.content):r?(l?n.push({...o,offset:s,content:r+o.content}):n.push({content:r,offset:s},o),s=void 0,r=""):n.push(o)}),n})}function fa(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,o,i]=r;if(!s&&!i)return n;const a=[{...n,offset:n.offset+s.length,content:o}];return s&&a.unshift({content:s,offset:n.offset}),i&&a.push({content:i,offset:n.offset+s.length+o.length}),a}))}function ha(t){return t.map(e=>{const n=[];for(const r of e){if(n.length===0){n.push({...r});continue}const s=n[n.length-1],o=Zt(s.htmlStyle||lt(s)),i=Zt(r.htmlStyle||lt(r)),a=s.fontStyle&&(s.fontStyle&W.Underline||s.fontStyle&W.Strikethrough),l=r.fontStyle&&(r.fontStyle&W.Underline||r.fontStyle&W.Strikethrough);!a&&!l&&o===i?s.content+=r.content:n.push({...r})}return n})}const da=Ni;function pa(t,e,n){const r={meta:{},options:n,codeToHast:(o,i)=>ft(t,o,i),codeToTokens:(o,i)=>ut(t,o,i)};let s=da(ft(t,e,n,r));for(const o of ct(n))s=o.postprocess?.call(r,s,n)||s;return s}const jn={light:"#333333",dark:"#bbbbbb"},Wn={light:"#fffffe",dark:"#1e1e1e"},zn="__shiki_resolved";function gn(t){if(t?.[zn])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){const a=e.settings?e.settings.find(l=>!l.name&&!l.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?jn.light:jn.dark),n||(n=e.type==="light"?Wn.light:Wn.dark),e.fg=r,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const o=new Map;function i(a){if(o.has(a))return o.get(a);s+=1;const l=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${l}`]?i(a):(o.set(a,l),l)}e.settings=e.settings.map(a=>{const l=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),c=a.settings?.background&&!a.settings.background.startsWith("#");if(!l&&!c)return a;const u={...a,settings:{...a.settings}};if(l){const f=i(a.settings.foreground);e.colorReplacements[f]=a.settings.foreground,u.settings.foreground=f}if(c){const f=i(a.settings.background);e.colorReplacements[f]=a.settings.background,u.settings.background=f}return u});for(const a of Object.keys(e.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!e.colors[a]?.startsWith("#")){const l=i(e.colors[a]);e.colorReplacements[l]=e.colors[a],e.colors[a]=l}return Object.defineProperty(e,zn,{enumerable:!1,writable:!1,value:!0}),e}async function Yr(t){return Array.from(new Set((await Promise.all(t.filter(e=>!Mi(e)).map(async e=>await Vr(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Jr(t){return(await Promise.all(t.map(async n=>Oi(n)?null:gn(await Vr(n))))).filter(n=>!!n)}let ga=3;function ma(t,e=3){e>ga||console.trace(`[SHIKI DEPRECATE]: ${t}`)}let Ce=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function es(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new Ce(`Circular alias \`${Array.from(n).join(" -> ")} -> ${t}\``);n.add(t)}}return t}class ya extends yo{constructor(e,n,r,s={}){super(e),this._resolver=e,this._themes=n,this._langs=r,this._alias=s,this._themes.map(o=>this.loadTheme(o)),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 typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const n=gn(e);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let n=this._textmateThemeCache.get(e);n||(n=nt.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){return e=es(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const n=new Set([...this._langMap.values()].filter(o=>o.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(o=>{this._alias[o]=e.name}),this._loadedLanguagesCache=null,n.size)for(const o of n)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const n=Array.from(this._langGraph.entries()),r=n.filter(([s,o])=>!o);if(r.length){const s=n.filter(([o,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(l=>r.map(([c])=>c).includes(l)):!1).filter(o=>!r.includes(o));throw new Ce(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${s.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[s,o]of n)this._resolver.addLanguage(o);for(const[s,o]of n)this.loadLanguage(o)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const n=e.embeddedLanguages??e.embeddedLangs;if(n)for(const r of n)this._langGraph.set(r,this._langMap.get(r))}}class ba{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,n){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.forEach(r=>this.addLanguage(r))}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(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let s=1;s<=n.length;s++){const o=n.slice(0,s).join(".");r=[...r,...this._injections.get(o)||[]]}return r}}let Re=0;function wa(t){Re+=1,t.warnings!==!1&&Re>=10&&Re%10===0&&console.warn(`[Shiki] ${Re} 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 e=!1;if(!t.engine)throw new Ce("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(gn),s=new ba(t.engine,n),o=new ya(s,r,n,t.langAlias);let i;function a(g){return es(g,t.langAlias)}function l(g){y();const _=o.getGrammar(typeof g=="string"?g:g.name);if(!_)throw new Ce(`Language \`${g}\` not found, you may need to load it first`);return _}function c(g){if(g==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};y();const _=o.getTheme(g);if(!_)throw new Ce(`Theme \`${g}\` not found, you may need to load it first`);return _}function u(g){y();const _=c(g);i!==g&&(o.setTheme(_),i=g);const S=o.getColorMap();return{theme:_,colorMap:S}}function f(){return y(),o.getLoadedThemes()}function h(){return y(),o.getLoadedLanguages()}function d(...g){y(),o.loadLanguages(g.flat(1))}async function p(...g){return d(await Yr(g))}function b(...g){y();for(const _ of g.flat(1))o.loadTheme(_)}async function w(...g){return y(),b(await Jr(g))}function y(){if(e)throw new Ce("Shiki instance has been disposed")}function m(){e||(e=!0,o.dispose(),Re-=1)}return{setTheme:u,getTheme:c,getLanguage:l,getLoadedThemes:f,getLoadedLanguages:h,resolveLangAlias:a,loadLanguage:p,loadLanguageSync:d,loadTheme:w,loadThemeSync:b,dispose:m,[Symbol.dispose]:m}}async function Ca(t){t.engine||ma("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,r]=await Promise.all([Jr(t.themes||[]),Yr(t.langs||[]),t.engine]);return wa({...t,themes:e,langs:n,engine:r})}async function _a(t){const e=await Ca(t);return{getLastGrammarState:(...n)=>na(e,...n),codeToTokensBase:(n,r)=>dn(e,n,r),codeToTokensWithThemes:(n,r)=>Qr(e,n,r),codeToTokens:(n,r)=>ut(e,n,r),codeToHast:(n,r)=>ft(e,n,r),codeToHtml:(n,r)=>pa(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function Ee(t){if([...t].length!==1)throw new Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}function Sa(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}const mn=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),U=String.raw;function Ae(t,e){if(t==null)throw new Error(e??"Value expected");return t}const ts=U`\[\^?`,ns=`c.? | C(?:-.?)?|${U`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${U`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${U`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${U`o\{[^\}]*\}?`}|${U`\d{1,3}`}`,yn=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Xe=new RegExp(U`
13
13
  \\ (?:
14
- ${ts}
14
+ ${ns}
15
15
  | [gk]<[^>]*>?
16
16
  | [gk]'[^']*'?
17
17
  | .
@@ -28,20 +28,20 @@ let F=class extends Error{constructor(e){super(e),this.name="ShikiError"}};funct
28
28
  )?
29
29
  | \*[^\)]*\)?
30
30
  )?
31
- | (?:${mn.source})+
32
- | ${es}
31
+ | (?:${yn.source})+
32
+ | ${ts}
33
33
  | .
34
- `.replace(/\s+/g,""),"gsu"),At=new RegExp(U`
34
+ `.replace(/\s+/g,""),"gsu"),Lt=new RegExp(U`
35
35
  \\ (?:
36
- ${ts}
36
+ ${ns}
37
37
  | .
38
38
  )
39
39
  | \[:(?:\^?\p{Alpha}+|\^):\]
40
- | ${es}
40
+ | ${ts}
41
41
  | &&
42
42
  | .
43
- `.replace(/\s+/g,""),"gsu");function Sa(t,e={}){const n={flags:"",...e,rules:{captureGroup:!1,singleline:!1,...e.rules}};if(typeof t!="string")throw new Error("String expected as pattern");const r=Ua(n.flags),s=[r.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(f){s.push(f)},replaceCurrentModX(f){s[s.length-1]=f},singleline:n.rules.singleline};let i=[],a;for(Xe.lastIndex=0;a=Xe.exec(t);){const f=ka(o,t,a[0],Xe.lastIndex);f.tokens?i.push(...f.tokens):f.token&&i.push(f.token),f.lastIndex!==void 0&&(Xe.lastIndex=f.lastIndex)}const l=[];let c=0;i.filter(f=>f.type==="GroupOpen").forEach(f=>{f.kind==="capturing"?f.number=++c:f.raw==="("&&l.push(f)}),c||l.forEach((f,h)=>{f.kind="capturing",f.number=h+1});const u=c||l.length;return{tokens:i.map(f=>f.type==="EscapedNumber"?Wa(f,u):f).flat(),flags:r}}function ka(t,e,n,r){const[s,o]=n;if(n==="["||n==="[^"){const i=xa(e,n,r);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:zn(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Ta(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:rs(n)}}if(o==="K")return{token:ss("keep",n)};if(o==="N"||o==="R")return{token:he("newline",n,{negate:o==="N"})};if(o==="O")return{token:he("any",n)};if(o==="X")return{token:he("text_segment",n)};const i=ns(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(s==="("){if(o==="*")return{token:Ga(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(e[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Da(n,t)};if(t.pushModX(t.getCurrentModX()),t.numOpenGroups++,n==="("&&!t.captureGroup||n==="(?:")return{token:be("group",n)};if(n==="(?>")return{token:be("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:be(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&t.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:be("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:be("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(t.popModX(),t.numOpenGroups--,t.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Na(n)}}if(t.getCurrentModX()){if(n==="#"){const i=e.indexOf(`
44
- `,r);return{lastIndex:i===-1?e.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=r,{lastIndex:i.exec(e)?i.lastIndex:r}}}if(n===".")return{token:he("dot",n)};if(n==="^"||n==="$"){const i=t.singleline?{"^":U`\A`,$:U`\Z`}[n]:n;return{token:zn(i,n)}}return n==="|"?{token:Ia(n)}:mn.test(n)?{tokens:za(n)}:{token:re(Ee(n),n)}}function xa(t,e,n){const r=[Hn(e[1]==="^",e)];let s=1,o;for(At.lastIndex=n;o=At.exec(t);){const i=o[0];if(i[0]==="["&&i[1]!==":")s++,r.push(Hn(i[1]==="^",i));else if(i==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(re(93,i));else if(s--,r.push(Ea(i)),!s)break}else{const a=va(i);Array.isArray(a)?r.push(...a):r.push(a)}}return{tokens:r,lastIndex:At.lastIndex||t.length}}function va(t){if(t[0]==="\\")return ns(t,{inCharClass:!0});if(t[0]==="["){const e=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(t);if(!e||!gn.has(e.groups.name))throw new Error(`Invalid POSIX class "${t}"`);return he("posix",t,{value:e.groups.name,negate:!!e.groups.negate})}return t==="-"?Aa(t):t==="&&"?La(t):re(Ee(t),t)}function ns(t,{inCharClass:e}){const n=t[1];if(n==="c"||n==="C")return Oa(t);if("dDhHsSwW".includes(n))return Ba(t);if(t.startsWith(U`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${t}"`);if(/^\\[pP]\{/.test(t)){if(t.length===3)throw new Error(`Incomplete or invalid Unicode property "${t}"`);return Fa(t)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(t))try{const r=t.split(/\\x/).slice(1).map(i=>parseInt(i,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(r)),o=new TextEncoder;return[...s].map(i=>{const a=[...o.encode(i)].map(l=>`\\x${l.toString(16)}`).join("");return re(Ee(i),a)})}catch{throw new Error(`Multibyte code "${t}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return re(ja(t),t);if(qn.has(n))return re(qn.get(n),t);if(/\d/.test(n))return Ra(e,t);if(t==="\\")throw new Error(U`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${t}"`);if([...t].length===2)return re(t.codePointAt(1),t);throw new Error(`Unexpected escape "${t}"`)}function Ia(t){return{type:"Alternator",raw:t}}function zn(t,e){return{type:"Assertion",kind:t,raw:e}}function rs(t){return{type:"Backreference",raw:t}}function re(t,e){return{type:"Character",value:t,raw:e}}function Ea(t){return{type:"CharacterClassClose",raw:t}}function Aa(t){return{type:"CharacterClassHyphen",raw:t}}function La(t){return{type:"CharacterClassIntersector",raw:t}}function Hn(t,e){return{type:"CharacterClassOpen",negate:t,raw:e}}function he(t,e,n={}){return{type:"CharacterSet",kind:t,...n,raw:e}}function ss(t,e,n={}){return t==="keep"?{type:"Directive",kind:t,raw:e}:{type:"Directive",kind:t,flags:Ae(n.flags),raw:e}}function Ra(t,e){return{type:"EscapedNumber",inCharClass:t,raw:e}}function Na(t){return{type:"GroupClose",raw:t}}function be(t,e,n={}){return{type:"GroupOpen",kind:t,...n,raw:e}}function Pa(t,e,n,r){return{type:"NamedCallout",kind:t,tag:e,arguments:n,raw:r}}function $a(t,e,n,r){return{type:"Quantifier",kind:t,min:e,max:n,raw:r}}function Ta(t){return{type:"Subroutine",raw:t}}const Ma=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),qn=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function Oa(t){const e=t[1]==="c"?t[2]:t[3];if(!e||!/[A-Za-z]/.test(e))throw new Error(`Unsupported control character "${t}"`);return re(Ee(e.toUpperCase())-64,t)}function Da(t,e){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(t).groups;r??="";const s=(e.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=Xn(n),i=Xn(r),a={};if(o&&(a.enable=o),i&&(a.disable=i),t.endsWith(")"))return e.replaceCurrentModX(s),ss("flags",t,{flags:a});if(t.endsWith(":"))return e.pushModX(s),e.numOpenGroups++,be("group",t,{...(o||i)&&{flags:a}});throw new Error(`Unexpected flag modifier "${t}"`)}function Ga(t){const e=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(t);if(!e)throw new Error(`Incomplete or invalid named callout "${t}"`);const{name:n,tag:r,args:s}=e.groups;if(!n)throw new Error(`Invalid named callout "${t}"`);if(r==="")throw new Error(`Named callout tag with empty value not allowed "${t}"`);const o=s?s.split(",").filter(u=>u!=="").map(u=>/^[+-]?\d+$/.test(u)?+u:u):[],[i,a,l]=o,c=Ma.has(n)?n.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(o.length>0)throw new Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(typeof i=="string")throw new Error(`Named callout argument must be a number "${i}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(o.length===2&&(typeof a=="number"||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);break;case"count":case"total_count":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(o.length===1&&(typeof i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${i}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(typeof a=="number"||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if(typeof l=="string"&&!/^[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 Pa(c,r??null,s?.split(",")??null,t)}function Vn(t){let e=null,n,r;if(t[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(t).groups,i=1e5;if(+s>i||o&&+o>i)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+s,r=o===void 0?+s:o===""?1/0:+o,n>r&&(e="possessive",[n,r]=[r,n]),t.endsWith("?")){if(e==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');e="lazy"}else e||(e="greedy")}else n=t[0]==="+"?1:0,r=t[0]==="?"?1:1/0,e=t[1]==="+"?"possessive":t[1]==="?"?"lazy":"greedy";return $a(e,n,r,t)}function Ba(t){const e=t[1].toLowerCase();return he({d:"digit",h:"hex",s:"space",w:"word"}[e],t,{negate:t[1]!==e})}function Fa(t){const{p:e,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(t).groups;return he("property",t,{value:r,negate:e==="P"&&!n||e==="p"&&!!n})}function Xn(t){const e={};return t.includes("i")&&(e.ignoreCase=!0),t.includes("m")&&(e.dotAll=!0),t.includes("x")&&(e.extended=!0),Object.keys(e).length?e:null}function Ua(t){const e={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<t.length;n++){const r=t[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(t.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');e.textSegmentMode=t[n+2]==="g"?"grapheme":"word",n+=3;continue}e[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return e}function ja(t){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(t))throw new Error(`Incomplete or invalid escape "${t}"`);const e=t[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(t).groups.hex:t.slice(2);return parseInt(e,16)}function Wa(t,e){const{raw:n,inCharClass:r}=t,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=e))return[rs(n)];const o=[],i=s.match(/^[0-7]+|\d/g);for(let a=0;a<i.length;a++){const l=i[a];let c;if(a===0&&l!=="8"&&l!=="9"){if(c=parseInt(l,8),c>127)throw new Error(U`Octal encoded byte above 177 unsupported "${n}"`)}else c=Ee(l);o.push(re(c,(a===0?"\\":"")+l))}return o}function za(t){const e=[],n=new RegExp(mn,"gy");let r;for(;r=n.exec(t);){const s=r[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:i,max:a}=o.groups;if(+i>+a&&s.endsWith("?")){n.lastIndex--,e.push(Vn(s.slice(0,-1)));continue}}}e.push(Vn(s))}return e}function os(t,e){if(!Array.isArray(t.body))throw new Error("Expected node with body array");if(t.body.length!==1)return!1;const n=t.body[0];return!e||Object.keys(e).every(r=>e[r]===n[r])}function Ha(t){return qa.has(t.type)}const qa=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function is(t,e={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e,rules:{captureGroup:!1,singleline:!1,...e.rules}},r=Sa(t,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(h,d)=>{const p=r.tokens[o.nextIndex];switch(o.parent=h,o.nextIndex++,p.type){case"Alternator":return de();case"Assertion":return Va(p);case"Backreference":return Xa(p,o);case"Character":return gt(p.value,{useLastValid:!!d.isCheckingRangeEnd});case"CharacterClassHyphen":return Ka(p,o,d);case"CharacterClassOpen":return Za(p,o,d);case"CharacterSet":return Qa(p,o);case"Directive":return rl(p.kind,{flags:p.flags});case"GroupOpen":return Ya(p,o,d);case"NamedCallout":return ol(p.kind,p.tag,p.arguments);case"Quantifier":return Ja(p,o);case"Subroutine":return el(p,o);default:throw new Error(`Unexpected token type "${p.type}"`)}},o={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},i=al(sl(r.flags));let a=i.body[0];for(;o.nextIndex<r.tokens.length;){const h=s(a,{});h.type==="Alternative"?(i.body.push(h),a=h):a.body.push(h)}const{capturingGroups:l,hasNumberedRef:c,namedGroupsByName:u,subroutines:f}=o;if(c&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:h}of f)if(typeof h=="number"){if(h>l.length)throw new Error("Subroutine uses a group number that's not defined");h&&(l[h-1].isSubroutined=!0)}else if(u.has(h)){if(u.get(h).length>1)throw new Error(U`Subroutine uses a duplicate group name "\g<${h}>"`);u.get(h)[0].isSubroutined=!0}else throw new Error(U`Subroutine uses a group name that's not defined "\g<${h}>"`);return i}function Va({kind:t}){return Zt(Ae({"^":"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"}[t],`Unexpected assertion kind "${t}"`),{negate:t===U`\B`||t===U`\Y`})}function Xa({raw:t},e){const n=/^\\k[<']/.test(t),r=n?t.slice(3,-1):t.slice(1),s=(o,i=!1)=>{const a=e.capturingGroups.length;let l=!1;if(o>a)if(e.skipBackrefValidation)l=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,Qt(i?a+1-o:o,{orphan:l})};if(n){const o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(o)return s(+o.groups.num,!!o.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${t}"`);if(!e.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${t}"`);return Qt(r)}return s(+r)}function Ka(t,e,n){const{tokens:r,walk:s}=e,o=e.parent,i=o.body.at(-1),a=r[e.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&a&&a.type!=="CharacterClassOpen"&&a.type!=="CharacterClassClose"&&a.type!=="CharacterClassIntersector"){const l=s(o,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&l.type==="Character")return o.body.pop(),nl(i,l);throw new Error("Invalid character class range")}return gt(Ee("-"))}function Za({negate:t},e,n){const{tokens:r,walk:s}=e,o=r[e.nextIndex],i=[tt()];let a=Qn(o);for(;a.type!=="CharacterClassClose";){if(a.type==="CharacterClassIntersector")i.push(tt()),e.nextIndex++;else{const c=i.at(-1);c.body.push(s(c,n))}a=Qn(r[e.nextIndex],o)}const l=tt({negate:t});return i.length===1?l.body=i[0].body:(l.kind="intersection",l.body=i.map(c=>c.body.length===1?c.body[0]:c)),e.nextIndex++,l}function Qa({kind:t,negate:e,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i}=r;if(t==="property"){const a=mt(n);if(gn.has(a)&&!i?.has(a))t="posix",n=a;else return we(n,{negate:e,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i})}return t==="posix"?il(n,{negate:e}):Yt(t,{negate:e})}function Ya(t,e,n){const{tokens:r,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:i,walk:a}=e,l=ll(t),c=l.type==="AbsenceFunction",u=Zn(l),f=u&&l.negate;if(l.type==="CapturingGroup"&&(s.push(l),l.name&&_a(o,l.name,[]).push(l)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=Yn(r[e.nextIndex]);for(;h.type!=="GroupClose";){if(h.type==="Alternator")l.body.push(de()),e.nextIndex++;else{const d=l.body.at(-1),p=a(d,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||f});if(d.body.push(p),(u||n.isInLookbehind)&&!i){const b="Lookbehind includes a pattern not allowed by Oniguruma";if(f||n.isInNegLookbehind){if(Kn(p)||p.type==="CapturingGroup")throw new Error(b)}else if(Kn(p)||Zn(p)&&p.negate)throw new Error(b)}}h=Yn(r[e.nextIndex])}return e.nextIndex++,l}function Ja({kind:t,min:e,max:n},r){const s=r.parent,o=s.body.at(-1);if(!o||!Ha(o))throw new Error("Quantifier requires a repeatable token");const i=ls(t,e,n,o);return s.body.pop(),i}function el({raw:t},e){const{capturingGroups:n,subroutines:r}=e;let s=t.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(o){const a=+o.groups.num,l=n.length;if(e.hasNumberedRef=!0,s={"":a,"+":l+a,"-":l+1-a}[o.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=cs(s);return r.push(i),i}function tl(t,e){return{type:"AbsenceFunction",kind:t,body:We(e?.body)}}function de(t){return{type:"Alternative",body:us(t?.body)}}function Zt(t,e){const n={type:"Assertion",kind:t};return(t==="word_boundary"||t==="text_segment_boundary")&&(n.negate=!!e?.negate),n}function Qt(t,e){const n=!!e?.orphan;return{type:"Backreference",ref:t,...n&&{orphan:n}}}function as(t,e){const n={name:void 0,isSubroutined:!1,...e};if(n.name!==void 0&&!cl(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:t,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:We(e?.body)}}function gt(t,e){const n={useLastValid:!1,...e};if(t>1114111){const r=t.toString(16);if(n.useLastValid)t=1114111;else throw t>1310719?new Error(`Invalid code point out of range "\\x{${r}}"`):new Error(`Invalid code point out of range in JS "\\x{${r}}"`)}return{type:"Character",value:t}}function tt(t){const e={kind:"union",negate:!1,...t};return{type:"CharacterClass",kind:e.kind,negate:e.negate,body:us(t?.body)}}function nl(t,e){if(e.value<t.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:t,max:e}}function Yt(t,e){const n=!!e?.negate,r={type:"CharacterSet",kind:t};return(t==="digit"||t==="hex"||t==="newline"||t==="space"||t==="word")&&(r.negate=n),(t==="text_segment"||t==="newline"&&!n)&&(r.variableLength=!0),r}function rl(t,e={}){if(t==="keep")return{type:"Directive",kind:t};if(t==="flags")return{type:"Directive",kind:t,flags:Ae(e.flags)};throw new Error(`Unexpected directive kind "${t}"`)}function sl(t){return{type:"Flags",...t}}function Y(t){const e=t?.atomic,n=t?.flags;if(e&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...e&&{atomic:e},...n&&{flags:n},body:We(t?.body)}}function ue(t){const e={behind:!1,negate:!1,...t};return{type:"LookaroundAssertion",kind:e.behind?"lookbehind":"lookahead",negate:e.negate,body:We(t?.body)}}function ol(t,e,n){return{type:"NamedCallout",kind:t,tag:e,arguments:n}}function il(t,e){const n=!!e?.negate;if(!gn.has(t))throw new Error(`Invalid POSIX class "${t}"`);return{type:"CharacterSet",kind:"posix",value:t,negate:n}}function ls(t,e,n,r){if(e>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:t,min:e,max:n,body:r}}function al(t,e){return{type:"Regex",body:We(e?.body),flags:t}}function cs(t){return{type:"Subroutine",ref:t}}function we(t,e){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e};let r=n.unicodePropertyMap?.get(mt(t));if(!r){if(n.normalizeUnknownPropertyNames)r=ul(t);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(U`Invalid Unicode property "\p{${t}}"`)}return{type:"CharacterSet",kind:"property",value:r??t,negate:n.negate}}function ll({flags:t,kind:e,name:n,negate:r,number:s}){switch(e){case"absence_repeater":return tl("repeater");case"atomic":return Y({atomic:!0});case"capturing":return as(s,{name:n});case"group":return Y({flags:t});case"lookahead":case"lookbehind":return ue({behind:e==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${e}"`)}}function We(t){if(t===void 0)t=[de()];else if(!Array.isArray(t)||!t.length||!t.every(e=>e.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return t}function us(t){if(t===void 0)t=[];else if(!Array.isArray(t)||!t.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return t}function Kn(t){return t.type==="LookaroundAssertion"&&t.kind==="lookahead"}function Zn(t){return t.type==="LookaroundAssertion"&&t.kind==="lookbehind"}function cl(t){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(t)}function ul(t){return t.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function mt(t){return t.replace(/[- _]+/g,"").toLowerCase()}function Qn(t,e){return Ae(t,`${e?.type==="Character"&&e.value===93?"Empty":"Unclosed"} character class`)}function Yn(t){return Ae(t,"Unclosed group")}function Te(t,e,n=null){function r(o,i){for(let a=0;a<o.length;a++){const l=s(o[a],i,a,o);a=Math.max(-1,a+l)}}function s(o,i=null,a=null,l=null){let c=0,u=!1;const f={node:o,parent:i,key:a,container:l,root:t,remove(){Ke(l).splice(Math.max(0,ge(a)+c),1),c--,u=!0},removeAllNextSiblings(){return Ke(l).splice(ge(a)+1)},removeAllPrevSiblings(){const y=ge(a)+c;return c-=y,Ke(l).splice(0,Math.max(0,y))},replaceWith(y,m={}){const g=!!m.traverse;l?l[Math.max(0,ge(a)+c)]=y:Ae(i,"Can't replace root node")[a]=y,g&&s(y,i,a,l),u=!0},replaceWithMultiple(y,m={}){const g=!!m.traverse;if(Ke(l).splice(Math.max(0,ge(a)+c),1,...y),c+=y.length-1,g){let _=0;for(let S=0;S<y.length;S++)_+=s(y[S],i,ge(a)+S+_,l)}u=!0},skip(){u=!0}},{type:h}=o,d=e["*"],p=e[h],b=typeof d=="function"?d:d?.enter,w=typeof p=="function"?p:p?.enter;if(b?.(f,n),w?.(f,n),!u)switch(h){case"AbsenceFunction":case"CapturingGroup":case"Group":r(o.body,o);break;case"Alternative":case"CharacterClass":r(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(o.min,o,"min"),s(o.max,o,"max");break;case"LookaroundAssertion":r(o.body,o);break;case"Quantifier":s(o.body,o,"body");break;case"Regex":r(o.body,o),s(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${h}"`)}return p?.exit?.(f,n),d?.exit?.(f,n),c}return s(t),t}function Ke(t){if(!Array.isArray(t))throw new Error("Container expected");return t}function ge(t){if(typeof t!="number")throw new Error("Numeric key expected");return t}const fl=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function hl(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function dl(t,e,n,r){return t.slice(0,e)+r+t.slice(e+n.length)}const Q=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function yn(t,e,n,r){const s=new RegExp(String.raw`${e}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let i=0,a="";for(const l of t.matchAll(s)){const{0:c,groups:{$skip:u}}=l;if(!u&&(!r||r===Q.DEFAULT==!i)){n instanceof Function?a+=n(l,{context:i?Q.CHAR_CLASS:Q.DEFAULT,negated:o[o.length-1]}):a+=n;continue}c[0]==="["?(i++,o.push(c[1]==="^")):c==="]"&&i&&(i--,o.pop()),a+=c}return a}function fs(t,e,n,r){yn(t,e,n,r)}function pl(t,e,n=0,r){if(!new RegExp(e,"su").test(t))return null;const s=new RegExp(`${e}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let o=0,i;for(;i=s.exec(t);){const{0:a,groups:{$skip:l}}=i;if(!l&&(!r||r===Q.DEFAULT==!o))return i;a==="["?o++:a==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function Ze(t,e,n){return!!pl(t,e,0,n)}function gl(t,e){const n=/\\?./gsu;n.lastIndex=e;let r=t.length,s=0,o=1,i;for(;i=n.exec(t);){const[a]=i;if(a==="[")s++;else if(s)a==="]"&&s--;else if(a==="(")o++;else if(a===")"&&(o--,!o)){r=i.index;break}}return t.slice(e,r)}const Jn=new RegExp(String.raw`(?<noncapturingStart>${fl})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function ml(t,e){const n=e?.hiddenCaptures??[];let r=e?.captureTransfers??new Map;if(!/\(\?>/.test(t))return{pattern:t,captureTransfers:r,hiddenCaptures:n};const s="(?>",o="(?:(?=(",i=[0],a=[];let l=0,c=0,u=NaN,f;do{f=!1;let h=0,d=0,p=!1,b;for(Jn.lastIndex=Number.isNaN(u)?0:u+o.length;b=Jn.exec(t);){const{0:w,index:y,groups:{capturingStart:m,noncapturingStart:g}}=b;if(w==="[")h++;else if(h)w==="]"&&h--;else if(w===s&&!p)u=y,p=!0;else if(p&&g)d++;else if(m)p?d++:(l++,i.push(l+c));else if(w===")"&&p){if(!d){c++;const _=l+c;if(t=`${t.slice(0,u)}${o}${t.slice(u+s.length,y)}))<$$${_}>)${t.slice(y+1)}`,f=!0,a.push(_),hl(n,_),r.size){const S=new Map;r.forEach((x,A)=>{S.set(A>=_?A+1:A,x.map(k=>k>=_?k+1:k))}),r=S}break}d--}}}while(f);return n.push(...a),t=yn(t,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:h,groups:{backrefNum:d,wrappedBackrefNum:p}})=>{if(d){const b=+d;if(b>i.length-1)throw new Error(`Backref "${h}" greater than number of captures`);return`\\${i[b]}`}return`\\${p}`},Q.DEFAULT),{pattern:t,captureTransfers:r,hiddenCaptures:n}}const hs=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Lt=new RegExp(String.raw`
43
+ `.replace(/\s+/g,""),"gsu");function ka(t,e={}){const n={flags:"",...e,rules:{captureGroup:!1,singleline:!1,...e.rules}};if(typeof t!="string")throw new Error("String expected as pattern");const r=ja(n.flags),s=[r.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(f){s.push(f)},replaceCurrentModX(f){s[s.length-1]=f},singleline:n.rules.singleline};let i=[],a;for(Xe.lastIndex=0;a=Xe.exec(t);){const f=xa(o,t,a[0],Xe.lastIndex);f.tokens?i.push(...f.tokens):f.token&&i.push(f.token),f.lastIndex!==void 0&&(Xe.lastIndex=f.lastIndex)}const l=[];let c=0;i.filter(f=>f.type==="GroupOpen").forEach(f=>{f.kind==="capturing"?f.number=++c:f.raw==="("&&l.push(f)}),c||l.forEach((f,h)=>{f.kind="capturing",f.number=h+1});const u=c||l.length;return{tokens:i.map(f=>f.type==="EscapedNumber"?za(f,u):f).flat(),flags:r}}function xa(t,e,n,r){const[s,o]=n;if(n==="["||n==="[^"){const i=va(e,n,r);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:Hn(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Ma(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:ss(n)}}if(o==="K")return{token:os("keep",n)};if(o==="N"||o==="R")return{token:he("newline",n,{negate:o==="N"})};if(o==="O")return{token:he("any",n)};if(o==="X")return{token:he("text_segment",n)};const i=rs(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(s==="("){if(o==="*")return{token:Ba(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(e[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Ga(n,t)};if(t.pushModX(t.getCurrentModX()),t.numOpenGroups++,n==="("&&!t.captureGroup||n==="(?:")return{token:be("group",n)};if(n==="(?>")return{token:be("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:be(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&t.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:be("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:be("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(t.popModX(),t.numOpenGroups--,t.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Pa(n)}}if(t.getCurrentModX()){if(n==="#"){const i=e.indexOf(`
44
+ `,r);return{lastIndex:i===-1?e.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=r,{lastIndex:i.exec(e)?i.lastIndex:r}}}if(n===".")return{token:he("dot",n)};if(n==="^"||n==="$"){const i=t.singleline?{"^":U`\A`,$:U`\Z`}[n]:n;return{token:Hn(i,n)}}return n==="|"?{token:Ea(n)}:yn.test(n)?{tokens:Ha(n)}:{token:se(Ee(n),n)}}function va(t,e,n){const r=[qn(e[1]==="^",e)];let s=1,o;for(Lt.lastIndex=n;o=Lt.exec(t);){const i=o[0];if(i[0]==="["&&i[1]!==":")s++,r.push(qn(i[1]==="^",i));else if(i==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(se(93,i));else if(s--,r.push(Aa(i)),!s)break}else{const a=Ia(i);Array.isArray(a)?r.push(...a):r.push(a)}}return{tokens:r,lastIndex:Lt.lastIndex||t.length}}function Ia(t){if(t[0]==="\\")return rs(t,{inCharClass:!0});if(t[0]==="["){const e=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(t);if(!e||!mn.has(e.groups.name))throw new Error(`Invalid POSIX class "${t}"`);return he("posix",t,{value:e.groups.name,negate:!!e.groups.negate})}return t==="-"?La(t):t==="&&"?Ra(t):se(Ee(t),t)}function rs(t,{inCharClass:e}){const n=t[1];if(n==="c"||n==="C")return Da(t);if("dDhHsSwW".includes(n))return Fa(t);if(t.startsWith(U`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${t}"`);if(/^\\[pP]\{/.test(t)){if(t.length===3)throw new Error(`Incomplete or invalid Unicode property "${t}"`);return Ua(t)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(t))try{const r=t.split(/\\x/).slice(1).map(i=>parseInt(i,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(r)),o=new TextEncoder;return[...s].map(i=>{const a=[...o.encode(i)].map(l=>`\\x${l.toString(16)}`).join("");return se(Ee(i),a)})}catch{throw new Error(`Multibyte code "${t}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return se(Wa(t),t);if(Vn.has(n))return se(Vn.get(n),t);if(/\d/.test(n))return Na(e,t);if(t==="\\")throw new Error(U`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${t}"`);if([...t].length===2)return se(t.codePointAt(1),t);throw new Error(`Unexpected escape "${t}"`)}function Ea(t){return{type:"Alternator",raw:t}}function Hn(t,e){return{type:"Assertion",kind:t,raw:e}}function ss(t){return{type:"Backreference",raw:t}}function se(t,e){return{type:"Character",value:t,raw:e}}function Aa(t){return{type:"CharacterClassClose",raw:t}}function La(t){return{type:"CharacterClassHyphen",raw:t}}function Ra(t){return{type:"CharacterClassIntersector",raw:t}}function qn(t,e){return{type:"CharacterClassOpen",negate:t,raw:e}}function he(t,e,n={}){return{type:"CharacterSet",kind:t,...n,raw:e}}function os(t,e,n={}){return t==="keep"?{type:"Directive",kind:t,raw:e}:{type:"Directive",kind:t,flags:Ae(n.flags),raw:e}}function Na(t,e){return{type:"EscapedNumber",inCharClass:t,raw:e}}function Pa(t){return{type:"GroupClose",raw:t}}function be(t,e,n={}){return{type:"GroupOpen",kind:t,...n,raw:e}}function $a(t,e,n,r){return{type:"NamedCallout",kind:t,tag:e,arguments:n,raw:r}}function Ta(t,e,n,r){return{type:"Quantifier",kind:t,min:e,max:n,raw:r}}function Ma(t){return{type:"Subroutine",raw:t}}const Oa=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),Vn=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function Da(t){const e=t[1]==="c"?t[2]:t[3];if(!e||!/[A-Za-z]/.test(e))throw new Error(`Unsupported control character "${t}"`);return se(Ee(e.toUpperCase())-64,t)}function Ga(t,e){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(t).groups;r??="";const s=(e.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=Kn(n),i=Kn(r),a={};if(o&&(a.enable=o),i&&(a.disable=i),t.endsWith(")"))return e.replaceCurrentModX(s),os("flags",t,{flags:a});if(t.endsWith(":"))return e.pushModX(s),e.numOpenGroups++,be("group",t,{...(o||i)&&{flags:a}});throw new Error(`Unexpected flag modifier "${t}"`)}function Ba(t){const e=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(t);if(!e)throw new Error(`Incomplete or invalid named callout "${t}"`);const{name:n,tag:r,args:s}=e.groups;if(!n)throw new Error(`Invalid named callout "${t}"`);if(r==="")throw new Error(`Named callout tag with empty value not allowed "${t}"`);const o=s?s.split(",").filter(u=>u!=="").map(u=>/^[+-]?\d+$/.test(u)?+u:u):[],[i,a,l]=o,c=Oa.has(n)?n.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(o.length>0)throw new Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(typeof i=="string")throw new Error(`Named callout argument must be a number "${i}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(o.length===2&&(typeof a=="number"||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);break;case"count":case"total_count":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(o.length===1&&(typeof i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${i}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(typeof a=="number"||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if(typeof l=="string"&&!/^[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 $a(c,r??null,s?.split(",")??null,t)}function Xn(t){let e=null,n,r;if(t[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(t).groups,i=1e5;if(+s>i||o&&+o>i)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+s,r=o===void 0?+s:o===""?1/0:+o,n>r&&(e="possessive",[n,r]=[r,n]),t.endsWith("?")){if(e==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');e="lazy"}else e||(e="greedy")}else n=t[0]==="+"?1:0,r=t[0]==="?"?1:1/0,e=t[1]==="+"?"possessive":t[1]==="?"?"lazy":"greedy";return Ta(e,n,r,t)}function Fa(t){const e=t[1].toLowerCase();return he({d:"digit",h:"hex",s:"space",w:"word"}[e],t,{negate:t[1]!==e})}function Ua(t){const{p:e,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(t).groups;return he("property",t,{value:r,negate:e==="P"&&!n||e==="p"&&!!n})}function Kn(t){const e={};return t.includes("i")&&(e.ignoreCase=!0),t.includes("m")&&(e.dotAll=!0),t.includes("x")&&(e.extended=!0),Object.keys(e).length?e:null}function ja(t){const e={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<t.length;n++){const r=t[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(t.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');e.textSegmentMode=t[n+2]==="g"?"grapheme":"word",n+=3;continue}e[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return e}function Wa(t){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(t))throw new Error(`Incomplete or invalid escape "${t}"`);const e=t[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(t).groups.hex:t.slice(2);return parseInt(e,16)}function za(t,e){const{raw:n,inCharClass:r}=t,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=e))return[ss(n)];const o=[],i=s.match(/^[0-7]+|\d/g);for(let a=0;a<i.length;a++){const l=i[a];let c;if(a===0&&l!=="8"&&l!=="9"){if(c=parseInt(l,8),c>127)throw new Error(U`Octal encoded byte above 177 unsupported "${n}"`)}else c=Ee(l);o.push(se(c,(a===0?"\\":"")+l))}return o}function Ha(t){const e=[],n=new RegExp(yn,"gy");let r;for(;r=n.exec(t);){const s=r[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:i,max:a}=o.groups;if(+i>+a&&s.endsWith("?")){n.lastIndex--,e.push(Xn(s.slice(0,-1)));continue}}}e.push(Xn(s))}return e}function is(t,e){if(!Array.isArray(t.body))throw new Error("Expected node with body array");if(t.body.length!==1)return!1;const n=t.body[0];return!e||Object.keys(e).every(r=>e[r]===n[r])}function qa(t){return Va.has(t.type)}const Va=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function as(t,e={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e,rules:{captureGroup:!1,singleline:!1,...e.rules}},r=ka(t,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(h,d)=>{const p=r.tokens[o.nextIndex];switch(o.parent=h,o.nextIndex++,p.type){case"Alternator":return de();case"Assertion":return Xa(p);case"Backreference":return Ka(p,o);case"Character":return gt(p.value,{useLastValid:!!d.isCheckingRangeEnd});case"CharacterClassHyphen":return Za(p,o,d);case"CharacterClassOpen":return Qa(p,o,d);case"CharacterSet":return Ya(p,o);case"Directive":return sl(p.kind,{flags:p.flags});case"GroupOpen":return Ja(p,o,d);case"NamedCallout":return il(p.kind,p.tag,p.arguments);case"Quantifier":return el(p,o);case"Subroutine":return tl(p,o);default:throw new Error(`Unexpected token type "${p.type}"`)}},o={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},i=ll(ol(r.flags));let a=i.body[0];for(;o.nextIndex<r.tokens.length;){const h=s(a,{});h.type==="Alternative"?(i.body.push(h),a=h):a.body.push(h)}const{capturingGroups:l,hasNumberedRef:c,namedGroupsByName:u,subroutines:f}=o;if(c&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:h}of f)if(typeof h=="number"){if(h>l.length)throw new Error("Subroutine uses a group number that's not defined");h&&(l[h-1].isSubroutined=!0)}else if(u.has(h)){if(u.get(h).length>1)throw new Error(U`Subroutine uses a duplicate group name "\g<${h}>"`);u.get(h)[0].isSubroutined=!0}else throw new Error(U`Subroutine uses a group name that's not defined "\g<${h}>"`);return i}function Xa({kind:t}){return Qt(Ae({"^":"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"}[t],`Unexpected assertion kind "${t}"`),{negate:t===U`\B`||t===U`\Y`})}function Ka({raw:t},e){const n=/^\\k[<']/.test(t),r=n?t.slice(3,-1):t.slice(1),s=(o,i=!1)=>{const a=e.capturingGroups.length;let l=!1;if(o>a)if(e.skipBackrefValidation)l=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,Yt(i?a+1-o:o,{orphan:l})};if(n){const o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(o)return s(+o.groups.num,!!o.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${t}"`);if(!e.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${t}"`);return Yt(r)}return s(+r)}function Za(t,e,n){const{tokens:r,walk:s}=e,o=e.parent,i=o.body.at(-1),a=r[e.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&a&&a.type!=="CharacterClassOpen"&&a.type!=="CharacterClassClose"&&a.type!=="CharacterClassIntersector"){const l=s(o,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&l.type==="Character")return o.body.pop(),rl(i,l);throw new Error("Invalid character class range")}return gt(Ee("-"))}function Qa({negate:t},e,n){const{tokens:r,walk:s}=e,o=r[e.nextIndex],i=[tt()];let a=Yn(o);for(;a.type!=="CharacterClassClose";){if(a.type==="CharacterClassIntersector")i.push(tt()),e.nextIndex++;else{const c=i.at(-1);c.body.push(s(c,n))}a=Yn(r[e.nextIndex],o)}const l=tt({negate:t});return i.length===1?l.body=i[0].body:(l.kind="intersection",l.body=i.map(c=>c.body.length===1?c.body[0]:c)),e.nextIndex++,l}function Ya({kind:t,negate:e,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i}=r;if(t==="property"){const a=mt(n);if(mn.has(a)&&!i?.has(a))t="posix",n=a;else return we(n,{negate:e,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i})}return t==="posix"?al(n,{negate:e}):Jt(t,{negate:e})}function Ja(t,e,n){const{tokens:r,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:i,walk:a}=e,l=cl(t),c=l.type==="AbsenceFunction",u=Qn(l),f=u&&l.negate;if(l.type==="CapturingGroup"&&(s.push(l),l.name&&Sa(o,l.name,[]).push(l)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=Jn(r[e.nextIndex]);for(;h.type!=="GroupClose";){if(h.type==="Alternator")l.body.push(de()),e.nextIndex++;else{const d=l.body.at(-1),p=a(d,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||f});if(d.body.push(p),(u||n.isInLookbehind)&&!i){const b="Lookbehind includes a pattern not allowed by Oniguruma";if(f||n.isInNegLookbehind){if(Zn(p)||p.type==="CapturingGroup")throw new Error(b)}else if(Zn(p)||Qn(p)&&p.negate)throw new Error(b)}}h=Jn(r[e.nextIndex])}return e.nextIndex++,l}function el({kind:t,min:e,max:n},r){const s=r.parent,o=s.body.at(-1);if(!o||!qa(o))throw new Error("Quantifier requires a repeatable token");const i=cs(t,e,n,o);return s.body.pop(),i}function tl({raw:t},e){const{capturingGroups:n,subroutines:r}=e;let s=t.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(o){const a=+o.groups.num,l=n.length;if(e.hasNumberedRef=!0,s={"":a,"+":l+a,"-":l+1-a}[o.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=us(s);return r.push(i),i}function nl(t,e){return{type:"AbsenceFunction",kind:t,body:We(e?.body)}}function de(t){return{type:"Alternative",body:fs(t?.body)}}function Qt(t,e){const n={type:"Assertion",kind:t};return(t==="word_boundary"||t==="text_segment_boundary")&&(n.negate=!!e?.negate),n}function Yt(t,e){const n=!!e?.orphan;return{type:"Backreference",ref:t,...n&&{orphan:n}}}function ls(t,e){const n={name:void 0,isSubroutined:!1,...e};if(n.name!==void 0&&!ul(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:t,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:We(e?.body)}}function gt(t,e){const n={useLastValid:!1,...e};if(t>1114111){const r=t.toString(16);if(n.useLastValid)t=1114111;else throw t>1310719?new Error(`Invalid code point out of range "\\x{${r}}"`):new Error(`Invalid code point out of range in JS "\\x{${r}}"`)}return{type:"Character",value:t}}function tt(t){const e={kind:"union",negate:!1,...t};return{type:"CharacterClass",kind:e.kind,negate:e.negate,body:fs(t?.body)}}function rl(t,e){if(e.value<t.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:t,max:e}}function Jt(t,e){const n=!!e?.negate,r={type:"CharacterSet",kind:t};return(t==="digit"||t==="hex"||t==="newline"||t==="space"||t==="word")&&(r.negate=n),(t==="text_segment"||t==="newline"&&!n)&&(r.variableLength=!0),r}function sl(t,e={}){if(t==="keep")return{type:"Directive",kind:t};if(t==="flags")return{type:"Directive",kind:t,flags:Ae(e.flags)};throw new Error(`Unexpected directive kind "${t}"`)}function ol(t){return{type:"Flags",...t}}function Y(t){const e=t?.atomic,n=t?.flags;if(e&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...e&&{atomic:e},...n&&{flags:n},body:We(t?.body)}}function ue(t){const e={behind:!1,negate:!1,...t};return{type:"LookaroundAssertion",kind:e.behind?"lookbehind":"lookahead",negate:e.negate,body:We(t?.body)}}function il(t,e,n){return{type:"NamedCallout",kind:t,tag:e,arguments:n}}function al(t,e){const n=!!e?.negate;if(!mn.has(t))throw new Error(`Invalid POSIX class "${t}"`);return{type:"CharacterSet",kind:"posix",value:t,negate:n}}function cs(t,e,n,r){if(e>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:t,min:e,max:n,body:r}}function ll(t,e){return{type:"Regex",body:We(e?.body),flags:t}}function us(t){return{type:"Subroutine",ref:t}}function we(t,e){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e};let r=n.unicodePropertyMap?.get(mt(t));if(!r){if(n.normalizeUnknownPropertyNames)r=fl(t);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(U`Invalid Unicode property "\p{${t}}"`)}return{type:"CharacterSet",kind:"property",value:r??t,negate:n.negate}}function cl({flags:t,kind:e,name:n,negate:r,number:s}){switch(e){case"absence_repeater":return nl("repeater");case"atomic":return Y({atomic:!0});case"capturing":return ls(s,{name:n});case"group":return Y({flags:t});case"lookahead":case"lookbehind":return ue({behind:e==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${e}"`)}}function We(t){if(t===void 0)t=[de()];else if(!Array.isArray(t)||!t.length||!t.every(e=>e.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return t}function fs(t){if(t===void 0)t=[];else if(!Array.isArray(t)||!t.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return t}function Zn(t){return t.type==="LookaroundAssertion"&&t.kind==="lookahead"}function Qn(t){return t.type==="LookaroundAssertion"&&t.kind==="lookbehind"}function ul(t){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(t)}function fl(t){return t.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function mt(t){return t.replace(/[- _]+/g,"").toLowerCase()}function Yn(t,e){return Ae(t,`${e?.type==="Character"&&e.value===93?"Empty":"Unclosed"} character class`)}function Jn(t){return Ae(t,"Unclosed group")}function Te(t,e,n=null){function r(o,i){for(let a=0;a<o.length;a++){const l=s(o[a],i,a,o);a=Math.max(-1,a+l)}}function s(o,i=null,a=null,l=null){let c=0,u=!1;const f={node:o,parent:i,key:a,container:l,root:t,remove(){Ke(l).splice(Math.max(0,ge(a)+c),1),c--,u=!0},removeAllNextSiblings(){return Ke(l).splice(ge(a)+1)},removeAllPrevSiblings(){const y=ge(a)+c;return c-=y,Ke(l).splice(0,Math.max(0,y))},replaceWith(y,m={}){const g=!!m.traverse;l?l[Math.max(0,ge(a)+c)]=y:Ae(i,"Can't replace root node")[a]=y,g&&s(y,i,a,l),u=!0},replaceWithMultiple(y,m={}){const g=!!m.traverse;if(Ke(l).splice(Math.max(0,ge(a)+c),1,...y),c+=y.length-1,g){let _=0;for(let S=0;S<y.length;S++)_+=s(y[S],i,ge(a)+S+_,l)}u=!0},skip(){u=!0}},{type:h}=o,d=e["*"],p=e[h],b=typeof d=="function"?d:d?.enter,w=typeof p=="function"?p:p?.enter;if(b?.(f,n),w?.(f,n),!u)switch(h){case"AbsenceFunction":case"CapturingGroup":case"Group":r(o.body,o);break;case"Alternative":case"CharacterClass":r(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(o.min,o,"min"),s(o.max,o,"max");break;case"LookaroundAssertion":r(o.body,o);break;case"Quantifier":s(o.body,o,"body");break;case"Regex":r(o.body,o),s(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${h}"`)}return p?.exit?.(f,n),d?.exit?.(f,n),c}return s(t),t}function Ke(t){if(!Array.isArray(t))throw new Error("Container expected");return t}function ge(t){if(typeof t!="number")throw new Error("Numeric key expected");return t}const hl=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function dl(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function pl(t,e,n,r){return t.slice(0,e)+r+t.slice(e+n.length)}const Q=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function bn(t,e,n,r){const s=new RegExp(String.raw`${e}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let i=0,a="";for(const l of t.matchAll(s)){const{0:c,groups:{$skip:u}}=l;if(!u&&(!r||r===Q.DEFAULT==!i)){n instanceof Function?a+=n(l,{context:i?Q.CHAR_CLASS:Q.DEFAULT,negated:o[o.length-1]}):a+=n;continue}c[0]==="["?(i++,o.push(c[1]==="^")):c==="]"&&i&&(i--,o.pop()),a+=c}return a}function hs(t,e,n,r){bn(t,e,n,r)}function gl(t,e,n=0,r){if(!new RegExp(e,"su").test(t))return null;const s=new RegExp(`${e}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let o=0,i;for(;i=s.exec(t);){const{0:a,groups:{$skip:l}}=i;if(!l&&(!r||r===Q.DEFAULT==!o))return i;a==="["?o++:a==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function Ze(t,e,n){return!!gl(t,e,0,n)}function ml(t,e){const n=/\\?./gsu;n.lastIndex=e;let r=t.length,s=0,o=1,i;for(;i=n.exec(t);){const[a]=i;if(a==="[")s++;else if(s)a==="]"&&s--;else if(a==="(")o++;else if(a===")"&&(o--,!o)){r=i.index;break}}return t.slice(e,r)}const er=new RegExp(String.raw`(?<noncapturingStart>${hl})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function yl(t,e){const n=e?.hiddenCaptures??[];let r=e?.captureTransfers??new Map;if(!/\(\?>/.test(t))return{pattern:t,captureTransfers:r,hiddenCaptures:n};const s="(?>",o="(?:(?=(",i=[0],a=[];let l=0,c=0,u=NaN,f;do{f=!1;let h=0,d=0,p=!1,b;for(er.lastIndex=Number.isNaN(u)?0:u+o.length;b=er.exec(t);){const{0:w,index:y,groups:{capturingStart:m,noncapturingStart:g}}=b;if(w==="[")h++;else if(h)w==="]"&&h--;else if(w===s&&!p)u=y,p=!0;else if(p&&g)d++;else if(m)p?d++:(l++,i.push(l+c));else if(w===")"&&p){if(!d){c++;const _=l+c;if(t=`${t.slice(0,u)}${o}${t.slice(u+s.length,y)}))<$$${_}>)${t.slice(y+1)}`,f=!0,a.push(_),dl(n,_),r.size){const S=new Map;r.forEach((x,A)=>{S.set(A>=_?A+1:A,x.map(k=>k>=_?k+1:k))}),r=S}break}d--}}}while(f);return n.push(...a),t=bn(t,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:h,groups:{backrefNum:d,wrappedBackrefNum:p}})=>{if(d){const b=+d;if(b>i.length-1)throw new Error(`Backref "${h}" greater than number of captures`);return`\\${i[b]}`}return`\\${p}`},Q.DEFAULT),{pattern:t,captureTransfers:r,hiddenCaptures:n}}const ds=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Rt=new RegExp(String.raw`
45
45
  \\(?: \d+
46
46
  | c[A-Za-z]
47
47
  | [gk]<[^>]+>
@@ -54,9 +54,9 @@ let F=class extends Error{constructor(e){super(e),this.name="ShikiError"}};funct
54
54
  | [A-Za-z\-]+:
55
55
  | \(DEFINE\)
56
56
  ))?
57
- | (?<qBase>${hs})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
57
+ | (?<qBase>${ds})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
58
58
  | \\?.
59
- `.replace(/\s+/g,""),"gsu");function yl(t){if(!new RegExp(`${hs}\\+`).test(t))return{pattern:t};const e=[];let n=null,r=null,s="",o=0,i;for(Lt.lastIndex=0;i=Lt.exec(t);){const{0:a,index:l,groups:{qBase:c,qMod:u,invalidQ:f}}=i;if(a==="[")o||(r=l),o++;else if(a==="]")o?o--:r=null;else if(!o)if(u==="+"&&s&&!s.startsWith("(")){if(f)throw new Error(`Invalid quantifier "${a}"`);let h=-1;if(/^\{\d+\}$/.test(c))t=dl(t,l+c.length,u,"");else{if(s===")"||s==="]"){const d=s===")"?n:r;if(d===null)throw new Error(`Invalid unmatched "${s}"`);t=`${t.slice(0,d)}(?>${t.slice(d,l)}${c})${t.slice(l+a.length)}`}else t=`${t.slice(0,l-s.length)}(?>${s}${c})${t.slice(l+a.length)}`;h+=4}Lt.lastIndex+=h}else a[0]==="("?e.push(l):a===")"&&(n=e.length?e.pop():null);s=a}return{pattern:t}}const Z=String.raw,bl=Z`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Jt=Z`\(\?R=(?<rDepth>[^\)]+)\)|${bl}`,yt=Z`\(\?<(?![=!])(?<captureName>[^>]+)>`,ds=Z`${yt}|(?<unnamed>\()(?!\?)`,le=new RegExp(Z`${yt}|${Jt}|\(\?|\\?.`,"gsu"),Rt="Cannot use multiple overlapping recursions";function wl(t,e){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...e};let s=e?.captureTransfers??new Map;if(!new RegExp(Jt,"su").test(t))return{pattern:t,captureTransfers:s,hiddenCaptures:n};if(r==="plugin"&&Ze(t,Z`\(\?\(DEFINE\)`,Q.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],i=Ze(t,Z`\\[1-9]`,Q.DEFAULT),a=new Map,l=[];let c=!1,u=0,f=0,h;for(le.lastIndex=0;h=le.exec(t);){const{0:d,groups:{captureName:p,rDepth:b,gRNameOrNum:w,gRDepth:y}}=h;if(d==="[")u++;else if(u)d==="]"&&u--;else if(b){if(er(b),c)throw new Error(Rt);if(i)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const m=t.slice(0,h.index),g=t.slice(le.lastIndex);if(Ze(g,Jt,Q.DEFAULT))throw new Error(Rt);const _=+b-1;t=tr(m,g,_,!1,n,o,f),s=rr(s,m,_,o.length,0,f);break}else if(w){er(y);let m=!1;for(const R of l)if(R.name===w||R.num===+w){if(m=!0,R.hasRecursedWithin)throw new Error(Rt);break}if(!m)throw new Error(Z`Recursive \g cannot be used outside the referenced group "${r==="external"?w:Z`\g<${w}&R=${y}>`}"`);const g=a.get(w),_=gl(t,g);if(i&&Ze(_,Z`${yt}|\((?!\?)`,Q.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const S=t.slice(g,h.index),x=_.slice(S.length+d.length),A=o.length,k=+y-1,N=tr(S,x,k,!0,n,o,f);s=rr(s,S,k,o.length-A,A,f);const L=t.slice(0,g),T=t.slice(g+_.length);t=`${L}${N}${T}`,le.lastIndex+=N.length-d.length-S.length-x.length,l.forEach(R=>R.hasRecursedWithin=!0),c=!0}else if(p)f++,a.set(String(f),le.lastIndex),a.set(p,le.lastIndex),l.push({num:f,name:p});else if(d[0]==="("){const m=d==="(";m&&(f++,a.set(String(f),le.lastIndex)),l.push(m?{num:f}:{})}else d===")"&&l.pop()}return n.push(...o),{pattern:t,captureTransfers:s,hiddenCaptures:n}}function er(t){const e=`Max depth must be integer between 2 and 100; used ${t}`;if(!/^[1-9]\d*$/.test(t))throw new Error(e);if(t=+t,t<2||t>100)throw new Error(e)}function tr(t,e,n,r,s,o,i){const a=new Set;r&&fs(t+e,yt,({groups:{captureName:c}})=>{a.add(c)},Q.DEFAULT);const l=[n,r?a:null,s,o,i];return`${t}${nr(`(?:${t}`,"forward",...l)}(?:)${nr(`${e})`,"backward",...l)}${e}`}function nr(t,e,n,r,s,o,i){const l=u=>e==="forward"?u+2:n-u+2-1;let c="";for(let u=0;u<n;u++){const f=l(u);c+=yn(t,Z`${ds}|\\k<(?<backref>[^>]+)>`,({0:h,groups:{captureName:d,unnamed:p,backref:b}})=>{if(b&&r&&!r.has(b))return h;const w=`_$${f}`;if(p||d){const y=i+o.length+1;return o.push(y),Cl(s,y),p?h:`(?<${d}${w}>`}return Z`\k<${b}${w}>`},Q.DEFAULT)}return c}function Cl(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function rr(t,e,n,r,s,o){if(t.size&&r){let i=0;fs(e,ds,()=>i++,Q.DEFAULT);const a=o-i+s,l=new Map;return t.forEach((c,u)=>{const f=(r-i*n)/n,h=i*n,d=u>a+i?u+r:u,p=[];for(const b of c)if(b<=a)p.push(b);else if(b>a+i+f)p.push(b+r);else if(b<=a+i)for(let w=0;w<=n;w++)p.push(b+i*w);else for(let w=0;w<=n;w++)p.push(b+h+f*w);l.set(d,p)}),l}return t}var O=String.fromCodePoint,v=String.raw,se={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("[[]]","v")}catch{return!1}return!0})()};se.bugFlagVLiteralHyphenIsRange=se.unicodeSets?(()=>{try{new RegExp(v`[\d\-a]`,"v")}catch{return!0}return!1})():!1;se.bugNestedClassIgnoresNegation=se.unicodeSets&&new RegExp("[[^a]]","v").test("a");function ht(t,{enable:e,disable:n}){return{dotAll:!n?.dotAll&&!!(e?.dotAll||t.dotAll),ignoreCase:!n?.ignoreCase&&!!(e?.ignoreCase||t.ignoreCase)}}function Be(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}function en(t,e){return sr[t]>=sr[e]}function _l(t,e){if(t==null)throw new Error(e??"Value expected");return t}var sr={ES2025:2025,ES2024:2024,ES2018:2018},Sl={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function ps(t={}){if({}.toString.call(t)!=="[object Object]")throw new Error("Unexpected options");if(t.target!==void 0&&!Sl[t.target])throw new Error(`Unexpected target "${t.target}"`);const e={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...t,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...t.rules}};return e.target==="auto"&&(e.target=se.flagGroups?"ES2025":se.unicodeSets?"ES2024":"ES2018"),e}var kl="[ -\r ]",xl=new Set([O(304),O(305)]),te=v`[\p{L}\p{M}\p{N}\p{Pc}]`;function gs(t){if(xl.has(t))return[t];const e=new Set,n=t.toLowerCase(),r=n.toUpperCase(),s=El.get(n),o=vl.get(n),i=Il.get(n);return[...r].length===1&&e.add(r),i&&e.add(i),s&&e.add(s),e.add(n),o&&e.add(o),[...e]}var bn=new Map(`C Other
59
+ `.replace(/\s+/g,""),"gsu");function bl(t){if(!new RegExp(`${ds}\\+`).test(t))return{pattern:t};const e=[];let n=null,r=null,s="",o=0,i;for(Rt.lastIndex=0;i=Rt.exec(t);){const{0:a,index:l,groups:{qBase:c,qMod:u,invalidQ:f}}=i;if(a==="[")o||(r=l),o++;else if(a==="]")o?o--:r=null;else if(!o)if(u==="+"&&s&&!s.startsWith("(")){if(f)throw new Error(`Invalid quantifier "${a}"`);let h=-1;if(/^\{\d+\}$/.test(c))t=pl(t,l+c.length,u,"");else{if(s===")"||s==="]"){const d=s===")"?n:r;if(d===null)throw new Error(`Invalid unmatched "${s}"`);t=`${t.slice(0,d)}(?>${t.slice(d,l)}${c})${t.slice(l+a.length)}`}else t=`${t.slice(0,l-s.length)}(?>${s}${c})${t.slice(l+a.length)}`;h+=4}Rt.lastIndex+=h}else a[0]==="("?e.push(l):a===")"&&(n=e.length?e.pop():null);s=a}return{pattern:t}}const Z=String.raw,wl=Z`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,en=Z`\(\?R=(?<rDepth>[^\)]+)\)|${wl}`,yt=Z`\(\?<(?![=!])(?<captureName>[^>]+)>`,ps=Z`${yt}|(?<unnamed>\()(?!\?)`,le=new RegExp(Z`${yt}|${en}|\(\?|\\?.`,"gsu"),Nt="Cannot use multiple overlapping recursions";function Cl(t,e){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...e};let s=e?.captureTransfers??new Map;if(!new RegExp(en,"su").test(t))return{pattern:t,captureTransfers:s,hiddenCaptures:n};if(r==="plugin"&&Ze(t,Z`\(\?\(DEFINE\)`,Q.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],i=Ze(t,Z`\\[1-9]`,Q.DEFAULT),a=new Map,l=[];let c=!1,u=0,f=0,h;for(le.lastIndex=0;h=le.exec(t);){const{0:d,groups:{captureName:p,rDepth:b,gRNameOrNum:w,gRDepth:y}}=h;if(d==="[")u++;else if(u)d==="]"&&u--;else if(b){if(tr(b),c)throw new Error(Nt);if(i)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const m=t.slice(0,h.index),g=t.slice(le.lastIndex);if(Ze(g,en,Q.DEFAULT))throw new Error(Nt);const _=+b-1;t=nr(m,g,_,!1,n,o,f),s=sr(s,m,_,o.length,0,f);break}else if(w){tr(y);let m=!1;for(const R of l)if(R.name===w||R.num===+w){if(m=!0,R.hasRecursedWithin)throw new Error(Nt);break}if(!m)throw new Error(Z`Recursive \g cannot be used outside the referenced group "${r==="external"?w:Z`\g<${w}&R=${y}>`}"`);const g=a.get(w),_=ml(t,g);if(i&&Ze(_,Z`${yt}|\((?!\?)`,Q.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const S=t.slice(g,h.index),x=_.slice(S.length+d.length),A=o.length,k=+y-1,N=nr(S,x,k,!0,n,o,f);s=sr(s,S,k,o.length-A,A,f);const L=t.slice(0,g),T=t.slice(g+_.length);t=`${L}${N}${T}`,le.lastIndex+=N.length-d.length-S.length-x.length,l.forEach(R=>R.hasRecursedWithin=!0),c=!0}else if(p)f++,a.set(String(f),le.lastIndex),a.set(p,le.lastIndex),l.push({num:f,name:p});else if(d[0]==="("){const m=d==="(";m&&(f++,a.set(String(f),le.lastIndex)),l.push(m?{num:f}:{})}else d===")"&&l.pop()}return n.push(...o),{pattern:t,captureTransfers:s,hiddenCaptures:n}}function tr(t){const e=`Max depth must be integer between 2 and 100; used ${t}`;if(!/^[1-9]\d*$/.test(t))throw new Error(e);if(t=+t,t<2||t>100)throw new Error(e)}function nr(t,e,n,r,s,o,i){const a=new Set;r&&hs(t+e,yt,({groups:{captureName:c}})=>{a.add(c)},Q.DEFAULT);const l=[n,r?a:null,s,o,i];return`${t}${rr(`(?:${t}`,"forward",...l)}(?:)${rr(`${e})`,"backward",...l)}${e}`}function rr(t,e,n,r,s,o,i){const l=u=>e==="forward"?u+2:n-u+2-1;let c="";for(let u=0;u<n;u++){const f=l(u);c+=bn(t,Z`${ps}|\\k<(?<backref>[^>]+)>`,({0:h,groups:{captureName:d,unnamed:p,backref:b}})=>{if(b&&r&&!r.has(b))return h;const w=`_$${f}`;if(p||d){const y=i+o.length+1;return o.push(y),_l(s,y),p?h:`(?<${d}${w}>`}return Z`\k<${b}${w}>`},Q.DEFAULT)}return c}function _l(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function sr(t,e,n,r,s,o){if(t.size&&r){let i=0;hs(e,ps,()=>i++,Q.DEFAULT);const a=o-i+s,l=new Map;return t.forEach((c,u)=>{const f=(r-i*n)/n,h=i*n,d=u>a+i?u+r:u,p=[];for(const b of c)if(b<=a)p.push(b);else if(b>a+i+f)p.push(b+r);else if(b<=a+i)for(let w=0;w<=n;w++)p.push(b+i*w);else for(let w=0;w<=n;w++)p.push(b+h+f*w);l.set(d,p)}),l}return t}var O=String.fromCodePoint,v=String.raw,J={},bt=globalThis.RegExp;J.flagGroups=(()=>{try{new bt("(?i:)")}catch{return!1}return!0})();J.unicodeSets=(()=>{try{new bt("[[]]","v")}catch{return!1}return!0})();J.bugFlagVLiteralHyphenIsRange=J.unicodeSets?(()=>{try{new bt(v`[\d\-a]`,"v")}catch{return!0}return!1})():!1;J.bugNestedClassIgnoresNegation=J.unicodeSets&&new bt("[[^a]]","v").test("a");function ht(t,{enable:e,disable:n}){return{dotAll:!n?.dotAll&&!!(e?.dotAll||t.dotAll),ignoreCase:!n?.ignoreCase&&!!(e?.ignoreCase||t.ignoreCase)}}function Be(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}function tn(t,e){return or[t]>=or[e]}function Sl(t,e){if(t==null)throw new Error(e??"Value expected");return t}var or={ES2025:2025,ES2024:2024,ES2018:2018},kl={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function gs(t={}){if({}.toString.call(t)!=="[object Object]")throw new Error("Unexpected options");if(t.target!==void 0&&!kl[t.target])throw new Error(`Unexpected target "${t.target}"`);const e={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...t,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...t.rules}};return e.target==="auto"&&(e.target=J.flagGroups?"ES2025":J.unicodeSets?"ES2024":"ES2018"),e}var xl="[ -\r ]",vl=new Set([O(304),O(305)]),ne=v`[\p{L}\p{M}\p{N}\p{Pc}]`;function ms(t){if(vl.has(t))return[t];const e=new Set,n=t.toLowerCase(),r=n.toUpperCase(),s=Al.get(n),o=Il.get(n),i=El.get(n);return[...r].length===1&&e.add(r),i&&e.add(i),s&&e.add(s),e.add(n),o&&e.add(o),[...e]}var wn=new Map(`C Other
60
60
  Cc Control cntrl
61
61
  Cf Format
62
62
  Cn Unassigned
@@ -146,10 +146,10 @@ Uppercase Upper
146
146
  Variation_Selector VS
147
147
  White_Space space
148
148
  XID_Continue XIDC
149
- XID_Start XIDS`.split(/\s/).map(t=>[mt(t),t])),vl=new Map([["s",O(383)],[O(383),"s"]]),Il=new Map([[O(223),O(7838)],[O(107),O(8490)],[O(229),O(8491)],[O(969),O(8486)]]),El=new Map([oe(453),oe(456),oe(459),oe(498),...Nt(8072,8079),...Nt(8088,8095),...Nt(8104,8111),oe(8124),oe(8140),oe(8188)]),Al=new Map([["alnum",v`[\p{Alpha}\p{Nd}]`],["alpha",v`\p{Alpha}`],["ascii",v`\p{ASCII}`],["blank",v`[\p{Zs}\t]`],["cntrl",v`\p{Cc}`],["digit",v`\p{Nd}`],["graph",v`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",v`\p{Lower}`],["print",v`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",v`[\p{P}\p{S}]`],["space",v`\p{space}`],["upper",v`\p{Upper}`],["word",v`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",v`\p{AHex}`]]);function Ll(t,e){const n=[];for(let r=t;r<=e;r++)n.push(r);return n}function oe(t){const e=O(t);return[e.toLowerCase(),e]}function Nt(t,e){return Ll(t,e).map(n=>oe(n))}var ms=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function Rl(t,e){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...e};ys(t);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:en(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:t.flags.digitIsAscii,spaceIsAscii:t.flags.spaceIsAscii,wordIsAscii:t.flags.wordIsAscii};Te(t,Nl,r);const s={dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},o={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};Te(t,Pl,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return Te(t,$l,i),t._originMap=o.groupOriginByCopy,t._strategy=r.strategy,t}var Nl={AbsenceFunction({node:t,parent:e,replaceWith:n}){const{body:r,kind:s}=t;if(s==="repeater"){const o=Y();o.body[0].body.push(ue({negate:!0,body:r}),we("Any"));const i=Y();i.body[0].body.push(ls("greedy",0,1/0,o)),n($(i,e),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:t,parent:e,key:n},{flagDirectivesByAlt:r}){const s=t.body.filter(o=>o.kind==="flags");for(let o=n+1;o<e.body.length;o++){const i=e.body[o];Be(r,i,[]).push(...s)}},exit({node:t},{flagDirectivesByAlt:e}){if(e.get(t)?.length){const n=ws(e.get(t));if(n){const r=Y({flags:n});r.body[0].body=t.body,t.body=[$(r,t)]}}}},Assertion({node:t,parent:e,key:n,container:r,root:s,remove:o,replaceWith:i},a){const{kind:l,negate:c}=t,{asciiWordBoundaries:u,avoidSubclass:f,supportedGNodes:h,wordIsAscii:d}=a;if(l==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if(l==="line_end")i($(ue({body:[de({body:[Zt("string_end")]}),de({body:[gt(10)]})]}),e));else if(l==="line_start")i($(ne(v`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),e));else if(l==="search_start")if(h.has(t))s.flags.sticky=!0,o();else{const p=r[n-1];if(p&&Bl(p))i($(ue({negate:!0}),e));else{if(f)throw new Error(v`Uses "\G" in a way that requires a subclass`);i(ie(Zt("string_start"),e)),a.strategy="clip_search"}}else if(!(l==="string_end"||l==="string_start"))if(l==="string_end_newline")i($(ne(v`(?=\n?\z)`),e));else if(l==="word_boundary"){if(!d&&!u){const p=`(?:(?<=${te})(?!${te})|(?<!${te})(?=${te}))`,b=`(?:(?<=${te})(?=${te})|(?<!${te})(?!${te}))`;i($(ne(c?b:p),e))}}else throw new Error(`Unexpected assertion kind "${l}"`)},Backreference({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!$t(n)&&(n=Pt(n,e),t.ref=n)},CapturingGroup({node:t},{jsGroupNameMap:e,subroutineRefMap:n}){let{name:r}=t;r&&!$t(r)&&(r=Pt(r,e),t.name=r),n.set(t.number,t),r&&n.set(r,t)},CharacterClassRange({node:t,parent:e,replaceWith:n}){if(e.kind==="intersection"){const r=tt({body:[t]});n($(r,e),{traverse:!0})}},CharacterSet({node:t,parent:e,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:a}){const{kind:l,negate:c,value:u}=t;if(o&&(l==="digit"||u==="digit")){n(ie(Yt("digit",{negate:c}),e));return}if(i&&(l==="space"||u==="space")){n($(Tt(ne(kl),c),e));return}if(a&&(l==="word"||u==="word")){n(ie(Yt("word",{negate:c}),e));return}if(l==="any")n(ie(we("Any"),e));else if(l==="digit")n(ie(we("Nd",{negate:c}),e));else if(l!=="dot")if(l==="text_segment"){if(r==="strict")throw new Error(v`Use of "\X" requires non-strict accuracy`);const f="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",h=v`\p{RI}{2}|${f}(?:\u200D${f})*`;n($(ne(v`(?>\r\n|${s?v`\p{RGI_Emoji}`:h}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),e))}else if(l==="hex")n(ie(we("AHex",{negate:c}),e));else if(l==="newline")n($(ne(c?`[^
149
+ XID_Start XIDS`.split(/\s/).map(t=>[mt(t),t])),Il=new Map([["s",O(383)],[O(383),"s"]]),El=new Map([[O(223),O(7838)],[O(107),O(8490)],[O(229),O(8491)],[O(969),O(8486)]]),Al=new Map([oe(453),oe(456),oe(459),oe(498),...Pt(8072,8079),...Pt(8088,8095),...Pt(8104,8111),oe(8124),oe(8140),oe(8188)]),Ll=new Map([["alnum",v`[\p{Alpha}\p{Nd}]`],["alpha",v`\p{Alpha}`],["ascii",v`\p{ASCII}`],["blank",v`[\p{Zs}\t]`],["cntrl",v`\p{Cc}`],["digit",v`\p{Nd}`],["graph",v`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",v`\p{Lower}`],["print",v`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",v`[\p{P}\p{S}]`],["space",v`\p{space}`],["upper",v`\p{Upper}`],["word",v`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",v`\p{AHex}`]]);function Rl(t,e){const n=[];for(let r=t;r<=e;r++)n.push(r);return n}function oe(t){const e=O(t);return[e.toLowerCase(),e]}function Pt(t,e){return Rl(t,e).map(n=>oe(n))}var ys=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function Nl(t,e){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...e};bs(t);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:tn(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:t.flags.digitIsAscii,spaceIsAscii:t.flags.spaceIsAscii,wordIsAscii:t.flags.wordIsAscii};Te(t,Pl,r);const s={dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},o={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};Te(t,$l,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return Te(t,Tl,i),t._originMap=o.groupOriginByCopy,t._strategy=r.strategy,t}var Pl={AbsenceFunction({node:t,parent:e,replaceWith:n}){const{body:r,kind:s}=t;if(s==="repeater"){const o=Y();o.body[0].body.push(ue({negate:!0,body:r}),we("Any"));const i=Y();i.body[0].body.push(cs("greedy",0,1/0,o)),n($(i,e),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:t,parent:e,key:n},{flagDirectivesByAlt:r}){const s=t.body.filter(o=>o.kind==="flags");for(let o=n+1;o<e.body.length;o++){const i=e.body[o];Be(r,i,[]).push(...s)}},exit({node:t},{flagDirectivesByAlt:e}){if(e.get(t)?.length){const n=Cs(e.get(t));if(n){const r=Y({flags:n});r.body[0].body=t.body,t.body=[$(r,t)]}}}},Assertion({node:t,parent:e,key:n,container:r,root:s,remove:o,replaceWith:i},a){const{kind:l,negate:c}=t,{asciiWordBoundaries:u,avoidSubclass:f,supportedGNodes:h,wordIsAscii:d}=a;if(l==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if(l==="line_end")i($(ue({body:[de({body:[Qt("string_end")]}),de({body:[gt(10)]})]}),e));else if(l==="line_start")i($(re(v`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),e));else if(l==="search_start")if(h.has(t))s.flags.sticky=!0,o();else{const p=r[n-1];if(p&&Fl(p))i($(ue({negate:!0}),e));else{if(f)throw new Error(v`Uses "\G" in a way that requires a subclass`);i(ie(Qt("string_start"),e)),a.strategy="clip_search"}}else if(!(l==="string_end"||l==="string_start"))if(l==="string_end_newline")i($(re(v`(?=\n?\z)`),e));else if(l==="word_boundary"){if(!d&&!u){const p=`(?:(?<=${ne})(?!${ne})|(?<!${ne})(?=${ne}))`,b=`(?:(?<=${ne})(?=${ne})|(?<!${ne})(?!${ne}))`;i($(re(c?b:p),e))}}else throw new Error(`Unexpected assertion kind "${l}"`)},Backreference({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!Tt(n)&&(n=$t(n,e),t.ref=n)},CapturingGroup({node:t},{jsGroupNameMap:e,subroutineRefMap:n}){let{name:r}=t;r&&!Tt(r)&&(r=$t(r,e),t.name=r),n.set(t.number,t),r&&n.set(r,t)},CharacterClassRange({node:t,parent:e,replaceWith:n}){if(e.kind==="intersection"){const r=tt({body:[t]});n($(r,e),{traverse:!0})}},CharacterSet({node:t,parent:e,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:a}){const{kind:l,negate:c,value:u}=t;if(o&&(l==="digit"||u==="digit")){n(ie(Jt("digit",{negate:c}),e));return}if(i&&(l==="space"||u==="space")){n($(Mt(re(xl),c),e));return}if(a&&(l==="word"||u==="word")){n(ie(Jt("word",{negate:c}),e));return}if(l==="any")n(ie(we("Any"),e));else if(l==="digit")n(ie(we("Nd",{negate:c}),e));else if(l!=="dot")if(l==="text_segment"){if(r==="strict")throw new Error(v`Use of "\X" requires non-strict accuracy`);const f="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",h=v`\p{RI}{2}|${f}(?:\u200D${f})*`;n($(re(v`(?>\r\n|${s?v`\p{RGI_Emoji}`:h}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),e))}else if(l==="hex")n(ie(we("AHex",{negate:c}),e));else if(l==="newline")n($(re(c?`[^
150
150
  ]`:`(?>\r
151
151
  ?|[
152
- \v\f…\u2028\u2029])`),e));else if(l==="posix")if(!s&&(u==="graph"||u==="print")){if(r==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let f={graph:"!-~",print:" -~"}[u];c&&(f=`\0-${O(f.codePointAt(0)-1)}${O(f.codePointAt(2)+1)}-􏿿`),n($(ne(`[${f}]`),e))}else n($(Tt(ne(Al.get(u)),c),e));else if(l==="property")bn.has(mt(u))||(t.key="sc");else if(l==="space")n(ie(we("space",{negate:c}),e));else if(l==="word")n($(Tt(ne(te),c),e));else throw new Error(`Unexpected character set kind "${l}"`)},Directive({node:t,parent:e,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:a,flags:l}=t;if(a==="flags")if(!l.enable&&!l.disable)r();else{const c=Y({flags:l});c.body[0].body=i(),s($(c,e),{traverse:!0})}else if(a==="keep"){const c=n.body[0],f=n.body.length===1&&os(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:n;if(e.parent!==f||f.body.length>1)throw new Error(v`Uses "\K" in a way that's unsupported`);const h=ue({behind:!0});h.body[0].body=o(),s($(h,e))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:t,parent:e}){if(t.posixIsAscii)throw new Error('Unsupported flag "P"');if(t.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete t[n]),Object.assign(t,{global:!1,hasIndices:!1,multiline:!1,sticky:t.sticky??!1}),e.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:t}){if(!t.flags)return;const{enable:e,disable:n}=t.flags;e?.extended&&delete e.extended,n?.extended&&delete n.extended,e?.dotAll&&n?.dotAll&&delete e.dotAll,e?.ignoreCase&&n?.ignoreCase&&delete e.ignoreCase,e&&!Object.keys(e).length&&delete t.flags.enable,n&&!Object.keys(n).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},e){const{kind:n}=t;n==="lookbehind"&&(e.passedLookbehind=!0)},NamedCallout({node:t,parent:e,replaceWith:n}){const{kind:r}=t;if(r==="fail")n($(ue({negate:!0}),e));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:t}){if(t.body.type==="Quantifier"){const e=Y();e.body[0].body.push(t.body),t.body=$(e,t)}},Regex:{enter({node:t},{supportedGNodes:e}){const n=[];let r=!1,s=!1;for(const o of t.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=_s(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>e.add(o))},exit(t,{accuracy:e,passedLookbehind:n,strategy:r}){if(e==="strict"&&n&&r)throw new Error(v`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!$t(n)&&(n=Pt(n,e),t.ref=n)}},Pl={Backreference({node:t},{multiplexCapturesToLeftByRef:e,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=t;r||n.set(t,[...e.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:t,parent:e,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:l}){const c=s.get(t);if(c&&a.has(t.number)){const f=ie(or(t.number),e);l.set(f,a.get(t.number)),n(f);return}a.set(t.number,t),i.set(t.number,[]),t.name&&Be(i,t.name,[]);const u=i.get(t.name??t.number);for(let f=0;f<u.length;f++){const h=u[f];if(c===h.node||c&&c===h.origin||t===h.origin){u.splice(f,1);break}}if(i.get(t.number).push({node:t,origin:c}),t.name&&i.get(t.name).push({node:t,origin:c}),t.name){const f=Be(o,t.name,new Map);let h=!1;if(c)h=!0;else for(const d of f.values())if(!d.hasDuplicateNameToRemove){h=!0;break}o.get(t.name).set(t,{node:t,hasDuplicateNameToRemove:h})}},exit({node:t},{openRefs:e}){e.delete(t.number)}},Group:{enter({node:t},e){e.prevFlags=e.currentFlags,t.flags&&(e.currentFlags=ht(e.currentFlags,t.flags))},exit(t,e){e.currentFlags=e.prevFlags}},Subroutine({node:t,parent:e,replaceWith:n},r){const{isRecursive:s,ref:o}=t;if(s){let u=e;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===o||u.number===o)););r.reffedNodesByReferencer.set(t,u);return}const i=r.subroutineRefMap.get(o),a=o===0,l=a?or(0):bs(i,r.groupOriginByCopy,null);let c=l;if(!a){const u=ws(Ol(i,h=>h.type==="Group"&&!!h.flags)),f=u?ht(r.globalFlags,u):r.globalFlags;Tl(f,r.currentFlags)||(c=Y({flags:Dl(f)}),c.body[0].body.push(l))}n($(c,e),{traverse:!a})}},$l={Backreference({node:t,parent:e,replaceWith:n},r){if(t.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,t.ref);return}const o=r.reffedNodesByReferencer.get(t).filter(i=>Ml(i,t));if(!o.length)n($(ue({negate:!0}),e));else if(o.length>1){const i=Y({atomic:!0,body:o.reverse().map(a=>de({body:[Qt(a.number)]}))});n($(i,e))}else t.ref=o[0].number},CapturingGroup({node:t},e){t.number=++e.numCapturesToLeft,t.name&&e.groupsByName.get(t.name).get(t).hasDuplicateNameToRemove&&delete t.name},Regex:{exit({node:t},e){const n=Math.max(e.highestOrphanBackref-e.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=as();t.body.at(-1).body.push(s)}}},Subroutine({node:t},e){!t.isRecursive||t.ref===0||(t.ref=e.reffedNodesByReferencer.get(t).number)}};function ys(t){Te(t,{"*"({node:e,parent:n}){e.parent=n}})}function Tl(t,e){return t.dotAll===e.dotAll&&t.ignoreCase===e.ignoreCase}function Ml(t,e){let n=e;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===t)return!1;const r=Cs(n.parent);for(const s of r){if(s===n)break;if(s===t||Ss(s,t))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function bs(t,e,n,r){const s=Array.isArray(t)?[]:{};for(const[o,i]of Object.entries(t))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=bs(i,e,s,n):(o==="type"&&i==="CapturingGroup"&&e.set(s,e.get(t)??t),s[o]=i);return s}function or(t){const e=cs(t);return e.isRecursive=!0,e}function Ol(t,e){const n=[];for(;t=t.parent;)(!e||e(t))&&n.push(t);return n}function Pt(t,e){if(e.has(t))return e.get(t);const n=`$${e.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return e.set(t,n),n}function ws(t){const e=["dotAll","ignoreCase"],n={enable:{},disable:{}};return t.forEach(({flags:r})=>{e.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Dl({dotAll:t,ignoreCase:e}){const n={};return(t||e)&&(n.enable={},t&&(n.enable.dotAll=!0),e&&(n.enable.ignoreCase=!0)),(!t||!e)&&(n.disable={},!t&&(n.disable.dotAll=!0),!e&&(n.disable.ignoreCase=!0)),n}function Cs(t){if(!t)throw new Error("Node expected");const{body:e}=t;return Array.isArray(e)?e:e?[e]:null}function _s(t){const e=t.find(n=>n.kind==="search_start"||Fl(n,{negate:!1})||!Gl(n));if(!e)return null;if(e.kind==="search_start")return e;if(e.type==="LookaroundAssertion")return e.body[0].body[0];if(e.type==="CapturingGroup"||e.type==="Group"){const n=[];for(const r of e.body){const s=_s(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Ss(t,e){const n=Cs(t)??[];for(const r of n)if(r===e||Ss(r,e))return!0;return!1}function Gl({type:t}){return t==="Assertion"||t==="Directive"||t==="LookaroundAssertion"}function Bl(t){const e=["Character","CharacterClass","CharacterSet"];return e.includes(t.type)||t.type==="Quantifier"&&t.min&&e.includes(t.body.type)}function Fl(t,e){const n={negate:null,...e};return t.type==="LookaroundAssertion"&&(n.negate===null||t.negate===n.negate)&&t.body.length===1&&os(t.body[0],{type:"Assertion",kind:"search_start"})}function $t(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function ne(t,e){const r=is(t,{...e,unicodePropertyMap:bn}).body;return r.length>1||r[0].body.length>1?Y({body:r}):r[0].body[0]}function Tt(t,e){return t.negate=e,t}function ie(t,e){return t.parent=e,t}function $(t,e){return ys(t),t.parent=e,t}function Ul(t,e){const n=ps(e),r=en(n.target,"ES2024"),s=en(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,a=null;if(!s){const d=[t.flags.ignoreCase];Te(t,jl,{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(p){d.push(p)},setHasCasedChar(){d.at(-1)?i=!0:a=!0}})}const l={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||i)&&!a)};let c=t;const u={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:t._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&a),useFlagMods:s,useFlagV:r,verbose:n.verbose};function f(d){return u.lastNode=c,c=d,_l(Wl[d.type],`Unexpected node type "${d.type}"`)(d,u,f)}const h={pattern:t.body.map(f).join("|"),flags:f(t.flags),options:{...t.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((d,p)=>{d.hidden&&h._hiddenCaptures.push(p),d.transferTo&&Be(h._captureTransfers,d.transferTo,[]).push(p)}),h}var jl={"*":{enter({node:t},e){if(ar(t)){const n=e.getCurrentModI();e.pushModI(t.flags?ht({ignoreCase:n},t.flags).ignoreCase:n)}},exit({node:t},e){ar(t)&&e.popModI()}},Backreference(t,e){e.setHasCasedChar()},Character({node:t},e){wn(O(t.value))&&e.setHasCasedChar()},CharacterClassRange({node:t,skip:e},n){e(),ks(t,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:t},e){t.kind==="property"&&ms.has(t.value)&&e.setHasCasedChar()}},Wl={Alternative({body:t},e,n){return t.map(n).join("")},Assertion({kind:t,negate:e}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return e?v`\B`:v`\b`;throw new Error(`Unexpected assertion kind "${t}"`)},Backreference({ref:t},e){if(typeof t!="number")throw new Error("Unexpected named backref in transformed AST");if(!e.useFlagMods&&e.accuracy==="strict"&&e.currentFlags.ignoreCase&&!e.captureMap.get(t).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+t},CapturingGroup(t,e,n){const{body:r,name:s,number:o}=t,i={ignoreCase:e.currentFlags.ignoreCase},a=e.originMap.get(t);return a&&(i.hidden=!0,o>a.number&&(i.transferTo=a.number)),e.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:t},e){const n=O(t),r=me(t,{escDigit:e.lastNode.type==="Backreference",inCharClass:e.inCharClass,useFlagV:e.useFlagV});if(r!==n)return r;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&wn(n)){const s=gs(n);return e.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(t,e,n){const{kind:r,negate:s,parent:o}=t;let{body:i}=t;if(r==="intersection"&&!e.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");se.bugFlagVLiteralHyphenIsRange&&e.useFlagV&&i.some(lr)&&(i=[gt(45),...i.filter(c=>!lr(c))]);const a=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!e.inCharClass){if((!e.useFlagV||se.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(f=>f.type==="CharacterClass"&&f.kind==="union"&&f.negate);if(u.length){const f=Y(),h=f.body[0];return f.parent=o,h.parent=f,i=i.filter(d=>!u.includes(d)),t.body=i,i.length?(t.parent=h,h.body.push(t)):f.body.pop(),u.forEach(d=>{const p=de({body:[d]});d.parent=p,p.parent=f,f.body.push(p)}),n(f)}}e.inCharClass=!0;const c=a();return e.inCharClass=!1,c}const l=i[0];if(r==="union"&&!s&&l&&((!e.useFlagV||!e.verbose)&&o.kind==="union"&&!(se.bugFlagVLiteralHyphenIsRange&&e.useFlagV)||!e.verbose&&o.kind==="intersection"&&i.length===1&&l.type!=="CharacterClassRange"))return i.map(n).join("");if(!e.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(t,e){const n=t.min.value,r=t.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:e.useFlagV},o=me(n,s),i=me(r,s),a=new Set;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase){const l=ks(t);Xl(l).forEach(u=>{a.add(Array.isArray(u)?`${me(u[0],s)}-${me(u[1],s)}`:me(u,s))})}return`${o}-${i}${[...a].join("")}`},CharacterSet({kind:t,negate:e,value:n,key:r},s){if(t==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":v`[^\n]`;if(t==="digit")return e?v`\D`:v`\d`;if(t==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&ms.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${e?v`\P`:v`\p`}{${r?`${r}=`:""}${n}}`}if(t==="word")return e?v`\W`:v`\w`;throw new Error(`Unexpected character set kind "${t}"`)},Flags(t,e){return(e.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")},Group({atomic:t,body:e,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=ht(i,n));const a=e.map(o).join("|"),l=!s.verbose&&e.length===1&&r.type!=="Quantifier"&&!t&&(!s.useFlagMods||!n)?a:`(?${Kl(t,n,s.useFlagMods)}${a})`;return s.currentFlags=i,l},LookaroundAssertion({body:t,kind:e,negate:n},r,s){return`(?${`${e==="lookahead"?"":"<"}${n?"!":"="}`}${t.map(s).join("|")})`},Quantifier(t,e,n){return n(t.body)+Zl(t)},Subroutine({isRecursive:t,ref:e},n){if(!t)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return e===0?`(?R=${r})`:v`\g<${e}&R=${r}>`}},zl=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Hl=new Set(["-","\\","]","^","["]),ql=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),ir=new Map([[9,v`\t`],[10,v`\n`],[11,v`\v`],[12,v`\f`],[13,v`\r`],[8232,v`\u2028`],[8233,v`\u2029`],[65279,v`\uFEFF`]]),Vl=/^\p{Cased}$/u;function wn(t){return Vl.test(t)}function ks(t,e){const n=!!e?.firstOnly,r=t.min.value,s=t.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const a=O(i);if(!wn(a))continue;const l=gs(a).filter(c=>{const u=c.codePointAt(0);return u<r||u>s});if(l.length&&(o.push(...l),n))break}return o}function me(t,{escDigit:e,inCharClass:n,useFlagV:r}){if(ir.has(t))return ir.get(t);if(t<32||t>126&&t<160||t>262143||e&&Ql(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?ql:Hl:zl,o=O(t);return(s.has(o)?"\\":"")+o}function Xl(t){const e=t.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<e.length;s++)e[s+1]===e[s]+1?r??=e[s]:r===null?n.push(e[s]):(n.push([r,e[s]]),r=null);return n}function Kl(t,e,n){if(t)return">";let r="";if(e&&n){const{enable:s,disable:o}=e;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function Zl({kind:t,max:e,min:n}){let r;return!n&&e===1?r="?":!n&&e===1/0?r="*":n===1&&e===1/0?r="+":n===e?r=`{${n}}`:r=`{${n},${e===1/0?"":e}}`,r+{greedy:"",lazy:"?",possessive:"+"}[t]}function ar({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function Ql(t){return t>47&&t<58}function lr({type:t,value:e}){return t==="Character"&&e===45}var Yl=class tn extends RegExp{#t=new Map;#e=null;#r;#n=null;#s=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(e,n,r){const s=!!r?.lazyCompile;if(e instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=e;super(o,n),this.#r=o.source,o instanceof tn&&(this.#t=o.#t,this.#n=o.#n,this.#s=o.#s,this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":e,n),this.#r=e,this.#t=ec(o.hiddenCaptures,o.transfers),this.#s=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(e){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new tn(this.#r,this.flags,o)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#s==="clip_search"&&n&&r){this.lastIndex=0;const s=this.#o(e.slice(r));return s&&(Jl(s,r,e,this.hasIndices),this.lastIndex+=r),s}return this.#o(e)}#o(e){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,e);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:a,transferTo:l}=this.#t.get(i)??{};if(a?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),l&&r[i]!==void 0){const c=o[l];if(!c)throw new Error(`Invalid capture transfer to "${c}"`);if(n[c]=r[i],this.hasIndices&&(n.indices[c]=s[i]),n.groups){this.#n||(this.#n=tc(this.source));const u=this.#n.get(l);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function Jl(t,e,n,r){if(t.index+=e,t.input=n,r){const s=t.indices;for(let i=0;i<s.length;i++){const a=s[i];a&&(s[i]=[a[0]+e,a[1]+e])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const a=o[i];a&&(o[i]=[a[0]+e,a[1]+e])})}}function ec(t,e){const n=new Map;for(const r of t)n.set(r,{hidden:!0});for(const[r,s]of e)for(const o of s)Be(n,o,{}).transferTo=r;return n}function tc(t){const e=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=e.exec(t);){const{0:i,groups:{capture:a,name:l}}=o;i==="["?r++:r?i==="]"&&r--:a&&(s++,l&&n.set(s,l))}return n}function nc(t,e){const n=rc(t,e);return n.options?new Yl(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function rc(t,e){const n=ps(e),r=is(t,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:bn}),s=Rl(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=Ul(s,n),i=wl(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),a=yl(i.pattern),l=ml(a.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),c={pattern:l.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const u=l.hiddenCaptures.sort((p,b)=>p-b),f=Array.from(l.captureTransfers),h=s._strategy,d=c.pattern.length>=n.lazyCompileLength;(u.length||f.length||h||d)&&(c.options={...u.length&&{hiddenCaptures:u},...f.length&&{transfers:f},...h&&{strategy:h},...d&&{lazyCompile:d}})}return c}const cr=4294967295;class sc{constructor(e,n={}){this.patterns=e,this.options=n;const{forgiving:r=!1,cache:s,regexConstructor:o}=n;if(!o)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(i=>{if(typeof i!="string")return i;const a=s?.get(i);if(a){if(a instanceof RegExp)return a;if(r)return null;throw a}try{const l=o(i);return s?.set(i,l),l}catch(l){if(s?.set(i,l),r)return null;throw l}})}regexps;findNextMatchSync(e,n,r){const s=typeof e=="string"?e:e.content,o=[];function i(a,l,c=0){return{index:a,captureIndices:l.indices.map(u=>u==null?{start:cr,end:cr,length:0}:{start:u[0]+c,end:u[1]+c,length:u[1]-u[0]})}}for(let a=0;a<this.regexps.length;a++){const l=this.regexps[a];if(l)try{l.lastIndex=n;const c=l.exec(s);if(!c)continue;if(c.index===n)return i(a,c,0);o.push([a,c,0])}catch(c){if(this.options.forgiving)continue;throw c}}if(o.length){const a=Math.min(...o.map(l=>l[1].index));for(const[l,c,u]of o)if(c.index===a)return i(l,c,u)}return null}}function oc(t,e){return nc(t,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...e})}function ic(t={}){const e=Object.assign({target:"auto",cache:new Map},t);return e.regexConstructor||=n=>oc(n,{target:e.target}),{createScanner(n){return new sc(n,e)},createString(n){return{content:n}}}}class Cn extends Error{constructor(e){super(e),this.name="ShikiError"}}function ac(){return 2147483648}function lc(){return typeof performance<"u"?performance.now():Date.now()}const cc=(t,e)=>t+(e-t%e)%e;async function uc(t){let e,n;const r={};function s(d){n=d,r.HEAPU8=new Uint8Array(d),r.HEAPU32=new Uint32Array(d)}function o(d,p,b){r.HEAPU8.copyWithin(d,p,p+b)}function i(d){try{return e.grow(d-n.byteLength+65535>>>16),s(e.buffer),1}catch{}}function a(d){const p=r.HEAPU8.length;d=d>>>0;const b=ac();if(d>b)return!1;for(let w=1;w<=4;w*=2){let y=p*(1+.2/w);y=Math.min(y,d+100663296);const m=Math.min(b,cc(Math.max(d,y),65536));if(i(m))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(d,p,b=1024){const w=p+b;let y=p;for(;d[y]&&!(y>=w);)++y;if(y-p>16&&d.buffer&&l)return l.decode(d.subarray(p,y));let m="";for(;p<y;){let g=d[p++];if(!(g&128)){m+=String.fromCharCode(g);continue}const _=d[p++]&63;if((g&224)===192){m+=String.fromCharCode((g&31)<<6|_);continue}const S=d[p++]&63;if((g&240)===224?g=(g&15)<<12|_<<6|S:g=(g&7)<<18|_<<12|S<<6|d[p++]&63,g<65536)m+=String.fromCharCode(g);else{const x=g-65536;m+=String.fromCharCode(55296|x>>10,56320|x&1023)}}return m}function u(d,p){return d?c(r.HEAPU8,d,p):""}const f={emscripten_get_now:lc,emscripten_memcpy_big:o,emscripten_resize_heap:a,fd_write:()=>0};async function h(){const p=await t({env:f,wasi_snapshot_preview1:f});e=p.memory,s(e.buffer),Object.assign(r,p),r.UTF8ToString=u}return await h(),r}var fc=Object.defineProperty,hc=(t,e,n)=>e in t?fc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,D=(t,e,n)=>hc(t,typeof e!="symbol"?e+"":e,n);let B=null;function dc(t){throw new Cn(t.UTF8ToString(t.getLastOnigError()))}class bt{constructor(e){D(this,"utf16Length"),D(this,"utf8Length"),D(this,"utf16Value"),D(this,"utf8Value"),D(this,"utf16OffsetToUtf8"),D(this,"utf8OffsetToUtf16");const n=e.length,r=bt._utf8ByteLength(e),s=r!==n,o=s?new Uint32Array(n+1):null;s&&(o[n]=r);const i=s?new Uint32Array(r+1):null;s&&(i[r]=n);const a=new Uint8Array(r);let l=0;for(let c=0;c<n;c++){const u=e.charCodeAt(c);let f=u,h=!1;if(u>=55296&&u<=56319&&c+1<n){const d=e.charCodeAt(c+1);d>=56320&&d<=57343&&(f=(u-55296<<10)+65536|d-56320,h=!0)}s&&(o[c]=l,h&&(o[c+1]=l),f<=127?i[l+0]=c:f<=2047?(i[l+0]=c,i[l+1]=c):f<=65535?(i[l+0]=c,i[l+1]=c,i[l+2]=c):(i[l+0]=c,i[l+1]=c,i[l+2]=c,i[l+3]=c)),f<=127?a[l++]=f:f<=2047?(a[l++]=192|(f&1984)>>>6,a[l++]=128|(f&63)>>>0):f<=65535?(a[l++]=224|(f&61440)>>>12,a[l++]=128|(f&4032)>>>6,a[l++]=128|(f&63)>>>0):(a[l++]=240|(f&1835008)>>>18,a[l++]=128|(f&258048)>>>12,a[l++]=128|(f&4032)>>>6,a[l++]=128|(f&63)>>>0),h&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=e,this.utf8Value=a,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=i}static _utf8ByteLength(e){let n=0;for(let r=0,s=e.length;r<s;r++){const o=e.charCodeAt(r);let i=o,a=!1;if(o>=55296&&o<=56319&&r+1<s){const l=e.charCodeAt(r+1);l>=56320&&l<=57343&&(i=(o-55296<<10)+65536|l-56320,a=!0)}i<=127?n+=1:i<=2047?n+=2:i<=65535?n+=3:n+=4,a&&r++}return n}createString(e){const n=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,n),n}}const wt=class ee{constructor(e){if(D(this,"id",++ee.LAST_ID),D(this,"_onigBinding"),D(this,"content"),D(this,"utf16Length"),D(this,"utf8Length"),D(this,"utf16OffsetToUtf8"),D(this,"utf8OffsetToUtf16"),D(this,"ptr"),!B)throw new Cn("Must invoke loadWasm first.");this._onigBinding=B,this.content=e;const n=new bt(e);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!ee._sharedPtrInUse?(ee._sharedPtr||(ee._sharedPtr=B.omalloc(1e4)),ee._sharedPtrInUse=!0,B.HEAPU8.set(n.utf8Value,ee._sharedPtr),this.ptr=ee._sharedPtr):this.ptr=n.createString(B)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===ee._sharedPtr?ee._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};D(wt,"LAST_ID",0);D(wt,"_sharedPtr",0);D(wt,"_sharedPtrInUse",!1);let xs=wt;class pc{constructor(e){if(D(this,"_onigBinding"),D(this,"_ptr"),!B)throw new Cn("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=e.length;a<l;a++){const c=new bt(e[a]);n[a]=c.createString(B),r[a]=c.utf8Length}const s=B.omalloc(4*e.length);B.HEAPU32.set(n,s/4);const o=B.omalloc(4*e.length);B.HEAPU32.set(r,o/4);const i=B.createOnigScanner(s,o,e.length);for(let a=0,l=e.length;a<l;a++)B.ofree(n[a]);B.ofree(o),B.ofree(s),i===0&&dc(B),this._onigBinding=B,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof e=="string"){e=new xs(e);const o=this._findNextMatchSync(e,n,!1,s);return e.dispose(),o}return this._findNextMatchSync(e,n,!1,s)}_findNextMatchSync(e,n,r,s){const o=this._onigBinding,i=o.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(n),s);if(i===0)return null;const a=o.HEAPU32;let l=i/4;const c=a[l++],u=a[l++],f=[];for(let h=0;h<u;h++){const d=e.convertUtf8OffsetToUtf16(a[l++]),p=e.convertUtf8OffsetToUtf16(a[l++]);f[h]={start:d,end:p,length:p-d}}return{index:c,captureIndices:f}}}function gc(t){return typeof t.instantiator=="function"}function mc(t){return typeof t.default=="function"}function yc(t){return typeof t.data<"u"}function bc(t){return typeof Response<"u"&&t instanceof Response}function wc(t){return typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||ArrayBuffer.isView(t))||typeof Buffer<"u"&&Buffer.isBuffer?.(t)||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&t instanceof Uint32Array}let Qe;function Cc(t){if(Qe)return Qe;async function e(){B=await uc(async n=>{let r=t;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),gc(r)?r=await r.instantiator(n):mc(r)?r=await r.default(n):(yc(r)&&(r=r.data),bc(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await _c(r)(n):r=await Sc(r)(n):wc(r)?r=await Mt(r)(n):r instanceof WebAssembly.Module?r=await Mt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Mt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Qe=e(),Qe}function Mt(t){return e=>WebAssembly.instantiate(t,e)}function _c(t){return e=>WebAssembly.instantiateStreaming(t,e)}function Sc(t){return async e=>{const n=await t.arrayBuffer();return WebAssembly.instantiate(n,e)}}async function kc(t){return t&&await Cc(t),{createScanner(e){return new pc(e.map(n=>typeof n=="string"?n:n.source))},createString(e){return new xs(e)}}}class vs{diff(e,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const o=this.castInput(e,r),i=this.castInput(n,r),a=this.removeEmpty(this.tokenize(o,r)),l=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(a,l,r,s)}diffWithOptionsObj(e,n,r,s){var o;const i=m=>{if(m=this.postProcess(m,r),s){setTimeout(function(){s(m)},0);return}else return m},a=n.length,l=e.length;let c=1,u=a+l;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const f=(o=r.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+f,d=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(d[0],n,e,0,r);if(d[0].oldPos+1>=l&&p+1>=a)return i(this.buildValues(d[0].lastComponent,n,e));let b=-1/0,w=1/0;const y=()=>{for(let m=Math.max(b,-c);m<=Math.min(w,c);m+=2){let g;const _=d[m-1],S=d[m+1];_&&(d[m-1]=void 0);let x=!1;if(S){const k=S.oldPos-m;x=S&&0<=k&&k<a}const A=_&&_.oldPos+1<l;if(!x&&!A){d[m]=void 0;continue}if(!A||x&&_.oldPos<S.oldPos?g=this.addToPath(S,!0,!1,0,r):g=this.addToPath(_,!1,!0,1,r),p=this.extractCommon(g,n,e,m,r),g.oldPos+1>=l&&p+1>=a)return i(this.buildValues(g.lastComponent,n,e))||!0;d[m]=g,g.oldPos+1>=l&&(w=Math.min(w,m-1)),p+1>=a&&(b=Math.max(b,m+1))}c++};if(s)(function m(){setTimeout(function(){if(c>u||Date.now()>h)return s(void 0);y()||m()},0)})();else for(;c<=u&&Date.now()<=h;){const m=y();if(m)return m}}addToPath(e,n,r,s,o){const i=e.lastComponent;return i&&!o.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:e.oldPos+s,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(e,n,r,s,o){const i=n.length,a=r.length;let l=e.oldPos,c=l-s,u=0;for(;c+1<i&&l+1<a&&this.equals(r[l+1],n[c+1],o);)c++,l++,u++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!o.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const s=[];let o;for(;e;)s.push(e),o=e.previousComponent,delete e.previousComponent,e=o;s.reverse();const i=s.length;let a=0,l=0,c=0;for(;a<i;a++){const u=s[a];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(l,l+u.count);f=f.map(function(h,d){const p=r[c+d];return p.length>h.length?p:h}),u.value=this.join(f)}else u.value=this.join(n.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return s}}class xc extends vs{}const vc=new xc;function Ic(t,e,n){return vc.diff(t,e,n)}const ur="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class Ec extends vs{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${ur}]+|[^\\S\\n\\r]+|[^${ur}]`,"ug");return e.match(n)||[]}}const Ac=new Ec;function Lc(t,e,n){return Ac.diff(t,e,n)}function Rc(t={}){const{classPrefix:e="__shiki_",classSuffix:n="",classReplacer:r=a=>a}=t,s=new Map;function o(a){return Object.entries(a).map(([l,c])=>`${l}:${c}`).join(";")}function i(a){const l=typeof a=="string"?a:o(a);let c=e+Nc(l)+n;return c=r(c),s.has(c)||s.set(c,typeof a=="string"?a:{...a}),c}return{name:"@shikijs/transformers:style-to-class",pre(a){if(!a.properties.style)return;const l=i(a.properties.style);delete a.properties.style,this.addClassToHast(a,l)},tokens(a){for(const l of a)for(const c of l){if(!c.htmlStyle)continue;const u=i(c.htmlStyle);c.htmlStyle={},c.htmlAttrs||={},c.htmlAttrs.class?c.htmlAttrs.class+=` ${u}`:c.htmlAttrs.class=u}},getClassRegistry(){return s},getCSS(){let a="";for(const[l,c]of s.entries())a+=`.${l}{${typeof c=="string"?c:o(c)}}`;return a},clearRegistry(){s.clear()}}}function Nc(t,e=0){let n=3735928559^e,r=1103547991^e;for(let s=0,o;s<t.length;s++)o=t.charCodeAt(s),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}const Pc=/(?<=\n)/,ze={dark:"pierre-dark",light:"pierre-light"},Is=1,fr=new Map,hr=new Set;function _n(t,e){t=Array.isArray(t)?t:[t];for(const n of t){if(hr.has(n.name))continue;let r=fr.get(n.name);r==null&&(r=n,fr.set(n.name,r)),hr.add(r.name),e.loadLanguageSync(r.data)}}const Ot=new Map,dr=new Set;function Es(t,e){t=Array.isArray(t)?t:[t];for(let n of t){let r;if(typeof n=="string"){if(r=Ot.get(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,Ot.has(n)||Ot.set(n,r);dr.has(n)||(dr.add(n),e.loadThemeSync(r))}}function Fe(t){return t.replace(/\n$|\r\n$/,"")}function $c(t){return{type:"text",value:t}}function Tc(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e;"children"in e?e=e.children[0]:e=null}}function Mc(t,e,n){const r=typeof n.lineInfo=="function"?n.lineInfo(e):n.lineInfo[e-1];if(r==null){const s=`processLine: line ${e}, contains no state.lineInfo`;throw console.error(s,{node:t,line:e,state:n}),new Error(s)}return t.tagName="div",t.properties["data-line"]=r.lineNumber,t.properties["data-alt-line"]=r.altLineNumber,t.properties["data-line-type"]=r.type,t.properties["data-line-index"]=r.lineIndex,t.children.length===0&&t.children.push($c(`
153
- `)),t}function As(t=!1){const e={lineInfo:[]},n=[{line(r){return delete r.properties.class,r},pre(r){const s=Tc(r),o=[];if(s!=null){let i=1;for(const a of s.children)a.type==="element"&&(o.push(Mc(a,i,e)),i++);s.children=o}return r}}];return t&&n.push(Oc,pr),{state:e,transformers:n,toClass:pr}}const pr=Rc({classPrefix:"hl-"}),Oc={name:"token-style-normalizer",tokens(t){for(const e of t)for(const n of e){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function V(t){return`--${t==="token"?"diffs-token":"diffs"}-`}const ye=new Map,Ne={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function nn(t){if(ye.has(t))return ye.get(t)??"text";if(Ne[t]!=null)return Ne[t];const e=t.match(/\.([^/\\]+\.[^/\\]+)$/);if(e!=null){if(ye.has(e[1]))return ye.get(e[1])??"text";if(Ne[e[1]]!=null)return Ne[e[1]]??"text"}const n=t.match(/\.([^.]+)$/)?.[1]??"";return ye.has(n)?ye.get(n)??"text":Ne[n]??"text"}function Ls({theme:t=ze,highlighter:e,prefix:n}){let r="";if(typeof t=="string"){const s=e.getTheme(t);r+=`color:${s.fg};`,r+=`background-color:${s.bg};`,r+=`${V("global")}fg:${s.fg};`,r+=`${V("global")}bg:${s.bg};`,r+=Dt(s,n)}else{let s=e.getTheme(t.dark);r+=`${V("global")}dark:${s.fg};`,r+=`${V("global")}dark-bg:${s.bg};`,r+=Dt(s,"dark"),s=e.getTheme(t.light),r+=`${V("global")}light:${s.fg};`,r+=`${V("global")}light-bg:${s.bg};`,r+=Dt(s,"light")}return r}function Dt(t,e){e=e!=null?`${e}-`:"";let n="";const r=t.colors?.["gitDecoration.addedResourceForeground"]??t.colors?.["terminal.ansiGreen"];r!=null&&(n+=`${V("global")}${e}addition-color:${r};`);const s=t.colors?.["gitDecoration.deletedResourceForeground"]??t.colors?.["terminal.ansiRed"];s!=null&&(n+=`${V("global")}${e}deletion-color:${s};`);const o=t.colors?.["gitDecoration.modifiedResourceForeground"]??t.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${V("global")}${e}modified-color:${o};`),n}function rn(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e.children;"children"in e?e=e.children[0]:e=null}throw console.error(t),new Error("getLineNodes: Unable to find children")}function Dc({diff:t,diffStyle:e,startingLine:n=0,totalLines:r=1/0,expandedHunks:s,collapsedContextThreshold:o=Is,callback:i}){const a={finalHunk:t.hunks.at(-1),viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:0,unifiedCount:0,shouldBreak(){if(!a.isWindowedHighlight)return!1;const u=a.unifiedCount>=n+r,f=a.splitCount>=n+r;return u&&f},shouldSkip(u,f){if(!a.isWindowedHighlight)return!1;const h=a.unifiedCount+u<n,d=a.splitCount+f<n;return h&&d},incrementCounts(u,f){a.unifiedCount+=u,a.splitCount+=f},isInWindow(u,f){if(!a.isWindowedHighlight)return!0;const h=a.isInUnifiedWindow(u),d=a.isInSplitWindow(f);return h||d},isInUnifiedWindow(u){return!a.isWindowedHighlight||a.unifiedCount>=n-u&&a.unifiedCount<n+r},isInSplitWindow(u){return!a.isWindowedHighlight||a.splitCount>=n-u&&a.splitCount<n+r},emit(u,f=!1){return f||a.incrementCounts(1,1),i(u)??!1}};e:for(const[u,f]of t.hunks.entries()){let b=function(k,N){return d==null||d.collapsedLines<=0||d.fromStart+d.fromEnd>0?0:N===f.splitLineStart+f.splitLineCount-1?d.collapsedLines:0},w=function(){if(h.collapsedLines===0)return 0;const k=h.collapsedLines;return h.collapsedLines=0,k};var l=b,c=w;if(a.shouldBreak())break;const h=gr(t.isPartial,f.collapsedBefore,s,u,o),d=(()=>{if(f!==a.finalHunk||!Gc(t))return;const k=t.additionLines.length-(f.additionLineIndex+f.additionCount),N=t.deletionLines.length-(f.deletionLineIndex+f.deletionCount);if(k!==N)throw new Error(`iterateOverDiff: trailing context mismatch (additions=${k}, deletions=${N}) for ${t.name}`);const L=Math.min(k,N);return gr(t.isPartial,L,s,t.hunks.length,o)})(),p=h.fromStart+h.fromEnd;if(a.shouldSkip(p,p))a.incrementCounts(p,p),w();else{let k=f.unifiedLineStart-h.rangeSize,N=f.splitLineStart-h.rangeSize,L=f.deletionLineIndex-h.rangeSize,T=f.additionLineIndex-h.rangeSize,R=f.deletionStart-h.rangeSize,z=f.additionStart-h.rangeSize,E=0;for(;E<h.fromStart;){if(a.isInWindow(0,0)){if(a.emit({hunkIndex:u,hunk:f,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:R+E,lineIndex:L+E,noEOFCR:!1,unifiedLineIndex:k+E,splitLineIndex:N+E},additionLine:{unifiedLineIndex:k+E,splitLineIndex:N+E,lineIndex:T+E,lineNumber:z+E,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);E++}for(k=f.unifiedLineStart-h.fromEnd,N=f.splitLineStart-h.fromEnd,L=f.deletionLineIndex-h.fromEnd,T=f.additionLineIndex-h.fromEnd,R=f.deletionStart-h.fromEnd,z=f.additionStart-h.fromEnd,E=0;E<h.fromEnd;){if(a.isInWindow(0,0)){if(a.emit({hunkIndex:u,hunk:f,collapsedBefore:w(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:R+E,lineIndex:L+E,noEOFCR:!1,unifiedLineIndex:k+E,splitLineIndex:N+E},additionLine:{unifiedLineIndex:k+E,splitLineIndex:N+E,lineIndex:T+E,lineNumber:z+E,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);E++}}let y=f.unifiedLineStart,m=f.splitLineStart,g=f.deletionLineIndex,_=f.additionLineIndex,S=f.deletionStart,x=f.additionStart;const A=f.hunkContent.at(-1);for(const k of f.hunkContent){if(a.shouldBreak())break e;const N=k===A;if(k.type==="context"){if(a.shouldSkip(k.lines,k.lines))a.incrementCounts(k.lines,k.lines),w();else{let L=0;for(;L<k.lines;){if(a.isInWindow(0,0)){const T=N&&L===k.lines-1,R=y+L,z=m+L;if(a.emit({hunkIndex:u,hunk:f,collapsedBefore:w(),collapsedAfter:b(R,z),type:"context",deletionLine:{lineNumber:S+L,lineIndex:g+L,noEOFCR:T&&f.noEOFCRDeletions,unifiedLineIndex:R,splitLineIndex:z},additionLine:{unifiedLineIndex:R,splitLineIndex:z,lineIndex:_+L,lineNumber:x+L,noEOFCR:T&&f.noEOFCRAdditions}}))break e}else a.incrementCounts(1,1);L++}}y+=k.lines,m+=k.lines,g+=k.lines,_+=k.lines,S+=k.lines,x+=k.lines}else{const L=Math.max(k.deletions,k.additions),T=k.deletions+k.additions;if(!a.shouldSkip(T,L)){const R=Bc(a,k);for(const[z,E]of R)for(let X=z;X<E;X++){const Le=b(y+X,m+X);if(a.emit(Fc({hunkIndex:u,hunk:f,collapsedBefore:w(),collapsedAfter:Le,diffStyle:e,index:X,unifiedLineIndex:y,splitLineIndex:m,additionLineIndex:_,deletionLineIndex:g,additionLineNumber:x,deletionLineNumber:S,content:k,isLastContent:N,unifiedCount:T,splitCount:L}),!0))break e}}w(),a.incrementCounts(T,L),y+=T,m+=L,g+=k.deletions,_+=k.additions,S+=k.deletions,x+=k.additions}}if(d!=null){const{collapsedLines:k,fromStart:N,fromEnd:L}=d,T=N+L;let R=0;for(;R<T;){if(a.shouldBreak())break e;if(a.isInWindow(0,0)){const z=R===T-1;if(a.emit({hunkIndex:t.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:z?k:0,type:"context-expanded",deletionLine:{lineNumber:S+R,lineIndex:g+R,noEOFCR:!1,unifiedLineIndex:y+R,splitLineIndex:m+R},additionLine:{unifiedLineIndex:y+R,splitLineIndex:m+R,lineIndex:_+R,lineNumber:x+R,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);R++}}}}function gr(t,e,n,r,s){if(e=Math.max(e,0),e===0||t)return{fromStart:0,fromEnd:0,rangeSize:e,collapsedLines:Math.max(e,0)};if(n===!0||e<=s)return{fromStart:e,fromEnd:0,rangeSize:e,collapsedLines:0};const o=n?.get(r),i=Math.min(Math.max(o?.fromStart??0,0),e),a=Math.min(Math.max(o?.fromEnd??0,0),e),l=i+a,c=l>=e;return{fromStart:c?e:i,fromEnd:c?0:a,rangeSize:e,collapsedLines:Math.max(e-l,0)}}function Gc(t){const e=t.hunks.at(-1);return e==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0?!1:e.additionLineIndex+e.additionCount<t.additionLines.length||e.deletionLineIndex+e.deletionCount<t.deletionLines.length}function Bc(t,e,n){if(!t.isWindowedHighlight)return[[0,Math.max(e.deletions,e.additions)]];const r=[];function s(l,c){if(l+c<=t.viewportStart||l>=t.viewportEnd)return;const u=Math.max(0,t.viewportStart-l),f=Math.min(c,t.viewportEnd-l);return f>u?[u,f]:void 0}function o(l,c){return l}function i(l,c){if(l==null)return;const[u,f]=o(l);f>u&&r.push([u,f])}if(i(s(t.unifiedCount,e.deletions)),i(s(t.unifiedCount+e.deletions,e.additions)),i(s(t.splitCount,e.deletions)),i(s(t.splitCount,e.additions)),r.length===0)return r;r.sort((l,c)=>l[0]-c[0]);const a=[r[0]];for(const[l,c]of r.slice(1)){const u=a[a.length-1];l<=u[1]?u[1]=Math.max(u[1],c):a.push([l,c])}return a}function Fc({hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,diffStyle:s,index:o,unifiedLineIndex:i,splitLineIndex:a,additionLineIndex:l,deletionLineIndex:c,additionLineNumber:u,deletionLineNumber:f,content:h,isLastContent:d,unifiedCount:p,splitCount:b}){const w=o<h.deletions?i+o:void 0,y=o<h.additions?i+h.deletions+o:void 0,m=a+o,g=o<h.deletions?c+o:void 0,_=o<h.deletions?f+o:void 0,S=o<h.additions?l+o:void 0,x=o<h.additions?u+o:void 0,A=d&&o===b-1&&e.noEOFCRDeletions,k=d&&o===b-1&&e.noEOFCRAdditions,N=g!=null&&_!=null&&w!=null?{lineNumber:_,lineIndex:g,noEOFCR:A,unifiedLineIndex:w,splitLineIndex:m}:void 0,L=S!=null&&x!=null&&y!=null?{unifiedLineIndex:y,splitLineIndex:m,lineIndex:S,lineNumber:x,noEOFCR:k}:void 0;if(N==null&&L!=null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:L};if(N!=null&&L==null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:N,additionLine:void 0};if(N==null||L==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:N,additionLine:L}}function mr({line:t,spanStart:e,spanLength:n}){return{start:{line:t,character:e},end:{line:t,character:e+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function Ye({item:t,arr:e,enableJoin:n,isNeutral:r=!1,isLastItem:s=!1}){const o=e[e.length-1];if(o==null||s||!n){e.push([r?0:1,t.value]);return}const i=o[0]===0;if(r===i||r&&t.value.length===1&&!i){o[1]+=t.value;return}e.push([r?0:1,t.value])}const Uc={forcePlainText:!1};function jc(t,e,n,{forcePlainText:r,startingLine:s,totalLines:o,expandedHunks:i,collapsedContextThreshold:a=Is}=Uc){r?(s??=0,o??=1/0):(s=0,o=1/0);const l=s>0||o<1/0,c=(()=>{const m=n.theme??ze;if(typeof m=="string")return e.getTheme(m).type})(),u=Ls({theme:n.theme,highlighter:e}),f=r&&!l&&(t.unifiedLineCount>1e3||t.splitLineCount>1e3)?"none":n.lineDiffType,h={deletionLines:[],additionLines:[]},d=!r&&!t.isPartial,p=r?i:void 0,b=new Map;function w(m){const g=d?0:m,_=b.get(g)??zc();return b.set(g,_),_}function y(m,g,_,S){if(l){let x=_.at(-1);(x==null||x.targetIndex+x.count!==g)&&(x={targetIndex:g,originalOffset:S.length,count:0},_.push(x)),x.count++}S.push(m)}Dc({diff:t,diffStyle:"both",startingLine:s,totalLines:o,expandedHunks:l?p:!0,collapsedContextThreshold:a,callback:({hunkIndex:m,additionLine:g,deletionLine:_,type:S})=>{const x=w(m),A=g!=null?g.splitLineIndex:_.splitLineIndex;S==="change"&&g!=null&&_!=null&&Wc({additionLine:t.additionLines[g.lineIndex],deletionLine:t.deletionLines[_.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:f}),_!=null&&(y(t.deletionLines[_.lineIndex],_.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:S==="change"?"change-deletion":S,lineNumber:_.lineNumber,altLineNumber:S==="change"?void 0:g.lineNumber??void 0,lineIndex:`${_.unifiedLineIndex},${A}`})),g!=null&&(y(t.additionLines[g.lineIndex],g.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:S==="change"?"change-addition":S,lineNumber:g.lineNumber,altLineNumber:S==="change"?void 0:_.lineNumber??void 0,lineIndex:`${g.unifiedLineIndex},${A}`}))}});for(const m of b.values()){if(m.deletionContent.length===0&&m.additionContent.length===0)continue;const g={name:t.prevName??t.name,contents:m.deletionContent.value},_={name:t.name,contents:m.additionContent.value},{deletionLines:S,additionLines:x}=Hc({deletionFile:g,deletionInfo:m.deletionInfo,deletionDecorations:m.deletionDecorations,additionFile:_,additionInfo:m.additionInfo,additionDecorations:m.additionDecorations,highlighter:e,options:n,languageOverride:r?"text":t.lang});if(d){h.deletionLines=S,h.additionLines=x;continue}if(m.deletionSegments.length>0)for(const A of m.deletionSegments)for(let k=0;k<A.count;k++)h.deletionLines[A.targetIndex+k]=S[A.originalOffset+k];else h.deletionLines.push(...S);if(m.additionSegments.length>0)for(const A of m.additionSegments)for(let k=0;k<A.count;k++)h.additionLines[A.targetIndex+k]=x[A.originalOffset+k];else h.additionLines.push(...x)}return{code:h,themeStyles:u,baseThemeType:c}}function Wc({deletionLine:t,additionLine:e,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:s,additionDecorations:o,lineDiffType:i}){if(t==null||e==null||i==="none")return;t=Fe(t),e=Fe(e);const a=i==="char"?Ic(t,e):Lc(t,e),l=[],c=[],u=i==="word-alt",f=a.at(-1);for(const d of a){const p=d===f;!d.added&&!d.removed?(Ye({item:d,arr:l,enableJoin:u,isNeutral:!0,isLastItem:p}),Ye({item:d,arr:c,enableJoin:u,isNeutral:!0,isLastItem:p})):d.removed?Ye({item:d,arr:l,enableJoin:u,isLastItem:p}):Ye({item:d,arr:c,enableJoin:u,isLastItem:p})}let h=0;for(const d of l)d[0]===1&&s.push(mr({line:n,spanStart:h,spanLength:d[1].length})),h+=d[1].length;h=0;for(const d of c)d[0]===1&&o.push(mr({line:r,spanStart:h,spanLength:d[1].length})),h+=d[1].length}function zc(){return{deletionContent:{push(t){this.value+=t,this.length++},value:"",length:0},additionContent:{push(t){this.value+=t,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Hc({deletionFile:t,additionFile:e,deletionInfo:n,additionInfo:r,highlighter:s,deletionDecorations:o,additionDecorations:i,languageOverride:a,options:{theme:l=ze,...c}}){const u=a??nn(t.name),f=a??nn(e.name),{state:h,transformers:d}=As(),p=typeof l=="string"?{...c,lang:"text",theme:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:V("token")}:{...c,lang:"text",themes:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:V("token")};return{deletionLines:t.contents===""?[]:(p.lang=u,h.lineInfo=n,p.decorations=o,rn(s.codeToHast(Fe(t.contents),p))),additionLines:e.contents===""?[]:(p.lang=f,p.decorations=i,h.lineInfo=r,rn(s.codeToHast(Fe(e.contents),p)))}}function qc({lines:t,startingLine:e=0,totalLines:n=1/0,callback:r}){const s=Math.min(e+n,t.length),o=(()=>{const i=t.at(-1);return i===""||i===`
152
+ \v\f…\u2028\u2029])`),e));else if(l==="posix")if(!s&&(u==="graph"||u==="print")){if(r==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let f={graph:"!-~",print:" -~"}[u];c&&(f=`\0-${O(f.codePointAt(0)-1)}${O(f.codePointAt(2)+1)}-􏿿`),n($(re(`[${f}]`),e))}else n($(Mt(re(Ll.get(u)),c),e));else if(l==="property")wn.has(mt(u))||(t.key="sc");else if(l==="space")n(ie(we("space",{negate:c}),e));else if(l==="word")n($(Mt(re(ne),c),e));else throw new Error(`Unexpected character set kind "${l}"`)},Directive({node:t,parent:e,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:a,flags:l}=t;if(a==="flags")if(!l.enable&&!l.disable)r();else{const c=Y({flags:l});c.body[0].body=i(),s($(c,e),{traverse:!0})}else if(a==="keep"){const c=n.body[0],f=n.body.length===1&&is(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:n;if(e.parent!==f||f.body.length>1)throw new Error(v`Uses "\K" in a way that's unsupported`);const h=ue({behind:!0});h.body[0].body=o(),s($(h,e))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:t,parent:e}){if(t.posixIsAscii)throw new Error('Unsupported flag "P"');if(t.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete t[n]),Object.assign(t,{global:!1,hasIndices:!1,multiline:!1,sticky:t.sticky??!1}),e.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:t}){if(!t.flags)return;const{enable:e,disable:n}=t.flags;e?.extended&&delete e.extended,n?.extended&&delete n.extended,e?.dotAll&&n?.dotAll&&delete e.dotAll,e?.ignoreCase&&n?.ignoreCase&&delete e.ignoreCase,e&&!Object.keys(e).length&&delete t.flags.enable,n&&!Object.keys(n).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},e){const{kind:n}=t;n==="lookbehind"&&(e.passedLookbehind=!0)},NamedCallout({node:t,parent:e,replaceWith:n}){const{kind:r}=t;if(r==="fail")n($(ue({negate:!0}),e));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:t}){if(t.body.type==="Quantifier"){const e=Y();e.body[0].body.push(t.body),t.body=$(e,t)}},Regex:{enter({node:t},{supportedGNodes:e}){const n=[];let r=!1,s=!1;for(const o of t.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=Ss(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>e.add(o))},exit(t,{accuracy:e,passedLookbehind:n,strategy:r}){if(e==="strict"&&n&&r)throw new Error(v`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!Tt(n)&&(n=$t(n,e),t.ref=n)}},$l={Backreference({node:t},{multiplexCapturesToLeftByRef:e,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=t;r||n.set(t,[...e.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:t,parent:e,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:l}){const c=s.get(t);if(c&&a.has(t.number)){const f=ie(ir(t.number),e);l.set(f,a.get(t.number)),n(f);return}a.set(t.number,t),i.set(t.number,[]),t.name&&Be(i,t.name,[]);const u=i.get(t.name??t.number);for(let f=0;f<u.length;f++){const h=u[f];if(c===h.node||c&&c===h.origin||t===h.origin){u.splice(f,1);break}}if(i.get(t.number).push({node:t,origin:c}),t.name&&i.get(t.name).push({node:t,origin:c}),t.name){const f=Be(o,t.name,new Map);let h=!1;if(c)h=!0;else for(const d of f.values())if(!d.hasDuplicateNameToRemove){h=!0;break}o.get(t.name).set(t,{node:t,hasDuplicateNameToRemove:h})}},exit({node:t},{openRefs:e}){e.delete(t.number)}},Group:{enter({node:t},e){e.prevFlags=e.currentFlags,t.flags&&(e.currentFlags=ht(e.currentFlags,t.flags))},exit(t,e){e.currentFlags=e.prevFlags}},Subroutine({node:t,parent:e,replaceWith:n},r){const{isRecursive:s,ref:o}=t;if(s){let u=e;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===o||u.number===o)););r.reffedNodesByReferencer.set(t,u);return}const i=r.subroutineRefMap.get(o),a=o===0,l=a?ir(0):ws(i,r.groupOriginByCopy,null);let c=l;if(!a){const u=Cs(Dl(i,h=>h.type==="Group"&&!!h.flags)),f=u?ht(r.globalFlags,u):r.globalFlags;Ml(f,r.currentFlags)||(c=Y({flags:Gl(f)}),c.body[0].body.push(l))}n($(c,e),{traverse:!a})}},Tl={Backreference({node:t,parent:e,replaceWith:n},r){if(t.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,t.ref);return}const o=r.reffedNodesByReferencer.get(t).filter(i=>Ol(i,t));if(!o.length)n($(ue({negate:!0}),e));else if(o.length>1){const i=Y({atomic:!0,body:o.reverse().map(a=>de({body:[Yt(a.number)]}))});n($(i,e))}else t.ref=o[0].number},CapturingGroup({node:t},e){t.number=++e.numCapturesToLeft,t.name&&e.groupsByName.get(t.name).get(t).hasDuplicateNameToRemove&&delete t.name},Regex:{exit({node:t},e){const n=Math.max(e.highestOrphanBackref-e.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=ls();t.body.at(-1).body.push(s)}}},Subroutine({node:t},e){!t.isRecursive||t.ref===0||(t.ref=e.reffedNodesByReferencer.get(t).number)}};function bs(t){Te(t,{"*"({node:e,parent:n}){e.parent=n}})}function Ml(t,e){return t.dotAll===e.dotAll&&t.ignoreCase===e.ignoreCase}function Ol(t,e){let n=e;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===t)return!1;const r=_s(n.parent);for(const s of r){if(s===n)break;if(s===t||ks(s,t))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function ws(t,e,n,r){const s=Array.isArray(t)?[]:{};for(const[o,i]of Object.entries(t))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=ws(i,e,s,n):(o==="type"&&i==="CapturingGroup"&&e.set(s,e.get(t)??t),s[o]=i);return s}function ir(t){const e=us(t);return e.isRecursive=!0,e}function Dl(t,e){const n=[];for(;t=t.parent;)(!e||e(t))&&n.push(t);return n}function $t(t,e){if(e.has(t))return e.get(t);const n=`$${e.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return e.set(t,n),n}function Cs(t){const e=["dotAll","ignoreCase"],n={enable:{},disable:{}};return t.forEach(({flags:r})=>{e.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Gl({dotAll:t,ignoreCase:e}){const n={};return(t||e)&&(n.enable={},t&&(n.enable.dotAll=!0),e&&(n.enable.ignoreCase=!0)),(!t||!e)&&(n.disable={},!t&&(n.disable.dotAll=!0),!e&&(n.disable.ignoreCase=!0)),n}function _s(t){if(!t)throw new Error("Node expected");const{body:e}=t;return Array.isArray(e)?e:e?[e]:null}function Ss(t){const e=t.find(n=>n.kind==="search_start"||Ul(n,{negate:!1})||!Bl(n));if(!e)return null;if(e.kind==="search_start")return e;if(e.type==="LookaroundAssertion")return e.body[0].body[0];if(e.type==="CapturingGroup"||e.type==="Group"){const n=[];for(const r of e.body){const s=Ss(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function ks(t,e){const n=_s(t)??[];for(const r of n)if(r===e||ks(r,e))return!0;return!1}function Bl({type:t}){return t==="Assertion"||t==="Directive"||t==="LookaroundAssertion"}function Fl(t){const e=["Character","CharacterClass","CharacterSet"];return e.includes(t.type)||t.type==="Quantifier"&&t.min&&e.includes(t.body.type)}function Ul(t,e){const n={negate:null,...e};return t.type==="LookaroundAssertion"&&(n.negate===null||t.negate===n.negate)&&t.body.length===1&&is(t.body[0],{type:"Assertion",kind:"search_start"})}function Tt(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function re(t,e){const r=as(t,{...e,unicodePropertyMap:wn}).body;return r.length>1||r[0].body.length>1?Y({body:r}):r[0].body[0]}function Mt(t,e){return t.negate=e,t}function ie(t,e){return t.parent=e,t}function $(t,e){return bs(t),t.parent=e,t}function jl(t,e){const n=gs(e),r=tn(n.target,"ES2024"),s=tn(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,a=null;if(!s){const d=[t.flags.ignoreCase];Te(t,Wl,{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(p){d.push(p)},setHasCasedChar(){d.at(-1)?i=!0:a=!0}})}const l={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||i)&&!a)};let c=t;const u={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:t._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&a),useFlagMods:s,useFlagV:r,verbose:n.verbose};function f(d){return u.lastNode=c,c=d,Sl(zl[d.type],`Unexpected node type "${d.type}"`)(d,u,f)}const h={pattern:t.body.map(f).join("|"),flags:f(t.flags),options:{...t.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((d,p)=>{d.hidden&&h._hiddenCaptures.push(p),d.transferTo&&Be(h._captureTransfers,d.transferTo,[]).push(p)}),h}var Wl={"*":{enter({node:t},e){if(lr(t)){const n=e.getCurrentModI();e.pushModI(t.flags?ht({ignoreCase:n},t.flags).ignoreCase:n)}},exit({node:t},e){lr(t)&&e.popModI()}},Backreference(t,e){e.setHasCasedChar()},Character({node:t},e){Cn(O(t.value))&&e.setHasCasedChar()},CharacterClassRange({node:t,skip:e},n){e(),xs(t,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:t},e){t.kind==="property"&&ys.has(t.value)&&e.setHasCasedChar()}},zl={Alternative({body:t},e,n){return t.map(n).join("")},Assertion({kind:t,negate:e}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return e?v`\B`:v`\b`;throw new Error(`Unexpected assertion kind "${t}"`)},Backreference({ref:t},e){if(typeof t!="number")throw new Error("Unexpected named backref in transformed AST");if(!e.useFlagMods&&e.accuracy==="strict"&&e.currentFlags.ignoreCase&&!e.captureMap.get(t).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+t},CapturingGroup(t,e,n){const{body:r,name:s,number:o}=t,i={ignoreCase:e.currentFlags.ignoreCase},a=e.originMap.get(t);return a&&(i.hidden=!0,o>a.number&&(i.transferTo=a.number)),e.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:t},e){const n=O(t),r=me(t,{escDigit:e.lastNode.type==="Backreference",inCharClass:e.inCharClass,useFlagV:e.useFlagV});if(r!==n)return r;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&Cn(n)){const s=ms(n);return e.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(t,e,n){const{kind:r,negate:s,parent:o}=t;let{body:i}=t;if(r==="intersection"&&!e.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");J.bugFlagVLiteralHyphenIsRange&&e.useFlagV&&i.some(cr)&&(i=[gt(45),...i.filter(c=>!cr(c))]);const a=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!e.inCharClass){if((!e.useFlagV||J.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(f=>f.type==="CharacterClass"&&f.kind==="union"&&f.negate);if(u.length){const f=Y(),h=f.body[0];return f.parent=o,h.parent=f,i=i.filter(d=>!u.includes(d)),t.body=i,i.length?(t.parent=h,h.body.push(t)):f.body.pop(),u.forEach(d=>{const p=de({body:[d]});d.parent=p,p.parent=f,f.body.push(p)}),n(f)}}e.inCharClass=!0;const c=a();return e.inCharClass=!1,c}const l=i[0];if(r==="union"&&!s&&l&&((!e.useFlagV||!e.verbose)&&o.kind==="union"&&!(J.bugFlagVLiteralHyphenIsRange&&e.useFlagV)||!e.verbose&&o.kind==="intersection"&&i.length===1&&l.type!=="CharacterClassRange"))return i.map(n).join("");if(!e.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(t,e){const n=t.min.value,r=t.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:e.useFlagV},o=me(n,s),i=me(r,s),a=new Set;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase){const l=xs(t);Kl(l).forEach(u=>{a.add(Array.isArray(u)?`${me(u[0],s)}-${me(u[1],s)}`:me(u,s))})}return`${o}-${i}${[...a].join("")}`},CharacterSet({kind:t,negate:e,value:n,key:r},s){if(t==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":v`[^\n]`;if(t==="digit")return e?v`\D`:v`\d`;if(t==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&ys.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${e?v`\P`:v`\p`}{${r?`${r}=`:""}${n}}`}if(t==="word")return e?v`\W`:v`\w`;throw new Error(`Unexpected character set kind "${t}"`)},Flags(t,e){return(e.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")},Group({atomic:t,body:e,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=ht(i,n));const a=e.map(o).join("|"),l=!s.verbose&&e.length===1&&r.type!=="Quantifier"&&!t&&(!s.useFlagMods||!n)?a:`(?${Zl(t,n,s.useFlagMods)}${a})`;return s.currentFlags=i,l},LookaroundAssertion({body:t,kind:e,negate:n},r,s){return`(?${`${e==="lookahead"?"":"<"}${n?"!":"="}`}${t.map(s).join("|")})`},Quantifier(t,e,n){return n(t.body)+Ql(t)},Subroutine({isRecursive:t,ref:e},n){if(!t)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return e===0?`(?R=${r})`:v`\g<${e}&R=${r}>`}},Hl=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),ql=new Set(["-","\\","]","^","["]),Vl=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),ar=new Map([[9,v`\t`],[10,v`\n`],[11,v`\v`],[12,v`\f`],[13,v`\r`],[8232,v`\u2028`],[8233,v`\u2029`],[65279,v`\uFEFF`]]),Xl=/^\p{Cased}$/u;function Cn(t){return Xl.test(t)}function xs(t,e){const n=!!e?.firstOnly,r=t.min.value,s=t.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const a=O(i);if(!Cn(a))continue;const l=ms(a).filter(c=>{const u=c.codePointAt(0);return u<r||u>s});if(l.length&&(o.push(...l),n))break}return o}function me(t,{escDigit:e,inCharClass:n,useFlagV:r}){if(ar.has(t))return ar.get(t);if(t<32||t>126&&t<160||t>262143||e&&Yl(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?Vl:ql:Hl,o=O(t);return(s.has(o)?"\\":"")+o}function Kl(t){const e=t.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<e.length;s++)e[s+1]===e[s]+1?r??=e[s]:r===null?n.push(e[s]):(n.push([r,e[s]]),r=null);return n}function Zl(t,e,n){if(t)return">";let r="";if(e&&n){const{enable:s,disable:o}=e;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function Ql({kind:t,max:e,min:n}){let r;return!n&&e===1?r="?":!n&&e===1/0?r="*":n===1&&e===1/0?r="+":n===e?r=`{${n}}`:r=`{${n},${e===1/0?"":e}}`,r+{greedy:"",lazy:"?",possessive:"+"}[t]}function lr({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function Yl(t){return t>47&&t<58}function cr({type:t,value:e}){return t==="Character"&&e===45}var Jl=class nn extends RegExp{#t=new Map;#e=null;#r;#n=null;#s=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(e,n,r){const s=!!r?.lazyCompile;if(e instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=e;super(o,n),this.#r=o.source,o instanceof nn&&(this.#t=o.#t,this.#n=o.#n,this.#s=o.#s,this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":e,n),this.#r=e,this.#t=tc(o.hiddenCaptures,o.transfers),this.#s=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(e){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new nn(this.#r,this.flags,o)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#s==="clip_search"&&n&&r){this.lastIndex=0;const s=this.#o(e.slice(r));return s&&(ec(s,r,e,this.hasIndices),this.lastIndex+=r),s}return this.#o(e)}#o(e){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,e);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:a,transferTo:l}=this.#t.get(i)??{};if(a?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),l&&r[i]!==void 0){const c=o[l];if(!c)throw new Error(`Invalid capture transfer to "${c}"`);if(n[c]=r[i],this.hasIndices&&(n.indices[c]=s[i]),n.groups){this.#n||(this.#n=nc(this.source));const u=this.#n.get(l);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function ec(t,e,n,r){if(t.index+=e,t.input=n,r){const s=t.indices;for(let i=0;i<s.length;i++){const a=s[i];a&&(s[i]=[a[0]+e,a[1]+e])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const a=o[i];a&&(o[i]=[a[0]+e,a[1]+e])})}}function tc(t,e){const n=new Map;for(const r of t)n.set(r,{hidden:!0});for(const[r,s]of e)for(const o of s)Be(n,o,{}).transferTo=r;return n}function nc(t){const e=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=e.exec(t);){const{0:i,groups:{capture:a,name:l}}=o;i==="["?r++:r?i==="]"&&r--:a&&(s++,l&&n.set(s,l))}return n}function rc(t,e){const n=sc(t,e);return n.options?new Jl(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function sc(t,e){const n=gs(e),r=as(t,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:wn}),s=Nl(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=jl(s,n),i=Cl(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),a=bl(i.pattern),l=yl(a.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),c={pattern:l.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const u=l.hiddenCaptures.sort((p,b)=>p-b),f=Array.from(l.captureTransfers),h=s._strategy,d=c.pattern.length>=n.lazyCompileLength;(u.length||f.length||h||d)&&(c.options={...u.length&&{hiddenCaptures:u},...f.length&&{transfers:f},...h&&{strategy:h},...d&&{lazyCompile:d}})}return c}const ur=4294967295;class oc{constructor(e,n={}){this.patterns=e,this.options=n;const{forgiving:r=!1,cache:s,regexConstructor:o}=n;if(!o)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(i=>{if(typeof i!="string")return i;const a=s?.get(i);if(a){if(a instanceof RegExp)return a;if(r)return null;throw a}try{const l=o(i);return s?.set(i,l),l}catch(l){if(s?.set(i,l),r)return null;throw l}})}regexps;findNextMatchSync(e,n,r){const s=typeof e=="string"?e:e.content,o=[];function i(a,l,c=0){return{index:a,captureIndices:l.indices.map(u=>u==null?{start:ur,end:ur,length:0}:{start:u[0]+c,end:u[1]+c,length:u[1]-u[0]})}}for(let a=0;a<this.regexps.length;a++){const l=this.regexps[a];if(l)try{l.lastIndex=n;const c=l.exec(s);if(!c)continue;if(c.index===n)return i(a,c,0);o.push([a,c,0])}catch(c){if(this.options.forgiving)continue;throw c}}if(o.length){const a=Math.min(...o.map(l=>l[1].index));for(const[l,c,u]of o)if(c.index===a)return i(l,c,u)}return null}}function ic(t,e){return rc(t,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...e})}function ac(t={}){const e=Object.assign({target:"auto",cache:new Map},t);return e.regexConstructor||=n=>ic(n,{target:e.target}),{createScanner(n){return new oc(n,e)},createString(n){return{content:n}}}}class _n extends Error{constructor(e){super(e),this.name="ShikiError"}}function lc(){return 2147483648}function cc(){return typeof performance<"u"?performance.now():Date.now()}const uc=(t,e)=>t+(e-t%e)%e;async function fc(t){let e,n;const r={};function s(d){n=d,r.HEAPU8=new Uint8Array(d),r.HEAPU32=new Uint32Array(d)}function o(d,p,b){r.HEAPU8.copyWithin(d,p,p+b)}function i(d){try{return e.grow(d-n.byteLength+65535>>>16),s(e.buffer),1}catch{}}function a(d){const p=r.HEAPU8.length;d=d>>>0;const b=lc();if(d>b)return!1;for(let w=1;w<=4;w*=2){let y=p*(1+.2/w);y=Math.min(y,d+100663296);const m=Math.min(b,uc(Math.max(d,y),65536));if(i(m))return!0}return!1}const l=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(d,p,b=1024){const w=p+b;let y=p;for(;d[y]&&!(y>=w);)++y;if(y-p>16&&d.buffer&&l)return l.decode(d.subarray(p,y));let m="";for(;p<y;){let g=d[p++];if(!(g&128)){m+=String.fromCharCode(g);continue}const _=d[p++]&63;if((g&224)===192){m+=String.fromCharCode((g&31)<<6|_);continue}const S=d[p++]&63;if((g&240)===224?g=(g&15)<<12|_<<6|S:g=(g&7)<<18|_<<12|S<<6|d[p++]&63,g<65536)m+=String.fromCharCode(g);else{const x=g-65536;m+=String.fromCharCode(55296|x>>10,56320|x&1023)}}return m}function u(d,p){return d?c(r.HEAPU8,d,p):""}const f={emscripten_get_now:cc,emscripten_memcpy_big:o,emscripten_resize_heap:a,fd_write:()=>0};async function h(){const p=await t({env:f,wasi_snapshot_preview1:f});e=p.memory,s(e.buffer),Object.assign(r,p),r.UTF8ToString=u}return await h(),r}var hc=Object.defineProperty,dc=(t,e,n)=>e in t?hc(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,D=(t,e,n)=>dc(t,typeof e!="symbol"?e+"":e,n);let B=null;function pc(t){throw new _n(t.UTF8ToString(t.getLastOnigError()))}class wt{constructor(e){D(this,"utf16Length"),D(this,"utf8Length"),D(this,"utf16Value"),D(this,"utf8Value"),D(this,"utf16OffsetToUtf8"),D(this,"utf8OffsetToUtf16");const n=e.length,r=wt._utf8ByteLength(e),s=r!==n,o=s?new Uint32Array(n+1):null;s&&(o[n]=r);const i=s?new Uint32Array(r+1):null;s&&(i[r]=n);const a=new Uint8Array(r);let l=0;for(let c=0;c<n;c++){const u=e.charCodeAt(c);let f=u,h=!1;if(u>=55296&&u<=56319&&c+1<n){const d=e.charCodeAt(c+1);d>=56320&&d<=57343&&(f=(u-55296<<10)+65536|d-56320,h=!0)}s&&(o[c]=l,h&&(o[c+1]=l),f<=127?i[l+0]=c:f<=2047?(i[l+0]=c,i[l+1]=c):f<=65535?(i[l+0]=c,i[l+1]=c,i[l+2]=c):(i[l+0]=c,i[l+1]=c,i[l+2]=c,i[l+3]=c)),f<=127?a[l++]=f:f<=2047?(a[l++]=192|(f&1984)>>>6,a[l++]=128|(f&63)>>>0):f<=65535?(a[l++]=224|(f&61440)>>>12,a[l++]=128|(f&4032)>>>6,a[l++]=128|(f&63)>>>0):(a[l++]=240|(f&1835008)>>>18,a[l++]=128|(f&258048)>>>12,a[l++]=128|(f&4032)>>>6,a[l++]=128|(f&63)>>>0),h&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=e,this.utf8Value=a,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=i}static _utf8ByteLength(e){let n=0;for(let r=0,s=e.length;r<s;r++){const o=e.charCodeAt(r);let i=o,a=!1;if(o>=55296&&o<=56319&&r+1<s){const l=e.charCodeAt(r+1);l>=56320&&l<=57343&&(i=(o-55296<<10)+65536|l-56320,a=!0)}i<=127?n+=1:i<=2047?n+=2:i<=65535?n+=3:n+=4,a&&r++}return n}createString(e){const n=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,n),n}}const Ct=class te{constructor(e){if(D(this,"id",++te.LAST_ID),D(this,"_onigBinding"),D(this,"content"),D(this,"utf16Length"),D(this,"utf8Length"),D(this,"utf16OffsetToUtf8"),D(this,"utf8OffsetToUtf16"),D(this,"ptr"),!B)throw new _n("Must invoke loadWasm first.");this._onigBinding=B,this.content=e;const n=new wt(e);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!te._sharedPtrInUse?(te._sharedPtr||(te._sharedPtr=B.omalloc(1e4)),te._sharedPtrInUse=!0,B.HEAPU8.set(n.utf8Value,te._sharedPtr),this.ptr=te._sharedPtr):this.ptr=n.createString(B)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===te._sharedPtr?te._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};D(Ct,"LAST_ID",0);D(Ct,"_sharedPtr",0);D(Ct,"_sharedPtrInUse",!1);let vs=Ct;class gc{constructor(e){if(D(this,"_onigBinding"),D(this,"_ptr"),!B)throw new _n("Must invoke loadWasm first.");const n=[],r=[];for(let a=0,l=e.length;a<l;a++){const c=new wt(e[a]);n[a]=c.createString(B),r[a]=c.utf8Length}const s=B.omalloc(4*e.length);B.HEAPU32.set(n,s/4);const o=B.omalloc(4*e.length);B.HEAPU32.set(r,o/4);const i=B.createOnigScanner(s,o,e.length);for(let a=0,l=e.length;a<l;a++)B.ofree(n[a]);B.ofree(o),B.ofree(s),i===0&&pc(B),this._onigBinding=B,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof e=="string"){e=new vs(e);const o=this._findNextMatchSync(e,n,!1,s);return e.dispose(),o}return this._findNextMatchSync(e,n,!1,s)}_findNextMatchSync(e,n,r,s){const o=this._onigBinding,i=o.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(n),s);if(i===0)return null;const a=o.HEAPU32;let l=i/4;const c=a[l++],u=a[l++],f=[];for(let h=0;h<u;h++){const d=e.convertUtf8OffsetToUtf16(a[l++]),p=e.convertUtf8OffsetToUtf16(a[l++]);f[h]={start:d,end:p,length:p-d}}return{index:c,captureIndices:f}}}function mc(t){return typeof t.instantiator=="function"}function yc(t){return typeof t.default=="function"}function bc(t){return typeof t.data<"u"}function wc(t){return typeof Response<"u"&&t instanceof Response}function Cc(t){return typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||ArrayBuffer.isView(t))||typeof Buffer<"u"&&Buffer.isBuffer?.(t)||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&t instanceof Uint32Array}let Qe;function _c(t){if(Qe)return Qe;async function e(){B=await fc(async n=>{let r=t;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),mc(r)?r=await r.instantiator(n):yc(r)?r=await r.default(n):(bc(r)&&(r=r.data),wc(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Sc(r)(n):r=await kc(r)(n):Cc(r)?r=await Ot(r)(n):r instanceof WebAssembly.Module?r=await Ot(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await Ot(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Qe=e(),Qe}function Ot(t){return e=>WebAssembly.instantiate(t,e)}function Sc(t){return e=>WebAssembly.instantiateStreaming(t,e)}function kc(t){return async e=>{const n=await t.arrayBuffer();return WebAssembly.instantiate(n,e)}}async function xc(t){return t&&await _c(t),{createScanner(e){return new gc(e.map(n=>typeof n=="string"?n:n.source))},createString(e){return new vs(e)}}}class Is{diff(e,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const o=this.castInput(e,r),i=this.castInput(n,r),a=this.removeEmpty(this.tokenize(o,r)),l=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(a,l,r,s)}diffWithOptionsObj(e,n,r,s){var o;const i=m=>{if(m=this.postProcess(m,r),s){setTimeout(function(){s(m)},0);return}else return m},a=n.length,l=e.length;let c=1,u=a+l;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const f=(o=r.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+f,d=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(d[0],n,e,0,r);if(d[0].oldPos+1>=l&&p+1>=a)return i(this.buildValues(d[0].lastComponent,n,e));let b=-1/0,w=1/0;const y=()=>{for(let m=Math.max(b,-c);m<=Math.min(w,c);m+=2){let g;const _=d[m-1],S=d[m+1];_&&(d[m-1]=void 0);let x=!1;if(S){const k=S.oldPos-m;x=S&&0<=k&&k<a}const A=_&&_.oldPos+1<l;if(!x&&!A){d[m]=void 0;continue}if(!A||x&&_.oldPos<S.oldPos?g=this.addToPath(S,!0,!1,0,r):g=this.addToPath(_,!1,!0,1,r),p=this.extractCommon(g,n,e,m,r),g.oldPos+1>=l&&p+1>=a)return i(this.buildValues(g.lastComponent,n,e))||!0;d[m]=g,g.oldPos+1>=l&&(w=Math.min(w,m-1)),p+1>=a&&(b=Math.max(b,m+1))}c++};if(s)(function m(){setTimeout(function(){if(c>u||Date.now()>h)return s(void 0);y()||m()},0)})();else for(;c<=u&&Date.now()<=h;){const m=y();if(m)return m}}addToPath(e,n,r,s,o){const i=e.lastComponent;return i&&!o.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:e.oldPos+s,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:e.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(e,n,r,s,o){const i=n.length,a=r.length;let l=e.oldPos,c=l-s,u=0;for(;c+1<i&&l+1<a&&this.equals(r[l+1],n[c+1],o);)c++,l++,u++,o.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return u&&!o.oneChangePerToken&&(e.lastComponent={count:u,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=l,c}equals(e,n,r){return r.comparator?r.comparator(e,n):e===n||!!r.ignoreCase&&e.toLowerCase()===n.toLowerCase()}removeEmpty(e){const n=[];for(let r=0;r<e.length;r++)e[r]&&n.push(e[r]);return n}castInput(e,n){return e}tokenize(e,n){return Array.from(e)}join(e){return e.join("")}postProcess(e,n){return e}get useLongestToken(){return!1}buildValues(e,n,r){const s=[];let o;for(;e;)s.push(e),o=e.previousComponent,delete e.previousComponent,e=o;s.reverse();const i=s.length;let a=0,l=0,c=0;for(;a<i;a++){const u=s[a];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(l,l+u.count);f=f.map(function(h,d){const p=r[c+d];return p.length>h.length?p:h}),u.value=this.join(f)}else u.value=this.join(n.slice(l,l+u.count));l+=u.count,u.added||(c+=u.count)}}return s}}class vc extends Is{}const Ic=new vc;function Ec(t,e,n){return Ic.diff(t,e,n)}const fr="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class Ac extends Is{tokenize(e){const n=new RegExp(`(\\r?\\n)|[${fr}]+|[^\\S\\n\\r]+|[^${fr}]`,"ug");return e.match(n)||[]}}const Lc=new Ac;function Rc(t,e,n){return Lc.diff(t,e,n)}function Nc(t={}){const{classPrefix:e="__shiki_",classSuffix:n="",classReplacer:r=a=>a}=t,s=new Map;function o(a){return Object.entries(a).map(([l,c])=>`${l}:${c}`).join(";")}function i(a){const l=typeof a=="string"?a:o(a);let c=e+Pc(l)+n;return c=r(c),s.has(c)||s.set(c,typeof a=="string"?a:{...a}),c}return{name:"@shikijs/transformers:style-to-class",pre(a){if(!a.properties.style)return;const l=i(a.properties.style);delete a.properties.style,this.addClassToHast(a,l)},tokens(a){for(const l of a)for(const c of l){if(!c.htmlStyle)continue;const u=i(c.htmlStyle);c.htmlStyle={},c.htmlAttrs||={},c.htmlAttrs.class?c.htmlAttrs.class+=` ${u}`:c.htmlAttrs.class=u}},getClassRegistry(){return s},getCSS(){let a="";for(const[l,c]of s.entries())a+=`.${l}{${typeof c=="string"?c:o(c)}}`;return a},clearRegistry(){s.clear()}}}function Pc(t,e=0){let n=3735928559^e,r=1103547991^e;for(let s=0,o;s<t.length;s++)o=t.charCodeAt(s),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}const $c=/(?<=\n)/,ze={dark:"pierre-dark",light:"pierre-light"},Es=1,hr=new Map,dr=new Set;function Sn(t,e){t=Array.isArray(t)?t:[t];for(const n of t){if(dr.has(n.name))continue;let r=hr.get(n.name);r==null&&(r=n,hr.set(n.name,r)),dr.add(r.name),e.loadLanguageSync(r.data)}}const Dt=new Map,pr=new Set;function As(t,e){t=Array.isArray(t)?t:[t];for(let n of t){let r;if(typeof n=="string"){if(r=Dt.get(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,Dt.has(n)||Dt.set(n,r);pr.has(n)||(pr.add(n),e.loadThemeSync(r))}}function Fe(t){return t.replace(/\n$|\r\n$/,"")}function Tc(t){return{type:"text",value:t}}function Mc(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e;"children"in e?e=e.children[0]:e=null}}function Oc(t,e,n){const r=typeof n.lineInfo=="function"?n.lineInfo(e):n.lineInfo[e-1];if(r==null){const s=`processLine: line ${e}, contains no state.lineInfo`;throw console.error(s,{node:t,line:e,state:n}),new Error(s)}return t.tagName="div",t.properties["data-line"]=r.lineNumber,t.properties["data-alt-line"]=r.altLineNumber,t.properties["data-line-type"]=r.type,t.properties["data-line-index"]=r.lineIndex,t.children.length===0&&t.children.push(Tc(`
153
+ `)),t}function Ls(t=!1){const e={lineInfo:[]},n=[{line(r){return delete r.properties.class,r},pre(r){const s=Mc(r),o=[];if(s!=null){let i=1;for(const a of s.children)a.type==="element"&&(o.push(Oc(a,i,e)),i++);s.children=o}return r}}];return t&&n.push(Dc,gr),{state:e,transformers:n,toClass:gr}}const gr=Nc({classPrefix:"hl-"}),Dc={name:"token-style-normalizer",tokens(t){for(const e of t)for(const n of e){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function V(t){return`--${t==="token"?"diffs-token":"diffs"}-`}const ye=new Map,Ne={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function rn(t){if(ye.has(t))return ye.get(t)??"text";if(Ne[t]!=null)return Ne[t];const e=t.match(/\.([^/\\]+\.[^/\\]+)$/);if(e!=null){if(ye.has(e[1]))return ye.get(e[1])??"text";if(Ne[e[1]]!=null)return Ne[e[1]]??"text"}const n=t.match(/\.([^.]+)$/)?.[1]??"";return ye.has(n)?ye.get(n)??"text":Ne[n]??"text"}function Rs({theme:t=ze,highlighter:e,prefix:n}){let r="";if(typeof t=="string"){const s=e.getTheme(t);r+=`color:${s.fg};`,r+=`background-color:${s.bg};`,r+=`${V("global")}fg:${s.fg};`,r+=`${V("global")}bg:${s.bg};`,r+=Gt(s,n)}else{let s=e.getTheme(t.dark);r+=`${V("global")}dark:${s.fg};`,r+=`${V("global")}dark-bg:${s.bg};`,r+=Gt(s,"dark"),s=e.getTheme(t.light),r+=`${V("global")}light:${s.fg};`,r+=`${V("global")}light-bg:${s.bg};`,r+=Gt(s,"light")}return r}function Gt(t,e){e=e!=null?`${e}-`:"";let n="";const r=t.colors?.["gitDecoration.addedResourceForeground"]??t.colors?.["terminal.ansiGreen"];r!=null&&(n+=`${V("global")}${e}addition-color:${r};`);const s=t.colors?.["gitDecoration.deletedResourceForeground"]??t.colors?.["terminal.ansiRed"];s!=null&&(n+=`${V("global")}${e}deletion-color:${s};`);const o=t.colors?.["gitDecoration.modifiedResourceForeground"]??t.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${V("global")}${e}modified-color:${o};`),n}function sn(t){let e=t.children[0];for(;e!=null;){if(e.type==="element"&&e.tagName==="code")return e.children;"children"in e?e=e.children[0]:e=null}throw console.error(t),new Error("getLineNodes: Unable to find children")}function Gc({diff:t,diffStyle:e,startingLine:n=0,totalLines:r=1/0,expandedHunks:s,collapsedContextThreshold:o=Es,callback:i}){const a={finalHunk:t.hunks.at(-1),viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:0,unifiedCount:0,shouldBreak(){if(!a.isWindowedHighlight)return!1;const u=a.unifiedCount>=n+r,f=a.splitCount>=n+r;return u&&f},shouldSkip(u,f){if(!a.isWindowedHighlight)return!1;const h=a.unifiedCount+u<n,d=a.splitCount+f<n;return h&&d},incrementCounts(u,f){a.unifiedCount+=u,a.splitCount+=f},isInWindow(u,f){if(!a.isWindowedHighlight)return!0;const h=a.isInUnifiedWindow(u),d=a.isInSplitWindow(f);return h||d},isInUnifiedWindow(u){return!a.isWindowedHighlight||a.unifiedCount>=n-u&&a.unifiedCount<n+r},isInSplitWindow(u){return!a.isWindowedHighlight||a.splitCount>=n-u&&a.splitCount<n+r},emit(u,f=!1){return f||a.incrementCounts(1,1),i(u)??!1}};e:for(const[u,f]of t.hunks.entries()){let b=function(k,N){return d==null||d.collapsedLines<=0||d.fromStart+d.fromEnd>0?0:N===f.splitLineStart+f.splitLineCount-1?d.collapsedLines:0},w=function(){if(h.collapsedLines===0)return 0;const k=h.collapsedLines;return h.collapsedLines=0,k};var l=b,c=w;if(a.shouldBreak())break;const h=mr(t.isPartial,f.collapsedBefore,s,u,o),d=(()=>{if(f!==a.finalHunk||!Bc(t))return;const k=t.additionLines.length-(f.additionLineIndex+f.additionCount),N=t.deletionLines.length-(f.deletionLineIndex+f.deletionCount);if(k!==N)throw new Error(`iterateOverDiff: trailing context mismatch (additions=${k}, deletions=${N}) for ${t.name}`);const L=Math.min(k,N);return mr(t.isPartial,L,s,t.hunks.length,o)})(),p=h.fromStart+h.fromEnd;if(a.shouldSkip(p,p))a.incrementCounts(p,p),w();else{let k=f.unifiedLineStart-h.rangeSize,N=f.splitLineStart-h.rangeSize,L=f.deletionLineIndex-h.rangeSize,T=f.additionLineIndex-h.rangeSize,R=f.deletionStart-h.rangeSize,z=f.additionStart-h.rangeSize,E=0;for(;E<h.fromStart;){if(a.isInWindow(0,0)){if(a.emit({hunkIndex:u,hunk:f,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:R+E,lineIndex:L+E,noEOFCR:!1,unifiedLineIndex:k+E,splitLineIndex:N+E},additionLine:{unifiedLineIndex:k+E,splitLineIndex:N+E,lineIndex:T+E,lineNumber:z+E,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);E++}for(k=f.unifiedLineStart-h.fromEnd,N=f.splitLineStart-h.fromEnd,L=f.deletionLineIndex-h.fromEnd,T=f.additionLineIndex-h.fromEnd,R=f.deletionStart-h.fromEnd,z=f.additionStart-h.fromEnd,E=0;E<h.fromEnd;){if(a.isInWindow(0,0)){if(a.emit({hunkIndex:u,hunk:f,collapsedBefore:w(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:R+E,lineIndex:L+E,noEOFCR:!1,unifiedLineIndex:k+E,splitLineIndex:N+E},additionLine:{unifiedLineIndex:k+E,splitLineIndex:N+E,lineIndex:T+E,lineNumber:z+E,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);E++}}let y=f.unifiedLineStart,m=f.splitLineStart,g=f.deletionLineIndex,_=f.additionLineIndex,S=f.deletionStart,x=f.additionStart;const A=f.hunkContent.at(-1);for(const k of f.hunkContent){if(a.shouldBreak())break e;const N=k===A;if(k.type==="context"){if(a.shouldSkip(k.lines,k.lines))a.incrementCounts(k.lines,k.lines),w();else{let L=0;for(;L<k.lines;){if(a.isInWindow(0,0)){const T=N&&L===k.lines-1,R=y+L,z=m+L;if(a.emit({hunkIndex:u,hunk:f,collapsedBefore:w(),collapsedAfter:b(R,z),type:"context",deletionLine:{lineNumber:S+L,lineIndex:g+L,noEOFCR:T&&f.noEOFCRDeletions,unifiedLineIndex:R,splitLineIndex:z},additionLine:{unifiedLineIndex:R,splitLineIndex:z,lineIndex:_+L,lineNumber:x+L,noEOFCR:T&&f.noEOFCRAdditions}}))break e}else a.incrementCounts(1,1);L++}}y+=k.lines,m+=k.lines,g+=k.lines,_+=k.lines,S+=k.lines,x+=k.lines}else{const L=Math.max(k.deletions,k.additions),T=k.deletions+k.additions;if(!a.shouldSkip(T,L)){const R=Fc(a,k);for(const[z,E]of R)for(let X=z;X<E;X++){const Le=b(y+X,m+X);if(a.emit(Uc({hunkIndex:u,hunk:f,collapsedBefore:w(),collapsedAfter:Le,diffStyle:e,index:X,unifiedLineIndex:y,splitLineIndex:m,additionLineIndex:_,deletionLineIndex:g,additionLineNumber:x,deletionLineNumber:S,content:k,isLastContent:N,unifiedCount:T,splitCount:L}),!0))break e}}w(),a.incrementCounts(T,L),y+=T,m+=L,g+=k.deletions,_+=k.additions,S+=k.deletions,x+=k.additions}}if(d!=null){const{collapsedLines:k,fromStart:N,fromEnd:L}=d,T=N+L;let R=0;for(;R<T;){if(a.shouldBreak())break e;if(a.isInWindow(0,0)){const z=R===T-1;if(a.emit({hunkIndex:t.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:z?k:0,type:"context-expanded",deletionLine:{lineNumber:S+R,lineIndex:g+R,noEOFCR:!1,unifiedLineIndex:y+R,splitLineIndex:m+R},additionLine:{unifiedLineIndex:y+R,splitLineIndex:m+R,lineIndex:_+R,lineNumber:x+R,noEOFCR:!1}}))break e}else a.incrementCounts(1,1);R++}}}}function mr(t,e,n,r,s){if(e=Math.max(e,0),e===0||t)return{fromStart:0,fromEnd:0,rangeSize:e,collapsedLines:Math.max(e,0)};if(n===!0||e<=s)return{fromStart:e,fromEnd:0,rangeSize:e,collapsedLines:0};const o=n?.get(r),i=Math.min(Math.max(o?.fromStart??0,0),e),a=Math.min(Math.max(o?.fromEnd??0,0),e),l=i+a,c=l>=e;return{fromStart:c?e:i,fromEnd:c?0:a,rangeSize:e,collapsedLines:Math.max(e-l,0)}}function Bc(t){const e=t.hunks.at(-1);return e==null||t.isPartial||t.additionLines.length===0||t.deletionLines.length===0?!1:e.additionLineIndex+e.additionCount<t.additionLines.length||e.deletionLineIndex+e.deletionCount<t.deletionLines.length}function Fc(t,e,n){if(!t.isWindowedHighlight)return[[0,Math.max(e.deletions,e.additions)]];const r=[];function s(l,c){if(l+c<=t.viewportStart||l>=t.viewportEnd)return;const u=Math.max(0,t.viewportStart-l),f=Math.min(c,t.viewportEnd-l);return f>u?[u,f]:void 0}function o(l,c){return l}function i(l,c){if(l==null)return;const[u,f]=o(l);f>u&&r.push([u,f])}if(i(s(t.unifiedCount,e.deletions)),i(s(t.unifiedCount+e.deletions,e.additions)),i(s(t.splitCount,e.deletions)),i(s(t.splitCount,e.additions)),r.length===0)return r;r.sort((l,c)=>l[0]-c[0]);const a=[r[0]];for(const[l,c]of r.slice(1)){const u=a[a.length-1];l<=u[1]?u[1]=Math.max(u[1],c):a.push([l,c])}return a}function Uc({hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,diffStyle:s,index:o,unifiedLineIndex:i,splitLineIndex:a,additionLineIndex:l,deletionLineIndex:c,additionLineNumber:u,deletionLineNumber:f,content:h,isLastContent:d,unifiedCount:p,splitCount:b}){const w=o<h.deletions?i+o:void 0,y=o<h.additions?i+h.deletions+o:void 0,m=a+o,g=o<h.deletions?c+o:void 0,_=o<h.deletions?f+o:void 0,S=o<h.additions?l+o:void 0,x=o<h.additions?u+o:void 0,A=d&&o===b-1&&e.noEOFCRDeletions,k=d&&o===b-1&&e.noEOFCRAdditions,N=g!=null&&_!=null&&w!=null?{lineNumber:_,lineIndex:g,noEOFCR:A,unifiedLineIndex:w,splitLineIndex:m}:void 0,L=S!=null&&x!=null&&y!=null?{unifiedLineIndex:y,splitLineIndex:m,lineIndex:S,lineNumber:x,noEOFCR:k}:void 0;if(N==null&&L!=null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:L};if(N!=null&&L==null)return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:N,additionLine:void 0};if(N==null||L==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:t,hunk:e,collapsedAfter:n,collapsedBefore:r,deletionLine:N,additionLine:L}}function yr({line:t,spanStart:e,spanLength:n}){return{start:{line:t,character:e},end:{line:t,character:e+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function Ye({item:t,arr:e,enableJoin:n,isNeutral:r=!1,isLastItem:s=!1}){const o=e[e.length-1];if(o==null||s||!n){e.push([r?0:1,t.value]);return}const i=o[0]===0;if(r===i||r&&t.value.length===1&&!i){o[1]+=t.value;return}e.push([r?0:1,t.value])}const jc={forcePlainText:!1};function Wc(t,e,n,{forcePlainText:r,startingLine:s,totalLines:o,expandedHunks:i,collapsedContextThreshold:a=Es}=jc){r?(s??=0,o??=1/0):(s=0,o=1/0);const l=s>0||o<1/0,c=(()=>{const m=n.theme??ze;if(typeof m=="string")return e.getTheme(m).type})(),u=Rs({theme:n.theme,highlighter:e}),f=r&&!l&&(t.unifiedLineCount>1e3||t.splitLineCount>1e3)?"none":n.lineDiffType,h={deletionLines:[],additionLines:[]},d=!r&&!t.isPartial,p=r?i:void 0,b=new Map;function w(m){const g=d?0:m,_=b.get(g)??Hc();return b.set(g,_),_}function y(m,g,_,S){if(l){let x=_.at(-1);(x==null||x.targetIndex+x.count!==g)&&(x={targetIndex:g,originalOffset:S.length,count:0},_.push(x)),x.count++}S.push(m)}Gc({diff:t,diffStyle:"both",startingLine:s,totalLines:o,expandedHunks:l?p:!0,collapsedContextThreshold:a,callback:({hunkIndex:m,additionLine:g,deletionLine:_,type:S})=>{const x=w(m),A=g!=null?g.splitLineIndex:_.splitLineIndex;S==="change"&&g!=null&&_!=null&&zc({additionLine:t.additionLines[g.lineIndex],deletionLine:t.deletionLines[_.lineIndex],deletionLineIndex:x.deletionContent.length,additionLineIndex:x.additionContent.length,deletionDecorations:x.deletionDecorations,additionDecorations:x.additionDecorations,lineDiffType:f}),_!=null&&(y(t.deletionLines[_.lineIndex],_.lineIndex,x.deletionSegments,x.deletionContent),x.deletionInfo.push({type:S==="change"?"change-deletion":S,lineNumber:_.lineNumber,altLineNumber:S==="change"?void 0:g.lineNumber??void 0,lineIndex:`${_.unifiedLineIndex},${A}`})),g!=null&&(y(t.additionLines[g.lineIndex],g.lineIndex,x.additionSegments,x.additionContent),x.additionInfo.push({type:S==="change"?"change-addition":S,lineNumber:g.lineNumber,altLineNumber:S==="change"?void 0:_.lineNumber??void 0,lineIndex:`${g.unifiedLineIndex},${A}`}))}});for(const m of b.values()){if(m.deletionContent.length===0&&m.additionContent.length===0)continue;const g={name:t.prevName??t.name,contents:m.deletionContent.value},_={name:t.name,contents:m.additionContent.value},{deletionLines:S,additionLines:x}=qc({deletionFile:g,deletionInfo:m.deletionInfo,deletionDecorations:m.deletionDecorations,additionFile:_,additionInfo:m.additionInfo,additionDecorations:m.additionDecorations,highlighter:e,options:n,languageOverride:r?"text":t.lang});if(d){h.deletionLines=S,h.additionLines=x;continue}if(m.deletionSegments.length>0)for(const A of m.deletionSegments)for(let k=0;k<A.count;k++)h.deletionLines[A.targetIndex+k]=S[A.originalOffset+k];else h.deletionLines.push(...S);if(m.additionSegments.length>0)for(const A of m.additionSegments)for(let k=0;k<A.count;k++)h.additionLines[A.targetIndex+k]=x[A.originalOffset+k];else h.additionLines.push(...x)}return{code:h,themeStyles:u,baseThemeType:c}}function zc({deletionLine:t,additionLine:e,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:s,additionDecorations:o,lineDiffType:i}){if(t==null||e==null||i==="none")return;t=Fe(t),e=Fe(e);const a=i==="char"?Ec(t,e):Rc(t,e),l=[],c=[],u=i==="word-alt",f=a.at(-1);for(const d of a){const p=d===f;!d.added&&!d.removed?(Ye({item:d,arr:l,enableJoin:u,isNeutral:!0,isLastItem:p}),Ye({item:d,arr:c,enableJoin:u,isNeutral:!0,isLastItem:p})):d.removed?Ye({item:d,arr:l,enableJoin:u,isLastItem:p}):Ye({item:d,arr:c,enableJoin:u,isLastItem:p})}let h=0;for(const d of l)d[0]===1&&s.push(yr({line:n,spanStart:h,spanLength:d[1].length})),h+=d[1].length;h=0;for(const d of c)d[0]===1&&o.push(yr({line:r,spanStart:h,spanLength:d[1].length})),h+=d[1].length}function Hc(){return{deletionContent:{push(t){this.value+=t,this.length++},value:"",length:0},additionContent:{push(t){this.value+=t,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function qc({deletionFile:t,additionFile:e,deletionInfo:n,additionInfo:r,highlighter:s,deletionDecorations:o,additionDecorations:i,languageOverride:a,options:{theme:l=ze,...c}}){const u=a??rn(t.name),f=a??rn(e.name),{state:h,transformers:d}=Ls(),p=typeof l=="string"?{...c,lang:"text",theme:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:V("token")}:{...c,lang:"text",themes:l,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:V("token")};return{deletionLines:t.contents===""?[]:(p.lang=u,h.lineInfo=n,p.decorations=o,sn(s.codeToHast(Fe(t.contents),p))),additionLines:e.contents===""?[]:(p.lang=f,p.decorations=i,h.lineInfo=r,sn(s.codeToHast(Fe(e.contents),p)))}}function Vc({lines:t,startingLine:e=0,totalLines:n=1/0,callback:r}){const s=Math.min(e+n,t.length),o=(()=>{const i=t.at(-1);return i===""||i===`
154
154
  `||i===`\r
155
- `||i==="\r"?Math.max(0,t.length-2):t.length-1})();for(let i=e;i<s;i++){const a=i===o;if(r({lineIndex:i,lineNumber:i+1,content:t[i],isLastLine:a})===!0||a)break}}function Vc(t){return t!==""?t.split(Pc):[]}const Xc={forcePlainText:!1};function Kc(t,e,{theme:n=ze,tokenizeMaxLineLength:r},{forcePlainText:s,startingLine:o,totalLines:i,lines:a}=Xc){s?(o??=0,i??=1/0):(o=0,i=1/0);const l=o>0||i<1/0,{state:c,transformers:u}=As(),f=s?"text":t.lang??nn(t.name),h=(()=>{if(typeof n=="string")return e.getTheme(n).type})(),d=Ls({theme:n,highlighter:e});c.lineInfo=y=>({type:"context",lineIndex:y-1+o,lineNumber:y+o});const p=typeof n=="string"?{lang:f,theme:n,transformers:u,defaultColor:!1,cssVariablePrefix:V("token"),tokenizeMaxLineLength:r}:{lang:f,themes:n,transformers:u,defaultColor:!1,cssVariablePrefix:V("token"),tokenizeMaxLineLength:r},b=rn(e.codeToHast(l?Zc(a??Vc(t.contents),o,i):Fe(t.contents),p)),w=l?new Array(o):b;return l&&w.push(...b),{code:w,themeStyles:d,baseThemeType:h}}function Zc(t,e,n){let r="";return qc({lines:t,startingLine:e,totalLines:n,callback({content:s}){r+=s}}),r}let yr,xe={theme:ze,tokenizeMaxLineLength:1e3,lineDiffType:"word-alt"};self.addEventListener("error",t=>{console.error("[Shiki Worker] Unhandled error:",t.error)});self.addEventListener("message",t=>{Qc(t.data)});async function Qc(t){try{switch(t.type){case"initialize":await Yc(t);break;case"set-render-options":await Jc(t);break;case"file":await eu(t);break;case"diff":await tu(t);break;default:throw new Error(`Unknown request type: ${t.type}`)}}catch(e){console.error("Worker error:",e),su(t.id,e)}}async function Yc({id:t,renderOptions:e,preferredHighlighter:n,resolvedThemes:r,resolvedLanguages:s}){let o=Ct(n);"then"in o&&(o=await o),Es(r,o),s!=null&&_n(s,o),xe=e,postMessage({type:"success",id:t,requestType:"initialize",sentAt:Date.now()})}async function Jc({id:t,renderOptions:e,resolvedThemes:n}){let r=Ct();"then"in r&&(r=await r),Es(n,r),xe=e,postMessage({type:"success",id:t,requestType:"set-render-options",sentAt:Date.now()})}async function eu({id:t,file:e,resolvedLanguages:n}){let r=Ct();"then"in r&&(r=await r),n!=null&&_n(n,r);const s={theme:xe.theme,tokenizeMaxLineLength:xe.tokenizeMaxLineLength};nu(t,Kc(e,r,s),s)}async function tu({id:t,diff:e,resolvedLanguages:n}){let r=Ct();"then"in r&&(r=await r),n!=null&&_n(n,r),ru(t,jc(e,r,xe),xe)}function Ct(t="shiki-js"){return yr??=Ca({themes:[],langs:[],engine:t==="shiki-wasm"?kc(import("./wasm-CG6Dc4jp.js")):ic()}),yr}function nu(t,e,n){postMessage({type:"success",requestType:"file",id:t,result:e,options:n,sentAt:Date.now()})}function ru(t,e,n){postMessage({type:"success",requestType:"diff",id:t,result:e,options:n,sentAt:Date.now()})}function su(t,e){const n={type:"error",id:t,error:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0};postMessage(n)}
155
+ `||i==="\r"?Math.max(0,t.length-2):t.length-1})();for(let i=e;i<s;i++){const a=i===o;if(r({lineIndex:i,lineNumber:i+1,content:t[i],isLastLine:a})===!0||a)break}}function Xc(t){return t!==""?t.split($c):[]}const Kc={forcePlainText:!1};function Zc(t,e,{theme:n=ze,tokenizeMaxLineLength:r},{forcePlainText:s,startingLine:o,totalLines:i,lines:a}=Kc){s?(o??=0,i??=1/0):(o=0,i=1/0);const l=o>0||i<1/0,{state:c,transformers:u}=Ls(),f=s?"text":t.lang??rn(t.name),h=(()=>{if(typeof n=="string")return e.getTheme(n).type})(),d=Rs({theme:n,highlighter:e});c.lineInfo=y=>({type:"context",lineIndex:y-1+o,lineNumber:y+o});const p=typeof n=="string"?{lang:f,theme:n,transformers:u,defaultColor:!1,cssVariablePrefix:V("token"),tokenizeMaxLineLength:r}:{lang:f,themes:n,transformers:u,defaultColor:!1,cssVariablePrefix:V("token"),tokenizeMaxLineLength:r},b=sn(e.codeToHast(l?Qc(a??Xc(t.contents),o,i):Fe(t.contents),p)),w=l?new Array(o):b;return l&&w.push(...b),{code:w,themeStyles:d,baseThemeType:h}}function Qc(t,e,n){let r="";return Vc({lines:t,startingLine:e,totalLines:n,callback({content:s}){r+=s}}),r}let br,xe={theme:ze,tokenizeMaxLineLength:1e3,lineDiffType:"word-alt"};self.addEventListener("error",t=>{console.error("[Shiki Worker] Unhandled error:",t.error)});self.addEventListener("message",t=>{Yc(t.data)});async function Yc(t){try{switch(t.type){case"initialize":await Jc(t);break;case"set-render-options":await eu(t);break;case"file":await tu(t);break;case"diff":await nu(t);break;default:throw new Error(`Unknown request type: ${t.type}`)}}catch(e){console.error("Worker error:",e),ou(t.id,e)}}async function Jc({id:t,renderOptions:e,preferredHighlighter:n,resolvedThemes:r,resolvedLanguages:s}){let o=_t(n);"then"in o&&(o=await o),As(r,o),s!=null&&Sn(s,o),xe=e,postMessage({type:"success",id:t,requestType:"initialize",sentAt:Date.now()})}async function eu({id:t,renderOptions:e,resolvedThemes:n}){let r=_t();"then"in r&&(r=await r),As(n,r),xe=e,postMessage({type:"success",id:t,requestType:"set-render-options",sentAt:Date.now()})}async function tu({id:t,file:e,resolvedLanguages:n}){let r=_t();"then"in r&&(r=await r),n!=null&&Sn(n,r);const s={theme:xe.theme,tokenizeMaxLineLength:xe.tokenizeMaxLineLength};ru(t,Zc(e,r,s),s)}async function nu({id:t,diff:e,resolvedLanguages:n}){let r=_t();"then"in r&&(r=await r),n!=null&&Sn(n,r),su(t,Wc(e,r,xe),xe)}function _t(t="shiki-js"){return br??=_a({themes:[],langs:[],engine:t==="shiki-wasm"?xc(import("./wasm-CG6Dc4jp.js")):ac()}),br}function ru(t,e,n){postMessage({type:"success",requestType:"file",id:t,result:e,options:n,sentAt:Date.now()})}function su(t,e,n){postMessage({type:"success",requestType:"diff",id:t,result:e,options:n,sentAt:Date.now()})}function ou(t,e){const n={type:"error",id:t,error:e instanceof Error?e.message:String(e),stack:e instanceof Error?e.stack:void 0};postMessage(n)}