nuxt-studio 1.2.0 → 1.3.0

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 (136) hide show
  1. package/README.md +2 -2
  2. package/dist/app/actionscript-3-DKotD2Vd.js +1 -0
  3. package/dist/app/{andromeeda-C-Jbm3Hp.js → andromeeda-C4gqWexZ.js} +1 -1
  4. package/dist/app/ayu-dark-CMjwMIkn.js +1 -0
  5. package/dist/app/ayu-light-C47S-Tmv.js +1 -0
  6. package/dist/app/ayu-mirage-CjoLj4QM.js +1 -0
  7. package/dist/app/bn-BXLyqIGp.js +1 -0
  8. package/dist/app/csharp-VAkxddOj.js +1 -0
  9. package/dist/app/en-BLcCUEmi.js +1 -0
  10. package/dist/app/{erb-Buz1_99_.js → erb-BkKzIHzi.js} +1 -1
  11. package/dist/app/{gdresource-BLuZCTp3.js → gdresource-pHyHNgx5.js} +1 -1
  12. package/dist/app/{gdscript-fffAh1pn.js → gdscript-BpxQpKjR.js} +1 -1
  13. package/dist/app/go-Ci1olR0S.js +1 -0
  14. package/dist/app/horizon-BUw7H-hv.js +1 -0
  15. package/dist/app/index-BR26Sfgr.js +2 -0
  16. package/dist/app/index-C-y2greB.js +2 -0
  17. package/dist/app/index-CS_mI4k2.js +2 -0
  18. package/dist/app/index-Cl-ktQMQ.js +1 -0
  19. package/dist/app/index-DPJS0mlQ.js +2 -0
  20. package/dist/app/km-ClEwYEyg.js +1 -0
  21. package/dist/app/latex-DHfEut71.js +1 -0
  22. package/dist/app/lua-DlAioYQl.js +1 -0
  23. package/dist/app/main--P1Cc3W1.js +90 -0
  24. package/dist/app/main-BJNMrnKc.js +90 -0
  25. package/dist/app/main-D38hv2hq.js +90 -0
  26. package/dist/app/main-DKqH6k_9.js +69 -0
  27. package/dist/app/main.d.ts +121 -15
  28. package/dist/app/main.js +1 -82
  29. package/dist/app/mdc-import-FmFgRqLi.js +1 -0
  30. package/dist/app/{move-Cr8dt_E3.js → move-Dg7rFHVC.js} +1 -1
  31. package/dist/app/{nginx-CX2EZAQM.js → nginx-B2z8CTeP.js} +1 -1
  32. package/dist/app/night-owl-light-CMTm3GFP.js +1 -0
  33. package/dist/app/odin-BINPiy40.js +1 -0
  34. package/dist/app/one-light-C3Wv6jpd.js +1 -0
  35. package/dist/app/php-Ch-cYjOD.js +1 -0
  36. package/dist/app/{razor-WF-JDWnd.js → razor-Dx4-zBXE.js} +1 -1
  37. package/dist/app/ron-1l4eGd0-.js +1 -0
  38. package/dist/app/{rst-DDesMrJR.js → rst-Db6JICNt.js} +1 -1
  39. package/dist/app/{ruby-D9zFRbhA.js → ruby-DQYiaCa_.js} +1 -1
  40. package/dist/app/service-worker.d.ts +48 -14
  41. package/dist/app/shared-Bk3qBOVF.js +1 -0
  42. package/dist/app/shared-DSAAKzND.js +1 -0
  43. package/dist/app/shared-cDYJuGWk.js +1 -0
  44. package/dist/app/shared.d.ts +91 -14
  45. package/dist/app/shared.js +1 -1
  46. package/dist/app/surrealql-C_6seBBi.js +1 -0
  47. package/dist/app/{templ-BpwXGbW_.js → templ-B_lDaXqj.js} +1 -1
  48. package/dist/app/th-CiKRqNnp.js +1 -0
  49. package/dist/app/{twig-D5851E2W.js → twig-DL5s0dWc.js} +1 -1
  50. package/dist/module/module.d.mts +86 -2
  51. package/dist/module/module.json +1 -1
  52. package/dist/module/module.mjs +151 -13
  53. package/dist/module/runtime/host.js +15 -2
  54. package/dist/module/runtime/plugins/studio.client.dev.js +3 -1
  55. package/dist/module/runtime/server/routes/admin.js +20 -1
  56. package/dist/module/runtime/server/routes/ai/analyze.post.d.ts +8 -0
  57. package/dist/module/runtime/server/routes/ai/analyze.post.js +132 -0
  58. package/dist/module/runtime/server/routes/ai/generate.post.d.ts +2 -0
  59. package/dist/module/runtime/server/routes/ai/generate.post.js +93 -0
  60. package/dist/module/runtime/server/routes/auth/github.get.js +1 -1
  61. package/dist/module/runtime/server/routes/auth/gitlab.get.js +1 -1
  62. package/dist/module/runtime/server/routes/auth/google.get.js +4 -2
  63. package/dist/module/runtime/server/routes/auth/sso.get.d.ts +32 -0
  64. package/dist/module/runtime/server/routes/auth/sso.get.js +122 -0
  65. package/dist/module/runtime/server/types/ai.d.ts +40 -0
  66. package/dist/module/runtime/server/types/ai.js +7 -0
  67. package/dist/module/runtime/server/utils/ai/analyze.d.ts +32 -0
  68. package/dist/module/runtime/server/utils/ai/analyze.js +222 -0
  69. package/dist/module/runtime/server/utils/ai/generate.d.ts +63 -0
  70. package/dist/module/runtime/server/utils/ai/generate.js +285 -0
  71. package/dist/module/runtime/server/utils/ai/index.d.ts +7 -0
  72. package/dist/module/runtime/server/utils/ai/index.js +23 -0
  73. package/dist/module/runtime/{utils → server/utils}/auth.d.ts +8 -0
  74. package/dist/module/runtime/{utils → server/utils}/auth.js +30 -0
  75. package/dist/module/runtime/utils/document/generate.js +4 -2
  76. package/package.json +25 -22
  77. package/dist/app/actionscript-3-CKUqbIUM.js +0 -1
  78. package/dist/app/ar-QyL_HV85.js +0 -1
  79. package/dist/app/ar-_-RGPmO-.js +0 -1
  80. package/dist/app/ayu-dark-CmMr59Fi.js +0 -1
  81. package/dist/app/bg-DFTPuayt.js +0 -1
  82. package/dist/app/bg-DQB5FGjP.js +0 -1
  83. package/dist/app/ckb-CrQ-WJac.js +0 -1
  84. package/dist/app/ckb-DeCBOUtF.js +0 -1
  85. package/dist/app/cs-B98a2yWu.js +0 -1
  86. package/dist/app/cs-BH_F8qAm.js +0 -1
  87. package/dist/app/csharp-D3FXe4qe.js +0 -1
  88. package/dist/app/de-CcUtq3BY.js +0 -1
  89. package/dist/app/de-D14ADfq2.js +0 -1
  90. package/dist/app/en-CLoTvFGQ.js +0 -1
  91. package/dist/app/en-Dyk18FLF.js +0 -1
  92. package/dist/app/en-F_yDmSyh.js +0 -1
  93. package/dist/app/es-DNYVG1iM.js +0 -1
  94. package/dist/app/es-rJr14jIF.js +0 -1
  95. package/dist/app/fa-D8D4Juss.js +0 -1
  96. package/dist/app/fa-UOQDxc9M.js +0 -1
  97. package/dist/app/fi-CsyV_FZD.js +0 -1
  98. package/dist/app/fi-DyQnrsZG.js +0 -1
  99. package/dist/app/fr-Cc2mJRiD.js +0 -1
  100. package/dist/app/fr-URL6oX9g.js +0 -1
  101. package/dist/app/go-BR7YH85S.js +0 -1
  102. package/dist/app/id-976pWZzj.js +0 -1
  103. package/dist/app/id-mTfAucSk.js +0 -1
  104. package/dist/app/index-CNPuuSSp.js +0 -2
  105. package/dist/app/index-CP1r4M_D.js +0 -2
  106. package/dist/app/it-8iEYreYb.js +0 -1
  107. package/dist/app/it-CFQqwAz6.js +0 -1
  108. package/dist/app/ja-C2XZ4KU_.js +0 -1
  109. package/dist/app/ja-Da99Av5s.js +0 -1
  110. package/dist/app/ko-Chupaw_G.js +0 -1
  111. package/dist/app/ko-DHiZMNLx.js +0 -1
  112. package/dist/app/latex-CR-T6Gpw.js +0 -1
  113. package/dist/app/lua-B09NiSMa.js +0 -1
  114. package/dist/app/nb-no-Bs1s6rMn.js +0 -1
  115. package/dist/app/nb-no-D0vQN_qu.js +0 -1
  116. package/dist/app/nl-AS0JBFCr.js +0 -1
  117. package/dist/app/nl-DctNb_j0.js +0 -1
  118. package/dist/app/nn-no-BU_NKR1i.js +0 -1
  119. package/dist/app/nn-no-CPYyqwLs.js +0 -1
  120. package/dist/app/one-light-PoHY5YXO.js +0 -1
  121. package/dist/app/php-e5ftf-lz.js +0 -1
  122. package/dist/app/pl-DUO5RNGl.js +0 -1
  123. package/dist/app/pl-DeKXNi4V.js +0 -1
  124. package/dist/app/pt-br-BYRvhfst.js +0 -1
  125. package/dist/app/pt-br-DsJvwYKK.js +0 -1
  126. package/dist/app/ru-Bw2nJg-C.js +0 -1
  127. package/dist/app/ru-Cb_-x51Z.js +0 -1
  128. package/dist/app/shared-CdpkDwpC.js +0 -1
  129. package/dist/app/ua-CU6rzhlT.js +0 -1
  130. package/dist/app/ua-u_LezIM_.js +0 -1
  131. package/dist/app/vi-Ct_2aJ1a.js +0 -1
  132. package/dist/app/vi-DeNlKpcQ.js +0 -1
  133. package/dist/app/zh-BKDNFp3l.js +0 -1
  134. package/dist/app/zh-VPUrMzjH.js +0 -1
  135. package/dist/app/zh-tw-D-gS4Ane.js +0 -1
  136. package/dist/app/zh-tw-DVLUqrlM.js +0 -1
@@ -0,0 +1,2 @@
1
+ var e,t,n=Object.defineProperty,s=(e,t,s)=>((e,t,s)=>t in e?n(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s)(e,"symbol"!=typeof t?t+"":t,s);import{s as r,f as o,a as i,b as a,c,z as l,h as u,d as p}from"./main-DKqH6k_9.js";let d=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function g(e){return Array.isArray(e)?function(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=g(e[n]);return t}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let t={};for(let n in e)t[n]=g(e[n]);return t}(e):e}function m(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function f(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t===e.length-1?f(e.substring(0,e.length-1)):e.substr(1+~t)}var _=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,y=class{static hasCaptures(e){return null!==e&&(_.lastIndex=0,_.test(e))}static replaceCaptures(e,t,n){return e.replace(_,(e,s,r,o)=>{let i=n[parseInt(s||r,10)];if(!i)return e;{let e=t.substring(i.start,i.end);for(;"."===e[0];)e=e.substring(1);switch(o){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function b(e,t){return e<t?-1:e>t?1:0}function S(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let s=0;s<n;s++){let n=b(e[s],t[s]);if(0!==n)return n}return 0}return n-s}function k(e){return!!/^#[0-9a-f]{6}$/i.test(e)||(!!/^#[0-9a-f]{8}$/i.test(e)||(!!/^#[0-9a-f]{3}$/i.test(e)||!!/^#[0-9a-f]{4}$/i.test(e)))}function C(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var w=class{constructor(e){s(this,"cache",/* @__PURE__ */new Map),this.fn=e}get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},N=class{constructor(e,t,n){s(this,"_cachedMatchRoot",new w(e=>this._root.match(e))),this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let r=0,o=t.length;r<o;r++){let e,o=t[r];if(!o.settings)continue;if("string"==typeof o.scope){let t=o.scope;t=t.replace(/^[,]+/,""),t=t.replace(/[,]+$/,""),e=t.split(",")}else e=Array.isArray(o.scope)?o.scope:[""];let i=-1;if("string"==typeof o.settings.fontStyle){i=0;let e=o.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++){switch(e[t]){case"italic":i|=1;break;case"bold":i|=2;break;case"underline":i|=4;break;case"strikethrough":i|=8}}}let a=null;"string"==typeof o.settings.foreground&&k(o.settings.foreground)&&(a=o.settings.foreground);let c=null;"string"==typeof o.settings.background&&k(o.settings.background)&&(c=o.settings.background);for(let t=0,l=e.length;t<l;t++){let o=e[t].trim().split(" "),l=o[o.length-1],u=null;o.length>1&&(u=o.slice(0,o.length-1),u.reverse()),n[s++]=new P(l,u,r,i,a,c)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{let n=b(e.scope,t.scope);return 0!==n?n:(n=S(e.parentScopes,t.parentScopes),0!==n?n:e.index-t.index)});let n=0,s="#000000",r="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(s=t.foreground),null!==t.background&&(r=t.background)}let o=new T(t),i=new R(n,o.getId(s),o.getId(r)),a=new L(new E(0,null,-1,0,0),[]);for(let c=0,l=e.length;c<l;c++){let t=e[c];a.insert(0,t.scope,t.parentScopes,t.fontStyle,o.getId(t.foreground),o.getId(t.background))}return new N(o,i,a)}(e,t)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>function(e,t){if(0===t.length)return!0;for(let n=0;n<t.length;n++){let s=t[n],r=!1;if(">"===s){if(n===t.length-1)return!1;s=t[++n],r=!0}for(;e&&!A(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}(e.parent,t.parentScopes));return n?new R(n.fontStyle,n.foreground,n.background):null}},v=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(const s of n)t=new e(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new e(n,t[s]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function A(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var R=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};var P=class{constructor(e,t,n,s,r,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=r,this.background=o}},I=/* @__PURE__ */(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(I||{});var T=class{constructor(e){if(s(this,"_isFrozen"),s(this,"_lastColorId"),s(this,"_id2color"),s(this,"_color2id"),this._lastColorId=0,this._id2color=[],this._color2id=/* @__PURE__ */Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},x=Object.freeze([]),E=class e{constructor(e,t,n,r,o){s(this,"scopeDepth"),s(this,"parentScopes"),s(this,"fontStyle"),s(this,"foreground"),s(this,"background"),this.scopeDepth=e,this.parentScopes=t||x,this.fontStyle=n,this.foreground=r,this.background=o}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==s&&(this.background=s)}},L=class e{constructor(e,t=[],n={}){s(this,"_rulesWithParentScopes"),this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,s=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[s]&&s++,!(n>=e.parentScopes.length||s>=t.parentScopes.length);){const r=t.parentScopes[s].length-e.parentScopes[n].length;if(0!==r)return r;n++,s++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,s=t.indexOf(".");if(-1===s?(e=t,n=""):(e=t.substring(0,s),n=t.substring(s+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,s,r,o,i){if(""===n)return void this._doInsertHere(t,s,r,o,i);let a,c,l,u=n.indexOf(".");-1===u?(a=n,c=""):(a=n.substring(0,u),c=n.substring(u+1)),this._children.hasOwnProperty(a)?l=this._children[a]:(l=new e(this._mainRule.clone(),E.cloneArr(this._rulesWithParentScopes)),this._children[a]=l),l.insert(t+1,c,s,r,o,i)}_doInsertHere(e,t,n,s,r){if(null!==t){for(let o=0,i=this._rulesWithParentScopes.length;o<i;o++){let i=this._rulesWithParentScopes[o];if(0===S(i.parentScopes,t))return void i.acceptOverwrite(e,n,s,r)}-1===n&&(n=this._mainRule.fontStyle),0===s&&(s=this._mainRule.foreground),0===r&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new E(e,t,n,s,r))}else this._mainRule.acceptOverwrite(e,n,s,r)}},G=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){const n=e.getLanguageId(t),s=e.getTokenType(t),r=e.getFontStyle(t),o=e.getForeground(t),i=e.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:o,background:i})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,s,r,o,i,a){let c=e.getLanguageId(t),l=e.getTokenType(t),u=e.containsBalancedBrackets(t)?1:0,p=e.getFontStyle(t),d=e.getForeground(t),g=e.getBackground(t);return 0!==n&&(c=n),8!==s&&(l=s),null!==r&&(u=r?1:0),-1!==o&&(p=o),0!==i&&(d=i),0!==a&&(g=a),(c|l<<8|u<<10|p<<11|d<<15|g<<24)>>>0}};function $(e){return e}function O(e,t){const n=[],s=function(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}(e);let r=s.next();for(;null!==r;){let e=0;if(2===r.length&&":"===r.charAt(1)){switch(r.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let t=i();if(n.push({matcher:t,priority:e}),","!==r)break;r=s.next()}return n;function o(){if("-"===r){r=s.next();const e=o();return t=>!!e&&!e(t)}if("("===r){r=s.next();const e=function(){const e=[];let t=i();for(;t&&(e.push(t),"|"===r||","===r);){do{r=s.next()}while("|"===r||","===r);t=i()}return t=>e.some(e=>e(t))}();return")"===r&&(r=s.next()),e}if(B(r)){const e=[];do{e.push(r),r=s.next()}while(B(r));return n=>t(e,n)}return null}function i(){const e=[];let t=o();for(;t;)e.push(t),t=o();return t=>e.every(e=>e(t))}}function B(e){return!!e&&!!e.match(/[\w\.:]+/)}function M(e){"function"==typeof e.dispose&&e.dispose()}var j=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},F=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},D=class{constructor(){s(this,"_references",[]),s(this,"_seenReferenceKeys",/* @__PURE__ */new Set),s(this,"visitedRule",/* @__PURE__ */new Set)}get references(){return this._references}add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},W=class{constructor(e,t){s(this,"seenFullScopeRequests",/* @__PURE__ */new Set),s(this,"seenPartialScopeRequests",/* @__PURE__ */new Set),s(this,"Q"),this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new j(this.initialScopeName)]}processQueue(){const e=this.Q;this.Q=[];const t=new D;for(const n of e)q(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof j){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName))continue;if(this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function q(e,t,n,s){const r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof j?z({baseGrammar:o,selfGrammar:r},s):U(e.ruleName,{baseGrammar:o,selfGrammar:r,repository:r.repository},s);const i=n.injections(e.scopeName);if(i)for(const a of i)s.add(new j(a))}function U(e,t,n){if(t.repository&&t.repository[e]){H([t.repository[e]],t,n)}}function z(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&H(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&H(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function H(e,t,n){for(const s of e){if(n.visitedRule.has(s))continue;n.visitedRule.add(s);const e=s.repository?m({},t.repository,s.repository):t.repository;Array.isArray(s.patterns)&&H(s.patterns,{...t,repository:e},n);const r=s.include;if(!r)continue;const o=X(r);switch(o.kind){case 0:z({...t,selfGrammar:t.baseGrammar},n);break;case 1:z(t,n);break;case 2:U(o.ruleName,{...t,repository:e},n);break;case 3:case 4:const s=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){const r={baseGrammar:t.baseGrammar,selfGrammar:s,repository:e};4===o.kind?U(o.ruleName,r,n):z(r,n)}else 4===o.kind?n.add(new F(o.scopeName,o.ruleName)):n.add(new j(o.scopeName))}}}var K=class{constructor(){s(this,"kind",0)}},Y=class{constructor(){s(this,"kind",1)}},Q=class{constructor(e){s(this,"kind",2),this.ruleName=e}},J=class{constructor(e){s(this,"kind",3),this.scopeName=e}},V=class{constructor(e,t){s(this,"kind",4),this.scopeName=e,this.ruleName=t}};function X(e){if("$base"===e)return new K;if("$self"===e)return new Y;const t=e.indexOf("#");if(-1===t)return new J(e);if(0===t)return new Q(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new V(n,s)}}var Z=/\\(\d+)/,ee=/\\(\d+)/g;var te=class{constructor(e,t,n,r){s(this,"$location"),s(this,"id"),s(this,"_nameIsCapturing"),s(this,"_name"),s(this,"_contentNameIsCapturing"),s(this,"_contentName"),this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=y.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=y.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${f(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?y.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?y.replaceCaptures(this._contentName,e,t):this._contentName}},ne=class extends te{constructor(e,t,n,r,o){super(e,t,n,r),s(this,"retokenizeCapturedWithRuleId"),this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,s){throw new Error("Not supported!")}},se=class extends te{constructor(e,t,n,r,o){super(e,t,n,null),s(this,"_match"),s(this,"captures"),s(this,"_cachedCompiledPatterns"),this._match=new ce(r,this.id),this.captures=o,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new le,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},re=class extends te{constructor(e,t,n,r,o){super(e,t,n,r),s(this,"hasMissingPatterns"),s(this,"patterns"),s(this,"_cachedCompiledPatterns"),this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns){e.getRule(n).collectPatterns(e,t)}}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new le,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},oe=class extends te{constructor(e,t,n,r,o,i,a,c,l,u){super(e,t,n,r),s(this,"_begin"),s(this,"beginCaptures"),s(this,"_end"),s(this,"endHasBackReferences"),s(this,"endCaptures"),s(this,"applyEndPatternLast"),s(this,"hasMissingPatterns"),s(this,"patterns"),s(this,"_cachedCompiledPatterns"),this._begin=new ce(o,this.id),this.beginCaptures=i,this._end=new ce(a||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,s)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new le;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},ie=class extends te{constructor(e,t,n,r,o,i,a,c,l){super(e,t,n,r),s(this,"_begin"),s(this,"beginCaptures"),s(this,"whileCaptures"),s(this,"_while"),s(this,"whileHasBackReferences"),s(this,"hasMissingPatterns"),s(this,"patterns"),s(this,"_cachedCompiledPatterns"),s(this,"_cachedCompiledWhilePatterns"),this._begin=new ce(o,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new ce(a,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new le;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,s){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,s)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new le,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},ae=class e{static createCaptureRule(e,t,n,s,r){return e.registerRule(e=>new ne(t,e,n,s,r))}static getCompiledRuleId(t,n,s){return t.id||n.registerRule(r=>{if(t.id=r,t.match)return new se(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,s));if(void 0===t.begin){t.repository&&(s=m({},s,t.repository));let r=t.patterns;return void 0===r&&t.include&&(r=[{include:t.include}]),new re(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(r,n,s))}return t.while?new ie(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,s),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,s),e._compilePatterns(t.patterns,n,s)):new oe(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,s),t.end,e._compileCaptures(t.endCaptures||t.captures,n,s),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,s))}),t.id}static _compileCaptures(t,n,s){let r=[];if(t){let o=0;for(const e in t){if("$vscodeTextmateLocation"===e)continue;const t=parseInt(e,10);t>o&&(o=t)}for(let e=0;e<=o;e++)r[e]=null;for(const i in t){if("$vscodeTextmateLocation"===i)continue;const o=parseInt(i,10);let a=0;t[i].patterns&&(a=e.getCompiledRuleId(t[i],n,s)),r[o]=e.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,a)}}return r}static _compilePatterns(t,n,s){let r=[];if(t)for(let o=0,i=t.length;o<i;o++){const i=t[o];let a=-1;if(i.include){const t=X(i.include);switch(t.kind){case 0:case 1:a=e.getCompiledRuleId(s[i.include],n,s);break;case 2:let r=s[t.ruleName];r&&(a=e.getCompiledRuleId(r,n,s));break;case 3:case 4:const o=t.scopeName,c=4===t.kind?t.ruleName:null,l=n.getExternalGrammar(o,s);if(l)if(c){let t=l.repository[c];t&&(a=e.getCompiledRuleId(t,n,l.repository))}else a=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}else a=e.getCompiledRuleId(i,n,s);if(-1!==a){const e=n.getRule(a);let t=!1;if((e instanceof re||e instanceof oe||e instanceof ie)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;r.push(a)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},ce=class e{constructor(e,t){if(s(this,"source"),s(this,"ruleId"),s(this,"hasAnchor"),s(this,"hasBackReferences"),s(this,"_anchorCache"),e&&"string"==typeof e){const t=e.length;let n=0,s=[],r=!1;for(let o=0;o<t;o++){if("\\"===e.charAt(o)&&o+1<t){const t=e.charAt(o+1);"z"===t?(s.push(e.substring(n,o)),s.push("$(?!\\n)(?<!\\n)"),n=o+2):"A"!==t&&"G"!==t||(r=!0),o++}}this.hasAnchor=r,0===n?this.source=e:(s.push(e.substring(n,t)),this.source=s.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=Z.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let n=t.map(t=>e.substring(t.start,t.end));return ee.lastIndex=0,this.source.replace(ee,(e,t)=>C(n[parseInt(t,10)]||""))}_buildAnchorCache(){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let e,t,n,s,r=[],o=[],i=[],a=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),r[e]=n,o[e]=n,i[e]=n,a[e]=n,"\\"===n&&e+1<t&&(s=this.source.charAt(e+1),"A"===s?(r[e+1]="￿",o[e+1]="￿",i[e+1]="A",a[e+1]="A"):"G"===s?(r[e+1]="￿",o[e+1]="G",i[e+1]="￿",a[e+1]="G"):(r[e+1]=s,o[e+1]=s,i[e+1]=s,a[e+1]=s),e++);return{A0_G0:r.join(""),A0_G1:o.join(""),A1_G0:i.join(""),A1_G1:a.join("")}}resolveAnchors(e,t){return this.hasAnchor&&this._anchorCache&&"string"==typeof this.source?e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0:this.source}},le=class{constructor(){s(this,"_items"),s(this,"_hasAnchors"),s(this,"_cached"),s(this,"_anchorCache"),this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new he(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let s=this._items.map(e=>e.resolveAnchors(t,n));return new he(e,s,this._items.map(e=>e.ruleId))}},he=class{constructor(e,t,n){s(this,"scanner"),this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){const s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},ue=class{constructor(e,t){this.languageId=e,this.tokenType=t}},pe=(e=class{constructor(e,t){s(this,"_defaultAttributes"),s(this,"_embeddedLanguagesMatcher"),s(this,"_getBasicScopeAttributes",new w(e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new ue(t,n)})),this._defaultAttributes=new ue(e,8),this._embeddedLanguagesMatcher=new de(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){const n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},s(e,"_NULL_SCOPE_METADATA",new ue(0,0)),s(e,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),e),de=class{constructor(e){if(s(this,"values"),s(this,"scopesRegExp"),0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>C(e));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);return t?this.values.get(t[1]):void 0}};"undefined"!=typeof process&&process.env.VSCODE_TEXTMATE_DEBUG;var ge=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function me(e,t,n,s,r,o,i,a){const c=t.content.length;let l=!1,u=-1;if(i){const i=function(e,t,n,s,r,o){let i=r.beginRuleCapturedEOL?0:-1;const a=[];for(let c=r;c;c=c.pop()){const t=c.getRule(e);t instanceof ie&&a.push({rule:t,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:a,findOptions:l}=_e(c.rule,e,c.stack.endRule,n,s===i),u=a.findNextMatchSync(t,s,l);if(!u){r=c.stack.pop();break}if(-2!==u.ruleId){r=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(o.produce(c.stack,u.captureIndices[0].start),ye(e,t,n,c.stack,o,c.rule.whileCaptures,u.captureIndices),o.produce(c.stack,u.captureIndices[0].end),i=u.captureIndices[0].end,u.captureIndices[0].end>s&&(s=u.captureIndices[0].end,n=!1))}return{stack:r,linePos:s,anchorPosition:i,isFirstLine:n}}(e,t,n,s,r,o);r=i.stack,s=i.linePos,n=i.isFirstLine,u=i.anchorPosition}const p=Date.now();for(;!l;){if(0!==a){if(Date.now()-p>a)return new ge(r,!0)}d()}return new ge(r,!1);function d(){const i=function(e,t,n,s,r,o){const i=function(e,t,n,s,r,o){const i=r.getRule(e),{ruleScanner:a,findOptions:c}=fe(i,e,r.endRule,n,s===o),l=a.findNextMatchSync(t,s,c);if(l)return{captureIndices:l.captureIndices,matchedRuleId:l.ruleId};return null}(e,t,n,s,r,o),a=e.getInjections();if(0===a.length)return i;const c=function(e,t,n,s,r,o,i){let a,c=Number.MAX_VALUE,l=null,u=0;const p=o.contentNameScopesList.getScopeNames();for(let d=0,g=e.length;d<g;d++){const o=e[d];if(!o.matcher(p))continue;const g=t.getRule(o.ruleId),{ruleScanner:m,findOptions:f}=fe(g,t,null,s,r===i),_=m.findNextMatchSync(n,r,f);if(!_)continue;const y=_.captureIndices[0].start;if(!(y>=c)&&(c=y,l=_.captureIndices,a=_.ruleId,u=o.priority,c===r))break}if(l)return{priorityMatch:-1===u,captureIndices:l,matchedRuleId:a};return null}(a,e,t,n,s,r,o);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,u=c.captureIndices[0].start;if(u<l||c.priorityMatch&&u===l)return c;return i}(e,t,n,s,r,u);if(!i)return o.produce(r,c),void(l=!0);const a=i.captureIndices,p=i.matchedRuleId,d=!!(a&&a.length>0)&&a[0].end>s;if(-1===p){const i=r.getRule(e);o.produce(r,a[0].start),r=r.withContentNameScopesList(r.nameScopesList),ye(e,t,n,r,o,i.endCaptures,a),o.produce(r,a[0].end);const p=r;if(r=r.parent,u=p.getAnchorPos(),!d&&p.getEnterPos()===s)return r=p,o.produce(r,c),void(l=!0)}else{const i=e.getRule(p);o.produce(r,a[0].start);const g=r,m=i.getName(t.content,a),f=r.contentNameScopesList.pushAttributed(m,e);if(r=r.push(p,s,u,a[0].end===c,null,f,f),i instanceof oe){const s=i;ye(e,t,n,r,o,s.beginCaptures,a),o.produce(r,a[0].end),u=a[0].end;const p=s.getContentName(t.content,a),m=f.pushAttributed(p,e);if(r=r.withContentNameScopesList(m),s.endHasBackReferences&&(r=r.withEndRule(s.getEndWithResolvedBackReferences(t.content,a))),!d&&g.hasSameRuleAs(r))return r=r.pop(),o.produce(r,c),void(l=!0)}else if(i instanceof ie){const s=i;ye(e,t,n,r,o,s.beginCaptures,a),o.produce(r,a[0].end),u=a[0].end;const p=s.getContentName(t.content,a),m=f.pushAttributed(p,e);if(r=r.withContentNameScopesList(m),s.whileHasBackReferences&&(r=r.withEndRule(s.getWhileWithResolvedBackReferences(t.content,a))),!d&&g.hasSameRuleAs(r))return r=r.pop(),o.produce(r,c),void(l=!0)}else{if(ye(e,t,n,r,o,i.captures,a),o.produce(r,a[0].end),r=r.pop(),!d)return r=r.safePop(),o.produce(r,c),void(l=!0)}}a[0].end>s&&(s=a[0].end,n=!1)}}function fe(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function _e(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function ye(e,t,n,s,r,o,i){if(0===o.length)return;const a=t.content,c=Math.min(o.length,i.length),l=[],u=i[0].end;for(let p=0;p<c;p++){const t=o[p];if(null===t)continue;const c=i[p];if(0===c.length)continue;if(c.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=c.start;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?r.produceFromScopes(l[l.length-1].scopes,c.start):r.produce(s,c.start),t.retokenizeCapturedWithRuleId){const o=t.getName(a,i),l=s.contentNameScopesList.pushAttributed(o,e),u=t.getContentName(a,i),p=l.pushAttributed(u,e),d=s.push(t.retokenizeCapturedWithRuleId,c.start,-1,!1,null,l,p),g=e.createOnigString(a.substring(0,c.end));me(e,g,n&&0===c.start,c.start,d,r,!1,0),M(g);continue}const d=t.getName(a,i);if(null!==d){const t=(l.length>0?l[l.length-1].scopes:s.contentNameScopesList).pushAttributed(d,e);l.push(new be(t,c.end))}}for(;l.length>0;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var be=class{constructor(e,t){s(this,"scopes"),s(this,"endPos"),this.scopes=e,this.endPos=t}};function Se(e,t,n,s,r){const o=O(t,ke),i=ae.getCompiledRuleId(n,s,r.repository);for(const a of o)e.push({debugSelector:t,matcher:a.matcher,ruleId:i,grammar:r,priority:a.priority})}function ke(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let s=n;s<t.length;s++)if(Ce(t[s],e))return n=s+1,!0;return!1})}function Ce(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}var we=class{constructor(e,t,n,r,o,i,a,c){if(s(this,"_rootId"),s(this,"_lastRuleId"),s(this,"_ruleId2desc"),s(this,"_includedGrammars"),s(this,"_grammarRepository"),s(this,"_grammar"),s(this,"_injections"),s(this,"_basicScopeAttributesProvider"),s(this,"_tokenTypeMatchers"),this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=c,this._basicScopeAttributesProvider=new pe(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=Ne(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const s of Object.keys(o)){const e=O(s,ke);for(const t of e)this._tokenTypeMatchers.push({matcher:t.matcher,type:o[s]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e=e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),t=[],n=this._rootScopeName,s=e(n);if(s){const e=s.injections;if(e)for(let n in e)Se(t,n,e[n],this,s);const r=this._grammarRepository.injections(n);r&&r.forEach(e=>{const n=this.getExternalGrammar(e);if(n){const e=n.injectionSelector;e&&Se(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Ne(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){let r;if(-1===this._rootId&&(this._rootId=ae.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==Ae.NULL)r=!1,t.reset();else{r=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),s=G.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),o=this.getRule(this._rootId).getName(null,null);let i;i=o?ve.createRootAndLookUpScopeName(o,s,this):ve.createRoot("unknown",s),t=new Ae(null,this._rootId,-1,-1,!1,null,i,i)}e+="\n";const o=this.createOnigString(e),i=o.content.length,a=new Pe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=me(this,o,r,0,t,a,!0,s);return M(o),{lineLength:i,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Ne(e,t){return(e=g(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var ve=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let s=t,r=t?.scopePath??null;for(const o of n)r=v.push(r,o.scopeNames),s=new e(s,r,o.encodedTokenAttributes);return s}static createRoot(t,n){return new e(null,new v(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),o=new v(null,t),i=s.themeProvider.themeMatch(o),a=e.mergeAttributes(n,r,i);return new e(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let s=-1,r=0,o=0;return null!==n&&(s=n.fontStyle,r=n.foregroundId,o=n.backgroundId),G.set(e,t.languageId,t.tokenType,null,s,r,o)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const o of s)r=e._pushAttributed(r,o,n);return r}static _pushAttributed(t,n,s){const r=s.getMetadataForScope(n),o=t.scopePath.push(n),i=s.themeProvider.themeMatch(o),a=e.mergeAttributes(t.tokenAttributes,r,i);return new e(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Ae=(t=class{constructor(e,t,n,r,o,i,a,c){s(this,"_stackElementBrand"),s(this,"_enterPos"),s(this,"_anchorPos"),s(this,"depth"),this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}equals(e){return null!==e&&t._equals(this,e)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&ve.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){t._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,s,r,o,i,a){return new t(this,e,n,s,r,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,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new t(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const s=ve.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new t(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,ve.fromExtension(s,n.contentNameScopesList))}},s(t,"NULL",new t(null,0,0,0,!1,null,null,null)),t),Re=class{constructor(e,t){s(this,"balancedBracketScopes"),s(this,"unbalancedBracketScopes"),s(this,"allowAny",!1),this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):O(e,ke).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>O(e,ke).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Pe=class{constructor(e,t,n,r){s(this,"_emitBinaryTokens"),s(this,"_lineText"),s(this,"_tokens"),s(this,"_binaryTokens"),s(this,"_lastTokenEndIndex"),s(this,"_tokenTypeOverrides"),this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const t=e?.getScopeNames()??[];for(const e of this._tokenTypeOverrides)e.matcher(t)&&(n=G.set(n,0,$(e.type),null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(t))}return s&&(n=G.set(n,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n?void(this._lastTokenEndIndex=t):(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),void(this._lastTokenEndIndex=t))}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},Ie=class{constructor(e,t){s(this,"_grammars",/* @__PURE__ */new Map),s(this,"_rawGrammars",/* @__PURE__ */new Map),s(this,"_injectionGrammars",/* @__PURE__ */new Map),s(this,"_theme"),this._onigLib=t,this._theme=e}dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,s,r){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,function(e,t,n,s,r,o,i,a){return new we(e,t,n,s,r,o,i,a)}(e,o,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},Te=class{constructor(e){s(this,"_options"),s(this,"_syncRegistry"),s(this,"_ensureGrammarCache"),this._options=e,this._syncRegistry=new Ie(N.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=/* @__PURE__ */new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(N.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new Re(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,s,r){const o=new W(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(e=>this._loadSingleGrammar(e.scopeName)),o.processQueue();return this._grammarForScopeName(e,t,n,s,r)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,s=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,s)}_grammarForScopeName(e,t=0,n=null,s=null,r=null){return this._syncRegistry.grammarForScopeName(e,t,n,s,r)}},xe=Ae.NULL;const Ee=/["&'<>`]/g,Le=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ge=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,$e=/[|\\{}()[\]^$+*?.]/g,Oe=/* @__PURE__ */new WeakMap;function Be(e,t){return e=e.replace(t.subset?function(e){let t=Oe.get(e);t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace($e,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),Oe.set(e,t));return t}(t.subset):Ee,n),t.subset||t.escapeOnly?e:e.replace(Le,function(e,n,s){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,s.charCodeAt(n+2),t)}).replace(Ge,n);function n(e,n,s){return t.format(e.charCodeAt(0),s.charCodeAt(n+1),t)}}const Me=/[\dA-Fa-f]/;const je=/\d/;const Fe=["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"],De={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:"€"},We=["cent","copy","divide","gt","lt","not","para","times"],qe={}.hasOwnProperty,Ue={};let ze;for(ze in De)qe.call(De,ze)&&(Ue[De[ze]]=ze);const He=/[^\dA-Za-z]/;function Ke(e,t,n){let s,r=function(e,t,n){const s="&#x"+e.toString(16).toUpperCase();return n&&t&&!Me.test(String.fromCharCode(t))?s:s+";"}(e,t,n.omitOptionalSemicolons);if((n.useNamedReferences||n.useShortestReferences)&&(s=function(e,t,n,s){const r=String.fromCharCode(e);if(qe.call(Ue,r)){const e=Ue[r],o="&"+e;return n&&Fe.includes(e)&&!We.includes(e)&&(!s||t&&61!==t&&He.test(String.fromCharCode(t)))?o:o+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const s=function(e,t,n){const s="&#"+String(e);return n&&t&&!je.test(String.fromCharCode(t))?s:s+";"}(e,t,n.omitOptionalSemicolons);s.length<r.length&&(r=s)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Ye(e,t){return Be(e,Object.assign({format:Ke},t))}const Qe=/^>|^->|<!--|-->|--!>|<!-$/g,Je=[">"],Ve=["<",">"];const Xe=/[ \t\n\f\r]/g;function Ze(e){return"object"==typeof e?"text"===e.type&&et(e.value):et(e)}function et(e){return""===e.replace(Xe,"")}const tt=rt(1),nt=rt(-1),st=[];function rt(e){return function(t,n,s){const r=t?t.children:st;let o=(n||0)+e,i=r[o];if(!s)for(;i&&Ze(i);)o+=e,i=r[o];return i}}const ot={}.hasOwnProperty;function it(e){return function(t,n,s){return ot.call(e,t.tagName)&&e[t.tagName](t,n,s)}}const at=it({body:function(e,t,n){const s=tt(n,t);return!s||"comment"!==s.type},caption:ct,colgroup:ct,dd:function(e,t,n){const s=tt(n,t);return!s||"element"===s.type&&("dt"===s.tagName||"dd"===s.tagName)},dt:function(e,t,n){const s=tt(n,t);return Boolean(s&&"element"===s.type&&("dt"===s.tagName||"dd"===s.tagName))},head:ct,html:function(e,t,n){const s=tt(n,t);return!s||"comment"!==s.type},li:function(e,t,n){const s=tt(n,t);return!s||"element"===s.type&&"li"===s.tagName},optgroup:function(e,t,n){const s=tt(n,t);return!s||"element"===s.type&&"optgroup"===s.tagName},option:function(e,t,n){const s=tt(n,t);return!s||"element"===s.type&&("option"===s.tagName||"optgroup"===s.tagName)},p:function(e,t,n){const s=tt(n,t);return s?"element"===s.type&&("address"===s.tagName||"article"===s.tagName||"aside"===s.tagName||"blockquote"===s.tagName||"details"===s.tagName||"div"===s.tagName||"dl"===s.tagName||"fieldset"===s.tagName||"figcaption"===s.tagName||"figure"===s.tagName||"footer"===s.tagName||"form"===s.tagName||"h1"===s.tagName||"h2"===s.tagName||"h3"===s.tagName||"h4"===s.tagName||"h5"===s.tagName||"h6"===s.tagName||"header"===s.tagName||"hgroup"===s.tagName||"hr"===s.tagName||"main"===s.tagName||"menu"===s.tagName||"nav"===s.tagName||"ol"===s.tagName||"p"===s.tagName||"pre"===s.tagName||"section"===s.tagName||"table"===s.tagName||"ul"===s.tagName):!n||!("element"===n.type&&("a"===n.tagName||"audio"===n.tagName||"del"===n.tagName||"ins"===n.tagName||"map"===n.tagName||"noscript"===n.tagName||"video"===n.tagName))},rp:lt,rt:lt,tbody:function(e,t,n){const s=tt(n,t);return!s||"element"===s.type&&("tbody"===s.tagName||"tfoot"===s.tagName)},td:ht,tfoot:function(e,t,n){return!tt(n,t)},th:ht,thead:function(e,t,n){const s=tt(n,t);return Boolean(s&&"element"===s.type&&("tbody"===s.tagName||"tfoot"===s.tagName))},tr:function(e,t,n){const s=tt(n,t);return!s||"element"===s.type&&"tr"===s.tagName}});function ct(e,t,n){const s=tt(n,t,!0);return!s||"comment"!==s.type&&!("text"===s.type&&Ze(s.value.charAt(0)))}function lt(e,t,n){const s=tt(n,t);return!s||"element"===s.type&&("rp"===s.tagName||"rt"===s.tagName)}function ht(e,t,n){const s=tt(n,t);return!s||"element"===s.type&&("td"===s.tagName||"th"===s.tagName)}const ut=it({body:function(e){const t=tt(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&Ze(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,n){const s=nt(n,t),r=tt(e,-1,!0);if(n&&s&&"element"===s.type&&"colgroup"===s.tagName&&at(s,n.children.indexOf(s),n))return!1;return Boolean(r&&"element"===r.type&&"col"===r.tagName)},head:function(e){const t=/* @__PURE__ */new Set;for(const s of e.children)if("element"===s.type&&("base"===s.tagName||"title"===s.tagName)){if(t.has(s.tagName))return!1;t.add(s.tagName)}const n=e.children[0];return!n||"element"===n.type},html:function(e){const t=tt(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const s=nt(n,t),r=tt(e,-1);if(n&&s&&"element"===s.type&&("thead"===s.tagName||"tbody"===s.tagName)&&at(s,n.children.indexOf(s),n))return!1;return Boolean(r&&"element"===r.type&&"tr"===r.tagName)}});const pt={name:[["\t\n\f\r &/=>".split(""),"\t\n\f\r \"&'/=>`".split("")],["\0\t\n\f\r \"&'/<=>".split(""),"\0\t\n\f\r \"&'/<=>`".split("")]],unquoted:[["\t\n\f\r &>".split(""),"\0\t\n\f\r \"&'<=>`".split("")],["\0\t\n\f\r \"&'<=>`".split(""),"\0\t\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function dt(e,t,n){const s=o(e.schema,t),r=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,l=e.settings.allowDangerousCharacters?0:1;let u,p=e.quote;if(!s.overloadedBoolean||n!==s.attribute&&""!==n?!s.boolean&&!s.overloadedBoolean||"string"==typeof n&&n!==s.attribute&&""!==n||(n=Boolean(n)):n=!0,null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";const d=Ye(s.attribute,Object.assign({},e.settings.characterReferences,{subset:pt.name[r][l]}));return!0===n?d:(n=Array.isArray(n)?(s.commaSeparated?i:a)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?d:(e.settings.preferUnquoted&&(u=Ye(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:pt.unquoted[r][l]}))),u!==n&&(e.settings.quoteSmart&&c(n,p)>c(n,e.alternative)&&(p=e.alternative),u=p+Ye(n,Object.assign({},e.settings.characterReferences,{subset:("'"===p?pt.single:pt.double)[r][l],attribute:!0}))+p),d+(u?"="+u:u)))}const gt=["<","&"];function mt(e,t,n,s){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?Ye(e.value,Object.assign({},s.settings.characterReferences,{subset:gt})):e.value}const ft=l("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,s){return s.settings.bogusComments?"<?"+Ye(e.value,Object.assign({},s.settings.characterReferences,{subset:Je}))+">":"\x3c!--"+e.value.replace(Qe,function(e){return Ye(e,Object.assign({},s.settings.characterReferences,{subset:Ve}))})+"--\x3e"},doctype:function(e,t,n,s){return"<!"+(s.settings.upperDoctype?"DOCTYPE":"doctype")+(s.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,s){const o=s.schema,i="svg"!==o.space&&s.settings.omitOptionalTags;let a="svg"===o.space?s.settings.closeEmptyElements:s.settings.voids.includes(e.tagName.toLowerCase());const c=[];let l;"html"===o.space&&"svg"===e.tagName&&(s.schema=r);const u=function(e,t){const n=[];let s,r=-1;if(t)for(s in t)if(null!==t[s]&&void 0!==t[s]){const r=dt(e,s,t[s]);r&&n.push(r)}for(;++r<n.length;){const t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&'"'!==t&&"'"!==t&&(n[r]+=" ")}return n.join("")}(s,e.properties),p=s.all("html"===o.space&&"template"===e.tagName?e.content:e);return s.schema=o,p&&(a=!1),!u&&i&&ut(e,t,n)||(c.push("<",e.tagName,u?" "+u:""),a&&("svg"===o.space||s.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!s.settings.tightSelfClosing||"/"===l||l&&'"'!==l&&"'"!==l)&&c.push(" "),c.push("/")),c.push(">")),c.push(p),a||i&&at(e,t,n)||c.push("</"+e.tagName+">"),c.join("")},raw:function(e,t,n,s){return s.settings.allowDangerousHtml?e.value:mt(e,0,n,s)},root:function(e,t,n,s){return s.all(e)},text:mt}});const _t={},yt={},bt=[];function St(e,t,n){return ft(e,t,n,this)}function kt(e){const t=[],n=e&&e.children||bt;let s=-1;for(;++s<n.length;)t[s]=this.one(n[s],s,e);return t.join("")}function Ct(e,t){const n="string"==typeof e?{}:{...e.colorReplacements},s="string"==typeof e?e:e.name;for(const[r,o]of Object.entries(t?.colorReplacements||{}))"string"==typeof o?n[r]=o:r===s&&Object.assign(n,o);return n}function wt(e,t){return e&&t?.[e?.toLowerCase()]||e}function Nt(e){return Array.isArray(e)?e:[e]}async function vt(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function At(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Rt(e){return"ansi"===e||At(e)}function Pt(e){return"none"===e}function It(e){return Pt(e)}function Tt(e,t){var n;if(!t)return e;e.properties||(e.properties={}),(n=e.properties).class||(n.class=[]),"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const s=Array.isArray(t)?t:t.split(/\s+/g);for(const r of s)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function xt(e,t=!1){if(0===e.length)return[["",0]];const n=e.split(/(\r?\n)/g);let s=0;const r=[];for(let o=0;o<n.length;o+=2){const e=t?n[o]+(n[o+1]||""):n[o];r.push([e,s]),s+=n[o].length,s+=n[o+1]?.length||0}return r}function Et(e){const t=xt(e,!0).map(([e])=>e);return{lines:t,indexToPos:function(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let s=n,r=0;for(const e of t){if(s<e.length)break;s-=e.length,r++}return{line:r,character:s}},posToIndex:function(e,n){let s=0;for(let r=0;r<e;r++)s+=t[r].length;return s+=n,s}}}const Lt="light-dark()",Gt=["color","background-color"];function $t(e,t){let n=0;const s=[];for(const r of t)r>n&&s.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function Ot(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{const t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?$t(e,t):e})):e}function Bt(e,t,n,s,r="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(t=>Mt(e.variants[t])),a=new Set(i.flatMap(e=>Object.keys(e))),c={},l=(e,s)=>{const r="color"===s?"":"background-color"===s?"-bg":`-${s}`;return n+t[e]+("color"===s?"":r)};return i.forEach((e,n)=>{for(const o of a){const a=e[o]||"inherit";if(0===n&&s&&Gt.includes(o))if(s===Lt&&i.length>1){const e=t.findIndex(e=>"light"===e),s=t.findIndex(e=>"dark"===e);if(-1===e||-1===s)throw new d('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const u=i[e][o]||"inherit",p=i[s][o]||"inherit";c[o]=`light-dark(${u}, ${p})`,"css-vars"===r&&(c[l(n,o)]=a)}else c[o]=a;else"css-vars"===r&&(c[l(n,o)]=a)}}),o.htmlStyle=c,o}function Mt(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&I.Italic&&(t["font-style"]="italic"),e.fontStyle&I.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&I.Underline&&n.push("underline"),e.fontStyle&I.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function jt(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}const Ft=/* @__PURE__ */new WeakMap;function Dt(e,t){Ft.set(e,t)}function Wt(e){return Ft.get(e)}class qt{constructor(...e){if(s(this,"_stacks",{}),s(this,"lang"),2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,s]=e;this.lang=n,this._stacks={[s]:t}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new qt(Object.fromEntries(Nt(t).map(e=>[e,xe])),e)}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return function(e){const t=[],n=/* @__PURE__ */new Set;function s(e){if(n.has(e))return;n.add(e);const r=e?.nameScopesList?.scopeName;r&&t.push(r),e.parent&&s(e.parent)}return s(e),t}(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function Ut(){const e=/* @__PURE__ */new WeakMap;function t(t){if(!e.has(t.meta)){let n=function(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new d(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...s.indexToPos(e),offset:e}}{const t=s.lines[e.line];if(void 0===t)throw new d(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${s.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new d(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:s.posToIndex(e.line,n)}}};const s=Et(t.source),r=(t.options.decorations||[]).map(e=>({...e,start:n(e.start),end:n(e.end)}));!function(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new d(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let s=t+1;s<e.length;s++){const t=e[s],r=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,o=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,i=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,a=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(r||o||i||a){if(r&&o)continue;if(i&&a)continue;if(i&&n.start.offset===n.end.offset)continue;if(o&&t.start.offset===t.end.offset)continue;throw new d(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}(r),e.set(t.meta,{decorations:r,converter:s,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){if(!this.options.decorations?.length)return;return Ot(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;const n=t(this),s=Array.from(e.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(s.length!==n.converter.lines.length)throw new d(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function r(e,t,n,r){const o=s[e];let a="",c=-1,l=-1;if(0===t&&(c=0),0===n&&(l=0),n===Number.POSITIVE_INFINITY&&(l=o.children.length),-1===c||-1===l)for(let s=0;s<o.children.length;s++)a+=zt(o.children[s]),-1===c&&a.length===t&&(c=s+1),-1===l&&a.length===n&&(l=s+1);if(-1===c)throw new d(`Failed to find start index for decoration ${JSON.stringify(r.start)}`);if(-1===l)throw new d(`Failed to find end index for decoration ${JSON.stringify(r.end)}`);const u=o.children.slice(c,l);if(r.alwaysWrap||u.length!==o.children.length)if(r.alwaysWrap||1!==u.length||"element"!==u[0].type){const e={type:"element",tagName:"span",properties:{},children:u};i(e,r,"wrapper"),o.children.splice(c,u.length,e)}else i(u[0],r,"token");else i(o,r,"line")}function o(e,t){s[e]=i(s[e],t,"line")}function i(e,t,n){const s=t.properties||{},r=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...s,class:e.properties.class},t.properties?.class&&Tt(e,t.properties.class),e=r(e,n)||e}const a=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(const t of c){const{start:e,end:n}=t;if(e.line===n.line)r(e.line,e.character,n.character,t);else if(e.line<n.line){r(e.line,e.character,Number.POSITIVE_INFINITY,t);for(let s=e.line+1;s<n.line;s++)a.unshift(()=>o(s,t));r(n.line,0,n.character,t)}}a.forEach(e=>e())}}}function zt(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(zt).join(""):""}const Ht=[
2
+ /* @__PURE__ */Ut()];function Kt(e){const t=function(e){const t=[],n=[],s=[];for(const r of e)switch(r.enforce){case"pre":t.push(r);break;case"post":n.push(r);break;default:s.push(r)}return{pre:t,post:n,normal:s}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Ht]}var Yt=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Qt={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Jt(e,t){const n=e.indexOf("",t);if(-1!==n&&"["===e[n+1]){const t=e.indexOf("m",n);if(-1!==t)return{sequence:e.substring(n+2,t).split(";"),startPosition:n,position:t+1}}return{position:e.length}}function Vt(e){const t=e.shift();if("2"===t){const t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){const t=e.shift();if(t)return{type:"table",index:Number(t)}}}function Xt(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const s=Number.parseInt(n);if(!Number.isNaN(s))if(0===s)t.push({type:"resetAll"});else if(s<=9){Qt[s]&&t.push({type:"setDecoration",value:Qt[s]})}else if(s<=29){const e=Qt[s-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Yt[s-30]}});else if(38===s){const n=Vt(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===s)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Yt[s-40]}});else if(48===s){const n=Vt(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===s?t.push({type:"resetBackgroundColor"}):53===s?t.push({type:"setDecoration",value:"overline"}):55===s?t.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Yt[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Yt[s-100+8]}})}return t}var Zt={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 en(e=Zt){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(e){return function(){if(s)return s;s=[];for(let n=0;n<Yt.length;n++)s.push(t(Yt[n]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let r=0;r<6;r++)for(let o=0;o<6;o++)s.push(n([e[t],e[r],e[o]]));let r=8;for(let t=0;t<24;t++,r+=10)s.push(n([r,r,r]));return s}()[e]}return{value:function(e){switch(e.type){case"named":return t(e.name);case"rgb":return n(e.rgb);case"table":return r(e.index)}}}}const tn={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 nn(e,t,n){const s=Ct(e,n),r=xt(t),o=en(Object.fromEntries(Yt.map(t=>{const n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`,s=e.colors?.[n];return[t,s||tn[t]]}))),i=function(){let e=null,t=null,n=/* @__PURE__ */new Set;return{parse(s){const r=[];let o=0;do{const i=Jt(s,o),a=i.sequence?s.substring(o,i.startPosition):s.substring(o);if(a.length>0&&r.push({value:a,foreground:e,background:t,decorations:new Set(n)}),i.sequence){const s=Xt(i.sequence);for(const r of s)"resetAll"===r.type?(e=null,t=null,n.clear()):"resetForegroundColor"===r.type?e=null:"resetBackgroundColor"===r.type?t=null:"resetDecoration"===r.type&&n.delete(r.value);for(const r of s)"setForegroundColor"===r.type?e=r.value:"setBackgroundColor"===r.type?t=r.value:"setDecoration"===r.type&&n.add(r.value)}o=i.position}while(o<s.length);return r}}}();return r.map(t=>i.parse(t[0]).map(n=>{let r,i;n.decorations.has("reverse")?(r=n.background?o.value(n.background):e.bg,i=n.foreground?o.value(n.foreground):e.fg):(r=n.foreground?o.value(n.foreground):e.fg,i=n.background?o.value(n.background):void 0),r=wt(r,s),i=wt(i,s),n.decorations.has("dim")&&(r=function(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const e=t[1];if(8===e.length){const t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){const t=e[0],n=e[1],s=e[2],r=e[3];return`#${t}${t}${n}${n}${s}${s}${Math.round(Number.parseInt(`${r}${r}`,16)/2).toString(16).padStart(2,"0")}`}if(3===e.length){const t=e[0],n=e[1],s=e[2];return`#${t}${t}${n}${n}${s}${s}80`}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}(r));let a=I.None;return n.decorations.has("bold")&&(a|=I.Bold),n.decorations.has("italic")&&(a|=I.Italic),n.decorations.has("underline")&&(a|=I.Underline),n.decorations.has("strikethrough")&&(a|=I.Strikethrough),{content:n.value,offset:t[1],color:r,bgColor:i,fontStyle:a}}))}function sn(e,t,n={}){const{theme:s=e.getLoadedThemes()[0]}=n,r=e.resolveLangAlias(n.lang||"text");if(At(r)||Pt(s))return xt(t).map(e=>[{content:e[0],offset:e[1]}]);const{theme:o,colorMap:i}=e.setTheme(s);if("ansi"===r)return nn(o,t,n);const a=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==a.name)throw new d(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${a.name}"`);if(!n.grammarState.themes.includes(o.name))throw new d(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return rn(t,a,o,i,n)}function rn(e,t,n,s,r){const o=on(e,t,n,s,r),i=new qt(o.stateStack,t.name,n.name);return Dt(o.tokens,i),o.tokens}function on(e,t,n,s,r){const o=Ct(n,r),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500}=r,c=xt(e);let l=r.grammarState?function(e,t){if(!(e instanceof qt))throw new d("Invalid grammar state");return e.getInternalStack(t)}(r.grammarState,n.name)??xe:null!=r.grammarContextCode?on(r.grammarContextCode,t,n,s,{...r,grammarState:void 0,grammarContextCode:void 0}).stateStack:xe,u=[];const p=[];for(let d=0,g=c.length;d<g;d++){const[e,g]=c[d];if(""===e){u=[],p.push([]);continue}if(i>0&&e.length>=i){u=[],p.push([{content:e,offset:g,color:"",fontStyle:0}]);continue}let m,f,_;r.includeExplanation&&(m=t.tokenizeLine(e,l,a),f=m.tokens,_=0);const y=t.tokenizeLine2(e,l,a),b=y.tokens.length/2;for(let t=0;t<b;t++){const i=y.tokens[2*t],a=t+1<b?y.tokens[2*t+2]:e.length;if(i===a)continue;const c=y.tokens[2*t+1],l=wt(s[G.getForeground(c)],o),p=G.getFontStyle(c),d={content:e.substring(i,a),offset:g+i,color:l,fontStyle:p};if(r.includeExplanation){const t=[];if("scopeName"!==r.includeExplanation)for(const e of n.settings){let n;switch(typeof e.scope){case"string":n=e.scope.split(/,/).map(e=>e.trim());break;case"object":n=e.scope;break;default:continue}t.push({settings:e,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let s=0;for(;i+s<a;){const n=f[_],o=e.substring(n.startIndex,n.endIndex);s+=o.length,d.explanation.push({content:o,scopes:"scopeName"===r.includeExplanation?an(n.scopes):cn(t,n.scopes)}),_+=1}}u.push(d)}p.push(u),u=[],l=y.ruleStack}return{tokens:p,stateStack:l}}function an(e){return e.map(e=>({scopeName:e}))}function cn(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];n[s]={scopeName:r,themeMatches:un(e,r,t.slice(0,s))}}return n}function ln(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function hn(e,t,n){if(!ln(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)ln(e[s],n[r])&&(s-=1),r-=1;return-1===s}function un(e,t,n){const s=[];for(const{selectors:r,settings:o}of e)for(const e of r)if(hn(e,t,n)){s.push(o);break}return s}function pn(e,t,n){const s=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),r=s.map(s=>{const r=sn(e,t,{...n,theme:s.theme});return{tokens:r,state:Wt(r),theme:"string"==typeof s.theme?s.theme:s.theme.name}}),o=function(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const r=e.map(e=>e[s]),o=t.map(()=>[]);t.forEach((e,t)=>e.push(o[t]));const i=r.map(()=>0),a=r.map(e=>e[0]);for(;a.every(e=>e);){const e=Math.min(...a.map(e=>e.content.length));for(let t=0;t<n;t++){const n=a[t];n.content.length===e?(o[t].push(n),i[t]+=1,a[t]=r[t][i[t]]):(o[t].push({...n,content:n.content.slice(0,e)}),a[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...r.map(e=>e.tokens)),i=o[0].map((e,t)=>e.map((e,r)=>{const i={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(i.explanation=e.explanation),o.forEach((e,n)=>{const{content:o,explanation:a,offset:c,...l}=e[t][r];i.variants[s[n].color]=l}),i})),a=r[0].state?new qt(Object.fromEntries(r.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),r[0].state.lang):void 0;return a&&Dt(i,a),i}function dn(e,t,n){let s,r,o,i,a,c;if("themes"in n){const{defaultColor:l="light",cssVariablePrefix:u="--shiki-",colorsRendering:p="css-vars"}=n,g=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:t.color===l?1:0);if(0===g.length)throw new d("`themes` option must not be empty");const m=pn(e,t,n);if(c=Wt(m),l&&Lt!==l&&!g.find(e=>e.color===l))throw new d(`\`themes\` option must contain the defaultColor key \`${l}\``);const f=g.map(t=>e.getTheme(t.theme)),_=g.map(e=>e.color);o=m.map(e=>e.map(e=>Bt(e,_,u,l,p))),c&&Dt(o,c);const y=g.map(e=>Ct(e.theme,n));r=gn(g,f,y,u,l,"fg",p),s=gn(g,f,y,u,l,"bg",p),i=`shiki-themes ${f.map(e=>e.name).join(" ")}`,a=l?void 0:[r,s].join(";")}else{if(!("theme"in n))throw new d("Invalid options, either `theme` or `themes` must be provided");{const a=Ct(n.theme,n);o=sn(e,t,n);const l=e.getTheme(n.theme);s=wt(l.bg,a),r=wt(l.fg,a),i=l.name,c=Wt(o)}}return{tokens:o,fg:r,bg:s,themeName:i,rootStyle:a,grammarState:c}}function gn(e,t,n,s,r,o,i){return e.map((a,c)=>{const l=wt(t[c][o],n[c])||"inherit",u=`${s+a.color}${"bg"===o?"-bg":""}:${l}`;if(0===c&&r){if(r===Lt&&e.length>1){const s=e.findIndex(e=>"light"===e.color),r=e.findIndex(e=>"dark"===e.color);if(-1===s||-1===r)throw new d('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${wt(t[s][o],n[s])||"inherit"}, ${wt(t[r][o],n[r])||"inherit"});${u}`}return l}return"css-vars"===i?u:null}).filter(e=>!!e).join(";")}function mn(e,t,n,s={meta:{},options:n,codeToHast:(t,n)=>mn(e,t,n),codeToTokens:(t,n)=>dn(e,t,n)}){let r=t;for(const m of Kt(n))r=m.preprocess?.call(s,r,n)||r;let{tokens:o,fg:i,bg:a,themeName:c,rootStyle:l,grammarState:u}=dn(e,r,n);const{mergeWhitespaces:p=!0,mergeSameStyleTokens:d=!1}=n;!0===p?o=function(e){return e.map(e=>{const t=[];let n,s="";return e.forEach((r,o)=>{const i=!(r.fontStyle&&(r.fontStyle&I.Underline||r.fontStyle&I.Strikethrough));i&&r.content.match(/^\s+$/)&&e[o+1]?(void 0===n&&(n=r.offset),s+=r.content):s?(i?t.push({...r,offset:n,content:s+r.content}):t.push({content:s,offset:n},r),n=void 0,s=""):t.push(r)}),t})}(o):"never"===p&&(o=function(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;const t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;const[,n,s,r]=t;if(!n&&!r)return e;const o=[{...e,offset:e.offset+n.length,content:s}];return n&&o.unshift({content:n,offset:e.offset}),r&&o.push({content:r,offset:e.offset+n.length+s.length}),o}))}(o)),d&&(o=function(e){return e.map(e=>{const t=[];for(const n of e){if(0===t.length){t.push({...n});continue}const e=t[t.length-1],s=jt(e.htmlStyle||Mt(e)),r=jt(n.htmlStyle||Mt(n)),o=e.fontStyle&&(e.fontStyle&I.Underline||e.fontStyle&I.Strikethrough),i=n.fontStyle&&(n.fontStyle&I.Underline||n.fontStyle&I.Strikethrough);o||i||s!==r?t.push({...n}):e.content+=n.content}return t})}(o));const g={...s,get source(){return r}};for(const m of Kt(n))o=m.tokens?.call(g,o)||o;return fn(o,{...n,fg:i,bg:a,themeName:c,rootStyle:!1!==n.rootStyle&&(n.rootStyle??l)},g,u)}function fn(e,t,n,s=Wt(e)){const r=Kt(t),o=[],i={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=t,l={class:`shiki ${t.themeName||""}`};!1!==t.rootStyle&&(null!=t.rootStyle?l.style=t.rootStyle:l.style=`background-color:${t.bg};color:${t.fg}`),!1!==c&&null!=c&&(l.tabindex=c.toString());for(const[f,_]of Object.entries(t.meta||{}))f.startsWith("_")||(l[f]=_);let u={type:"element",tagName:"pre",properties:l,children:[],data:t.data},p={type:"element",tagName:"code",properties:{},children:o};const d=[],g={...n,structure:a,addClassToHast:Tt,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return u},get code(){return p},get lines(){return d}};if(e.forEach((e,t)=>{t&&("inline"===a?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===a&&o.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},s=0;for(const o of e){let e={type:"element",tagName:"span",properties:{...o.htmlAttrs},children:[{type:"text",value:o.content}]};const c=jt(o.htmlStyle||Mt(o));c&&(e.properties.style=c);for(const i of r)e=i?.span?.call(g,e,t+1,s,n,o)||e;"inline"===a?i.children.push(e):"classic"===a&&n.children.push(e),s+=o.content.length}if("classic"===a){for(const e of r)n=e?.line?.call(g,n,t+1)||n;d.push(n),o.push(n)}else"inline"===a&&d.push(n)}),"classic"===a){for(const e of r)p=e?.code?.call(g,p)||p;u.children.push(p);for(const e of r)u=e?.pre?.call(g,u)||u;i.children.push(u)}else if("inline"===a){const e=[];let t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const s of i.children)"element"===s.type&&"br"===s.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):"element"!==s.type&&"text"!==s.type||t.children.push(s);e.push(t);let n={type:"element",tagName:"code",properties:{},children:e};for(const s of r)n=s?.code?.call(g,n)||n;i.children=[];for(let s=0;s<n.children.length;s++){s>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const e=n.children[s];"element"===e.type&&i.children.push(...e.children)}}let m=i;for(const f of r)m=f?.root?.call(g,m)||m;return s&&Dt(m,s),m}const _n=function(e,t){const n=t||_t,s=n.quote||'"',o='"'===s?"'":'"';if('"'!==s&&"'"!==s)throw new Error("Invalid quote `"+s+"`, expected `'` or `\"`");return{one:St,all:kt,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||p,characterReferences:n.characterReferences||yt,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?r:u,quote:s,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)};function yn(e,t,n){const s={meta:{},options:n,codeToHast:(t,n)=>mn(e,t,n),codeToTokens:(t,n)=>dn(e,t,n)};let r=_n(mn(e,t,n,s));for(const o of Kt(n))r=o.postprocess?.call(s,r,n)||r;return r}const bn="#333333",Sn="#bbbbbb",kn="#fffffe",Cn="#1e1e1e",wn="__shiki_resolved";function Nn(e){if(e?.[wn])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||(t.type="dark"),t.colorReplacements={...t.colorReplacements},t.settings||(t.settings=[]);let{bg:n,fg:s}=t;if(!n||!s){const e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(s=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!s&&t?.colors?.["editor.foreground"]&&(s=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),s||(s="light"===t.type?bn:Sn),n||(n="light"===t.type?kn:Cn),t.fg=s,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let r=0;const o=/* @__PURE__ */new Map;function i(e){if(o.has(e))return o.get(e);r+=1;const n=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?i(e):(o.set(e,n),n)}t.settings=t.settings.map(e=>{const n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),s=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!s)return e;const r={...e,settings:{...e.settings}};if(n){const n=i(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,r.settings.foreground=n}if(s){const n=i(e.settings.background);t.colorReplacements[n]=e.settings.background,r.settings.background=n}return r});for(const a of Object.keys(t.colors||{}))if(("editor.foreground"===a||"editor.background"===a||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){const e=i(t.colors[a]);t.colorReplacements[e]=t.colors[a],t.colors[a]=e}return Object.defineProperty(t,wn,{enumerable:!1,writable:!1,value:!0}),t}async function vn(e){return Array.from(new Set((await Promise.all(e.filter(e=>!Rt(e)).map(async e=>await vt(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function An(e){return(await Promise.all(e.map(async e=>It(e)?null:Nn(await vt(e))))).filter(e=>!!e)}function Rn(e,t=3){t>3||console.trace(`[SHIKI DEPRECATE]: ${e}`)}class Pn extends Error{constructor(e){super(e),this.name="ShikiError"}}function In(e,t){if(!t)return e;if(t[e]){const n=/* @__PURE__ */new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new Pn(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class Tn extends Te{constructor(e,t,n,r={}){super(e),s(this,"_resolvedThemes",/* @__PURE__ */new Map),s(this,"_resolvedGrammars",/* @__PURE__ */new Map),s(this,"_langMap",/* @__PURE__ */new Map),s(this,"_langGraph",/* @__PURE__ */new Map),s(this,"_textmateThemeCache",/* @__PURE__ */new WeakMap),s(this,"_loadedThemesCache",null),s(this,"_loadedLanguagesCache",null),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=Nn(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=N.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=In(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(const r of t)this._resolvedGrammars.delete(r.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(r.scopeName),this._syncRegistry?._grammars?.delete(r.scopeName),this.loadLanguage(this._langMap.get(r.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 t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){const e=t.filter(([e,t])=>{if(!t)return!1;const s=t.embeddedLanguages||t.embeddedLangs;return s?.some(e=>n.map(([e])=>e).includes(e))}).filter(e=>!n.includes(e));throw new Pn(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(const[s,r]of t)this._resolver.addLanguage(r);for(const[s,r]of t)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[.../* @__PURE__ */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 t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const n of t)this._langGraph.set(n,this._langMap.get(n))}}class xn{constructor(e,t){s(this,"_langs",/* @__PURE__ */new Map),s(this,"_scopeToLang",/* @__PURE__ */new Map),s(this,"_injections",/* @__PURE__ */new Map),s(this,"_onigLib"),this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let s=1;s<=t.length;s++){const e=t.slice(0,s).join(".");n=[...n,...this._injections.get(e)||[]]}return n}}let En=0;function Ln(e){En+=1,!1!==e.warnings&&En>=10&&En%10==0&&console.warn(`[Shiki] ${En} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Pn("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(Nn),r=new xn(e.engine,n),o=new Tn(r,s,n,e.langAlias);let i;function a(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();const t=o.getTheme(e);if(!t)throw new Pn(`Theme \`${e}\` not found, you may need to load it first`);return t}function c(...e){u(),o.loadLanguages(e.flat(1))}function l(...e){u();for(const t of e.flat(1))o.loadTheme(t)}function u(){if(t)throw new Pn("Shiki instance has been disposed")}function p(){t||(t=!0,o.dispose(),En-=1)}return{setTheme:function(e){u();const t=a(e);return i!==e&&(o.setTheme(t),i=e),{theme:t,colorMap:o.getColorMap()}},getTheme:a,getLanguage:function(e){u();const t=o.getGrammar("string"==typeof e?e:e.name);if(!t)throw new Pn(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),o.getLoadedThemes()},getLoadedLanguages:function(){return u(),o.getLoadedLanguages()},resolveLangAlias:function(t){return In(t,e.langAlias)},loadLanguage:async function(...e){return c(await vn(e))},loadLanguageSync:c,loadTheme:async function(...e){return u(),l(await An(e))},loadThemeSync:l,dispose:p,[Symbol.dispose]:p}}async function Gn(e){e.engine||Rn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,s]=await Promise.all([An(e.themes||[]),vn(e.langs||[]),e.engine]);return Ln({...e,themes:t,langs:n,engine:s})}async function $n(e){const t=await Gn(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return Wt(e[1]);const[t,n,s={}]=e,{lang:r="text",theme:o=t.getLoadedThemes()[0]}=s;if(At(r)||Pt(o))throw new d("Plain language does not have grammar state");if("ansi"===r)throw new d("ANSI language does not have grammar state");const{theme:i,colorMap:a}=t.setTheme(o),c=t.getLanguage(r);return new qt(on(n,c,i,a,s).stateStack,c.name,i.name)}(t,...e),codeToTokensBase:(e,n)=>sn(t,e,n),codeToTokensWithThemes:(e,n)=>pn(t,e,n),codeToTokens:(e,n)=>dn(t,e,n),codeToHast:(e,n)=>mn(t,e,n),codeToHtml:(e,n)=>yn(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}export{d as ShikiError,Tt as addClassToHast,wt as applyColorReplacements,mn as codeToHast,yn as codeToHtml,dn as codeToTokens,sn as codeToTokensBase,pn as codeToTokensWithThemes,$n as createHighlighterCore,Et as createPositionConverter,Gn as createShikiInternal,Ln as createShikiInternalSync,Bt as flatTokenVariants,Mt as getTokenStyleObject,_n as hastToHtml,Pt as isNoneTheme,At as isPlainLang,Rt as isSpecialLang,It as isSpecialTheme,vt as normalizeGetter,Nn as normalizeTheme,Ct as resolveColorReplacements,xt as splitLines,$t as splitToken,Ot as splitTokens,jt as stringifyTokenStyle,Nt as toArray,nn as tokenizeAnsiWithTheme,rn as tokenizeWithTheme,fn as tokensToHast,Ut as transformerDecorations,Rn as warnDeprecated};
@@ -0,0 +1 @@
1
+ const e=[[/^(<!--)(.+)(-->)$/,!1],[/^(\/\*)(.+)(\*\/)$/,!1],[/^(\/\/|["'#]|;{1,2}|%{1,2}|--)(.*)$/,!0],[/^(\*)(.+)$/,!0]];function t(e,t){if("element"!==e.type)return!1;const n=e.children[0];return"text"===n.type&&n.value.trim()===t}function n(t,n){let i=t.trimStart();const s=t.length-i.length;i=i.trimEnd();const l=t.length-i.length-s;for(const[o,c]of e){if(c&&!n)continue;const e=o.exec(i);if(e)return[" ".repeat(s)+e[1],e[2],e[3]?e[3]+" ".repeat(l):void 0]}}function i(e){const t=e.match(/(?:\/\/|["'#]|;{1,2}|%{1,2}|--)(\s*)$/);return t&&0===t[1].trim().length?e.slice(0,t.index):e}function s(e,s,l,o){return null==o&&(o="v3"),{name:e,code(e){const c=e.children.filter(e=>"element"===e.type),r=[];e.data??(e.data={});const a=e.data;a._shiki_notation??(a._shiki_notation=function(e,i,s){const l=[];for(const o of e){if("v3"===s){const e=o.children.flatMap((e,t)=>{if("element"!==e.type)return e;const i=e.children[0];if("text"!==i.type)return e;const s=t===o.children.length-1;if(!n(i.value,s))return e;const l=i.value.split(/(\s+\/\/)/);if(l.length<=1)return e;let c=[l[0]];for(let n=1;n<l.length;n+=2)c.push(l[n]+(l[n+1]||""));return c=c.filter(Boolean),c.length<=1?e:c.map(t=>({...e,children:[{type:"text",value:t}]}))});e.length!==o.children.length&&(o.children=e)}const e=o.children;let c=e.length-1;"v1"===s?c=0:i&&(c=e.length-2);for(let s=Math.max(c,0);s<e.length;s++){const c=e[s];if("element"!==c.type)continue;const r=c.children.at(0);if("text"!==r?.type)continue;const a=s===e.length-1;let d,f=n(r.value,a);if(!f&&s>0&&r.value.trim().startsWith("[!code")){const t=e[s-1];if("element"===t?.type){const i=t.children.at(0);if("text"===i?.type&&i.value.includes("//")){const s=n(i.value+r.value,a);if(s){f=s,l.push({info:s,line:o,token:t,isLineCommentOnly:2===e.length&&1===t.children.length&&1===c.children.length,isJsxStyle:!1,additionalTokens:[c]});continue}}}}if(f)if(i&&!a&&0!==s){const n=t(e[s-1],"{")&&t(e[s+1],"}");l.push({info:f,line:o,token:c,isLineCommentOnly:3===e.length&&1===c.children.length,isJsxStyle:n,additionalTokens:d})}else l.push({info:f,line:o,token:c,isLineCommentOnly:1===e.length&&1===c.children.length,isJsxStyle:!1,additionalTokens:d})}}return l}(c,["jsx","tsx"].includes(this.options.lang),o));const d=a._shiki_notation;for(const t of d){if(0===t.info[1].length)continue;let e=c.indexOf(t.line);t.isLineCommentOnly&&"v1"!==o&&e++;let n=!1;if(t.info[1]=t.info[1].replace(s,(...i)=>l.call(this,i,t.line,t.token,c,e)?(n=!0,""):i[0]),!n)continue;"v1"===o&&(t.info[1]=i(t.info[1]));const a=0===t.info[1].trim().length;if(a&&(t.info[1]=""),a&&t.isLineCommentOnly)r.push(t.line);else if(a&&t.isJsxStyle)t.line.children.splice(t.line.children.indexOf(t.token)-1,3);else if(a){if(t.additionalTokens)for(let e=t.additionalTokens.length-1;e>=0;e--){const n=t.additionalTokens[e],i=t.line.children.indexOf(n);-1!==i&&t.line.children.splice(i,1)}t.line.children.splice(t.line.children.indexOf(t.token),1)}else{const e=t.token.children[0];if("text"===e.type&&(e.value=t.info.join(""),t.additionalTokens))for(const n of t.additionalTokens){const e=n.children[0];"text"===e?.type&&(e.value="")}}}for(const t of r){const n=e.children.indexOf(t),i=e.children[n+1];let s=1;"text"===i?.type&&"\n"===i?.value&&(s=2),e.children.splice(n,s)}}}}function l(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function o(e={},t="@shikijs/transformers:notation-map"){const{classMap:n={},classActivePre:i,classActiveCode:o}=e;return s(t,new RegExp(`#?\\s*\\[!code (${Object.keys(n).map(l).join("|")})(:\\d+)?\\]`,"gi"),function([e,t,s=":1"],l,c,r,a){const d=Number.parseInt(s.slice(1),10);for(let i=a;i<Math.min(a+d,r.length);i++)this.addClassToHast(r[i],n[t]);return i&&this.addClassToHast(this.pre,i),o&&this.addClassToHast(this.code,o),!0},e.matchAlgorithm)}function c(e={}){const{classLineAdd:t="diff add",classLineRemove:n="diff remove",classActivePre:i="has-diff",classActiveCode:s}=e;return o({classMap:{"++":t,"--":n},classActivePre:i,classActiveCode:s,matchAlgorithm:e.matchAlgorithm},"@shikijs/transformers:notation-diff")}function r(e={}){const{classMap:t={error:["highlighted","error"],warning:["highlighted","warning"]},classActivePre:n="has-highlighted",classActiveCode:i}=e;return o({classMap:t,classActivePre:n,classActiveCode:i,matchAlgorithm:e.matchAlgorithm},"@shikijs/transformers:notation-error-level")}function a(e={}){const{classActiveLine:t="focused",classActivePre:n="has-focused",classActiveCode:i}=e;return o({classMap:{focus:t},classActivePre:n,classActiveCode:i,matchAlgorithm:e.matchAlgorithm},"@shikijs/transformers:notation-focus")}function d(e={}){const{classActiveLine:t="highlighted",classActivePre:n="has-highlighted",classActiveCode:i}=e;return o({classMap:{highlight:t,hl:t},classActivePre:n,classActiveCode:i,matchAlgorithm:e.matchAlgorithm},"@shikijs/transformers:notation-highlight")}export{s as createCommentNotationTransformer,c as transformerNotationDiff,r as transformerNotationErrorLevel,a as transformerNotationFocus,d as transformerNotationHighlight,o as transformerNotationMap};
@@ -0,0 +1,2 @@
1
+ import{t as e}from"./main--P1Cc3W1.js";let t=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function n(e){return Array.isArray(e)?function(e){let t=[];for(let s=0,r=e.length;s<r;s++)t[s]=n(e[s]);return t}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let t={};for(let s in e)t[s]=n(e[s]);return t}(e):e}function s(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function r(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t===e.length-1?r(e.substring(0,e.length-1)):e.substr(1+~t)}var o=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,i=class{static hasCaptures(e){return null!==e&&(o.lastIndex=0,o.test(e))}static replaceCaptures(e,t,n){return e.replace(o,(e,s,r,o)=>{let i=n[parseInt(s||r,10)];if(!i)return e;{let e=t.substring(i.start,i.end);for(;"."===e[0];)e=e.substring(1);switch(o){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function a(e,t){return e<t?-1:e>t?1:0}function c(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,s=t.length;if(n===s){for(let s=0;s<n;s++){let n=a(e[s],t[s]);if(0!==n)return n}return 0}return n-s}function l(e){return!!/^#[0-9a-f]{6}$/i.test(e)||(!!/^#[0-9a-f]{8}$/i.test(e)||(!!/^#[0-9a-f]{3}$/i.test(e)||!!/^#[0-9a-f]{4}$/i.test(e)))}function u(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var p=class{constructor(e){this.fn=e}cache=/* @__PURE__ */new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},d=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],s=0;for(let r=0,o=t.length;r<o;r++){let e,o=t[r];if(!o.settings)continue;if("string"==typeof o.scope){let t=o.scope;t=t.replace(/^[,]+/,""),t=t.replace(/[,]+$/,""),e=t.split(",")}else e=Array.isArray(o.scope)?o.scope:[""];let i=-1;if("string"==typeof o.settings.fontStyle){i=0;let e=o.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++){switch(e[t]){case"italic":i|=1;break;case"bold":i|=2;break;case"underline":i|=4;break;case"strikethrough":i|=8}}}let a=null;"string"==typeof o.settings.foreground&&l(o.settings.foreground)&&(a=o.settings.foreground);let c=null;"string"==typeof o.settings.background&&l(o.settings.background)&&(c=o.settings.background);for(let t=0,l=e.length;t<l;t++){let o=e[t].trim().split(" "),l=o[o.length-1],u=null;o.length>1&&(u=o.slice(0,o.length-1),u.reverse()),n[s++]=new _(l,u,r,i,a,c)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{let n=a(e.scope,t.scope);return 0!==n?n:(n=c(e.parentScopes,t.parentScopes),0!==n?n:e.index-t.index)});let n=0,s="#000000",r="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(s=t.foreground),null!==t.background&&(r=t.background)}let o=new b(t),i=new m(n,o.getId(s),o.getId(r)),l=new w(new S(0,null,-1,0,0),[]);for(let a=0,c=e.length;a<c;a++){let t=e[a];l.insert(0,t.scope,t.parentScopes,t.fontStyle,o.getId(t.foreground),o.getId(t.background))}return new d(o,i,l)}(e,t)}_cachedMatchRoot=new p(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>function(e,t){if(0===t.length)return!0;for(let n=0;n<t.length;n++){let s=t[n],r=!1;if(">"===s){if(n===t.length-1)return!1;s=t[++n],r=!0}for(;e&&!f(e.scopeName,s);){if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}(e.parent,t.parentScopes));return n?new m(n.fontStyle,n.foreground,n.background):null}},g=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(const s of n)t=new e(t,s);return t}static from(...t){let n=null;for(let s=0;s<t.length;s++)n=new e(n,t[s]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function f(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var m=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};var _=class{constructor(e,t,n,s,r,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=s,this.foreground=r,this.background=o}},y=/* @__PURE__ */(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(y||{});var b=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=/* @__PURE__ */Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(null===e)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},k=Object.freeze([]),S=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,s,r){this.scopeDepth=e,this.parentScopes=t||k,this.fontStyle=n,this.foreground=s,this.background=r}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,s=e.length;n<s;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==s&&(this.background=s)}},w=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,s=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[s]&&s++,!(n>=e.parentScopes.length||s>=t.parentScopes.length);){const r=t.parentScopes[s].length-e.parentScopes[n].length;if(0!==r)return r;n++,s++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,s=t.indexOf(".");if(-1===s?(e=t,n=""):(e=t.substring(0,s),n=t.substring(s+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,s,r,o,i){if(""===n)return void this._doInsertHere(t,s,r,o,i);let a,c,l,u=n.indexOf(".");-1===u?(a=n,c=""):(a=n.substring(0,u),c=n.substring(u+1)),this._children.hasOwnProperty(a)?l=this._children[a]:(l=new e(this._mainRule.clone(),S.cloneArr(this._rulesWithParentScopes)),this._children[a]=l),l.insert(t+1,c,s,r,o,i)}_doInsertHere(e,t,n,s,r){if(null!==t){for(let o=0,i=this._rulesWithParentScopes.length;o<i;o++){let i=this._rulesWithParentScopes[o];if(0===c(i.parentScopes,t))return void i.acceptOverwrite(e,n,s,r)}-1===n&&(n=this._mainRule.fontStyle),0===s&&(s=this._mainRule.foreground),0===r&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new S(e,t,n,s,r))}else this._mainRule.acceptOverwrite(e,n,s,r)}},C=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){const n=e.getLanguageId(t),s=e.getTokenType(t),r=e.getFontStyle(t),o=e.getForeground(t),i=e.getBackground(t);console.log({languageId:n,tokenType:s,fontStyle:r,foreground:o,background:i})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,s,r,o,i,a){let c=e.getLanguageId(t),l=e.getTokenType(t),u=e.containsBalancedBrackets(t)?1:0,p=e.getFontStyle(t),d=e.getForeground(t),g=e.getBackground(t);return 0!==n&&(c=n),8!==s&&(l=s),null!==r&&(u=r?1:0),-1!==o&&(p=o),0!==i&&(d=i),0!==a&&(g=a),(c|l<<8|u<<10|p<<11|d<<15|g<<24)>>>0}};function N(e){return e}function A(e,t){const n=[],s=function(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const s=n[0];return n=t.exec(e),s}}}(e);let r=s.next();for(;null!==r;){let e=0;if(2===r.length&&":"===r.charAt(1)){switch(r.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=s.next()}let t=i();if(n.push({matcher:t,priority:e}),","!==r)break;r=s.next()}return n;function o(){if("-"===r){r=s.next();const e=o();return t=>!!e&&!e(t)}if("("===r){r=s.next();const e=function(){const e=[];let t=i();for(;t&&(e.push(t),"|"===r||","===r);){do{r=s.next()}while("|"===r||","===r);t=i()}return t=>e.some(e=>e(t))}();return")"===r&&(r=s.next()),e}if(v(r)){const e=[];do{e.push(r),r=s.next()}while(v(r));return n=>t(e,n)}return null}function i(){const e=[];let t=o();for(;t;)e.push(t),t=o();return t=>e.every(e=>e(t))}}function v(e){return!!e&&!!e.match(/[\w\.:]+/)}function P(e){"function"==typeof e.dispose&&e.dispose()}var I=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},R=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},T=class{_references=[];_seenReferenceKeys=/* @__PURE__ */new Set;get references(){return this._references}visitedRule=/* @__PURE__ */new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},L=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new I(this.initialScopeName)]}seenFullScopeRequests=/* @__PURE__ */new Set;seenPartialScopeRequests=/* @__PURE__ */new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new T;for(const n of e)x(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof I){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName))continue;if(this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function x(e,t,n,s){const r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof I?E({baseGrammar:o,selfGrammar:r},s):G(e.ruleName,{baseGrammar:o,selfGrammar:r,repository:r.repository},s);const i=n.injections(e.scopeName);if(i)for(const a of i)s.add(new I(a))}function G(e,t,n){if(t.repository&&t.repository[e]){$([t.repository[e]],t,n)}}function E(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&$(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&$(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function $(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const e=r.repository?s({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&$(r.patterns,{...t,repository:e},n);const o=r.include;if(!o)continue;const i=W(o);switch(i.kind){case 0:E({...t,selfGrammar:t.baseGrammar},n);break;case 1:E(t,n);break;case 2:G(i.ruleName,{...t,repository:e},n);break;case 3:case 4:const s=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){const r={baseGrammar:t.baseGrammar,selfGrammar:s,repository:e};4===i.kind?G(i.ruleName,r,n):E(r,n)}else 4===i.kind?n.add(new R(i.scopeName,i.ruleName)):n.add(new I(i.scopeName))}}}var B=class{kind=0},M=class{kind=1},O=class{constructor(e){this.ruleName=e}kind=2},j=class{constructor(e){this.scopeName=e}kind=3},F=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function W(e){if("$base"===e)return new B;if("$self"===e)return new M;const t=e.indexOf("#");if(-1===t)return new j(e);if(0===t)return new O(e.substring(1));{const n=e.substring(0,t),s=e.substring(t+1);return new F(n,s)}}var D=/\\(\d+)/,q=/\\(\d+)/g;var U=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,s){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=i.hasCaptures(this._name),this._contentName=s||null,this._contentNameIsCapturing=i.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${r(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?i.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?i.replaceCaptures(this._contentName,e,t):this._contentName}},z=class extends U{retokenizeCapturedWithRuleId;constructor(e,t,n,s,r){super(e,t,n,s),this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,s){throw new Error("Not supported!")}},H=class extends U{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,s,r){super(e,t,n,null),this._match=new V(s,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new X,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},K=class extends U{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,s,r){super(e,t,n,s),this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns){e.getRule(n).collectPatterns(e,t)}}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new X,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},J=class extends U{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,s,r,o,i,a,c,l){super(e,t,n,s),this._begin=new V(r,this.id),this.beginCaptures=o,this._end=new V(i||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,s)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new X;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Q=class extends U{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,s,r,o,i,a,c){super(e,t,n,s),this._begin=new V(r,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new V(i,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,s){return this._getCachedCompiledPatterns(e).compileAG(e,n,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new X;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,s){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,s)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new X,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},Y=class e{static createCaptureRule(e,t,n,s,r){return e.registerRule(e=>new z(t,e,n,s,r))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(o=>{if(t.id=o,t.match)return new H(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(void 0===t.begin){t.repository&&(r=s({},r,t.repository));let o=t.patterns;return void 0===o&&t.include&&(o=[{include:t.include}]),new K(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(o,n,r))}return t.while?new Q(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new J(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,s){let r=[];if(t){let o=0;for(const e in t){if("$vscodeTextmateLocation"===e)continue;const t=parseInt(e,10);t>o&&(o=t)}for(let e=0;e<=o;e++)r[e]=null;for(const i in t){if("$vscodeTextmateLocation"===i)continue;const o=parseInt(i,10);let a=0;t[i].patterns&&(a=e.getCompiledRuleId(t[i],n,s)),r[o]=e.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,a)}}return r}static _compilePatterns(t,n,s){let r=[];if(t)for(let o=0,i=t.length;o<i;o++){const i=t[o];let a=-1;if(i.include){const t=W(i.include);switch(t.kind){case 0:case 1:a=e.getCompiledRuleId(s[i.include],n,s);break;case 2:let r=s[t.ruleName];r&&(a=e.getCompiledRuleId(r,n,s));break;case 3:case 4:const o=t.scopeName,c=4===t.kind?t.ruleName:null,l=n.getExternalGrammar(o,s);if(l)if(c){let t=l.repository[c];t&&(a=e.getCompiledRuleId(t,n,l.repository))}else a=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}else a=e.getCompiledRuleId(i,n,s);if(-1!==a){const e=n.getRule(a);let t=!1;if((e instanceof K||e instanceof J||e instanceof Q)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;r.push(a)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},V=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let n=0,s=[],r=!1;for(let o=0;o<t;o++){if("\\"===e.charAt(o)&&o+1<t){const t=e.charAt(o+1);"z"===t?(s.push(e.substring(n,o)),s.push("$(?!\\n)(?<!\\n)"),n=o+2):"A"!==t&&"G"!==t||(r=!0),o++}}this.hasAnchor=r,0===n?this.source=e:(s.push(e.substring(n,t)),this.source=s.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=D.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let n=t.map(t=>e.substring(t.start,t.end));return q.lastIndex=0,this.source.replace(q,(e,t)=>u(n[parseInt(t,10)]||""))}_buildAnchorCache(){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let e,t,n,s,r=[],o=[],i=[],a=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),r[e]=n,o[e]=n,i[e]=n,a[e]=n,"\\"===n&&e+1<t&&(s=this.source.charAt(e+1),"A"===s?(r[e+1]="￿",o[e+1]="￿",i[e+1]="A",a[e+1]="A"):"G"===s?(r[e+1]="￿",o[e+1]="G",i[e+1]="￿",a[e+1]="G"):(r[e+1]=s,o[e+1]=s,i[e+1]=s,a[e+1]=s),e++);return{A0_G0:r.join(""),A0_G1:o.join(""),A1_G0:i.join(""),A1_G1:a.join("")}}resolveAnchors(e,t){return this.hasAnchor&&this._anchorCache&&"string"==typeof this.source?e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0:this.source}},X=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new Z(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let s=this._items.map(e=>e.resolveAnchors(t,n));return new Z(e,s,this._items.map(e=>e.ruleId))}},Z=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){const s=this.scanner.findNextMatchSync(e,t,n);return s?{ruleId:this.rules[s.index],captureIndices:s.captureIndices}:null}},ee=class{constructor(e,t){this.languageId=e,this.tokenType=t}},te=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new ee(e,8),this._embeddedLanguagesMatcher=new ne(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new ee(0,0);_getBasicScopeAttributes=new p(e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new ee(t,n)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){const n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},ne=class{values;scopesRegExp;constructor(e){if(0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>u(e));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);return t?this.values.get(t[1]):void 0}};"undefined"!=typeof process&&process.env.VSCODE_TEXTMATE_DEBUG;var se=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function re(e,t,n,s,r,o,i,a){const c=t.content.length;let l=!1,u=-1;if(i){const i=function(e,t,n,s,r,o){let i=r.beginRuleCapturedEOL?0:-1;const a=[];for(let c=r;c;c=c.pop()){const t=c.getRule(e);t instanceof Q&&a.push({rule:t,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:a,findOptions:l}=ie(c.rule,e,c.stack.endRule,n,s===i),u=a.findNextMatchSync(t,s,l);if(!u){r=c.stack.pop();break}if(-2!==u.ruleId){r=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(o.produce(c.stack,u.captureIndices[0].start),ae(e,t,n,c.stack,o,c.rule.whileCaptures,u.captureIndices),o.produce(c.stack,u.captureIndices[0].end),i=u.captureIndices[0].end,u.captureIndices[0].end>s&&(s=u.captureIndices[0].end,n=!1))}return{stack:r,linePos:s,anchorPosition:i,isFirstLine:n}}(e,t,n,s,r,o);r=i.stack,s=i.linePos,n=i.isFirstLine,u=i.anchorPosition}const p=Date.now();for(;!l;){if(0!==a){if(Date.now()-p>a)return new se(r,!0)}d()}return new se(r,!1);function d(){const i=function(e,t,n,s,r,o){const i=function(e,t,n,s,r,o){const i=r.getRule(e),{ruleScanner:a,findOptions:c}=oe(i,e,r.endRule,n,s===o),l=a.findNextMatchSync(t,s,c);if(l)return{captureIndices:l.captureIndices,matchedRuleId:l.ruleId};return null}(e,t,n,s,r,o),a=e.getInjections();if(0===a.length)return i;const c=function(e,t,n,s,r,o,i){let a,c=Number.MAX_VALUE,l=null,u=0;const p=o.contentNameScopesList.getScopeNames();for(let d=0,g=e.length;d<g;d++){const o=e[d];if(!o.matcher(p))continue;const g=t.getRule(o.ruleId),{ruleScanner:f,findOptions:m}=oe(g,t,null,s,r===i),_=f.findNextMatchSync(n,r,m);if(!_)continue;const y=_.captureIndices[0].start;if(!(y>=c)&&(c=y,l=_.captureIndices,a=_.ruleId,u=o.priority,c===r))break}if(l)return{priorityMatch:-1===u,captureIndices:l,matchedRuleId:a};return null}(a,e,t,n,s,r,o);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,u=c.captureIndices[0].start;if(u<l||c.priorityMatch&&u===l)return c;return i}(e,t,n,s,r,u);if(!i)return o.produce(r,c),void(l=!0);const a=i.captureIndices,p=i.matchedRuleId,d=!!(a&&a.length>0)&&a[0].end>s;if(-1===p){const i=r.getRule(e);o.produce(r,a[0].start),r=r.withContentNameScopesList(r.nameScopesList),ae(e,t,n,r,o,i.endCaptures,a),o.produce(r,a[0].end);const p=r;if(r=r.parent,u=p.getAnchorPos(),!d&&p.getEnterPos()===s)return r=p,o.produce(r,c),void(l=!0)}else{const i=e.getRule(p);o.produce(r,a[0].start);const g=r,f=i.getName(t.content,a),m=r.contentNameScopesList.pushAttributed(f,e);if(r=r.push(p,s,u,a[0].end===c,null,m,m),i instanceof J){const s=i;ae(e,t,n,r,o,s.beginCaptures,a),o.produce(r,a[0].end),u=a[0].end;const p=s.getContentName(t.content,a),f=m.pushAttributed(p,e);if(r=r.withContentNameScopesList(f),s.endHasBackReferences&&(r=r.withEndRule(s.getEndWithResolvedBackReferences(t.content,a))),!d&&g.hasSameRuleAs(r))return r=r.pop(),o.produce(r,c),void(l=!0)}else if(i instanceof Q){const s=i;ae(e,t,n,r,o,s.beginCaptures,a),o.produce(r,a[0].end),u=a[0].end;const p=s.getContentName(t.content,a),f=m.pushAttributed(p,e);if(r=r.withContentNameScopesList(f),s.whileHasBackReferences&&(r=r.withEndRule(s.getWhileWithResolvedBackReferences(t.content,a))),!d&&g.hasSameRuleAs(r))return r=r.pop(),o.produce(r,c),void(l=!0)}else{if(ae(e,t,n,r,o,i.captures,a),o.produce(r,a[0].end),r=r.pop(),!d)return r=r.safePop(),o.produce(r,c),void(l=!0)}}a[0].end>s&&(s=a[0].end,n=!1)}}function oe(e,t,n,s,r){return{ruleScanner:e.compileAG(t,n,s,r),findOptions:0}}function ie(e,t,n,s,r){return{ruleScanner:e.compileWhileAG(t,n,s,r),findOptions:0}}function ae(e,t,n,s,r,o,i){if(0===o.length)return;const a=t.content,c=Math.min(o.length,i.length),l=[],u=i[0].end;for(let p=0;p<c;p++){const t=o[p];if(null===t)continue;const c=i[p];if(0===c.length)continue;if(c.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=c.start;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?r.produceFromScopes(l[l.length-1].scopes,c.start):r.produce(s,c.start),t.retokenizeCapturedWithRuleId){const o=t.getName(a,i),l=s.contentNameScopesList.pushAttributed(o,e),u=t.getContentName(a,i),p=l.pushAttributed(u,e),d=s.push(t.retokenizeCapturedWithRuleId,c.start,-1,!1,null,l,p),g=e.createOnigString(a.substring(0,c.end));re(e,g,n&&0===c.start,c.start,d,r,!1,0),P(g);continue}const d=t.getName(a,i);if(null!==d){const t=(l.length>0?l[l.length-1].scopes:s.contentNameScopesList).pushAttributed(d,e);l.push(new ce(t,c.end))}}for(;l.length>0;)r.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var ce=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function le(e,t,n,s,r){const o=A(t,he),i=Y.getCompiledRuleId(n,s,r.repository);for(const a of o)e.push({debugSelector:t,matcher:a.matcher,ruleId:i,grammar:r,priority:a.priority})}function he(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let s=n;s<t.length;s++)if(ue(t[s],e))return n=s+1,!0;return!1})}function ue(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&"."===e[n]}var pe=class{constructor(e,t,n,s,r,o,i,a){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new te(n,s),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=de(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(const c of Object.keys(r)){const e=A(c,he);for(const t of e)this._tokenTypeMatchers.push({matcher:t.matcher,type:r[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e=e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),t=[],n=this._rootScopeName,s=e(n);if(s){const e=s.injections;if(e)for(let n in e)le(t,n,e[n],this,s);const r=this._grammarRepository.injections(n);r&&r.forEach(e=>{const n=this.getExternalGrammar(e);if(n){const e=n.injectionSelector;e&&le(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return null===this._injections&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=de(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const s=this._tokenize(e,t,!1,n);return{tokens:s.lineTokens.getResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}tokenizeLine2(e,t,n=0){const s=this._tokenize(e,t,!0,n);return{tokens:s.lineTokens.getBinaryResult(s.ruleStack,s.lineLength),ruleStack:s.ruleStack,stoppedEarly:s.stoppedEarly}}_tokenize(e,t,n,s){let r;if(-1===this._rootId&&(this._rootId=Y.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==fe.NULL)r=!1,t.reset();else{r=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),s=C.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),o=this.getRule(this._rootId).getName(null,null);let i;i=o?ge.createRootAndLookUpScopeName(o,s,this):ge.createRoot("unknown",s),t=new fe(null,this._rootId,-1,-1,!1,null,i,i)}e+="\n";const o=this.createOnigString(e),i=o.content.length,a=new _e(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=re(this,o,r,0,t,a,!0,s);return P(o),{lineLength:i,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function de(e,t){return(e=n(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var ge=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let s=t,r=t?.scopePath??null;for(const o of n)r=g.push(r,o.scopeNames),s=new e(s,r,o.encodedTokenAttributes);return s}static createRoot(t,n){return new e(null,new g(null,t),n)}static createRootAndLookUpScopeName(t,n,s){const r=s.getMetadataForScope(t),o=new g(null,t),i=s.themeProvider.themeMatch(o),a=e.mergeAttributes(n,r,i);return new e(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let s=-1,r=0,o=0;return null!==n&&(s=n.fontStyle,r=n.foregroundId,o=n.backgroundId),C.set(e,t.languageId,t.tokenType,null,s,r,o)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const s=t.split(/ /g);let r=this;for(const o of s)r=e._pushAttributed(r,o,n);return r}static _pushAttributed(t,n,s){const r=s.getMetadataForScope(n),o=t.scopePath.push(n),i=s.themeProvider.themeMatch(o),a=e.mergeAttributes(t.tokenAttributes,r,i);return new e(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},fe=class e{constructor(e,t,n,s,r,o,i,a){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=r,this.endRule=o,this.nameScopesList=i,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&ge.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,s,r,o,i,a){return new e(this,t,n,s,r,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,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){const s=ge.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,s,ge.fromExtension(s,n.contentNameScopesList))}},me=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):A(e,he).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>A(e,he).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},_e=class{constructor(e,t,n,s){this.balancedBracketSelectors=s,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const t=e?.getScopeNames()??[];for(const e of this._tokenTypeOverrides)e.matcher(t)&&(n=C.set(n,0,N(e.type),null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(t))}return s&&(n=C.set(n,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n?void(this._lastTokenEndIndex=t):(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),void(this._lastTokenEndIndex=t))}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let s=0,r=this._binaryTokens.length;s<r;s++)n[s]=this._binaryTokens[s];return n}},ye=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=/* @__PURE__ */new Map;_rawGrammars=/* @__PURE__ */new Map;_injectionGrammars=/* @__PURE__ */new Map;_theme;dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,s,r){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,function(e,t,n,s,r,o,i,a){return new pe(e,t,n,s,r,o,i,a)}(e,o,t,n,s,r,this,this._onigLib))}return this._grammars.get(e)}},be=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new ye(d.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=/* @__PURE__ */new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(d.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new me(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,s,r){const o=new L(this._syncRegistry,e);for(;o.Q.length>0;)o.Q.map(e=>this._loadSingleGrammar(e.scopeName)),o.processQueue();return this._grammarForScopeName(e,t,n,s,r)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,s=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,s)}_grammarForScopeName(e,t=0,n=null,s=null,r=null){return this._syncRegistry.grammarForScopeName(e,t,n,s,r)}},ke=fe.NULL;function Se(e,t){const n="string"==typeof e?{}:{...e.colorReplacements},s="string"==typeof e?e:e.name;for(const[r,o]of Object.entries(t?.colorReplacements||{}))"string"==typeof o?n[r]=o:r===s&&Object.assign(n,o);return n}function we(e,t){return e&&t?.[e?.toLowerCase()]||e}function Ce(e){return Array.isArray(e)?e:[e]}async function Ne(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function Ae(e){return!e||["plaintext","txt","text","plain"].includes(e)}function ve(e){return"ansi"===e||Ae(e)}function Pe(e){return"none"===e}function Ie(e){return Pe(e)}function Re(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(/\s+/g)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(/\s+/g);for(const s of n)s&&!e.properties.class.includes(s)&&e.properties.class.push(s);return e}function Te(e,t=!1){if(0===e.length)return[["",0]];const n=e.split(/(\r?\n)/g);let s=0;const r=[];for(let o=0;o<n.length;o+=2){const e=t?n[o]+(n[o+1]||""):n[o];r.push([e,s]),s+=n[o].length,s+=n[o+1]?.length||0}return r}function Le(e){const t=Te(e,!0).map(([e])=>e);return{lines:t,indexToPos:function(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let s=n,r=0;for(const e of t){if(s<e.length)break;s-=e.length,r++}return{line:r,character:s}},posToIndex:function(e,n){let s=0;for(let r=0;r<e;r++)s+=t[r].length;return s+=n,s}}}const xe="light-dark()",Ge=["color","background-color"];function Ee(e,t){let n=0;const s=[];for(const r of t)r>n&&s.push({...e,content:e.content.slice(n,r),offset:e.offset+n}),n=r;return n<e.content.length&&s.push({...e,content:e.content.slice(n),offset:e.offset+n}),s}function $e(e,t){const n=Array.from(t instanceof Set?t:new Set(t)).sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{const t=n.filter(t=>e.offset<t&&t<e.offset+e.content.length).map(t=>t-e.offset).sort((e,t)=>e-t);return t.length?Ee(e,t):e})):e}function Be(e,n,s,r,o="css-vars"){const i={content:e.content,explanation:e.explanation,offset:e.offset},a=n.map(t=>Me(e.variants[t])),c=new Set(a.flatMap(e=>Object.keys(e))),l={},u=(e,t)=>{const r="color"===t?"":"background-color"===t?"-bg":`-${t}`;return s+n[e]+("color"===t?"":r)};return a.forEach((e,s)=>{for(const i of c){const c=e[i]||"inherit";if(0===s&&r&&Ge.includes(i))if(r===xe&&a.length>1){const e=n.findIndex(e=>"light"===e),r=n.findIndex(e=>"dark"===e);if(-1===e||-1===r)throw new t('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=a[e][i]||"inherit",d=a[r][i]||"inherit";l[i]=`light-dark(${p}, ${d})`,"css-vars"===o&&(l[u(s,i)]=c)}else l[i]=c;else"css-vars"===o&&(l[u(s,i)]=c)}}),i.htmlStyle=l,i}function Me(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&y.Italic&&(t["font-style"]="italic"),e.fontStyle&y.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&y.Underline&&n.push("underline"),e.fontStyle&y.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function Oe(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}const je=/* @__PURE__ */new WeakMap;function Fe(e,t){je.set(e,t)}function We(e){return je.get(e)}class De{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new De(Object.fromEntries(Ce(t).map(e=>[e,ke])),e)}constructor(...e){if(2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,s]=e;this.lang=n,this._stacks={[s]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return function(e){const t=[],n=/* @__PURE__ */new Set;function s(e){if(n.has(e))return;n.add(e);const r=e?.nameScopesList?.scopeName;r&&t.push(r),e.parent&&s(e.parent)}return s(e),t}(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function qe(){const e=/* @__PURE__ */new WeakMap;function n(n){if(!e.has(n.meta)){let s=function(e){if("number"==typeof e){if(e<0||e>n.source.length)throw new t(`Invalid decoration offset: ${e}. Code length: ${n.source.length}`);return{...r.indexToPos(e),offset:e}}{const n=r.lines[e.line];if(void 0===n)throw new t(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);let s=e.character;if(s<0&&(s=n.length+s),s<0||s>n.length)throw new t(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${n.length}`);return{...e,character:s,offset:r.posToIndex(e.line,s)}}};const r=Le(n.source),o=(n.options.decorations||[]).map(e=>({...e,start:s(e.start),end:s(e.end)}));!function(e){for(let n=0;n<e.length;n++){const s=e[n];if(s.start.offset>s.end.offset)throw new t(`Invalid decoration range: ${JSON.stringify(s.start)} - ${JSON.stringify(s.end)}`);for(let r=n+1;r<e.length;r++){const n=e[r],o=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,i=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset,a=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,c=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset;if(o||i||a||c){if(o&&i)continue;if(a&&c)continue;if(a&&s.start.offset===s.end.offset)continue;if(i&&n.start.offset===n.end.offset)continue;throw new t(`Decorations ${JSON.stringify(s.start)} and ${JSON.stringify(n.start)} intersect.`)}}}}(o),e.set(n.meta,{decorations:o,converter:r,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(e){if(!this.options.decorations?.length)return;return $e(e,n(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;const s=n(this),r=Array.from(e.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(r.length!==s.converter.lines.length)throw new t(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${s.converter.lines.length}). Failed to apply decorations.`);function o(e,n,s,o){const i=r[e];let c="",l=-1,u=-1;if(0===n&&(l=0),0===s&&(u=0),s===Number.POSITIVE_INFINITY&&(u=i.children.length),-1===l||-1===u)for(let t=0;t<i.children.length;t++)c+=Ue(i.children[t]),-1===l&&c.length===n&&(l=t+1),-1===u&&c.length===s&&(u=t+1);if(-1===l)throw new t(`Failed to find start index for decoration ${JSON.stringify(o.start)}`);if(-1===u)throw new t(`Failed to find end index for decoration ${JSON.stringify(o.end)}`);const p=i.children.slice(l,u);if(o.alwaysWrap||p.length!==i.children.length)if(o.alwaysWrap||1!==p.length||"element"!==p[0].type){const e={type:"element",tagName:"span",properties:{},children:p};a(e,o,"wrapper"),i.children.splice(l,p.length,e)}else a(p[0],o,"token");else a(i,o,"line")}function i(e,t){r[e]=a(r[e],t,"line")}function a(e,t,n){const s=t.properties||{},r=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...s,class:e.properties.class},t.properties?.class&&Re(e,t.properties.class),e=r(e,n)||e}const c=[],l=s.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(const t of l){const{start:e,end:n}=t;if(e.line===n.line)o(e.line,e.character,n.character,t);else if(e.line<n.line){o(e.line,e.character,Number.POSITIVE_INFINITY,t);for(let s=e.line+1;s<n.line;s++)c.unshift(()=>i(s,t));o(n.line,0,n.character,t)}}c.forEach(e=>e())}}}function Ue(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(Ue).join(""):""}const ze=[
2
+ /* @__PURE__ */qe()];function He(e){const t=function(e){const t=[],n=[],s=[];for(const r of e)switch(r.enforce){case"pre":t.push(r);break;case"post":n.push(r);break;default:s.push(r)}return{pre:t,post:n,normal:s}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...ze]}var Ke=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Je={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Qe(e,t){const n=e.indexOf("",t);if(-1!==n&&"["===e[n+1]){const t=e.indexOf("m",n);if(-1!==t)return{sequence:e.substring(n+2,t).split(";"),startPosition:n,position:t+1}}return{position:e.length}}function Ye(e){const t=e.shift();if("2"===t){const t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){const t=e.shift();if(t)return{type:"table",index:Number(t)}}}function Ve(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const s=Number.parseInt(n);if(!Number.isNaN(s))if(0===s)t.push({type:"resetAll"});else if(s<=9){Je[s]&&t.push({type:"setDecoration",value:Je[s]})}else if(s<=29){const e=Je[s-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(s<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Ke[s-30]}});else if(38===s){const n=Ye(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===s)t.push({type:"resetForegroundColor"});else if(s<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Ke[s-40]}});else if(48===s){const n=Ye(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===s?t.push({type:"resetBackgroundColor"}):53===s?t.push({type:"setDecoration",value:"overline"}):55===s?t.push({type:"resetDecoration",value:"overline"}):s>=90&&s<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Ke[s-90+8]}}):s>=100&&s<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Ke[s-100+8]}})}return t}var Xe={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 Ze(e=Xe){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}let s;function r(e){return function(){if(s)return s;s=[];for(let n=0;n<Ke.length;n++)s.push(t(Ke[n]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let r=0;r<6;r++)for(let o=0;o<6;o++)s.push(n([e[t],e[r],e[o]]));let r=8;for(let t=0;t<24;t++,r+=10)s.push(n([r,r,r]));return s}()[e]}return{value:function(e){switch(e.type){case"named":return t(e.name);case"rgb":return n(e.rgb);case"table":return r(e.index)}}}}const et={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 tt(e,t,n){const s=Se(e,n),r=Te(t),o=Ze(Object.fromEntries(Ke.map(t=>{const n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`,s=e.colors?.[n];return[t,s||et[t]]}))),i=function(){let e=null,t=null,n=/* @__PURE__ */new Set;return{parse(s){const r=[];let o=0;do{const i=Qe(s,o),a=i.sequence?s.substring(o,i.startPosition):s.substring(o);if(a.length>0&&r.push({value:a,foreground:e,background:t,decorations:new Set(n)}),i.sequence){const s=Ve(i.sequence);for(const r of s)"resetAll"===r.type?(e=null,t=null,n.clear()):"resetForegroundColor"===r.type?e=null:"resetBackgroundColor"===r.type?t=null:"resetDecoration"===r.type&&n.delete(r.value);for(const r of s)"setForegroundColor"===r.type?e=r.value:"setBackgroundColor"===r.type?t=r.value:"setDecoration"===r.type&&n.add(r.value)}o=i.position}while(o<s.length);return r}}}();return r.map(t=>i.parse(t[0]).map(n=>{let r,i;n.decorations.has("reverse")?(r=n.background?o.value(n.background):e.bg,i=n.foreground?o.value(n.foreground):e.fg):(r=n.foreground?o.value(n.foreground):e.fg,i=n.background?o.value(n.background):void 0),r=we(r,s),i=we(i,s),n.decorations.has("dim")&&(r=function(e){const t=e.match(/#([0-9a-f]{3,8})/i);if(t){const e=t[1];if(8===e.length){const t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){const t=e[0],n=e[1],s=e[2],r=e[3];return`#${t}${t}${n}${n}${s}${s}${Math.round(Number.parseInt(`${r}${r}`,16)/2).toString(16).padStart(2,"0")}`}if(3===e.length){const t=e[0],n=e[1],s=e[2];return`#${t}${t}${n}${n}${s}${s}80`}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}(r));let a=y.None;return n.decorations.has("bold")&&(a|=y.Bold),n.decorations.has("italic")&&(a|=y.Italic),n.decorations.has("underline")&&(a|=y.Underline),n.decorations.has("strikethrough")&&(a|=y.Strikethrough),{content:n.value,offset:t[1],color:r,bgColor:i,fontStyle:a}}))}function nt(e,n,s={}){const{theme:r=e.getLoadedThemes()[0]}=s,o=e.resolveLangAlias(s.lang||"text");if(Ae(o)||Pe(r))return Te(n).map(e=>[{content:e[0],offset:e[1]}]);const{theme:i,colorMap:a}=e.setTheme(r);if("ansi"===o)return tt(i,n,s);const c=e.getLanguage(s.lang||"text");if(s.grammarState){if(s.grammarState.lang!==c.name)throw new t(`Grammar state language "${s.grammarState.lang}" does not match highlight language "${c.name}"`);if(!s.grammarState.themes.includes(i.name))throw new t(`Grammar state themes "${s.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return st(n,c,i,a,s)}function st(e,t,n,s,r){const o=rt(e,t,n,s,r),i=new De(o.stateStack,t.name,n.name);return Fe(o.tokens,i),o.tokens}function rt(e,n,s,r,o){const i=Se(s,o),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:c=500}=o,l=Te(e);let u=o.grammarState?function(e,n){if(!(e instanceof De))throw new t("Invalid grammar state");return e.getInternalStack(n)}(o.grammarState,s.name)??ke:null!=o.grammarContextCode?rt(o.grammarContextCode,n,s,r,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:ke,p=[];const d=[];for(let t=0,g=l.length;t<g;t++){const[e,g]=l[t];if(""===e){p=[],d.push([]);continue}if(a>0&&e.length>=a){p=[],d.push([{content:e,offset:g,color:"",fontStyle:0}]);continue}let f,m,_;o.includeExplanation&&(f=n.tokenizeLine(e,u,c),m=f.tokens,_=0);const y=n.tokenizeLine2(e,u,c),b=y.tokens.length/2;for(let t=0;t<b;t++){const n=y.tokens[2*t],a=t+1<b?y.tokens[2*t+2]:e.length;if(n===a)continue;const c=y.tokens[2*t+1],l=we(r[C.getForeground(c)],i),u=C.getFontStyle(c),d={content:e.substring(n,a),offset:g+n,color:l,fontStyle:u};if(o.includeExplanation){const t=[];if("scopeName"!==o.includeExplanation)for(const e of s.settings){let n;switch(typeof e.scope){case"string":n=e.scope.split(/,/).map(e=>e.trim());break;case"object":n=e.scope;break;default:continue}t.push({settings:e,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let r=0;for(;n+r<a;){const n=m[_],s=e.substring(n.startIndex,n.endIndex);r+=s.length,d.explanation.push({content:s,scopes:"scopeName"===o.includeExplanation?ot(n.scopes):it(t,n.scopes)}),_+=1}}p.push(d)}d.push(p),p=[],u=y.ruleStack}return{tokens:d,stateStack:u}}function ot(e){return e.map(e=>({scopeName:e}))}function it(e,t){const n=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];n[s]={scopeName:r,themeMatches:lt(e,r,t.slice(0,s))}}return n}function at(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function ct(e,t,n){if(!at(e[e.length-1],t))return!1;let s=e.length-2,r=n.length-1;for(;s>=0&&r>=0;)at(e[s],n[r])&&(s-=1),r-=1;return-1===s}function lt(e,t,n){const s=[];for(const{selectors:r,settings:o}of e)for(const e of r)if(ct(e,t,n)){s.push(o);break}return s}function ht(e,t,n){const s=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),r=s.map(s=>{const r=nt(e,t,{...n,theme:s.theme});return{tokens:r,state:We(r),theme:"string"==typeof s.theme?s.theme:s.theme.name}}),o=function(...e){const t=e.map(()=>[]),n=e.length;for(let s=0;s<e[0].length;s++){const r=e.map(e=>e[s]),o=t.map(()=>[]);t.forEach((e,t)=>e.push(o[t]));const i=r.map(()=>0),a=r.map(e=>e[0]);for(;a.every(e=>e);){const e=Math.min(...a.map(e=>e.content.length));for(let t=0;t<n;t++){const n=a[t];n.content.length===e?(o[t].push(n),i[t]+=1,a[t]=r[t][i[t]]):(o[t].push({...n,content:n.content.slice(0,e)}),a[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...r.map(e=>e.tokens)),i=o[0].map((e,t)=>e.map((e,r)=>{const i={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(i.explanation=e.explanation),o.forEach((e,n)=>{const{content:o,explanation:a,offset:c,...l}=e[t][r];i.variants[s[n].color]=l}),i})),a=r[0].state?new De(Object.fromEntries(r.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),r[0].state.lang):void 0;return a&&Fe(i,a),i}function ut(e,n,s){let r,o,i,a,c,l;if("themes"in s){const{defaultColor:u="light",cssVariablePrefix:p="--shiki-",colorsRendering:d="css-vars"}=s,g=Object.entries(s.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===u?-1:t.color===u?1:0);if(0===g.length)throw new t("`themes` option must not be empty");const f=ht(e,n,s);if(l=We(f),u&&xe!==u&&!g.find(e=>e.color===u))throw new t(`\`themes\` option must contain the defaultColor key \`${u}\``);const m=g.map(t=>e.getTheme(t.theme)),_=g.map(e=>e.color);i=f.map(e=>e.map(e=>Be(e,_,p,u,d))),l&&Fe(i,l);const y=g.map(e=>Se(e.theme,s));o=pt(g,m,y,p,u,"fg",d),r=pt(g,m,y,p,u,"bg",d),a=`shiki-themes ${m.map(e=>e.name).join(" ")}`,c=u?void 0:[o,r].join(";")}else{if(!("theme"in s))throw new t("Invalid options, either `theme` or `themes` must be provided");{const t=Se(s.theme,s);i=nt(e,n,s);const c=e.getTheme(s.theme);r=we(c.bg,t),o=we(c.fg,t),a=c.name,l=We(i)}}return{tokens:i,fg:o,bg:r,themeName:a,rootStyle:c,grammarState:l}}function pt(e,n,s,r,o,i,a){return e.map((c,l)=>{const u=we(n[l][i],s[l])||"inherit",p=`${r+c.color}${"bg"===i?"-bg":""}:${u}`;if(0===l&&o){if(o===xe&&e.length>1){const r=e.findIndex(e=>"light"===e.color),o=e.findIndex(e=>"dark"===e.color);if(-1===r||-1===o)throw new t('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${we(n[r][i],s[r])||"inherit"}, ${we(n[o][i],s[o])||"inherit"});${p}`}return u}return"css-vars"===a?p:null}).filter(e=>!!e).join(";")}function dt(e,t,n,s={meta:{},options:n,codeToHast:(t,n)=>dt(e,t,n),codeToTokens:(t,n)=>ut(e,t,n)}){let r=t;for(const f of He(n))r=f.preprocess?.call(s,r,n)||r;let{tokens:o,fg:i,bg:a,themeName:c,rootStyle:l,grammarState:u}=ut(e,r,n);const{mergeWhitespaces:p=!0,mergeSameStyleTokens:d=!1}=n;!0===p?o=function(e){return e.map(e=>{const t=[];let n,s="";return e.forEach((r,o)=>{const i=!(r.fontStyle&&(r.fontStyle&y.Underline||r.fontStyle&y.Strikethrough));i&&r.content.match(/^\s+$/)&&e[o+1]?(void 0===n&&(n=r.offset),s+=r.content):s?(i?t.push({...r,offset:n,content:s+r.content}):t.push({content:s,offset:n},r),n=void 0,s=""):t.push(r)}),t})}(o):"never"===p&&(o=function(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;const t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;const[,n,s,r]=t;if(!n&&!r)return e;const o=[{...e,offset:e.offset+n.length,content:s}];return n&&o.unshift({content:n,offset:e.offset}),r&&o.push({content:r,offset:e.offset+n.length+s.length}),o}))}(o)),d&&(o=function(e){return e.map(e=>{const t=[];for(const n of e){if(0===t.length){t.push({...n});continue}const e=t[t.length-1],s=Oe(e.htmlStyle||Me(e)),r=Oe(n.htmlStyle||Me(n)),o=e.fontStyle&&(e.fontStyle&y.Underline||e.fontStyle&y.Strikethrough),i=n.fontStyle&&(n.fontStyle&y.Underline||n.fontStyle&y.Strikethrough);o||i||s!==r?t.push({...n}):e.content+=n.content}return t})}(o));const g={...s,get source(){return r}};for(const f of He(n))o=f.tokens?.call(g,o)||o;return gt(o,{...n,fg:i,bg:a,themeName:c,rootStyle:!1!==n.rootStyle&&(n.rootStyle??l)},g,u)}function gt(e,t,n,s=We(e)){const r=He(t),o=[],i={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=t,l={class:`shiki ${t.themeName||""}`};!1!==t.rootStyle&&(null!=t.rootStyle?l.style=t.rootStyle:l.style=`background-color:${t.bg};color:${t.fg}`),!1!==c&&null!=c&&(l.tabindex=c.toString());for(const[m,_]of Object.entries(t.meta||{}))m.startsWith("_")||(l[m]=_);let u={type:"element",tagName:"pre",properties:l,children:[],data:t.data},p={type:"element",tagName:"code",properties:{},children:o};const d=[],g={...n,structure:a,addClassToHast:Re,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return u},get code(){return p},get lines(){return d}};if(e.forEach((e,t)=>{t&&("inline"===a?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===a&&o.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},s=0;for(const o of e){let e={type:"element",tagName:"span",properties:{...o.htmlAttrs},children:[{type:"text",value:o.content}]};const c=Oe(o.htmlStyle||Me(o));c&&(e.properties.style=c);for(const i of r)e=i?.span?.call(g,e,t+1,s,n,o)||e;"inline"===a?i.children.push(e):"classic"===a&&n.children.push(e),s+=o.content.length}if("classic"===a){for(const e of r)n=e?.line?.call(g,n,t+1)||n;d.push(n),o.push(n)}else"inline"===a&&d.push(n)}),"classic"===a){for(const e of r)p=e?.code?.call(g,p)||p;u.children.push(p);for(const e of r)u=e?.pre?.call(g,u)||u;i.children.push(u)}else if("inline"===a){const e=[];let t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const s of i.children)"element"===s.type&&"br"===s.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):"element"!==s.type&&"text"!==s.type||t.children.push(s);e.push(t);let n={type:"element",tagName:"code",properties:{},children:e};for(const s of r)n=s?.code?.call(g,n)||n;i.children=[];for(let s=0;s<n.children.length;s++){s>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const e=n.children[s];"element"===e.type&&i.children.push(...e.children)}}let f=i;for(const m of r)f=m?.root?.call(g,f)||f;return s&&Fe(f,s),f}const ft=e;function mt(e,t,n){const s={meta:{},options:n,codeToHast:(t,n)=>dt(e,t,n),codeToTokens:(t,n)=>ut(e,t,n)};let r=ft(dt(e,t,n,s));for(const o of He(n))r=o.postprocess?.call(s,r,n)||r;return r}const _t="#333333",yt="#bbbbbb",bt="#fffffe",kt="#1e1e1e",St="__shiki_resolved";function wt(e){if(e?.[St])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:s}=t;if(!n||!s){const e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(s=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!s&&t?.colors?.["editor.foreground"]&&(s=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),s||(s="light"===t.type?_t:yt),n||(n="light"===t.type?bt:kt),t.fg=s,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let r=0;const o=/* @__PURE__ */new Map;function i(e){if(o.has(e))return o.get(e);r+=1;const n=`#${r.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?i(e):(o.set(e,n),n)}t.settings=t.settings.map(e=>{const n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),s=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!s)return e;const r={...e,settings:{...e.settings}};if(n){const n=i(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,r.settings.foreground=n}if(s){const n=i(e.settings.background);t.colorReplacements[n]=e.settings.background,r.settings.background=n}return r});for(const a of Object.keys(t.colors||{}))if(("editor.foreground"===a||"editor.background"===a||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){const e=i(t.colors[a]);t.colorReplacements[e]=t.colors[a],t.colors[a]=e}return Object.defineProperty(t,St,{enumerable:!1,writable:!1,value:!0}),t}async function Ct(e){return Array.from(new Set((await Promise.all(e.filter(e=>!ve(e)).map(async e=>await Ne(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function Nt(e){return(await Promise.all(e.map(async e=>Ie(e)?null:wt(await Ne(e))))).filter(e=>!!e)}function At(e,t=3){t>3||console.trace(`[SHIKI DEPRECATE]: ${e}`)}class vt extends Error{constructor(e){super(e),this.name="ShikiError"}}function Pt(e,t){if(!t)return e;if(t[e]){const n=/* @__PURE__ */new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new vt(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class It extends be{constructor(e,t,n,s={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=s,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=/* @__PURE__ */new Map;_resolvedGrammars=/* @__PURE__ */new Map;_langMap=/* @__PURE__ */new Map;_langGraph=/* @__PURE__ */new Map;_textmateThemeCache=/* @__PURE__ */new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=wt(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=d.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Pt(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(const r of t)this._resolvedGrammars.delete(r.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(r.scopeName),this._syncRegistry?._grammars?.delete(r.scopeName),this.loadLanguage(this._langMap.get(r.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 t=Array.from(this._langGraph.entries()),n=t.filter(([e,t])=>!t);if(n.length){const e=t.filter(([e,t])=>{if(!t)return!1;const s=t.embeddedLanguages||t.embeddedLangs;return s?.some(e=>n.map(([e])=>e).includes(e))}).filter(e=>!n.includes(e));throw new vt(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(const[s,r]of t)this._resolver.addLanguage(r);for(const[s,r]of t)this.loadLanguage(r)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[.../* @__PURE__ */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 t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const n of t)this._langGraph.set(n,this._langMap.get(n))}}class Rt{_langs=/* @__PURE__ */new Map;_scopeToLang=/* @__PURE__ */new Map;_injections=/* @__PURE__ */new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let s=1;s<=t.length;s++){const e=t.slice(0,s).join(".");n=[...n,...this._injections.get(e)||[]]}return n}}let Tt=0;function Lt(e){Tt+=1,!1!==e.warnings&&Tt>=10&&Tt%10==0&&console.warn(`[Shiki] ${Tt} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new vt("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),s=(e.themes||[]).flat(1).map(wt),r=new Rt(e.engine,n),o=new It(r,s,n,e.langAlias);let i;function a(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();const t=o.getTheme(e);if(!t)throw new vt(`Theme \`${e}\` not found, you may need to load it first`);return t}function c(...e){u(),o.loadLanguages(e.flat(1))}function l(...e){u();for(const t of e.flat(1))o.loadTheme(t)}function u(){if(t)throw new vt("Shiki instance has been disposed")}function p(){t||(t=!0,o.dispose(),Tt-=1)}return{setTheme:function(e){u();const t=a(e);return i!==e&&(o.setTheme(t),i=e),{theme:t,colorMap:o.getColorMap()}},getTheme:a,getLanguage:function(e){u();const t=o.getGrammar("string"==typeof e?e:e.name);if(!t)throw new vt(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),o.getLoadedThemes()},getLoadedLanguages:function(){return u(),o.getLoadedLanguages()},resolveLangAlias:function(t){return Pt(t,e.langAlias)},loadLanguage:async function(...e){return c(await Ct(e))},loadLanguageSync:c,loadTheme:async function(...e){return u(),l(await Nt(e))},loadThemeSync:l,dispose:p,[Symbol.dispose]:p}}async function xt(e){e.engine||At("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,s]=await Promise.all([Nt(e.themes||[]),Ct(e.langs||[]),e.engine]);return Lt({...e,themes:t,langs:n,engine:s})}async function Gt(e){const n=await xt(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return We(e[1]);const[n,s,r={}]=e,{lang:o="text",theme:i=n.getLoadedThemes()[0]}=r;if(Ae(o)||Pe(i))throw new t("Plain language does not have grammar state");if("ansi"===o)throw new t("ANSI language does not have grammar state");const{theme:a,colorMap:c}=n.setTheme(i),l=n.getLanguage(o);return new De(rt(s,l,a,c,r).stateStack,l.name,a.name)}(n,...e),codeToTokensBase:(e,t)=>nt(n,e,t),codeToTokensWithThemes:(e,t)=>ht(n,e,t),codeToTokens:(e,t)=>ut(n,e,t),codeToHast:(e,t)=>dt(n,e,t),codeToHtml:(e,t)=>mt(n,e,t),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...n,getInternalContext:()=>n}}export{t as ShikiError,Re as addClassToHast,we as applyColorReplacements,dt as codeToHast,mt as codeToHtml,ut as codeToTokens,nt as codeToTokensBase,ht as codeToTokensWithThemes,Gt as createHighlighterCore,Le as createPositionConverter,xt as createShikiInternal,Lt as createShikiInternalSync,Be as flatTokenVariants,Me as getTokenStyleObject,ft as hastToHtml,Pe as isNoneTheme,Ae as isPlainLang,ve as isSpecialLang,Ie as isSpecialTheme,Ne as normalizeGetter,wt as normalizeTheme,Se as resolveColorReplacements,Te as splitLines,Ee as splitToken,$e as splitTokens,Oe as stringifyTokenStyle,Ce as toArray,tt as tokenizeAnsiWithTheme,st as tokenizeWithTheme,gt as tokensToHast,qe as transformerDecorations,At as warnDeprecated};
@@ -0,0 +1 @@
1
+ const e={buttons:{edit:"កែប្រែទំព័រ",retryPublish:"ព្យាយាមបង្ហោះម្តងទៀត",reloadApp:"ផ្ទុកកម្មវិធីឡើងវិញ",reload:"ផ្ទុកឡើងវិញ",signOut:"ចាកចេញពីគណនី",review:"ពិនិត្យឡើងវិញ",publish:"បង្ហោះ",back:"ត្រលប់ទៅក្រោយ",backToEdition:"ត្រលប់ទៅការកែសម្រួល",seeChanges:"មើលការផ្លាស់ប្តូរ"},headings:{directories:"ថតឯកសារ",files:"ឯកសារ",media:"មេឌៀ",pageSettings:"ការកំណត់ទំព័រ"},tooltips:{toggleStudio:"បិទ/បើក Studio",unlinkEditor:"បំបាត់តភ្ជាប់កម្មវិធីកែសម្រួលនិងការមើលជាមុន",linkEditor:"ភ្ជាប់កម្មវិធីកែសម្រួលនិងការមើលជាមុន",copiedToClipboard:"បានចម្លងទៅក្លីបបត",copyToClipboard:"ចម្លងទៅក្លីបបត",publishChanges:"ការបង្ហោះការផ្លាស់ប្តូរ",backToContent:"ត្រលប់ទៅមាតិកា"},notifications:{error:{unknown:"បានកើតមានកំហុសមិនស្គាល់"}},publish:{failedTitle:"ការបង្ហោះបរាជ័យ",summary:"នៅលើ {branch} នៃឃ្លាំង {repo}",errorTitle:"កំហុសក្នុងពេលការបង្ហោះ {providerName}",failedGeneric:"បរាជ័យក្នុងការបង្ហោះការផ្លាស់ប្តូរ"},review:{title:"ពិនិត្យការផ្លាស់ប្តូរ",created:"បានបង្កើត",updated:"បានធ្វើបច្ចុប្បន្នភាព",renamed:"បានផ្លាស់ប្តូរឈ្មោះ",deleted:"បានលុប"},publishSuccess:{title:"ការផ្លាស់ប្តូរបានបង្ហោះ",summary:"{count} ការផ្លាស់ប្តូរបានបង្ហោះនៅលើ {branch} នៃ {repo} | {count} ការផ្លាស់ប្តូរបានការបង្ហោះនៅលើ {branch} នៃឃ្លាំង {repo}",alertTitleWaiting:"កំពុងរង់ចាំការដាក់ឱ្យប្រើប្រាស់...",alertTitleComplete:"ការដាក់ឱ្យប្រើប្រាស់បានបញ្ចប់",alertDescWaiting:"គេហទំព័រត្រូវការដាក់ឱ្យប្រើប្រាស់ដើម្បីឱ្យការផ្លាស់ប្តូរអាចមើលឃើញក្នុង Studio។",alertDescComplete:"កំណែថ្មីនៃគេហទំព័ររបស់អ្នកបានដាក់ឱ្យប្រើប្រាស់។ សូមផ្ទុកកម្មវិធីឡើងវិញដើម្បីមើលការផ្លាស់ប្តូរក្នុង Studio។"},newVersionBanner:{title:"បានរកឃើញកំណែគេហទំព័រថ្មី",description:"កំណែថ្មីនៃគេហទំព័ររបស់អ្នកបានដាក់ឱ្យប្រើប្រាស់។ ផ្ទុកកម្មវិធីឡើងវិញដើម្បីមើលការផ្លាស់ប្តូរចុងក្រោយ។",reloadButton:"ផ្ទុកឡើងវិញ"},footer:{developer_view:"ទិដ្ឋភាពអ្នកអភិវឌ្ឍន៍",localFilesystem:"កំពុងប្រើប្រាស់ប្រព័ន្ធឯកសារក្នុងតំបន់",debugMode:"ពេលវេលាសាកល្បង"},alert:{mdcFormatting:"ការធ្វើទម្រង់ត្រូវបានអនុវត្តដើម្បីផ្គូផ្គងជាមួយស្តង់ដារវាក្យសរសេរី MDC។"},conflict:{title:"បានរកឃើញជម្លោះ",repository:"ឃ្លាំង",branch:"Branch",file:"ឯកសារ",description:"មាតិកានៅលើ {providerName} ខុសគ្នាពីកំណែគេហទំព័ររបស់អ្នក។ ត្រូវប្រាកដថាការផ្លាស់ប្តូរចុងក្រោយរបស់អ្នកត្រូវបានដាក់ឱ្យប្រើប្រាស់ ហើយផ្ទុកទំព័រឡើងវិញ។",websiteVersion:"គេហទំព័រ"},nav:{content:"មាតិកា",media:"មេឌៀ"},placeholders:{commitMessage:"សារការប្តេធ្វើបច្ចុប្បន្នភាព",order:"លេខលំដាប់",fileName:"ឈ្មោះឯកសារ"},validation:{commitRequired:"សារការប្តេធ្វើបច្ចុប្បន្នភាពត្រូវបានទាមទារ",nameEmpty:"ឈ្មោះមិនអាចទទេបាន",nameEndsWithDot:"ឈ្មោះមិនអាចបញ្ចប់ដោយ '.'",nameStartsWithSlash:"ឈ្មោះមិនអាចចាប់ផ្តើមដោយ '/'",nameExists:"ឈ្មោះមានស្រាប់រួច",prefixDigitsOnly:"បុព្រាមុខត្រូវតែជាខ្សែអក្សរមានតែលេខ",prefixNonNegativeInteger:"បុព្រាមុខត្រូវតែជាលេខគតិបន្តិច"},media:{altFilePreview:"មើលឯកសារជាមុន",altImagePreview:"មើលរូបភាពជាមុន",playAudio:"ដាក់អូឌីយ៉ូ",audioTagNotSupported:"កម្មវិធីរុករករបស់អ្នកមិនគាំទ្រ ស្លាកអូឌីយ៉ូ។",playVideo:"ដាក់វីដេអូ",videoTagNotSupported:"កម្មវិធីរុករករបស់អ្នកមិនគាំទ្រ ស្លាកវីដេអូ។",metaWidth:"ទទឹង",metaHeight:"កម្ពស់",metaType:"ប្រភេទ",metaDuration:"រយៈពេល",metaSize:"ទំហំ",fileName:"ឈ្មោះឯកសារ",publicPath:"ផ្លូវសាធារណៈ",providerPath:"ផ្លូវ {providerName}",markdown:"Markdown"},aria:{openActions:"បើកសកម្មភាព",cancel:"បោះបង់",submit:"ដាក់ស្នើ"},actions:{confirmAction:"ចុចម្តងទៀតដើម្បី {action}",verbs:{create:"បង្កើត",delete:"លុប",rename:"ផ្លាស់ប្តូរឈ្មោះ",upload:"ផ្ទុកឡើង",duplicate:"ធ្វើ certified copy"},labels:{createDocument:"ឯកសារថ្មី",createDocumentFolder:"ថតថ្មី",createMediaFolder:"ថតមេឌៀថ្មី",renameItem:"ផ្លាស់ប្តូរឈ្មោះ",deleteItem:"លុប",uploadMedia:"ផ្ទុកមេឌៀឡើង",duplicateItem:"ចម្លង",revertItem:"ដកការផ្លាស់ប្តូរ",publishBranch:"ការបង្ហោះ branch",openGitProvider:"បើកនៅលើ {providerName}",switchToTipTap:"ប្រើកម្មវិធីកែសម្រួលរូបភាព",switchToCode:"ប្រើកម្មវិធីកែសម្រួលកូដ"},tooltips:{createDocument:"បង្កើតឯកសារថ្មី",createDocumentFolder:"បង្កើតថតថ្មី",createMediaFolder:"បង្កើតថតមេឌៀថ្មី",renameItem:"ផ្លាស់ប្តូរឈ្មោះឯកសារ",deleteItem:"លុបឯកសារ",uploadMedia:"ផ្ទុកមេឌៀឡើង",duplicateItem:"ចម្លងឯកសារ",revertItem:"ដកការផ្លាស់ប្តូរ",publishBranch:"ការបង្ហោះ branch"}},items:{itemCount:"1 ធាតុ | {count} ធាតុ"},monaco:{headings:{h1:"ចំណងជើង ១",h2:"ចំណងជើង ២",h3:"ចំណងជើង ៣"},styles:{bold:"អក្សរដិត",italic:"អក្សរទ្រេត"},lists:{bulleted:"បញ្ជីជាចំណុចៗ",numbered:"បញ្ជីជាលេខ"},other:{emojis:"អីមូជី",blockquote:"សម្រង់ពាក្យសម្តី",code:"កូដ",inlineCode:"កូដក្នុងជួរ",link:"តំណភ្ជាប់",image:"រូបភាព"},writeSomething:"សរសេរអ្វីមួយ",snippets:{title:"ចំណងជើង",item1:"ធាតុទី ១",item2:"ធាតុទី ២",language:"ភាសា",code:"កូដ",link:"តំណភ្ជាប់",alt:"អត្ថបទជំនួស",src:"ប្រភព",value:"តម្លៃ"},docs:{path:"ផ្លូវក្នុងគម្រោង៖",props:"លក្ខណៈសម្បត្តិ",slots:"ប្រលោះ",type:"ប្រភេទ",required:"ចាំបាច់",default:"លំនាំដើម"}},tiptap:{editor:{placeholder:"សរសេរ វាយ '/' សម្រាប់ពាក្យបញ្ជា...",components:"ធាតុប្រសាទ"},toolbar:{h1:"ចំណងជើង ១",h2:"ចំណងជើង ២",h3:"ចំណងជើង ៣",h4:"ចំណងជើង ៤",bulletList:"បញ្ជីចំណុច",orderedList:"បញ្ជីលេខ",blockquote:"ប្លុកសេចក្តីថ្លែងការណ៍",codeBlock:"ប្លុកកូដ",bold:"អក្សរដិត",italic:"អក្សរទ្រេត",strike:"ឆ្លាក់",code:"កូដ",headings:"ចំណងជើង"},suggestion:{style:"រចនាប័ទ្ម",paragraph:"កថាខណ្ឌ",insert:"បញ្ចូល",image:"រូបភាព",video:"វីដេអូ",horizontalRule:"បន្ទាត់ផ្តេក"},drag:{turnInto:"ផ្លាស់ប្តូរទៅជា",resetFormatting:"កំណត់ទម្រង់ឡើងវិញ",duplicate:"ចម្លង",copyToClipboard:"ចម្លងទៅក្លីបបត",moveUp:"ផ្លាស់ទៅខាងលើ",moveDown:"ផ្លាស់ទៅខាងក្រោម",insertBefore:"បញ្ចូលមុន",insertAfter:"បញ្ចូលក្រោយ",delete:"លុប"},element:{addSlot:"បន្ថែមរន្ធ",editProps:"កែប្រែលក្ខណៈសម្បត្តិ",delete:"លុប",prop:"លក្ខណៈសម្បត្តិ",props:{label:"លក្ខណៈសម្បត្តិ",itemsCount:"{count} ធាតុ | {count} ធាតុ",fieldsCount:"{count} វាល | {count} វាល",edit:"កែប្រែ {type}"}},slot:{searchPlaceholder:"ស្វែងរក ឬបង្កើតរន្ធ...",deleteSlot:"លុបរន្ធ",noSlotsAvailable:"គ្មានរន្ធស្រេចចិត្ត"},inlineElement:{editContent:"កែប្រែមាតិកា",editProps:"កែប្រែលក្ខណៈសម្បត្តិ",delete:"លុប",editContentLabel:"កែប្រែមាតិកា {name}",enterContentPlaceholder:"បញ្ចូលមាតិកា...",apply:"អនុវត្ត"},codeBlock:{filenamePlaceholder:"filename.js"},link:{pasteLinkPlaceholder:"ដាក់តំណ...",applyLink:"អនុវត្តតំណ",openInNewWindow:"បើកក្នុងបង្អួចថ្មី",removeLink:"ដកតំណ"},spanStyle:{label:"រចនាប័ទ្ម span",stylePlaceholder:"រចនាប័ទ្ម៖ ឧ. color: tomato; font-weight: 600;",classPlaceholder:"ថ្នាក់៖ បំបែកដោយដកការ",apply:"អនុវត្ត",remove:"ដក"},binding:{variablePlaceholder:"ឈ្មោះប្តូរភាព",defaultValuePlaceholder:"តម្លៃលំនាំដើម"},image:{source:"URL ប្រភពរូបភាព",altText:"អត្ថបទជំនួស",title:"ចំណងជើងរូបភាព",width:"ទទឹង",height:"កម្ពស់",noSource:"គ្មានប្រភពរូបភាព",edit:"កែប្រែរូបភាព",delete:"លុបរូបភាព"},video:{source:"URL ប្រភពវីដេអូ",poster:"URL រូបភាព poster",width:"ទទឹង",height:"កម្ពស់",controls:"បង្ហាញឧបករណ៍បញ្ជា",autoplay:"ដាក់ដោយស្វ័យប្រវត្តិ",loop:"ចង្វាក់",muted:"បិទសំឡេង",noSource:"គ្មានប្រភពវីដេអូ",edit:"កែប្រែវីដេអូ",delete:"លុបវីដេអូ"}},mediaPicker:{image:{title:"ជ្រើសរើសរូបភាព",description:"ជ្រើសរើសរូបភាពពីបណ្តាញមេឌៀរបស់អ្នក",notAvailable:"គ្មានរូបភាពក្នុងបណ្តាញមេឌៀរបស់អ្នក",upload:"ផ្ទុកឡើង",useExternal:"ប្រើប្រភពខាងក្រៅ"},video:{title:"ជ្រើសរើសវីដេអូ",description:"ជ្រើសរើសវីដេអូពីបណ្តាញមេឌៀរបស់អ្នក",notAvailable:"គ្មានវីដេអូក្នុងបណ្តាញមេឌៀរបស់អ្នក",upload:"ផ្ទុកឡើង",useExternal:"ប្រើប្រភពខាងក្រៅ"}},form:{array:{addItem:"បន្ថែម {label}",deleteItem:"លុបធាតុ",editItem:"កែប្រែធាតុ",unsupportedType:"ប្រភេទអារេ {type} មិនត្រូវបានគាំទ្រ"},object:{noProperties:"គ្មានលក្ខណៈសម្បត្តិកំណត់",enterPlaceholder:"បញ្ចូល {field}..."},section:{propertyCount:"1 លក្ខណៈសម្បត្តិ | {count} លក្ខណៈសម្បត្តិ"},media:{placeholder:"បញ្ចូលផ្លូវក្និត ឬ URL សាធារណៈ...",searchPlaceholder:"ស្វែងរករូបភាព...",noImagesFound:"រកមិនឃើញរូបភាព",noImagesAvailable:"គ្មានរូបភាព",imageCount:"{count} នៃ {total} រូបភាព | {count} នៃ {total} រូបភាព"},icon:{placeholder:"i-lucide-icon",searchPlaceholder:"ស្វែងរករូបតំណាង...",noIconsFound:"រកមិនឃើញរូបតំណាង",searchHint:"វាយយ៉ាងហោចណាស់ ២ តួអក្សរ ដើម្បីស្វែងរក",libraries:"បណ្តាញ៖",allLibraries:"ទាំងអស់"},text:{placeholder:"បញ្ចូលអត្ថបទ...",selectPlaceholder:"ជ្រើសរើសជម្រើស..."},date:{selectDate:"ជ្រើសរើសកាលបរិច្ឆេទ"},number:{placeholder:"0"}}},t={studio:e};export{t as default,e as studio};