nuxt-studio 1.2.0 → 1.2.1

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 +107 -1
  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 +34 -0
  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 +77 -0
  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 +95 -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 +307 -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 +26 -23
  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
@@ -1,2 +0,0 @@
1
- function e(t){return Array.isArray(t)?function(t){let n=[];for(let r=0,o=t.length;r<o;r++)n[r]=e(t[r]);return n}(t):t instanceof RegExp?t:"object"==typeof t?function(t){let n={};for(let r in t)n[r]=e(t[r]);return n}(t):t}function t(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function n(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t===e.length-1?n(e.substring(0,e.length-1)):e.substr(1+~t)}var r=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,o=class{static hasCaptures(e){return null!==e&&(r.lastIndex=0,r.test(e))}static replaceCaptures(e,t,n){return e.replace(r,(e,r,o,s)=>{let a=n[parseInt(r||o,10)];if(!a)return e;{let e=t.substring(a.start,a.end);for(;"."===e[0];)e=e.substring(1);switch(s){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function s(e,t){return e<t?-1:e>t?1:0}function a(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=s(e[r],t[r]);if(0!==n)return n}return 0}return n-r}function i(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 l(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var c=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}},u=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let o=0,s=t.length;o<s;o++){let e,s=t[o];if(!s.settings)continue;if("string"==typeof s.scope){let t=s.scope;t=t.replace(/^[,]+/,""),t=t.replace(/[,]+$/,""),e=t.split(",")}else e=Array.isArray(s.scope)?s.scope:[""];let a=-1;if("string"==typeof s.settings.fontStyle){a=0;let e=s.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++){switch(e[t]){case"italic":a|=1;break;case"bold":a|=2;break;case"underline":a|=4;break;case"strikethrough":a|=8}}}let l=null;"string"==typeof s.settings.foreground&&i(s.settings.foreground)&&(l=s.settings.foreground);let c=null;"string"==typeof s.settings.background&&i(s.settings.background)&&(c=s.settings.background);for(let t=0,i=e.length;t<i;t++){let s=e[t].trim().split(" "),i=s[s.length-1],u=null;s.length>1&&(u=s.slice(0,s.length-1),u.reverse()),n[r++]=new m(i,u,o,a,l,c)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{let n=s(e.scope,t.scope);return 0!==n?n:(n=a(e.parentScopes,t.parentScopes),0!==n?n:e.index-t.index)});let n=0,r="#000000",o="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(r=t.foreground),null!==t.background&&(o=t.background)}let i=new y(t),l=new g(n,i.getId(r),i.getId(o)),c=new k(new b(0,null,-1,0,0),[]);for(let s=0,a=e.length;s<a;s++){let t=e[s];c.insert(0,t.scope,t.parentScopes,t.fontStyle,i.getId(t.foreground),i.getId(t.background))}return new u(i,l,c)}(e,t)}_cachedMatchRoot=new c(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>function(e,t){if(0===t.length)return!0;for(let n=0;n<t.length;n++){let r=t[n],o=!1;if(">"===r){if(n===t.length-1)return!1;r=t[++n],o=!0}for(;e&&!d(e.scopeName,r);){if(o)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}(e.parent,t.parentScopes));return n?new g(n.fontStyle,n.foreground,n.background):null}},p=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(const r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function d(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var g=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};var m=class{constructor(e,t,n,r,o,s){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=o,this.background=s}},f=/* @__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))(f||{});var y=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)}},_=Object.freeze([]),b=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,o){this.scopeDepth=e,this.parentScopes=t||_,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,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==r&&(this.background=r)}},k=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[r]&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){const o=t.parentScopes[r].length-e.parentScopes[n].length;if(0!==o)return o;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,r=t.indexOf(".");if(-1===r?(e=t,n=""):(e=t.substring(0,r),n=t.substring(r+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,o,s,a){if(""===n)return void this._doInsertHere(t,r,o,s,a);let i,l,c,u=n.indexOf(".");-1===u?(i=n,l=""):(i=n.substring(0,u),l=n.substring(u+1)),this._children.hasOwnProperty(i)?c=this._children[i]:(c=new e(this._mainRule.clone(),b.cloneArr(this._rulesWithParentScopes)),this._children[i]=c),c.insert(t+1,l,r,o,s,a)}_doInsertHere(e,t,n,r,o){if(null!==t){for(let s=0,i=this._rulesWithParentScopes.length;s<i;s++){let i=this._rulesWithParentScopes[s];if(0===a(i.parentScopes,t))return void i.acceptOverwrite(e,n,r,o)}-1===n&&(n=this._mainRule.fontStyle),0===r&&(r=this._mainRule.foreground),0===o&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new b(e,t,n,r,o))}else this._mainRule.acceptOverwrite(e,n,r,o)}},S=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){const n=e.getLanguageId(t),r=e.getTokenType(t),o=e.getFontStyle(t),s=e.getForeground(t),a=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:o,foreground:s,background:a})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,r,o,s,a,i){let l=e.getLanguageId(t),c=e.getTokenType(t),u=e.containsBalancedBrackets(t)?1:0,p=e.getFontStyle(t),d=e.getForeground(t),g=e.getBackground(t);return 0!==n&&(l=n),8!==r&&(c=r),null!==o&&(u=o?1:0),-1!==s&&(p=s),0!==a&&(d=a),0!==i&&(g=i),(l|c<<8|u<<10|p<<11|d<<15|g<<24)>>>0}};function C(e){return e}function v(e,t){const n=[],r=function(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}(e);let o=r.next();for(;null!==o;){let e=0;if(2===o.length&&":"===o.charAt(1)){switch(o.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=r.next()}let t=a();if(n.push({matcher:t,priority:e}),","!==o)break;o=r.next()}return n;function s(){if("-"===o){o=r.next();const e=s();return t=>!!e&&!e(t)}if("("===o){o=r.next();const e=function(){const e=[];let t=a();for(;t&&(e.push(t),"|"===o||","===o);){do{o=r.next()}while("|"===o||","===o);t=a()}return t=>e.some(e=>e(t))}();return")"===o&&(o=r.next()),e}if(w(o)){const e=[];do{e.push(o),o=r.next()}while(w(o));return n=>t(e,n)}return null}function a(){const e=[];let t=s();for(;t;)e.push(t),t=s();return t=>e.every(e=>e(t))}}function w(e){return!!e&&!!e.match(/[\w\.:]+/)}function N(e){"function"==typeof e.dispose&&e.dispose()}var A=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},P=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},x=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))}},R=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new A(this.initialScopeName)]}seenFullScopeRequests=/* @__PURE__ */new Set;seenPartialScopeRequests=/* @__PURE__ */new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new x;for(const n of e)L(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof A){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 L(e,t,n,r){const o=n.lookup(e.scopeName);if(!o){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const s=n.lookup(t);e instanceof A?E({baseGrammar:s,selfGrammar:o},r):T(e.ruleName,{baseGrammar:s,selfGrammar:o,repository:o.repository},r);const a=n.injections(e.scopeName);if(a)for(const i of a)r.add(new A(i))}function T(e,t,n){if(t.repository&&t.repository[e]){I([t.repository[e]],t,n)}}function E(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&I(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&I(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function I(e,n,r){for(const o of e){if(r.visitedRule.has(o))continue;r.visitedRule.add(o);const e=o.repository?t({},n.repository,o.repository):n.repository;Array.isArray(o.patterns)&&I(o.patterns,{...n,repository:e},r);const s=o.include;if(!s)continue;const a=$(s);switch(a.kind){case 0:E({...n,selfGrammar:n.baseGrammar},r);break;case 1:E(n,r);break;case 2:T(a.ruleName,{...n,repository:e},r);break;case 3:case 4:const t=a.scopeName===n.selfGrammar.scopeName?n.selfGrammar:a.scopeName===n.baseGrammar.scopeName?n.baseGrammar:void 0;if(t){const o={baseGrammar:n.baseGrammar,selfGrammar:t,repository:e};4===a.kind?T(a.ruleName,o,r):E(o,r)}else 4===a.kind?r.add(new P(a.scopeName,a.ruleName)):r.add(new A(a.scopeName))}}}var O=class{kind=0},M=class{kind=1},G=class{constructor(e){this.ruleName=e}kind=2},B=class{constructor(e){this.scopeName=e}kind=3},D=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function $(e){if("$base"===e)return new O;if("$self"===e)return new M;const t=e.indexOf("#");if(-1===t)return new B(e);if(0===t)return new G(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new D(n,r)}}var j=/\\(\d+)/,F=/\\(\d+)/g;var U=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=o.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=o.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${n(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?o.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?o.replaceCaptures(this._contentName,e,t):this._contentName}},W=class extends U{retokenizeCapturedWithRuleId;constructor(e,t,n,r,o){super(e,t,n,r),this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},q=class extends U{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,o){super(e,t,n,null),this._match=new Y(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,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new X,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},z=class extends U{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,o){super(e,t,n,r),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,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new X,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},H=class extends U{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,o,s,a,i,l,c){super(e,t,n,r),this._begin=new Y(o,this.id),this.beginCaptures=s,this._end=new Y(a||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=i,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new 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}},K=class extends U{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,o,s,a,i,l){super(e,t,n,r),this._begin=new Y(o,this.id),this.beginCaptures=s,this.whileCaptures=i,this._while=new Y(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,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_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,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_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}},V=class e{static createCaptureRule(e,t,n,r,o){return e.registerRule(e=>new W(t,e,n,r,o))}static getCompiledRuleId(n,r,o){return n.id||r.registerRule(s=>{if(n.id=s,n.match)return new q(n.$vscodeTextmateLocation,n.id,n.name,n.match,e._compileCaptures(n.captures,r,o));if(void 0===n.begin){n.repository&&(o=t({},o,n.repository));let s=n.patterns;return void 0===s&&n.include&&(s=[{include:n.include}]),new z(n.$vscodeTextmateLocation,n.id,n.name,n.contentName,e._compilePatterns(s,r,o))}return n.while?new K(n.$vscodeTextmateLocation,n.id,n.name,n.contentName,n.begin,e._compileCaptures(n.beginCaptures||n.captures,r,o),n.while,e._compileCaptures(n.whileCaptures||n.captures,r,o),e._compilePatterns(n.patterns,r,o)):new H(n.$vscodeTextmateLocation,n.id,n.name,n.contentName,n.begin,e._compileCaptures(n.beginCaptures||n.captures,r,o),n.end,e._compileCaptures(n.endCaptures||n.captures,r,o),n.applyEndPatternLast,e._compilePatterns(n.patterns,r,o))}),n.id}static _compileCaptures(t,n,r){let o=[];if(t){let s=0;for(const e in t){if("$vscodeTextmateLocation"===e)continue;const t=parseInt(e,10);t>s&&(s=t)}for(let e=0;e<=s;e++)o[e]=null;for(const a in t){if("$vscodeTextmateLocation"===a)continue;const s=parseInt(a,10);let i=0;t[a].patterns&&(i=e.getCompiledRuleId(t[a],n,r)),o[s]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,i)}}return o}static _compilePatterns(t,n,r){let o=[];if(t)for(let s=0,a=t.length;s<a;s++){const a=t[s];let i=-1;if(a.include){const t=$(a.include);switch(t.kind){case 0:case 1:i=e.getCompiledRuleId(r[a.include],n,r);break;case 2:let o=r[t.ruleName];o&&(i=e.getCompiledRuleId(o,n,r));break;case 3:case 4:const s=t.scopeName,l=4===t.kind?t.ruleName:null,c=n.getExternalGrammar(s,r);if(c)if(l){let t=c.repository[l];t&&(i=e.getCompiledRuleId(t,n,c.repository))}else i=e.getCompiledRuleId(c.repository.$self,n,c.repository)}}else i=e.getCompiledRuleId(a,n,r);if(-1!==i){const e=n.getRule(i);let t=!1;if((e instanceof z||e instanceof H||e instanceof K)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;o.push(i)}}return{patterns:o,hasMissingPatterns:(t?t.length:0)!==o.length}}},Y=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let n=0,r=[],o=!1;for(let s=0;s<t;s++){if("\\"===e.charAt(s)&&s+1<t){const t=e.charAt(s+1);"z"===t?(r.push(e.substring(n,s)),r.push("$(?!\\n)(?<!\\n)"),n=s+2):"A"!==t&&"G"!==t||(o=!0),s++}}this.hasAnchor=o,0===n?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=j.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 F.lastIndex=0,this.source.replace(F,(e,t)=>l(n[parseInt(t,10)]||""))}_buildAnchorCache(){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let e,t,n,r,o=[],s=[],a=[],i=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),o[e]=n,s[e]=n,a[e]=n,i[e]=n,"\\"===n&&e+1<t&&(r=this.source.charAt(e+1),"A"===r?(o[e+1]="￿",s[e+1]="￿",a[e+1]="A",i[e+1]="A"):"G"===r?(o[e+1]="￿",s[e+1]="G",a[e+1]="￿",i[e+1]="G"):(o[e+1]=r,s[e+1]=r,a[e+1]=r,i[e+1]=r),e++);return{A0_G0:o.join(""),A0_G1:s.join(""),A1_G0:a.join(""),A1_G1:i.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 J(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(e=>e.resolveAnchors(t,n));return new J(e,r,this._items.map(e=>e.ruleId))}},J=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Q=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Z=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Q(e,8),this._embeddedLanguagesMatcher=new ee(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 Q(0,0);_getBasicScopeAttributes=new c(e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new Q(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/},ee=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])=>l(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 te=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function ne(e,t,n,r,o,s,a,i){const l=t.content.length;let c=!1,u=-1;if(a){const a=function(e,t,n,r,o,s){let a=o.beginRuleCapturedEOL?0:-1;const i=[];for(let l=o;l;l=l.pop()){const t=l.getRule(e);t instanceof K&&i.push({rule:t,stack:l})}for(let l=i.pop();l;l=i.pop()){const{ruleScanner:i,findOptions:c}=oe(l.rule,e,l.stack.endRule,n,r===a),u=i.findNextMatchSync(t,r,c);if(!u){o=l.stack.pop();break}if(-2!==u.ruleId){o=l.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(s.produce(l.stack,u.captureIndices[0].start),se(e,t,n,l.stack,s,l.rule.whileCaptures,u.captureIndices),s.produce(l.stack,u.captureIndices[0].end),a=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}return{stack:o,linePos:r,anchorPosition:a,isFirstLine:n}}(e,t,n,r,o,s);o=a.stack,r=a.linePos,n=a.isFirstLine,u=a.anchorPosition}const p=Date.now();for(;!c;){if(0!==i){if(Date.now()-p>i)return new te(o,!0)}d()}return new te(o,!1);function d(){const a=function(e,t,n,r,o,s){const a=function(e,t,n,r,o,s){const a=o.getRule(e),{ruleScanner:i,findOptions:l}=re(a,e,o.endRule,n,r===s),c=i.findNextMatchSync(t,r,l);if(c)return{captureIndices:c.captureIndices,matchedRuleId:c.ruleId};return null}(e,t,n,r,o,s),i=e.getInjections();if(0===i.length)return a;const l=function(e,t,n,r,o,s,a){let i,l=Number.MAX_VALUE,c=null,u=0;const p=s.contentNameScopesList.getScopeNames();for(let d=0,g=e.length;d<g;d++){const s=e[d];if(!s.matcher(p))continue;const g=t.getRule(s.ruleId),{ruleScanner:m,findOptions:f}=re(g,t,null,r,o===a),y=m.findNextMatchSync(n,o,f);if(!y)continue;const _=y.captureIndices[0].start;if(!(_>=l)&&(l=_,c=y.captureIndices,i=y.ruleId,u=s.priority,l===o))break}if(c)return{priorityMatch:-1===u,captureIndices:c,matchedRuleId:i};return null}(i,e,t,n,r,o,s);if(!l)return a;if(!a)return l;const c=a.captureIndices[0].start,u=l.captureIndices[0].start;if(u<c||l.priorityMatch&&u===c)return l;return a}(e,t,n,r,o,u);if(!a)return s.produce(o,l),void(c=!0);const i=a.captureIndices,p=a.matchedRuleId,d=!!(i&&i.length>0)&&i[0].end>r;if(-1===p){const a=o.getRule(e);s.produce(o,i[0].start),o=o.withContentNameScopesList(o.nameScopesList),se(e,t,n,o,s,a.endCaptures,i),s.produce(o,i[0].end);const p=o;if(o=o.parent,u=p.getAnchorPos(),!d&&p.getEnterPos()===r)return o=p,s.produce(o,l),void(c=!0)}else{const a=e.getRule(p);s.produce(o,i[0].start);const g=o,m=a.getName(t.content,i),f=o.contentNameScopesList.pushAttributed(m,e);if(o=o.push(p,r,u,i[0].end===l,null,f,f),a instanceof H){const r=a;se(e,t,n,o,s,r.beginCaptures,i),s.produce(o,i[0].end),u=i[0].end;const p=r.getContentName(t.content,i),m=f.pushAttributed(p,e);if(o=o.withContentNameScopesList(m),r.endHasBackReferences&&(o=o.withEndRule(r.getEndWithResolvedBackReferences(t.content,i))),!d&&g.hasSameRuleAs(o))return o=o.pop(),s.produce(o,l),void(c=!0)}else if(a instanceof K){const r=a;se(e,t,n,o,s,r.beginCaptures,i),s.produce(o,i[0].end),u=i[0].end;const p=r.getContentName(t.content,i),m=f.pushAttributed(p,e);if(o=o.withContentNameScopesList(m),r.whileHasBackReferences&&(o=o.withEndRule(r.getWhileWithResolvedBackReferences(t.content,i))),!d&&g.hasSameRuleAs(o))return o=o.pop(),s.produce(o,l),void(c=!0)}else{if(se(e,t,n,o,s,a.captures,i),s.produce(o,i[0].end),o=o.pop(),!d)return o=o.safePop(),s.produce(o,l),void(c=!0)}}i[0].end>r&&(r=i[0].end,n=!1)}}function re(e,t,n,r,o){return{ruleScanner:e.compileAG(t,n,r,o),findOptions:0}}function oe(e,t,n,r,o){return{ruleScanner:e.compileWhileAG(t,n,r,o),findOptions:0}}function se(e,t,n,r,o,s,a){if(0===s.length)return;const i=t.content,l=Math.min(s.length,a.length),c=[],u=a[0].end;for(let p=0;p<l;p++){const t=s[p];if(null===t)continue;const l=a[p];if(0===l.length)continue;if(l.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=l.start;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?o.produceFromScopes(c[c.length-1].scopes,l.start):o.produce(r,l.start),t.retokenizeCapturedWithRuleId){const s=t.getName(i,a),c=r.contentNameScopesList.pushAttributed(s,e),u=t.getContentName(i,a),p=c.pushAttributed(u,e),d=r.push(t.retokenizeCapturedWithRuleId,l.start,-1,!1,null,c,p),g=e.createOnigString(i.substring(0,l.end));ne(e,g,n&&0===l.start,l.start,d,o,!1,0),N(g);continue}const d=t.getName(i,a);if(null!==d){const t=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(d,e);c.push(new ae(t,l.end))}}for(;c.length>0;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var ae=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function ie(e,t,n,r,o){const s=v(t,le),a=V.getCompiledRuleId(n,r,o.repository);for(const i of s)e.push({debugSelector:t,matcher:i.matcher,ruleId:a,grammar:o,priority:i.priority})}function le(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(ce(t[r],e))return n=r+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 ue=class{constructor(e,t,n,r,o,s,a,i){if(this._rootScopeName=e,this.balancedBracketSelectors=s,this._onigLib=i,this._basicScopeAttributesProvider=new Z(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=he(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const l of Object.keys(o)){const e=v(l,le);for(const t of e)this._tokenTypeMatchers.push({matcher:t.matcher,type:o[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e=e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),t=[],n=this._rootScopeName,r=e(n);if(r){const e=r.injections;if(e)for(let n in e)ie(t,n,e[n],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(e=>{const n=this.getExternalGrammar(e);if(n){const e=n.injectionSelector;e&&ie(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]=he(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){let o;if(-1===this._rootId&&(this._rootId=V.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==de.NULL)o=!1,t.reset();else{o=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=S.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),s=this.getRule(this._rootId).getName(null,null);let a;a=s?pe.createRootAndLookUpScopeName(s,r,this):pe.createRoot("unknown",r),t=new de(null,this._rootId,-1,-1,!1,null,a,a)}e+="\n";const s=this.createOnigString(e),a=s.content.length,i=new me(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=ne(this,s,o,0,t,i,!0,r);return N(s),{lineLength:a,lineTokens:i,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function he(t,n){return(t=e(t)).repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=n||t.repository.$self,t}var pe=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,o=t?.scopePath??null;for(const s of n)o=p.push(o,s.scopeNames),r=new e(r,o,s.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new p(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const o=r.getMetadataForScope(t),s=new p(null,t),a=r.themeProvider.themeMatch(s),i=e.mergeAttributes(n,o,a);return new e(null,s,i)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let r=-1,o=0,s=0;return null!==n&&(r=n.fontStyle,o=n.foregroundId,s=n.backgroundId),S.set(e,t.languageId,t.tokenType,null,r,o,s)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const r=t.split(/ /g);let o=this;for(const s of r)o=e._pushAttributed(o,s,n);return o}static _pushAttributed(t,n,r){const o=r.getMetadataForScope(n),s=t.scopePath.push(n),a=r.themeProvider.themeMatch(s),i=e.mergeAttributes(t.tokenAttributes,o,a);return new e(t,s,i)}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}},de=class e{constructor(e,t,n,r,o,s,a,i){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=o,this.endRule=s,this.nameScopesList=a,this.contentNameScopesList=i,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&pe.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,o,s,a,i){return new e(this,t,n,r,o,s,a,i)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){const r=pe.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,pe.fromExtension(r,n.contentNameScopesList))}},ge=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):v(e,le).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>v(e,le).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}},me=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const t=e?.getScopeNames()??[];for(const e of this._tokenTypeOverrides)e.matcher(t)&&(n=S.set(n,0,C(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}return r&&(n=S.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n?void(this._lastTokenEndIndex=t):(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),void(this._lastTokenEndIndex=t))}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,o=this._binaryTokens.length;r<o;r++)n[r]=this._binaryTokens[r];return n}},fe=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,r,o){if(!this._grammars.has(e)){let s=this._rawGrammars.get(e);if(!s)return null;this._grammars.set(e,function(e,t,n,r,o,s,a,i){return new ue(e,t,n,r,o,s,a,i)}(e,s,t,n,r,o,this,this._onigLib))}return this._grammars.get(e)}},ye=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new fe(u.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=/* @__PURE__ */new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(u.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 ge(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,o){const s=new R(this._syncRegistry,e);for(;s.Q.length>0;)s.Q.map(e=>this._loadSingleGrammar(e.scopeName)),s.processQueue();return this._grammarForScopeName(e,t,n,r,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,o=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,o)}},_e=de.NULL;const be=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class ke{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function Se(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new ke(n,r,t)}function Ce(e){return e.toLowerCase()}ke.prototype.normal={},ke.prototype.property={},ke.prototype.space=void 0;class ve{constructor(e,t){this.attribute=t,this.property=e}}ve.prototype.attribute="",ve.prototype.booleanish=!1,ve.prototype.boolean=!1,ve.prototype.commaOrSpaceSeparated=!1,ve.prototype.commaSeparated=!1,ve.prototype.defined=!1,ve.prototype.mustUseProperty=!1,ve.prototype.number=!1,ve.prototype.overloadedBoolean=!1,ve.prototype.property="",ve.prototype.spaceSeparated=!1,ve.prototype.space=void 0;let we=0;const Ne=Ee(),Ae=Ee(),Pe=Ee(),xe=Ee(),Re=Ee(),Le=Ee(),Te=Ee();function Ee(){return 2**++we}const Ie=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,boolean:Ne,booleanish:Ae,commaOrSpaceSeparated:Te,commaSeparated:Le,number:xe,overloadedBoolean:Pe,spaceSeparated:Re},Symbol.toStringTag,{value:"Module"})),Oe=Object.keys(Ie);class Me extends ve{constructor(e,t,n,r){let o=-1;if(super(e,t),Ge(this,"space",r),"number"==typeof n)for(;++o<Oe.length;){const e=Oe[o];Ge(this,Oe[o],(n&Ie[e])===Ie[e])}}}function Ge(e,t,n){n&&(e[t]=n)}function Be(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new Me(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Ce(r)]=r,n[Ce(s.attribute)]=r}return new ke(t,n,e.space)}Me.prototype.defined=!0;const De=Be({properties:{ariaActiveDescendant:null,ariaAtomic:Ae,ariaAutoComplete:null,ariaBusy:Ae,ariaChecked:Ae,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:Re,ariaCurrent:null,ariaDescribedBy:Re,ariaDetails:null,ariaDisabled:Ae,ariaDropEffect:Re,ariaErrorMessage:null,ariaExpanded:Ae,ariaFlowTo:Re,ariaGrabbed:Ae,ariaHasPopup:null,ariaHidden:Ae,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Re,ariaLevel:xe,ariaLive:null,ariaModal:Ae,ariaMultiLine:Ae,ariaMultiSelectable:Ae,ariaOrientation:null,ariaOwns:Re,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:Ae,ariaReadOnly:Ae,ariaRelevant:null,ariaRequired:Ae,ariaRoleDescription:Re,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:Ae,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function $e(e,t){return t in e?e[t]:t}function je(e,t){return $e(e,t.toLowerCase())}const Fe=Be({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Le,acceptCharset:Re,accessKey:Re,action:null,allow:null,allowFullScreen:Ne,allowPaymentRequest:Ne,allowUserMedia:Ne,alt:null,as:null,async:Ne,autoCapitalize:null,autoComplete:Re,autoFocus:Ne,autoPlay:Ne,blocking:Re,capture:null,charSet:null,checked:Ne,cite:null,className:Re,cols:xe,colSpan:null,content:null,contentEditable:Ae,controls:Ne,controlsList:Re,coords:xe|Le,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ne,defer:Ne,dir:null,dirName:null,disabled:Ne,download:Pe,draggable:Ae,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ne,formTarget:null,headers:Re,height:xe,hidden:Pe,high:xe,href:null,hrefLang:null,htmlFor:Re,httpEquiv:Re,id:null,imageSizes:null,imageSrcSet:null,inert:Ne,inputMode:null,integrity:null,is:null,isMap:Ne,itemId:null,itemProp:Re,itemRef:Re,itemScope:Ne,itemType:Re,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ne,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:Ne,muted:Ne,name:null,nonce:null,noModule:Ne,noValidate:Ne,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ne,optimum:xe,pattern:null,ping:Re,placeholder:null,playsInline:Ne,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ne,referrerPolicy:null,rel:Re,required:Ne,reversed:Ne,rows:xe,rowSpan:xe,sandbox:Re,scope:null,scoped:Ne,seamless:Ne,selected:Ne,shadowRootClonable:Ne,shadowRootDelegatesFocus:Ne,shadowRootMode:null,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:Ae,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:Ne,useMap:null,value:Ae,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Re,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ne,declare:Ne,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:Ne,noHref:Ne,noShade:Ne,noWrap:Ne,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:Ae,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ne,disableRemotePlayback:Ne,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:je}),Ue=Be({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Te,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:Re,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:Ne,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Le,g2:Le,glyphName:Le,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:Te,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:xe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Re,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Te,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Te,rev:Te,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Te,requiredFeatures:Te,requiredFonts:Te,requiredFormats:Te,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:Te,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Te,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Te,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:$e}),We=Be({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),qe=Be({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:je}),ze=Be({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),He=/[A-Z]/g,Ke=/-[a-z]/g,Ve=/^data[-\w.:]+$/i;function Ye(e){return"-"+e.toLowerCase()}function Xe(e){return e.charAt(1).toUpperCase()}const Je=Se([De,Fe,We,qe,ze],"html"),Qe=Se([De,Ue,We,qe,ze],"svg"),Ze={}.hasOwnProperty;const et=/["&'<>`]/g,tt=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,nt=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,rt=/[|\\{}()[\]^$+*?.]/g,ot=/* @__PURE__ */new WeakMap;function st(e,t){return e=e.replace(t.subset?function(e){let t=ot.get(e);t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(rt,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),ot.set(e,t));return t}(t.subset):et,n),t.subset||t.escapeOnly?e:e.replace(tt,function(e,n,r){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}).replace(nt,n);function n(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}const at=/[\dA-Fa-f]/;const it=/\d/;const lt=["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"],ct={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:"€"},ut=["cent","copy","divide","gt","lt","not","para","times"],ht={}.hasOwnProperty,pt={};let dt;for(dt in ct)ht.call(ct,dt)&&(pt[ct[dt]]=dt);const gt=/[^\dA-Za-z]/;function mt(e,t,n){let r,o=function(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!at.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);if((n.useNamedReferences||n.useShortestReferences)&&(r=function(e,t,n,r){const o=String.fromCharCode(e);if(ht.call(pt,o)){const e=pt[o],s="&"+e;return n&&lt.includes(e)&&!ut.includes(e)&&(!r||t&&61!==t&&gt.test(String.fromCharCode(t)))?s:s+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const r=function(e,t,n){const r="&#"+String(e);return n&&t&&!it.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);r.length<o.length&&(o=r)}return r&&(!n.useShortestReferences||r.length<o.length)?r:o}function ft(e,t){return st(e,Object.assign({format:mt},t))}const yt=/^>|^->|<!--|-->|--!>|<!-$/g,_t=[">"],bt=["<",">"];function kt(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;-1!==o;)r++,o=n.indexOf(t,o+t.length);return r}function St(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}function Ct(e){return e.join(" ").trim()}const vt=/[ \t\n\f\r]/g;function wt(e){return"object"==typeof e?"text"===e.type&&Nt(e.value):Nt(e)}function Nt(e){return""===e.replace(vt,"")}const At=Rt(1),Pt=Rt(-1),xt=[];function Rt(e){return function(t,n,r){const o=t?t.children:xt;let s=(n||0)+e,a=o[s];if(!r)for(;a&&wt(a);)s+=e,a=o[s];return a}}const Lt={}.hasOwnProperty;function Tt(e){return function(t,n,r){return Lt.call(e,t.tagName)&&e[t.tagName](t,n,r)}}const Et=Tt({body:function(e,t,n){const r=At(n,t);return!r||"comment"!==r.type},caption:It,colgroup:It,dd:function(e,t,n){const r=At(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){const r=At(n,t);return Boolean(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:It,html:function(e,t,n){const r=At(n,t);return!r||"comment"!==r.type},li:function(e,t,n){const r=At(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){const r=At(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){const r=At(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){const r=At(n,t);return r?"element"===r.type&&("address"===r.tagName||"article"===r.tagName||"aside"===r.tagName||"blockquote"===r.tagName||"details"===r.tagName||"div"===r.tagName||"dl"===r.tagName||"fieldset"===r.tagName||"figcaption"===r.tagName||"figure"===r.tagName||"footer"===r.tagName||"form"===r.tagName||"h1"===r.tagName||"h2"===r.tagName||"h3"===r.tagName||"h4"===r.tagName||"h5"===r.tagName||"h6"===r.tagName||"header"===r.tagName||"hgroup"===r.tagName||"hr"===r.tagName||"main"===r.tagName||"menu"===r.tagName||"nav"===r.tagName||"ol"===r.tagName||"p"===r.tagName||"pre"===r.tagName||"section"===r.tagName||"table"===r.tagName||"ul"===r.tagName):!n||!("element"===n.type&&("a"===n.tagName||"audio"===n.tagName||"del"===n.tagName||"ins"===n.tagName||"map"===n.tagName||"noscript"===n.tagName||"video"===n.tagName))},rp:Ot,rt:Ot,tbody:function(e,t,n){const r=At(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:Mt,tfoot:function(e,t,n){return!At(n,t)},th:Mt,thead:function(e,t,n){const r=At(n,t);return Boolean(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){const r=At(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function It(e,t,n){const r=At(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&wt(r.value.charAt(0)))}function Ot(e,t,n){const r=At(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function Mt(e,t,n){const r=At(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}const Gt=Tt({body:function(e){const t=At(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&wt(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,n){const r=Pt(n,t),o=At(e,-1,!0);if(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&Et(r,n.children.indexOf(r),n))return!1;return Boolean(o&&"element"===o.type&&"col"===o.tagName)},head:function(e){const t=/* @__PURE__ */new Set;for(const r of e.children)if("element"===r.type&&("base"===r.tagName||"title"===r.tagName)){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||"element"===n.type},html:function(e){const t=At(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const r=Pt(n,t),o=At(e,-1);if(n&&r&&"element"===r.type&&("thead"===r.tagName||"tbody"===r.tagName)&&Et(r,n.children.indexOf(r),n))return!1;return Boolean(o&&"element"===o.type&&"tr"===o.tagName)}});const Bt={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 r=function(e,t){const n=Ce(t);let r=t,o=ve;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&Ve.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Ke,Xe);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Ke.test(e)){let n=e.replace(He,Ye);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}o=Me}return new o(r,t)}(e.schema,t),o=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,s=e.settings.allowDangerousCharacters?0:1;let a,i=e.quote;if(!r.overloadedBoolean||n!==r.attribute&&""!==n?!r.boolean&&!r.overloadedBoolean||"string"==typeof n&&n!==r.attribute&&""!==n||(n=Boolean(n)):n=!0,null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";const l=ft(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Bt.name[o][s]}));return!0===n?l:(n=Array.isArray(n)?(r.commaSeparated?St:Ct)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?l:(e.settings.preferUnquoted&&(a=ft(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Bt.unquoted[o][s]}))),a!==n&&(e.settings.quoteSmart&&kt(n,i)>kt(n,e.alternative)&&(i=e.alternative),a=i+ft(n,Object.assign({},e.settings.characterReferences,{subset:("'"===i?Bt.single:Bt.double)[o][s],attribute:!0}))+i),l+(a?"="+a:a)))}const $t=["<","&"];function jt(e,t,n,r){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?ft(e.value,Object.assign({},r.settings.characterReferences,{subset:$t})):e.value}const Ft=function(e,t){const n=t||{};function r(t,...n){let o=r.invalid;const s=r.handlers;if(t&&Ze.call(t,e)){const n=String(t[e]);o=Ze.call(s,n)?s[n]:r.unknown}if(o)return o.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,r){return r.settings.bogusComments?"<?"+ft(e.value,Object.assign({},r.settings.characterReferences,{subset:_t}))+">":"\x3c!--"+e.value.replace(yt,function(e){return ft(e,Object.assign({},r.settings.characterReferences,{subset:bt}))})+"--\x3e"},doctype:function(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,r){const o=r.schema,s="svg"!==o.space&&r.settings.omitOptionalTags;let a="svg"===o.space?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const i=[];let l;"html"===o.space&&"svg"===e.tagName&&(r.schema=Qe);const c=function(e,t){const n=[];let r,o=-1;if(t)for(r in t)if(null!==t[r]&&void 0!==t[r]){const o=Dt(e,r,t[r]);o&&n.push(o)}for(;++o<n.length;){const t=e.settings.tightAttributes?n[o].charAt(n[o].length-1):void 0;o!==n.length-1&&'"'!==t&&"'"!==t&&(n[o]+=" ")}return n.join("")}(r,e.properties),u=r.all("html"===o.space&&"template"===e.tagName?e.content:e);return r.schema=o,u&&(a=!1),!c&&s&&Gt(e,t,n)||(i.push("<",e.tagName,c?" "+c:""),a&&("svg"===o.space||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||"/"===l||l&&'"'!==l&&"'"!==l)&&i.push(" "),i.push("/")),i.push(">")),i.push(u),a||s&&Et(e,t,n)||i.push("</"+e.tagName+">"),i.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:jt(e,0,n,r)},root:function(e,t,n,r){return r.all(e)},text:jt}});const Ut={},Wt={},qt=[];function zt(e,t,n){return Ft(e,t,n,this)}function Ht(e){const t=[],n=e&&e.children||qt;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}let Kt=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Vt(e,t){const n="string"==typeof e?{}:{...e.colorReplacements},r="string"==typeof e?e:e.name;for(const[o,s]of Object.entries(t?.colorReplacements||{}))"string"==typeof s?n[o]=s:o===r&&Object.assign(n,s);return n}function Yt(e,t){return e&&t?.[e?.toLowerCase()]||e}function Xt(e){return Array.isArray(e)?e:[e]}async function Jt(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function Qt(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Zt(e){return"ansi"===e||Qt(e)}function en(e){return"none"===e}function tn(e){return en(e)}function nn(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 r of n)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function rn(e,t=!1){if(0===e.length)return[["",0]];const n=e.split(/(\r?\n)/g);let r=0;const o=[];for(let s=0;s<n.length;s+=2){const e=t?n[s]+(n[s+1]||""):n[s];o.push([e,r]),r+=n[s].length,r+=n[s+1]?.length||0}return o}function on(e){const t=rn(e,!0).map(([e])=>e);return{lines:t,indexToPos:function(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=n,o=0;for(const e of t){if(r<e.length)break;r-=e.length,o++}return{line:o,character:r}},posToIndex:function(e,n){let r=0;for(let o=0;o<e;o++)r+=t[o].length;return r+=n,r}}}const sn="light-dark()",an=["color","background-color"];function ln(e,t){let n=0;const r=[];for(const o of t)o>n&&r.push({...e,content:e.content.slice(n,o),offset:e.offset+n}),n=o;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function cn(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?ln(e,t):e})):e}function un(e,t,n,r,o="css-vars"){const s={content:e.content,explanation:e.explanation,offset:e.offset},a=t.map(t=>hn(e.variants[t])),i=new Set(a.flatMap(e=>Object.keys(e))),l={},c=(e,r)=>{const o="color"===r?"":"background-color"===r?"-bg":`-${r}`;return n+t[e]+("color"===r?"":o)};return a.forEach((e,n)=>{for(const s of i){const i=e[s]||"inherit";if(0===n&&r&&an.includes(s))if(r===sn&&a.length>1){const e=t.findIndex(e=>"light"===e),r=t.findIndex(e=>"dark"===e);if(-1===e||-1===r)throw new Kt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const u=a[e][s]||"inherit",p=a[r][s]||"inherit";l[s]=`light-dark(${u}, ${p})`,"css-vars"===o&&(l[c(n,s)]=i)}else l[s]=i;else"css-vars"===o&&(l[c(n,s)]=i)}}),s.htmlStyle=l,s}function hn(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&f.Italic&&(t["font-style"]="italic"),e.fontStyle&f.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&f.Underline&&n.push("underline"),e.fontStyle&f.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function pn(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}const dn=/* @__PURE__ */new WeakMap;function gn(e,t){dn.set(e,t)}function mn(e){return dn.get(e)}class fn{_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 fn(Object.fromEntries(Xt(t).map(e=>[e,_e])),e)}constructor(...e){if(2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return function(e){const t=[],n=/* @__PURE__ */new Set;function r(e){if(n.has(e))return;n.add(e);const o=e?.nameScopesList?.scopeName;o&&t.push(o),e.parent&&r(e.parent)}return r(e),t}(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function yn(){const e=/* @__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 Kt(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...r.indexToPos(e),offset:e}}{const t=r.lines[e.line];if(void 0===t)throw new Kt(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${r.lines.length}`);let n=e.character;if(n<0&&(n=t.length+n),n<0||n>t.length)throw new Kt(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:n,offset:r.posToIndex(e.line,n)}}};const r=on(t.source),o=(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 Kt(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const t=e[r],o=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,s=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,a=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,i=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(o||s||a||i){if(o&&s)continue;if(a&&i)continue;if(a&&n.start.offset===n.end.offset)continue;if(s&&t.start.offset===t.end.offset)continue;throw new Kt(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}(o),e.set(t.meta,{decorations:o,converter:r,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){if(!this.options.decorations?.length)return;return cn(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;const n=t(this),r=Array.from(e.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(r.length!==n.converter.lines.length)throw new Kt(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function o(e,t,n,o){const s=r[e];let i="",l=-1,c=-1;if(0===t&&(l=0),0===n&&(c=0),n===Number.POSITIVE_INFINITY&&(c=s.children.length),-1===l||-1===c)for(let r=0;r<s.children.length;r++)i+=_n(s.children[r]),-1===l&&i.length===t&&(l=r+1),-1===c&&i.length===n&&(c=r+1);if(-1===l)throw new Kt(`Failed to find start index for decoration ${JSON.stringify(o.start)}`);if(-1===c)throw new Kt(`Failed to find end index for decoration ${JSON.stringify(o.end)}`);const u=s.children.slice(l,c);if(o.alwaysWrap||u.length!==s.children.length)if(o.alwaysWrap||1!==u.length||"element"!==u[0].type){const e={type:"element",tagName:"span",properties:{},children:u};a(e,o,"wrapper"),s.children.splice(l,u.length,e)}else a(u[0],o,"token");else a(s,o,"line")}function s(e,t){r[e]=a(r[e],t,"line")}function a(e,t,n){const r=t.properties||{},o=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&nn(e,t.properties.class),e=o(e,n)||e}const i=[],l=n.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 r=e.line+1;r<n.line;r++)i.unshift(()=>s(r,t));o(n.line,0,n.character,t)}}i.forEach(e=>e())}}}function _n(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(_n).join(""):""}const bn=[
2
- /* @__PURE__ */yn()];function kn(e){const t=function(e){const t=[],n=[],r=[];for(const o of e)switch(o.enforce){case"pre":t.push(o);break;case"post":n.push(o);break;default:r.push(o)}return{pre:t,post:n,normal:r}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...bn]}var Sn=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Cn={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function vn(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 wn(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 Nn(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(0===r)t.push({type:"resetAll"});else if(r<=9){Cn[r]&&t.push({type:"setDecoration",value:Cn[r]})}else if(r<=29){const e=Cn[r-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Sn[r-30]}});else if(38===r){const n=wn(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===r)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Sn[r-40]}});else if(48===r){const n=wn(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===r?t.push({type:"resetBackgroundColor"}):53===r?t.push({type:"setDecoration",value:"overline"}):55===r?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Sn[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Sn[r-100+8]}})}return t}var An={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 Pn(e=An){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}let r;function o(e){return function(){if(r)return r;r=[];for(let n=0;n<Sn.length;n++)r.push(t(Sn[n]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let o=0;o<6;o++)for(let s=0;s<6;s++)r.push(n([e[t],e[o],e[s]]));let o=8;for(let t=0;t<24;t++,o+=10)r.push(n([o,o,o]));return r}()[e]}return{value:function(e){switch(e.type){case"named":return t(e.name);case"rgb":return n(e.rgb);case"table":return o(e.index)}}}}const xn={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 Rn(e,t,n){const r=Vt(e,n),o=rn(t),s=Pn(Object.fromEntries(Sn.map(t=>{const n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`,r=e.colors?.[n];return[t,r||xn[t]]}))),a=function(){let e=null,t=null,n=/* @__PURE__ */new Set;return{parse(r){const o=[];let s=0;do{const a=vn(r,s),i=a.sequence?r.substring(s,a.startPosition):r.substring(s);if(i.length>0&&o.push({value:i,foreground:e,background:t,decorations:new Set(n)}),a.sequence){const r=Nn(a.sequence);for(const o of r)"resetAll"===o.type?(e=null,t=null,n.clear()):"resetForegroundColor"===o.type?e=null:"resetBackgroundColor"===o.type?t=null:"resetDecoration"===o.type&&n.delete(o.value);for(const o of r)"setForegroundColor"===o.type?e=o.value:"setBackgroundColor"===o.type?t=o.value:"setDecoration"===o.type&&n.add(o.value)}s=a.position}while(s<r.length);return o}}}();return o.map(t=>a.parse(t[0]).map(n=>{let o,a;n.decorations.has("reverse")?(o=n.background?s.value(n.background):e.bg,a=n.foreground?s.value(n.foreground):e.fg):(o=n.foreground?s.value(n.foreground):e.fg,a=n.background?s.value(n.background):void 0),o=Yt(o,r),a=Yt(a,r),n.decorations.has("dim")&&(o=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],r=e[2],o=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${o}${o}`,16)/2).toString(16).padStart(2,"0")}`}if(3===e.length){const t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}(o));let i=f.None;return n.decorations.has("bold")&&(i|=f.Bold),n.decorations.has("italic")&&(i|=f.Italic),n.decorations.has("underline")&&(i|=f.Underline),n.decorations.has("strikethrough")&&(i|=f.Strikethrough),{content:n.value,offset:t[1],color:o,bgColor:a,fontStyle:i}}))}function Ln(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n,o=e.resolveLangAlias(n.lang||"text");if(Qt(o)||en(r))return rn(t).map(e=>[{content:e[0],offset:e[1]}]);const{theme:s,colorMap:a}=e.setTheme(r);if("ansi"===o)return Rn(s,t,n);const i=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new Kt(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(s.name))throw new Kt(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Tn(t,i,s,a,n)}function Tn(e,t,n,r,o){const s=En(e,t,n,r,o),a=new fn(s.stateStack,t.name,n.name);return gn(s.tokens,a),s.tokens}function En(e,t,n,r,o){const s=Vt(n,o),{tokenizeMaxLineLength:a=0,tokenizeTimeLimit:i=500}=o,l=rn(e);let c=o.grammarState?function(e,t){if(!(e instanceof fn))throw new Kt("Invalid grammar state");return e.getInternalStack(t)}(o.grammarState,n.name)??_e:null!=o.grammarContextCode?En(o.grammarContextCode,t,n,r,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:_e,u=[];const p=[];for(let d=0,g=l.length;d<g;d++){const[e,g]=l[d];if(""===e){u=[],p.push([]);continue}if(a>0&&e.length>=a){u=[],p.push([{content:e,offset:g,color:"",fontStyle:0}]);continue}let m,f,y;o.includeExplanation&&(m=t.tokenizeLine(e,c,i),f=m.tokens,y=0);const _=t.tokenizeLine2(e,c,i),b=_.tokens.length/2;for(let t=0;t<b;t++){const a=_.tokens[2*t],i=t+1<b?_.tokens[2*t+2]:e.length;if(a===i)continue;const l=_.tokens[2*t+1],c=Yt(r[S.getForeground(l)],s),p=S.getFontStyle(l),d={content:e.substring(a,i),offset:g+a,color:c,fontStyle:p};if(o.includeExplanation){const t=[];if("scopeName"!==o.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 r=0;for(;a+r<i;){const n=f[y],s=e.substring(n.startIndex,n.endIndex);r+=s.length,d.explanation.push({content:s,scopes:"scopeName"===o.includeExplanation?In(n.scopes):On(t,n.scopes)}),y+=1}}u.push(d)}p.push(u),u=[],c=_.ruleStack}return{tokens:p,stateStack:c}}function In(e){return e.map(e=>({scopeName:e}))}function On(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const o=t[r];n[r]={scopeName:o,themeMatches:Bn(e,o,t.slice(0,r))}}return n}function Mn(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function Gn(e,t,n){if(!Mn(e[e.length-1],t))return!1;let r=e.length-2,o=n.length-1;for(;r>=0&&o>=0;)Mn(e[r],n[o])&&(r-=1),o-=1;return-1===r}function Bn(e,t,n){const r=[];for(const{selectors:o,settings:s}of e)for(const e of o)if(Gn(e,t,n)){r.push(s);break}return r}function Dn(e,t,n){const r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),o=r.map(r=>{const o=Ln(e,t,{...n,theme:r.theme});return{tokens:o,state:mn(o),theme:"string"==typeof r.theme?r.theme:r.theme.name}}),s=function(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const o=e.map(e=>e[r]),s=t.map(()=>[]);t.forEach((e,t)=>e.push(s[t]));const a=o.map(()=>0),i=o.map(e=>e[0]);for(;i.every(e=>e);){const e=Math.min(...i.map(e=>e.content.length));for(let t=0;t<n;t++){const n=i[t];n.content.length===e?(s[t].push(n),a[t]+=1,i[t]=o[t][a[t]]):(s[t].push({...n,content:n.content.slice(0,e)}),i[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...o.map(e=>e.tokens)),a=s[0].map((e,t)=>e.map((e,o)=>{const a={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(a.explanation=e.explanation),s.forEach((e,n)=>{const{content:s,explanation:i,offset:l,...c}=e[t][o];a.variants[r[n].color]=c}),a})),i=o[0].state?new fn(Object.fromEntries(o.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),o[0].state.lang):void 0;return i&&gn(a,i),a}function $n(e,t,n){let r,o,s,a,i,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:p="css-vars"}=n,d=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===c?-1:t.color===c?1:0);if(0===d.length)throw new Kt("`themes` option must not be empty");const g=Dn(e,t,n);if(l=mn(g),c&&sn!==c&&!d.find(e=>e.color===c))throw new Kt(`\`themes\` option must contain the defaultColor key \`${c}\``);const m=d.map(t=>e.getTheme(t.theme)),f=d.map(e=>e.color);s=g.map(e=>e.map(e=>un(e,f,u,c,p))),l&&gn(s,l);const y=d.map(e=>Vt(e.theme,n));o=jn(d,m,y,u,c,"fg",p),r=jn(d,m,y,u,c,"bg",p),a=`shiki-themes ${m.map(e=>e.name).join(" ")}`,i=c?void 0:[o,r].join(";")}else{if(!("theme"in n))throw new Kt("Invalid options, either `theme` or `themes` must be provided");{const i=Vt(n.theme,n);s=Ln(e,t,n);const c=e.getTheme(n.theme);r=Yt(c.bg,i),o=Yt(c.fg,i),a=c.name,l=mn(s)}}return{tokens:s,fg:o,bg:r,themeName:a,rootStyle:i,grammarState:l}}function jn(e,t,n,r,o,s,a){return e.map((i,l)=>{const c=Yt(t[l][s],n[l])||"inherit",u=`${r+i.color}${"bg"===s?"-bg":""}:${c}`;if(0===l&&o){if(o===sn&&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 Kt('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Yt(t[r][s],n[r])||"inherit"}, ${Yt(t[o][s],n[o])||"inherit"});${u}`}return c}return"css-vars"===a?u:null}).filter(e=>!!e).join(";")}function Fn(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Fn(e,t,n),codeToTokens:(t,n)=>$n(e,t,n)}){let o=t;for(const m of kn(n))o=m.preprocess?.call(r,o,n)||o;let{tokens:s,fg:a,bg:i,themeName:l,rootStyle:c,grammarState:u}=$n(e,o,n);const{mergeWhitespaces:p=!0,mergeSameStyleTokens:d=!1}=n;!0===p?s=function(e){return e.map(e=>{const t=[];let n,r="";return e.forEach((o,s)=>{const a=!(o.fontStyle&&(o.fontStyle&f.Underline||o.fontStyle&f.Strikethrough));a&&o.content.match(/^\s+$/)&&e[s+1]?(void 0===n&&(n=o.offset),r+=o.content):r?(a?t.push({...o,offset:n,content:r+o.content}):t.push({content:r,offset:n},o),n=void 0,r=""):t.push(o)}),t})}(s):"never"===p&&(s=function(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;const t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;const[,n,r,o]=t;if(!n&&!o)return e;const s=[{...e,offset:e.offset+n.length,content:r}];return n&&s.unshift({content:n,offset:e.offset}),o&&s.push({content:o,offset:e.offset+n.length+r.length}),s}))}(s)),d&&(s=function(e){return e.map(e=>{const t=[];for(const n of e){if(0===t.length){t.push({...n});continue}const e=t[t.length-1],r=pn(e.htmlStyle||hn(e)),o=pn(n.htmlStyle||hn(n)),s=e.fontStyle&&(e.fontStyle&f.Underline||e.fontStyle&f.Strikethrough),a=n.fontStyle&&(n.fontStyle&f.Underline||n.fontStyle&f.Strikethrough);s||a||r!==o?t.push({...n}):e.content+=n.content}return t})}(s));const g={...r,get source(){return o}};for(const m of kn(n))s=m.tokens?.call(g,s)||s;return Un(s,{...n,fg:a,bg:i,themeName:l,rootStyle:!1!==n.rootStyle&&(n.rootStyle??c)},g,u)}function Un(e,t,n,r=mn(e)){const o=kn(t),s=[],a={type:"root",children:[]},{structure:i="classic",tabindex:l="0"}=t,c={class:`shiki ${t.themeName||""}`};!1!==t.rootStyle&&(null!=t.rootStyle?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`),!1!==l&&null!=l&&(c.tabindex=l.toString());for(const[f,y]of Object.entries(t.meta||{}))f.startsWith("_")||(c[f]=y);let u={type:"element",tagName:"pre",properties:c,children:[]},p={type:"element",tagName:"code",properties:{},children:s};const d=[],g={...n,structure:i,addClassToHast:nn,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return a},get pre(){return u},get code(){return p},get lines(){return d}};if(e.forEach((e,t)=>{t&&("inline"===i?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===i&&s.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},r=0;for(const s of e){let e={type:"element",tagName:"span",properties:{...s.htmlAttrs},children:[{type:"text",value:s.content}]};const l=pn(s.htmlStyle||hn(s));l&&(e.properties.style=l);for(const a of o)e=a?.span?.call(g,e,t+1,r,n,s)||e;"inline"===i?a.children.push(e):"classic"===i&&n.children.push(e),r+=s.content.length}if("classic"===i){for(const e of o)n=e?.line?.call(g,n,t+1)||n;d.push(n),s.push(n)}else"inline"===i&&d.push(n)}),"classic"===i){for(const e of o)p=e?.code?.call(g,p)||p;u.children.push(p);for(const e of o)u=e?.pre?.call(g,u)||u;a.children.push(u)}else if("inline"===i){const e=[];let t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const r of a.children)"element"===r.type&&"br"===r.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):"element"!==r.type&&"text"!==r.type||t.children.push(r);e.push(t);let n={type:"element",tagName:"code",properties:{},children:e};for(const r of o)n=r?.code?.call(g,n)||n;a.children=[];for(let r=0;r<n.children.length;r++){r>0&&a.children.push({type:"element",tagName:"br",properties:{},children:[]});const e=n.children[r];"element"===e.type&&a.children.push(...e.children)}}let m=a;for(const f of o)m=f?.root?.call(g,m)||m;return r&&gn(m,r),m}const Wn=function(e,t){const n=t||Ut,r=n.quote||'"',o='"'===r?"'":'"';if('"'!==r&&"'"!==r)throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:zt,all:Ht,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||be,characterReferences:n.characterReferences||Wt,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?Qe:Je,quote:r,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)};function qn(e,t,n){const r={meta:{},options:n,codeToHast:(t,n)=>Fn(e,t,n),codeToTokens:(t,n)=>$n(e,t,n)};let o=Wn(Fn(e,t,n,r));for(const s of kn(n))o=s.postprocess?.call(r,o,n)||o;return o}const zn="#333333",Hn="#bbbbbb",Kn="#fffffe",Vn="#1e1e1e",Yn="__shiki_resolved";function Xn(e){if(e?.[Yn])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){const e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r="light"===t.type?zn:Hn),n||(n="light"===t.type?Kn:Vn),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0;const s=/* @__PURE__ */new Map;function a(e){if(s.has(e))return s.get(e);o+=1;const n=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?a(e):(s.set(e,n),n)}t.settings=t.settings.map(e=>{const n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),r=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!r)return e;const o={...e,settings:{...e.settings}};if(n){const n=a(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,o.settings.foreground=n}if(r){const n=a(e.settings.background);t.colorReplacements[n]=e.settings.background,o.settings.background=n}return o});for(const i of Object.keys(t.colors||{}))if(("editor.foreground"===i||"editor.background"===i||i.startsWith("terminal.ansi"))&&!t.colors[i]?.startsWith("#")){const e=a(t.colors[i]);t.colorReplacements[e]=t.colors[i],t.colors[i]=e}return Object.defineProperty(t,Yn,{enumerable:!1,writable:!1,value:!0}),t}async function Jn(e){return Array.from(new Set((await Promise.all(e.filter(e=>!Zt(e)).map(async e=>await Jt(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function Qn(e){return(await Promise.all(e.map(async e=>tn(e)?null:Xn(await Jt(e))))).filter(e=>!!e)}function Zn(e,t=3){t>3||console.trace(`[SHIKI DEPRECATE]: ${e}`)}class er extends Error{constructor(e){super(e),this.name="ShikiError"}}function tr(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 er(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class nr extends ye{constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=/* @__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=Xn(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=u.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=tr(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 r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(const o of t)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const r of e)this.resolveEmbeddedLanguages(r);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 r=t.embeddedLanguages||t.embeddedLangs;return r?.some(e=>n.map(([e])=>e).includes(e))}).filter(e=>!n.includes(e));throw new er(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(const[r,o]of t)this._resolver.addLanguage(o);for(const[r,o]of t)this.loadLanguage(o)}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 rr{_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 r=1;r<=t.length;r++){const e=t.slice(0,r).join(".");n=[...n,...this._injections.get(e)||[]]}return n}}let or=0;function sr(e){or+=1,!1!==e.warnings&&or>=10&&or%10==0&&console.warn(`[Shiki] ${or} 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 er("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Xn),o=new rr(e.engine,n),s=new nr(o,r,n,e.langAlias);let a;function i(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();const t=s.getTheme(e);if(!t)throw new er(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(...e){u(),s.loadLanguages(e.flat(1))}function c(...e){u();for(const t of e.flat(1))s.loadTheme(t)}function u(){if(t)throw new er("Shiki instance has been disposed")}function p(){t||(t=!0,s.dispose(),or-=1)}return{setTheme:function(e){u();const t=i(e);return a!==e&&(s.setTheme(t),a=e),{theme:t,colorMap:s.getColorMap()}},getTheme:i,getLanguage:function(e){u();const t=s.getGrammar("string"==typeof e?e:e.name);if(!t)throw new er(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),s.getLoadedThemes()},getLoadedLanguages:function(){return u(),s.getLoadedLanguages()},resolveLangAlias:function(t){return tr(t,e.langAlias)},loadLanguage:async function(...e){return l(await Jn(e))},loadLanguageSync:l,loadTheme:async function(...e){return u(),c(await Qn(e))},loadThemeSync:c,dispose:p,[Symbol.dispose]:p}}async function ar(e){e.engine||Zn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([Qn(e.themes||[]),Jn(e.langs||[]),e.engine]);return sr({...e,themes:t,langs:n,engine:r})}async function ir(e){const t=await ar(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return mn(e[1]);const[t,n,r={}]=e,{lang:o="text",theme:s=t.getLoadedThemes()[0]}=r;if(Qt(o)||en(s))throw new Kt("Plain language does not have grammar state");if("ansi"===o)throw new Kt("ANSI language does not have grammar state");const{theme:a,colorMap:i}=t.setTheme(s),l=t.getLanguage(o);return new fn(En(n,l,a,i,r).stateStack,l.name,a.name)}(t,...e),codeToTokensBase:(e,n)=>Ln(t,e,n),codeToTokensWithThemes:(e,n)=>Dn(t,e,n),codeToTokens:(e,n)=>$n(t,e,n),codeToHast:(e,n)=>Fn(t,e,n),codeToHtml:(e,n)=>qn(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}export{Kt as ShikiError,nn as addClassToHast,Yt as applyColorReplacements,Fn as codeToHast,qn as codeToHtml,$n as codeToTokens,Ln as codeToTokensBase,Dn as codeToTokensWithThemes,ir as createHighlighterCore,on as createPositionConverter,ar as createShikiInternal,sr as createShikiInternalSync,un as flatTokenVariants,hn as getTokenStyleObject,Wn as hastToHtml,en as isNoneTheme,Qt as isPlainLang,Zt as isSpecialLang,tn as isSpecialTheme,Jt as normalizeGetter,Xn as normalizeTheme,Vt as resolveColorReplacements,rn as splitLines,ln as splitToken,cn as splitTokens,pn as stringifyTokenStyle,Xt as toArray,Rn as tokenizeAnsiWithTheme,Tn as tokenizeWithTheme,Un as tokensToHast,yn as transformerDecorations,Zn as warnDeprecated};
@@ -1,2 +0,0 @@
1
- let e=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function t(e){return Array.isArray(e)?function(e){let n=[];for(let r=0,o=e.length;r<o;r++)n[r]=t(e[r]);return n}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let n={};for(let r in e)n[r]=t(e[r]);return n}(e):e}function n(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,s=class{static hasCaptures(e){return null!==e&&(o.lastIndex=0,o.test(e))}static replaceCaptures(e,t,n){return e.replace(o,(e,r,o,s)=>{let a=n[parseInt(r||o,10)];if(!a)return e;{let e=t.substring(a.start,a.end);for(;"."===e[0];)e=e.substring(1);switch(s){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 i(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=a(e[r],t[r]);if(0!==n)return n}return 0}return n-r}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 c(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var u=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}},p=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let o=0,s=t.length;o<s;o++){let e,s=t[o];if(!s.settings)continue;if("string"==typeof s.scope){let t=s.scope;t=t.replace(/^[,]+/,""),t=t.replace(/[,]+$/,""),e=t.split(",")}else e=Array.isArray(s.scope)?s.scope:[""];let a=-1;if("string"==typeof s.settings.fontStyle){a=0;let e=s.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++){switch(e[t]){case"italic":a|=1;break;case"bold":a|=2;break;case"underline":a|=4;break;case"strikethrough":a|=8}}}let i=null;"string"==typeof s.settings.foreground&&l(s.settings.foreground)&&(i=s.settings.foreground);let c=null;"string"==typeof s.settings.background&&l(s.settings.background)&&(c=s.settings.background);for(let t=0,l=e.length;t<l;t++){let s=e[t].trim().split(" "),l=s[s.length-1],u=null;s.length>1&&(u=s.slice(0,s.length-1),u.reverse()),n[r++]=new f(l,u,o,a,i,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=i(e.parentScopes,t.parentScopes),0!==n?n:e.index-t.index)});let n=0,r="#000000",o="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(r=t.foreground),null!==t.background&&(o=t.background)}let s=new _(t),l=new m(n,s.getId(r),s.getId(o)),c=new S(new k(0,null,-1,0,0),[]);for(let a=0,i=e.length;a<i;a++){let t=e[a];c.insert(0,t.scope,t.parentScopes,t.fontStyle,s.getId(t.foreground),s.getId(t.background))}return new p(s,l,c)}(e,t)}_cachedMatchRoot=new u(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>function(e,t){if(0===t.length)return!0;for(let n=0;n<t.length;n++){let r=t[n],o=!1;if(">"===r){if(n===t.length-1)return!1;r=t[++n],o=!0}for(;e&&!g(e.scopeName,r);){if(o)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}},d=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(const r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function g(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 f=class{constructor(e,t,n,r,o,s){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=o,this.background=s}},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 _=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)}},b=Object.freeze([]),k=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,o){this.scopeDepth=e,this.parentScopes=t||b,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,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==r&&(this.background=r)}},S=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[r]&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){const o=t.parentScopes[r].length-e.parentScopes[n].length;if(0!==o)return o;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,r=t.indexOf(".");if(-1===r?(e=t,n=""):(e=t.substring(0,r),n=t.substring(r+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,o,s,a){if(""===n)return void this._doInsertHere(t,r,o,s,a);let i,l,c,u=n.indexOf(".");-1===u?(i=n,l=""):(i=n.substring(0,u),l=n.substring(u+1)),this._children.hasOwnProperty(i)?c=this._children[i]:(c=new e(this._mainRule.clone(),k.cloneArr(this._rulesWithParentScopes)),this._children[i]=c),c.insert(t+1,l,r,o,s,a)}_doInsertHere(e,t,n,r,o){if(null!==t){for(let s=0,a=this._rulesWithParentScopes.length;s<a;s++){let a=this._rulesWithParentScopes[s];if(0===i(a.parentScopes,t))return void a.acceptOverwrite(e,n,r,o)}-1===n&&(n=this._mainRule.fontStyle),0===r&&(r=this._mainRule.foreground),0===o&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new k(e,t,n,r,o))}else this._mainRule.acceptOverwrite(e,n,r,o)}},C=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){const n=e.getLanguageId(t),r=e.getTokenType(t),o=e.getFontStyle(t),s=e.getForeground(t),a=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:o,foreground:s,background:a})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,r,o,s,a,i){let l=e.getLanguageId(t),c=e.getTokenType(t),u=e.containsBalancedBrackets(t)?1:0,p=e.getFontStyle(t),d=e.getForeground(t),g=e.getBackground(t);return 0!==n&&(l=n),8!==r&&(c=r),null!==o&&(u=o?1:0),-1!==s&&(p=s),0!==a&&(d=a),0!==i&&(g=i),(l|c<<8|u<<10|p<<11|d<<15|g<<24)>>>0}};function v(e){return e}function w(e,t){const n=[],r=function(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}(e);let o=r.next();for(;null!==o;){let e=0;if(2===o.length&&":"===o.charAt(1)){switch(o.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=r.next()}let t=a();if(n.push({matcher:t,priority:e}),","!==o)break;o=r.next()}return n;function s(){if("-"===o){o=r.next();const e=s();return t=>!!e&&!e(t)}if("("===o){o=r.next();const e=function(){const e=[];let t=a();for(;t&&(e.push(t),"|"===o||","===o);){do{o=r.next()}while("|"===o||","===o);t=a()}return t=>e.some(e=>e(t))}();return")"===o&&(o=r.next()),e}if(N(o)){const e=[];do{e.push(o),o=r.next()}while(N(o));return n=>t(e,n)}return null}function a(){const e=[];let t=s();for(;t;)e.push(t),t=s();return t=>e.every(e=>e(t))}}function N(e){return!!e&&!!e.match(/[\w\.:]+/)}function A(e){"function"==typeof e.dispose&&e.dispose()}var P=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},x=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},R=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 P(this.initialScopeName)]}seenFullScopeRequests=/* @__PURE__ */new Set;seenPartialScopeRequests=/* @__PURE__ */new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new R;for(const n of e)T(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof P){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 T(e,t,n,r){const o=n.lookup(e.scopeName);if(!o){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const s=n.lookup(t);e instanceof P?I({baseGrammar:s,selfGrammar:o},r):E(e.ruleName,{baseGrammar:s,selfGrammar:o,repository:o.repository},r);const a=n.injections(e.scopeName);if(a)for(const i of a)r.add(new P(i))}function E(e,t,n){if(t.repository&&t.repository[e]){O([t.repository[e]],t,n)}}function I(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&O(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&O(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function O(e,t,r){for(const o of e){if(r.visitedRule.has(o))continue;r.visitedRule.add(o);const e=o.repository?n({},t.repository,o.repository):t.repository;Array.isArray(o.patterns)&&O(o.patterns,{...t,repository:e},r);const s=o.include;if(!s)continue;const a=j(s);switch(a.kind){case 0:I({...t,selfGrammar:t.baseGrammar},r);break;case 1:I(t,r);break;case 2:E(a.ruleName,{...t,repository:e},r);break;case 3:case 4:const n=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(n){const o={baseGrammar:t.baseGrammar,selfGrammar:n,repository:e};4===a.kind?E(a.ruleName,o,r):I(o,r)}else 4===a.kind?r.add(new x(a.scopeName,a.ruleName)):r.add(new P(a.scopeName))}}}var M=class{kind=0},G=class{kind=1},B=class{constructor(e){this.ruleName=e}kind=2},D=class{constructor(e){this.scopeName=e}kind=3},$=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function j(e){if("$base"===e)return new M;if("$self"===e)return new G;const t=e.indexOf("#");if(-1===t)return new D(e);if(0===t)return new B(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new $(n,r)}}var F=/\\(\d+)/,U=/\\(\d+)/g;var W=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=s.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=s.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?s.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?s.replaceCaptures(this._contentName,e,t):this._contentName}},q=class extends W{retokenizeCapturedWithRuleId;constructor(e,t,n,r,o){super(e,t,n,r),this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},z=class extends W{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,o){super(e,t,n,null),this._match=new X(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,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new J,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},H=class extends W{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,o){super(e,t,n,r),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,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new J,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},K=class extends W{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,o,s,a,i,l,c){super(e,t,n,r),this._begin=new X(o,this.id),this.beginCaptures=s,this._end=new X(a||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=i,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new J;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}},V=class extends W{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,o,s,a,i,l){super(e,t,n,r),this._begin=new X(o,this.id),this.beginCaptures=s,this.whileCaptures=i,this._while=new X(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,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new J;for(const t of this.patterns){e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new J,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,r,o){return e.registerRule(e=>new q(t,e,n,r,o))}static getCompiledRuleId(t,r,o){return t.id||r.registerRule(s=>{if(t.id=s,t.match)return new z(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,r,o));if(void 0===t.begin){t.repository&&(o=n({},o,t.repository));let s=t.patterns;return void 0===s&&t.include&&(s=[{include:t.include}]),new H(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(s,r,o))}return t.while?new V(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,r,o),t.while,e._compileCaptures(t.whileCaptures||t.captures,r,o),e._compilePatterns(t.patterns,r,o)):new K(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,r,o),t.end,e._compileCaptures(t.endCaptures||t.captures,r,o),t.applyEndPatternLast,e._compilePatterns(t.patterns,r,o))}),t.id}static _compileCaptures(t,n,r){let o=[];if(t){let s=0;for(const e in t){if("$vscodeTextmateLocation"===e)continue;const t=parseInt(e,10);t>s&&(s=t)}for(let e=0;e<=s;e++)o[e]=null;for(const a in t){if("$vscodeTextmateLocation"===a)continue;const s=parseInt(a,10);let i=0;t[a].patterns&&(i=e.getCompiledRuleId(t[a],n,r)),o[s]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,i)}}return o}static _compilePatterns(t,n,r){let o=[];if(t)for(let s=0,a=t.length;s<a;s++){const a=t[s];let i=-1;if(a.include){const t=j(a.include);switch(t.kind){case 0:case 1:i=e.getCompiledRuleId(r[a.include],n,r);break;case 2:let o=r[t.ruleName];o&&(i=e.getCompiledRuleId(o,n,r));break;case 3:case 4:const s=t.scopeName,l=4===t.kind?t.ruleName:null,c=n.getExternalGrammar(s,r);if(c)if(l){let t=c.repository[l];t&&(i=e.getCompiledRuleId(t,n,c.repository))}else i=e.getCompiledRuleId(c.repository.$self,n,c.repository)}}else i=e.getCompiledRuleId(a,n,r);if(-1!==i){const e=n.getRule(i);let t=!1;if((e instanceof H||e instanceof K||e instanceof V)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;o.push(i)}}return{patterns:o,hasMissingPatterns:(t?t.length:0)!==o.length}}},X=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let n=0,r=[],o=!1;for(let s=0;s<t;s++){if("\\"===e.charAt(s)&&s+1<t){const t=e.charAt(s+1);"z"===t?(r.push(e.substring(n,s)),r.push("$(?!\\n)(?<!\\n)"),n=s+2):"A"!==t&&"G"!==t||(o=!0),s++}}this.hasAnchor=o,0===n?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=F.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 U.lastIndex=0,this.source.replace(U,(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,r,o=[],s=[],a=[],i=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),o[e]=n,s[e]=n,a[e]=n,i[e]=n,"\\"===n&&e+1<t&&(r=this.source.charAt(e+1),"A"===r?(o[e+1]="￿",s[e+1]="￿",a[e+1]="A",i[e+1]="A"):"G"===r?(o[e+1]="￿",s[e+1]="G",a[e+1]="￿",i[e+1]="G"):(o[e+1]=r,s[e+1]=r,a[e+1]=r,i[e+1]=r),e++);return{A0_G0:o.join(""),A0_G1:s.join(""),A1_G0:a.join(""),A1_G1:i.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}},J=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 Q(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(e=>e.resolveAnchors(t,n));return new Q(e,r,this._items.map(e=>e.ruleId))}},Q=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){"function"==typeof this.scanner.dispose&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join("\n")}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Z=class{constructor(e,t){this.languageId=e,this.tokenType=t}},ee=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Z(e,8),this._embeddedLanguagesMatcher=new te(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 Z(0,0);_getBasicScopeAttributes=new u(e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new Z(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/},te=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])=>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 ne=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function re(e,t,n,r,o,s,a,i){const l=t.content.length;let c=!1,u=-1;if(a){const a=function(e,t,n,r,o,s){let a=o.beginRuleCapturedEOL?0:-1;const i=[];for(let l=o;l;l=l.pop()){const t=l.getRule(e);t instanceof V&&i.push({rule:t,stack:l})}for(let l=i.pop();l;l=i.pop()){const{ruleScanner:i,findOptions:c}=se(l.rule,e,l.stack.endRule,n,r===a),u=i.findNextMatchSync(t,r,c);if(!u){o=l.stack.pop();break}if(-2!==u.ruleId){o=l.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(s.produce(l.stack,u.captureIndices[0].start),ae(e,t,n,l.stack,s,l.rule.whileCaptures,u.captureIndices),s.produce(l.stack,u.captureIndices[0].end),a=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}return{stack:o,linePos:r,anchorPosition:a,isFirstLine:n}}(e,t,n,r,o,s);o=a.stack,r=a.linePos,n=a.isFirstLine,u=a.anchorPosition}const p=Date.now();for(;!c;){if(0!==i){if(Date.now()-p>i)return new ne(o,!0)}d()}return new ne(o,!1);function d(){const a=function(e,t,n,r,o,s){const a=function(e,t,n,r,o,s){const a=o.getRule(e),{ruleScanner:i,findOptions:l}=oe(a,e,o.endRule,n,r===s),c=i.findNextMatchSync(t,r,l);if(c)return{captureIndices:c.captureIndices,matchedRuleId:c.ruleId};return null}(e,t,n,r,o,s),i=e.getInjections();if(0===i.length)return a;const l=function(e,t,n,r,o,s,a){let i,l=Number.MAX_VALUE,c=null,u=0;const p=s.contentNameScopesList.getScopeNames();for(let d=0,g=e.length;d<g;d++){const s=e[d];if(!s.matcher(p))continue;const g=t.getRule(s.ruleId),{ruleScanner:m,findOptions:f}=oe(g,t,null,r,o===a),y=m.findNextMatchSync(n,o,f);if(!y)continue;const _=y.captureIndices[0].start;if(!(_>=l)&&(l=_,c=y.captureIndices,i=y.ruleId,u=s.priority,l===o))break}if(c)return{priorityMatch:-1===u,captureIndices:c,matchedRuleId:i};return null}(i,e,t,n,r,o,s);if(!l)return a;if(!a)return l;const c=a.captureIndices[0].start,u=l.captureIndices[0].start;if(u<c||l.priorityMatch&&u===c)return l;return a}(e,t,n,r,o,u);if(!a)return s.produce(o,l),void(c=!0);const i=a.captureIndices,p=a.matchedRuleId,d=!!(i&&i.length>0)&&i[0].end>r;if(-1===p){const a=o.getRule(e);s.produce(o,i[0].start),o=o.withContentNameScopesList(o.nameScopesList),ae(e,t,n,o,s,a.endCaptures,i),s.produce(o,i[0].end);const p=o;if(o=o.parent,u=p.getAnchorPos(),!d&&p.getEnterPos()===r)return o=p,s.produce(o,l),void(c=!0)}else{const a=e.getRule(p);s.produce(o,i[0].start);const g=o,m=a.getName(t.content,i),f=o.contentNameScopesList.pushAttributed(m,e);if(o=o.push(p,r,u,i[0].end===l,null,f,f),a instanceof K){const r=a;ae(e,t,n,o,s,r.beginCaptures,i),s.produce(o,i[0].end),u=i[0].end;const p=r.getContentName(t.content,i),m=f.pushAttributed(p,e);if(o=o.withContentNameScopesList(m),r.endHasBackReferences&&(o=o.withEndRule(r.getEndWithResolvedBackReferences(t.content,i))),!d&&g.hasSameRuleAs(o))return o=o.pop(),s.produce(o,l),void(c=!0)}else if(a instanceof V){const r=a;ae(e,t,n,o,s,r.beginCaptures,i),s.produce(o,i[0].end),u=i[0].end;const p=r.getContentName(t.content,i),m=f.pushAttributed(p,e);if(o=o.withContentNameScopesList(m),r.whileHasBackReferences&&(o=o.withEndRule(r.getWhileWithResolvedBackReferences(t.content,i))),!d&&g.hasSameRuleAs(o))return o=o.pop(),s.produce(o,l),void(c=!0)}else{if(ae(e,t,n,o,s,a.captures,i),s.produce(o,i[0].end),o=o.pop(),!d)return o=o.safePop(),s.produce(o,l),void(c=!0)}}i[0].end>r&&(r=i[0].end,n=!1)}}function oe(e,t,n,r,o){return{ruleScanner:e.compileAG(t,n,r,o),findOptions:0}}function se(e,t,n,r,o){return{ruleScanner:e.compileWhileAG(t,n,r,o),findOptions:0}}function ae(e,t,n,r,o,s,a){if(0===s.length)return;const i=t.content,l=Math.min(s.length,a.length),c=[],u=a[0].end;for(let p=0;p<l;p++){const t=s[p];if(null===t)continue;const l=a[p];if(0===l.length)continue;if(l.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=l.start;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?o.produceFromScopes(c[c.length-1].scopes,l.start):o.produce(r,l.start),t.retokenizeCapturedWithRuleId){const s=t.getName(i,a),c=r.contentNameScopesList.pushAttributed(s,e),u=t.getContentName(i,a),p=c.pushAttributed(u,e),d=r.push(t.retokenizeCapturedWithRuleId,l.start,-1,!1,null,c,p),g=e.createOnigString(i.substring(0,l.end));re(e,g,n&&0===l.start,l.start,d,o,!1,0),A(g);continue}const d=t.getName(i,a);if(null!==d){const t=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(d,e);c.push(new ie(t,l.end))}}for(;c.length>0;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var ie=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function le(e,t,n,r,o){const s=w(t,ce),a=Y.getCompiledRuleId(n,r,o.repository);for(const i of s)e.push({debugSelector:t,matcher:i.matcher,ruleId:a,grammar:o,priority:i.priority})}function ce(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(ue(t[r],e))return n=r+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 he=class{constructor(e,t,n,r,o,s,a,i){if(this._rootScopeName=e,this.balancedBracketSelectors=s,this._onigLib=i,this._basicScopeAttributesProvider=new ee(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=a,this._grammar=pe(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const l of Object.keys(o)){const e=w(l,ce);for(const t of e)this._tokenTypeMatchers.push({matcher:t.matcher,type:o[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e=e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),t=[],n=this._rootScopeName,r=e(n);if(r){const e=r.injections;if(e)for(let n in e)le(t,n,e[n],this,r);const o=this._grammarRepository.injections(n);o&&o.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]=pe(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){let o;if(-1===this._rootId&&(this._rootId=Y.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==ge.NULL)o=!1,t.reset();else{o=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=C.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),s=this.getRule(this._rootId).getName(null,null);let a;a=s?de.createRootAndLookUpScopeName(s,r,this):de.createRoot("unknown",r),t=new ge(null,this._rootId,-1,-1,!1,null,a,a)}e+="\n";const s=this.createOnigString(e),a=s.content.length,i=new fe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=re(this,s,o,0,t,i,!0,r);return A(s),{lineLength:a,lineTokens:i,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function pe(e,n){return(e=t(e)).repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=n||e.repository.$self,e}var de=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,o=t?.scopePath??null;for(const s of n)o=d.push(o,s.scopeNames),r=new e(r,o,s.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new d(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const o=r.getMetadataForScope(t),s=new d(null,t),a=r.themeProvider.themeMatch(s),i=e.mergeAttributes(n,o,a);return new e(null,s,i)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let r=-1,o=0,s=0;return null!==n&&(r=n.fontStyle,o=n.foregroundId,s=n.backgroundId),C.set(e,t.languageId,t.tokenType,null,r,o,s)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const r=t.split(/ /g);let o=this;for(const s of r)o=e._pushAttributed(o,s,n);return o}static _pushAttributed(t,n,r){const o=r.getMetadataForScope(n),s=t.scopePath.push(n),a=r.themeProvider.themeMatch(s),i=e.mergeAttributes(t.tokenAttributes,o,a);return new e(t,s,i)}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}},ge=class e{constructor(e,t,n,r,o,s,a,i){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=o,this.endRule=s,this.nameScopesList=a,this.contentNameScopesList=i,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&de.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,o,s,a,i){return new e(this,t,n,r,o,s,a,i)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){const r=de.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,de.fromExtension(r,n.contentNameScopesList))}},me=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):w(e,ce).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>w(e,ce).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}},fe=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const t=e?.getScopeNames()??[];for(const e of this._tokenTypeOverrides)e.matcher(t)&&(n=C.set(n,0,v(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}return r&&(n=C.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n?void(this._lastTokenEndIndex=t):(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),void(this._lastTokenEndIndex=t))}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),0===this._tokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,o=this._binaryTokens.length;r<o;r++)n[r]=this._binaryTokens[r];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,r,o){if(!this._grammars.has(e)){let s=this._rawGrammars.get(e);if(!s)return null;this._grammars.set(e,function(e,t,n,r,o,s,a,i){return new he(e,t,n,r,o,s,a,i)}(e,s,t,n,r,o,this,this._onigLib))}return this._grammars.get(e)}},_e=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new ye(p.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=/* @__PURE__ */new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(p.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,r,o){const s=new L(this._syncRegistry,e);for(;s.Q.length>0;)s.Q.map(e=>this._loadSingleGrammar(e.scopeName)),s.processQueue();return this._grammarForScopeName(e,t,n,r,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,o=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,o)}},be=ge.NULL;const ke=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class Se{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function Ce(e,t){const n={},r={};for(const o of e)Object.assign(n,o.property),Object.assign(r,o.normal);return new Se(n,r,t)}function ve(e){return e.toLowerCase()}Se.prototype.normal={},Se.prototype.property={},Se.prototype.space=void 0;class we{constructor(e,t){this.attribute=t,this.property=e}}we.prototype.attribute="",we.prototype.booleanish=!1,we.prototype.boolean=!1,we.prototype.commaOrSpaceSeparated=!1,we.prototype.commaSeparated=!1,we.prototype.defined=!1,we.prototype.mustUseProperty=!1,we.prototype.number=!1,we.prototype.overloadedBoolean=!1,we.prototype.property="",we.prototype.spaceSeparated=!1,we.prototype.space=void 0;let Ne=0;const Ae=Ie(),Pe=Ie(),xe=Ie(),Re=Ie(),Le=Ie(),Te=Ie(),Ee=Ie();function Ie(){return 2**++Ne}const Oe=/* @__PURE__ */Object.freeze(/* @__PURE__ */Object.defineProperty({__proto__:null,boolean:Ae,booleanish:Pe,commaOrSpaceSeparated:Ee,commaSeparated:Te,number:Re,overloadedBoolean:xe,spaceSeparated:Le},Symbol.toStringTag,{value:"Module"})),Me=Object.keys(Oe);class Ge extends we{constructor(e,t,n,r){let o=-1;if(super(e,t),Be(this,"space",r),"number"==typeof n)for(;++o<Me.length;){const e=Me[o];Be(this,Me[o],(n&Oe[e])===Oe[e])}}}function Be(e,t,n){n&&(e[t]=n)}function De(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new Ge(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[ve(r)]=r,n[ve(s.attribute)]=r}return new Se(t,n,e.space)}Ge.prototype.defined=!0;const $e=De({properties:{ariaActiveDescendant:null,ariaAtomic:Pe,ariaAutoComplete:null,ariaBusy:Pe,ariaChecked:Pe,ariaColCount:Re,ariaColIndex:Re,ariaColSpan:Re,ariaControls:Le,ariaCurrent:null,ariaDescribedBy:Le,ariaDetails:null,ariaDisabled:Pe,ariaDropEffect:Le,ariaErrorMessage:null,ariaExpanded:Pe,ariaFlowTo:Le,ariaGrabbed:Pe,ariaHasPopup:null,ariaHidden:Pe,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Le,ariaLevel:Re,ariaLive:null,ariaModal:Pe,ariaMultiLine:Pe,ariaMultiSelectable:Pe,ariaOrientation:null,ariaOwns:Le,ariaPlaceholder:null,ariaPosInSet:Re,ariaPressed:Pe,ariaReadOnly:Pe,ariaRelevant:null,ariaRequired:Pe,ariaRoleDescription:Le,ariaRowCount:Re,ariaRowIndex:Re,ariaRowSpan:Re,ariaSelected:Pe,ariaSetSize:Re,ariaSort:null,ariaValueMax:Re,ariaValueMin:Re,ariaValueNow:Re,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function je(e,t){return t in e?e[t]:t}function Fe(e,t){return je(e,t.toLowerCase())}const Ue=De({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Te,acceptCharset:Le,accessKey:Le,action:null,allow:null,allowFullScreen:Ae,allowPaymentRequest:Ae,allowUserMedia:Ae,alt:null,as:null,async:Ae,autoCapitalize:null,autoComplete:Le,autoFocus:Ae,autoPlay:Ae,blocking:Le,capture:null,charSet:null,checked:Ae,cite:null,className:Le,cols:Re,colSpan:null,content:null,contentEditable:Pe,controls:Ae,controlsList:Le,coords:Re|Te,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ae,defer:Ae,dir:null,dirName:null,disabled:Ae,download:xe,draggable:Pe,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ae,formTarget:null,headers:Le,height:Re,hidden:xe,high:Re,href:null,hrefLang:null,htmlFor:Le,httpEquiv:Le,id:null,imageSizes:null,imageSrcSet:null,inert:Ae,inputMode:null,integrity:null,is:null,isMap:Ae,itemId:null,itemProp:Le,itemRef:Le,itemScope:Ae,itemType:Le,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ae,low:Re,manifest:null,max:null,maxLength:Re,media:null,method:null,min:null,minLength:Re,multiple:Ae,muted:Ae,name:null,nonce:null,noModule:Ae,noValidate:Ae,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Ae,optimum:Re,pattern:null,ping:Le,placeholder:null,playsInline:Ae,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ae,referrerPolicy:null,rel:Le,required:Ae,reversed:Ae,rows:Re,rowSpan:Re,sandbox:Le,scope:null,scoped:Ae,seamless:Ae,selected:Ae,shadowRootClonable:Ae,shadowRootDelegatesFocus:Ae,shadowRootMode:null,shape:null,size:Re,sizes:null,slot:null,span:Re,spellCheck:Pe,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Re,step:null,style:null,tabIndex:Re,target:null,title:null,translate:null,type:null,typeMustMatch:Ae,useMap:null,value:Pe,width:Re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Le,axis:null,background:null,bgColor:null,border:Re,borderColor:null,bottomMargin:Re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ae,declare:Ae,event:null,face:null,frame:null,frameBorder:null,hSpace:Re,leftMargin:Re,link:null,longDesc:null,lowSrc:null,marginHeight:Re,marginWidth:Re,noResize:Ae,noHref:Ae,noShade:Ae,noWrap:Ae,object:null,profile:null,prompt:null,rev:null,rightMargin:Re,rules:null,scheme:null,scrolling:Pe,standby:null,summary:null,text:null,topMargin:Re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ae,disableRemotePlayback:Ae,prefix:null,property:null,results:Re,security:null,unselectable:null},space:"html",transform:Fe}),We=De({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ee,accentHeight:Re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Re,amplitude:Re,arabicForm:null,ascent:Re,attributeName:null,attributeType:null,azimuth:Re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Re,by:null,calcMode:null,capHeight:Re,className:Le,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Re,diffuseConstant:Re,direction:null,display:null,dur:null,divisor:Re,dominantBaseline:null,download:Ae,dx:null,dy:null,edgeMode:null,editable:null,elevation:Re,enableBackground:null,end:null,event:null,exponent:Re,externalResourcesRequired:null,fill:null,fillOpacity:Re,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Te,g2:Te,glyphName:Te,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Re,horizOriginX:Re,horizOriginY:Re,id:null,ideographic:Re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Re,k:Re,k1:Re,k2:Re,k3:Re,k4:Re,kernelMatrix:Ee,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Re,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Re,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Re,overlineThickness:Re,paintOrder:null,panose1:null,path:null,pathLength:Re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Le,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Re,pointsAtY:Re,pointsAtZ:Re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ee,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ee,rev:Ee,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ee,requiredFeatures:Ee,requiredFonts:Ee,requiredFormats:Ee,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Re,specularExponent:Re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Re,strikethroughThickness:Re,string:null,stroke:null,strokeDashArray:Ee,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Re,strokeOpacity:Re,strokeWidth:null,style:null,surfaceScale:Re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ee,tabIndex:Re,tableValues:null,target:null,targetX:Re,targetY:Re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ee,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Re,underlineThickness:Re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Re,values:null,vAlphabetic:Re,vMathematical:Re,vectorEffect:null,vHanging:Re,vIdeographic:Re,version:null,vertAdvY:Re,vertOriginX:Re,vertOriginY:Re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:je}),qe=De({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),ze=De({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Fe}),He=De({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),Ke=/[A-Z]/g,Ve=/-[a-z]/g,Ye=/^data[-\w.:]+$/i;function Xe(e){return"-"+e.toLowerCase()}function Je(e){return e.charAt(1).toUpperCase()}const Qe=Ce([$e,Ue,qe,ze,He],"html"),Ze=Ce([$e,We,qe,ze,He],"svg"),et={}.hasOwnProperty;const tt=/["&'<>`]/g,nt=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,rt=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,ot=/[|\\{}()[\]^$+*?.]/g,st=/* @__PURE__ */new WeakMap;function at(e,t){return e=e.replace(t.subset?function(e){let t=st.get(e);t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(ot,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),st.set(e,t));return t}(t.subset):tt,n),t.subset||t.escapeOnly?e:e.replace(nt,function(e,n,r){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}).replace(rt,n);function n(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}const it=/[\dA-Fa-f]/;const lt=/\d/;const ct=["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"],ut={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:"€"},ht=["cent","copy","divide","gt","lt","not","para","times"],pt={}.hasOwnProperty,dt={};let gt;for(gt in ut)pt.call(ut,gt)&&(dt[ut[gt]]=gt);const mt=/[^\dA-Za-z]/;function ft(e,t,n){let r,o=function(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!it.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);if((n.useNamedReferences||n.useShortestReferences)&&(r=function(e,t,n,r){const o=String.fromCharCode(e);if(pt.call(dt,o)){const e=dt[o],s="&"+e;return n&&ct.includes(e)&&!ht.includes(e)&&(!r||t&&61!==t&&mt.test(String.fromCharCode(t)))?s:s+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const r=function(e,t,n){const r="&#"+String(e);return n&&t&&!lt.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);r.length<o.length&&(o=r)}return r&&(!n.useShortestReferences||r.length<o.length)?r:o}function yt(e,t){return at(e,Object.assign({format:ft},t))}const _t=/^>|^->|<!--|-->|--!>|<!-$/g,bt=[">"],kt=["<",">"];function St(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;-1!==o;)r++,o=n.indexOf(t,o+t.length);return r}function Ct(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}function vt(e){return e.join(" ").trim()}const wt=/[ \t\n\f\r]/g;function Nt(e){return"object"==typeof e?"text"===e.type&&At(e.value):At(e)}function At(e){return""===e.replace(wt,"")}const Pt=Lt(1),xt=Lt(-1),Rt=[];function Lt(e){return function(t,n,r){const o=t?t.children:Rt;let s=(n||0)+e,a=o[s];if(!r)for(;a&&Nt(a);)s+=e,a=o[s];return a}}const Tt={}.hasOwnProperty;function Et(e){return function(t,n,r){return Tt.call(e,t.tagName)&&e[t.tagName](t,n,r)}}const It=Et({body:function(e,t,n){const r=Pt(n,t);return!r||"comment"!==r.type},caption:Ot,colgroup:Ot,dd:function(e,t,n){const r=Pt(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){const r=Pt(n,t);return Boolean(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:Ot,html:function(e,t,n){const r=Pt(n,t);return!r||"comment"!==r.type},li:function(e,t,n){const r=Pt(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){const r=Pt(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){const r=Pt(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){const r=Pt(n,t);return r?"element"===r.type&&("address"===r.tagName||"article"===r.tagName||"aside"===r.tagName||"blockquote"===r.tagName||"details"===r.tagName||"div"===r.tagName||"dl"===r.tagName||"fieldset"===r.tagName||"figcaption"===r.tagName||"figure"===r.tagName||"footer"===r.tagName||"form"===r.tagName||"h1"===r.tagName||"h2"===r.tagName||"h3"===r.tagName||"h4"===r.tagName||"h5"===r.tagName||"h6"===r.tagName||"header"===r.tagName||"hgroup"===r.tagName||"hr"===r.tagName||"main"===r.tagName||"menu"===r.tagName||"nav"===r.tagName||"ol"===r.tagName||"p"===r.tagName||"pre"===r.tagName||"section"===r.tagName||"table"===r.tagName||"ul"===r.tagName):!n||!("element"===n.type&&("a"===n.tagName||"audio"===n.tagName||"del"===n.tagName||"ins"===n.tagName||"map"===n.tagName||"noscript"===n.tagName||"video"===n.tagName))},rp:Mt,rt:Mt,tbody:function(e,t,n){const r=Pt(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:Gt,tfoot:function(e,t,n){return!Pt(n,t)},th:Gt,thead:function(e,t,n){const r=Pt(n,t);return Boolean(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){const r=Pt(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function Ot(e,t,n){const r=Pt(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&Nt(r.value.charAt(0)))}function Mt(e,t,n){const r=Pt(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function Gt(e,t,n){const r=Pt(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}const Bt=Et({body:function(e){const t=Pt(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&Nt(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,n){const r=xt(n,t),o=Pt(e,-1,!0);if(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&It(r,n.children.indexOf(r),n))return!1;return Boolean(o&&"element"===o.type&&"col"===o.tagName)},head:function(e){const t=/* @__PURE__ */new Set;for(const r of e.children)if("element"===r.type&&("base"===r.tagName||"title"===r.tagName)){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||"element"===n.type},html:function(e){const t=Pt(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const r=xt(n,t),o=Pt(e,-1);if(n&&r&&"element"===r.type&&("thead"===r.tagName||"tbody"===r.tagName)&&It(r,n.children.indexOf(r),n))return!1;return Boolean(o&&"element"===o.type&&"tr"===o.tagName)}});const Dt={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 $t(e,t,n){const r=function(e,t){const n=ve(t);let r=t,o=we;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&Ye.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Ve,Je);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Ve.test(e)){let n=e.replace(Ke,Xe);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}o=Ge}return new o(r,t)}(e.schema,t),o=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,s=e.settings.allowDangerousCharacters?0:1;let a,i=e.quote;if(!r.overloadedBoolean||n!==r.attribute&&""!==n?!r.boolean&&!r.overloadedBoolean||"string"==typeof n&&n!==r.attribute&&""!==n||(n=Boolean(n)):n=!0,null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";const l=yt(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Dt.name[o][s]}));return!0===n?l:(n=Array.isArray(n)?(r.commaSeparated?Ct:vt)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n?l:(e.settings.preferUnquoted&&(a=yt(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Dt.unquoted[o][s]}))),a!==n&&(e.settings.quoteSmart&&St(n,i)>St(n,e.alternative)&&(i=e.alternative),a=i+yt(n,Object.assign({},e.settings.characterReferences,{subset:("'"===i?Dt.single:Dt.double)[o][s],attribute:!0}))+i),l+(a?"="+a:a)))}const jt=["<","&"];function Ft(e,t,n,r){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?yt(e.value,Object.assign({},r.settings.characterReferences,{subset:jt})):e.value}const Ut=function(e,t){const n=t||{};function r(t,...n){let o=r.invalid;const s=r.handlers;if(t&&et.call(t,e)){const n=String(t[e]);o=et.call(s,n)?s[n]:r.unknown}if(o)return o.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,r){return r.settings.bogusComments?"<?"+yt(e.value,Object.assign({},r.settings.characterReferences,{subset:bt}))+">":"\x3c!--"+e.value.replace(_t,function(e){return yt(e,Object.assign({},r.settings.characterReferences,{subset:kt}))})+"--\x3e"},doctype:function(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,r){const o=r.schema,s="svg"!==o.space&&r.settings.omitOptionalTags;let a="svg"===o.space?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const i=[];let l;"html"===o.space&&"svg"===e.tagName&&(r.schema=Ze);const c=function(e,t){const n=[];let r,o=-1;if(t)for(r in t)if(null!==t[r]&&void 0!==t[r]){const o=$t(e,r,t[r]);o&&n.push(o)}for(;++o<n.length;){const t=e.settings.tightAttributes?n[o].charAt(n[o].length-1):void 0;o!==n.length-1&&'"'!==t&&"'"!==t&&(n[o]+=" ")}return n.join("")}(r,e.properties),u=r.all("html"===o.space&&"template"===e.tagName?e.content:e);return r.schema=o,u&&(a=!1),!c&&s&&Bt(e,t,n)||(i.push("<",e.tagName,c?" "+c:""),a&&("svg"===o.space||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||"/"===l||l&&'"'!==l&&"'"!==l)&&i.push(" "),i.push("/")),i.push(">")),i.push(u),a||s&&It(e,t,n)||i.push("</"+e.tagName+">"),i.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Ft(e,0,n,r)},root:function(e,t,n,r){return r.all(e)},text:Ft}});const Wt={},qt={},zt=[];function Ht(e,t,n){return Ut(e,t,n,this)}function Kt(e){const t=[],n=e&&e.children||zt;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function Vt(e,t){const n="string"==typeof e?{}:{...e.colorReplacements},r="string"==typeof e?e:e.name;for(const[o,s]of Object.entries(t?.colorReplacements||{}))"string"==typeof s?n[o]=s:o===r&&Object.assign(n,s);return n}function Yt(e,t){return e&&t?.[e?.toLowerCase()]||e}function Xt(e){return Array.isArray(e)?e:[e]}async function Jt(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function Qt(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Zt(e){return"ansi"===e||Qt(e)}function en(e){return"none"===e}function tn(e){return en(e)}function nn(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 r of n)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function rn(e,t=!1){if(0===e.length)return[["",0]];const n=e.split(/(\r?\n)/g);let r=0;const o=[];for(let s=0;s<n.length;s+=2){const e=t?n[s]+(n[s+1]||""):n[s];o.push([e,r]),r+=n[s].length,r+=n[s+1]?.length||0}return o}function on(e){const t=rn(e,!0).map(([e])=>e);return{lines:t,indexToPos:function(n){if(n===e.length)return{line:t.length-1,character:t[t.length-1].length};let r=n,o=0;for(const e of t){if(r<e.length)break;r-=e.length,o++}return{line:o,character:r}},posToIndex:function(e,n){let r=0;for(let o=0;o<e;o++)r+=t[o].length;return r+=n,r}}}const sn="light-dark()",an=["color","background-color"];function ln(e,t){let n=0;const r=[];for(const o of t)o>n&&r.push({...e,content:e.content.slice(n,o),offset:e.offset+n}),n=o;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function cn(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?ln(e,t):e})):e}function un(t,n,r,o,s="css-vars"){const a={content:t.content,explanation:t.explanation,offset:t.offset},i=n.map(e=>hn(t.variants[e])),l=new Set(i.flatMap(e=>Object.keys(e))),c={},u=(e,t)=>{const o="color"===t?"":"background-color"===t?"-bg":`-${t}`;return r+n[e]+("color"===t?"":o)};return i.forEach((t,r)=>{for(const a of l){const l=t[a]||"inherit";if(0===r&&o&&an.includes(a))if(o===sn&&i.length>1){const t=n.findIndex(e=>"light"===e),o=n.findIndex(e=>"dark"===e);if(-1===t||-1===o)throw new e('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const p=i[t][a]||"inherit",d=i[o][a]||"inherit";c[a]=`light-dark(${p}, ${d})`,"css-vars"===s&&(c[u(r,a)]=l)}else c[a]=l;else"css-vars"===s&&(c[u(r,a)]=l)}}),a.htmlStyle=c,a}function hn(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 pn(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}const dn=/* @__PURE__ */new WeakMap;function gn(e,t){dn.set(e,t)}function mn(e){return dn.get(e)}class fn{_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 fn(Object.fromEntries(Xt(t).map(e=>[e,be])),e)}constructor(...e){if(2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return function(e){const t=[],n=/* @__PURE__ */new Set;function r(e){if(n.has(e))return;n.add(e);const o=e?.nameScopesList?.scopeName;o&&t.push(o),e.parent&&r(e.parent)}return r(e),t}(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}}function yn(){const t=/* @__PURE__ */new WeakMap;function n(n){if(!t.has(n.meta)){let r=function(t){if("number"==typeof t){if(t<0||t>n.source.length)throw new e(`Invalid decoration offset: ${t}. Code length: ${n.source.length}`);return{...o.indexToPos(t),offset:t}}{const n=o.lines[t.line];if(void 0===n)throw new e(`Invalid decoration position ${JSON.stringify(t)}. Lines length: ${o.lines.length}`);let r=t.character;if(r<0&&(r=n.length+r),r<0||r>n.length)throw new e(`Invalid decoration position ${JSON.stringify(t)}. Line ${t.line} length: ${n.length}`);return{...t,character:r,offset:o.posToIndex(t.line,r)}}};const o=on(n.source),s=(n.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));!function(t){for(let n=0;n<t.length;n++){const r=t[n];if(r.start.offset>r.end.offset)throw new e(`Invalid decoration range: ${JSON.stringify(r.start)} - ${JSON.stringify(r.end)}`);for(let o=n+1;o<t.length;o++){const n=t[o],s=r.start.offset<=n.start.offset&&n.start.offset<r.end.offset,a=r.start.offset<n.end.offset&&n.end.offset<=r.end.offset,i=n.start.offset<=r.start.offset&&r.start.offset<n.end.offset,l=n.start.offset<r.end.offset&&r.end.offset<=n.end.offset;if(s||a||i||l){if(s&&a)continue;if(i&&l)continue;if(i&&r.start.offset===r.end.offset)continue;if(a&&n.start.offset===n.end.offset)continue;throw new e(`Decorations ${JSON.stringify(r.start)} and ${JSON.stringify(n.start)} intersect.`)}}}}(s),t.set(n.meta,{decorations:s,converter:o,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(e){if(!this.options.decorations?.length)return;return cn(e,n(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(t){if(!this.options.decorations?.length)return;const r=n(this),o=Array.from(t.children).filter(e=>"element"===e.type&&"span"===e.tagName);if(o.length!==r.converter.lines.length)throw new e(`Number of lines in code element (${o.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function s(t,n,r,s){const a=o[t];let l="",c=-1,u=-1;if(0===n&&(c=0),0===r&&(u=0),r===Number.POSITIVE_INFINITY&&(u=a.children.length),-1===c||-1===u)for(let e=0;e<a.children.length;e++)l+=_n(a.children[e]),-1===c&&l.length===n&&(c=e+1),-1===u&&l.length===r&&(u=e+1);if(-1===c)throw new e(`Failed to find start index for decoration ${JSON.stringify(s.start)}`);if(-1===u)throw new e(`Failed to find end index for decoration ${JSON.stringify(s.end)}`);const p=a.children.slice(c,u);if(s.alwaysWrap||p.length!==a.children.length)if(s.alwaysWrap||1!==p.length||"element"!==p[0].type){const e={type:"element",tagName:"span",properties:{},children:p};i(e,s,"wrapper"),a.children.splice(c,p.length,e)}else i(p[0],s,"token");else i(a,s,"line")}function a(e,t){o[e]=i(o[e],t,"line")}function i(e,t,n){const r=t.properties||{},o=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&nn(e,t.properties.class),e=o(e,n)||e}const l=[],c=r.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(const e of c){const{start:t,end:n}=e;if(t.line===n.line)s(t.line,t.character,n.character,e);else if(t.line<n.line){s(t.line,t.character,Number.POSITIVE_INFINITY,e);for(let r=t.line+1;r<n.line;r++)l.unshift(()=>a(r,e));s(n.line,0,n.character,e)}}l.forEach(e=>e())}}}function _n(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(_n).join(""):""}const bn=[
2
- /* @__PURE__ */yn()];function kn(e){const t=function(e){const t=[],n=[],r=[];for(const o of e)switch(o.enforce){case"pre":t.push(o);break;case"post":n.push(o);break;default:r.push(o)}return{pre:t,post:n,normal:r}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...bn]}var Sn=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Cn={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function vn(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 wn(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 Nn(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(0===r)t.push({type:"resetAll"});else if(r<=9){Cn[r]&&t.push({type:"setDecoration",value:Cn[r]})}else if(r<=29){const e=Cn[r-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Sn[r-30]}});else if(38===r){const n=wn(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===r)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Sn[r-40]}});else if(48===r){const n=wn(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===r?t.push({type:"resetBackgroundColor"}):53===r?t.push({type:"setDecoration",value:"overline"}):55===r?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Sn[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Sn[r-100+8]}})}return t}var An={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 Pn(e=An){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}let r;function o(e){return function(){if(r)return r;r=[];for(let n=0;n<Sn.length;n++)r.push(t(Sn[n]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let o=0;o<6;o++)for(let s=0;s<6;s++)r.push(n([e[t],e[o],e[s]]));let o=8;for(let t=0;t<24;t++,o+=10)r.push(n([o,o,o]));return r}()[e]}return{value:function(e){switch(e.type){case"named":return t(e.name);case"rgb":return n(e.rgb);case"table":return o(e.index)}}}}const xn={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 Rn(e,t,n){const r=Vt(e,n),o=rn(t),s=Pn(Object.fromEntries(Sn.map(t=>{const n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`,r=e.colors?.[n];return[t,r||xn[t]]}))),a=function(){let e=null,t=null,n=/* @__PURE__ */new Set;return{parse(r){const o=[];let s=0;do{const a=vn(r,s),i=a.sequence?r.substring(s,a.startPosition):r.substring(s);if(i.length>0&&o.push({value:i,foreground:e,background:t,decorations:new Set(n)}),a.sequence){const r=Nn(a.sequence);for(const o of r)"resetAll"===o.type?(e=null,t=null,n.clear()):"resetForegroundColor"===o.type?e=null:"resetBackgroundColor"===o.type?t=null:"resetDecoration"===o.type&&n.delete(o.value);for(const o of r)"setForegroundColor"===o.type?e=o.value:"setBackgroundColor"===o.type?t=o.value:"setDecoration"===o.type&&n.add(o.value)}s=a.position}while(s<r.length);return o}}}();return o.map(t=>a.parse(t[0]).map(n=>{let o,a;n.decorations.has("reverse")?(o=n.background?s.value(n.background):e.bg,a=n.foreground?s.value(n.foreground):e.fg):(o=n.foreground?s.value(n.foreground):e.fg,a=n.background?s.value(n.background):void 0),o=Yt(o,r),a=Yt(a,r),n.decorations.has("dim")&&(o=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],r=e[2],o=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${o}${o}`,16)/2).toString(16).padStart(2,"0")}`}if(3===e.length){const t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}const n=e.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:e}(o));let i=y.None;return n.decorations.has("bold")&&(i|=y.Bold),n.decorations.has("italic")&&(i|=y.Italic),n.decorations.has("underline")&&(i|=y.Underline),n.decorations.has("strikethrough")&&(i|=y.Strikethrough),{content:n.value,offset:t[1],color:o,bgColor:a,fontStyle:i}}))}function Ln(t,n,r={}){const{theme:o=t.getLoadedThemes()[0]}=r,s=t.resolveLangAlias(r.lang||"text");if(Qt(s)||en(o))return rn(n).map(e=>[{content:e[0],offset:e[1]}]);const{theme:a,colorMap:i}=t.setTheme(o);if("ansi"===s)return Rn(a,n,r);const l=t.getLanguage(r.lang||"text");if(r.grammarState){if(r.grammarState.lang!==l.name)throw new e(`Grammar state language "${r.grammarState.lang}" does not match highlight language "${l.name}"`);if(!r.grammarState.themes.includes(a.name))throw new e(`Grammar state themes "${r.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return Tn(n,l,a,i,r)}function Tn(e,t,n,r,o){const s=En(e,t,n,r,o),a=new fn(s.stateStack,t.name,n.name);return gn(s.tokens,a),s.tokens}function En(t,n,r,o,s){const a=Vt(r,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:l=500}=s,c=rn(t);let u=s.grammarState?function(t,n){if(!(t instanceof fn))throw new e("Invalid grammar state");return t.getInternalStack(n)}(s.grammarState,r.name)??be:null!=s.grammarContextCode?En(s.grammarContextCode,n,r,o,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:be,p=[];const d=[];for(let e=0,g=c.length;e<g;e++){const[t,g]=c[e];if(""===t){p=[],d.push([]);continue}if(i>0&&t.length>=i){p=[],d.push([{content:t,offset:g,color:"",fontStyle:0}]);continue}let m,f,y;s.includeExplanation&&(m=n.tokenizeLine(t,u,l),f=m.tokens,y=0);const _=n.tokenizeLine2(t,u,l),b=_.tokens.length/2;for(let e=0;e<b;e++){const n=_.tokens[2*e],i=e+1<b?_.tokens[2*e+2]:t.length;if(n===i)continue;const l=_.tokens[2*e+1],c=Yt(o[C.getForeground(l)],a),u=C.getFontStyle(l),d={content:t.substring(n,i),offset:g+n,color:c,fontStyle:u};if(s.includeExplanation){const e=[];if("scopeName"!==s.includeExplanation)for(const t of r.settings){let n;switch(typeof t.scope){case"string":n=t.scope.split(/,/).map(e=>e.trim());break;case"object":n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(/ /))})}d.explanation=[];let o=0;for(;n+o<i;){const n=f[y],r=t.substring(n.startIndex,n.endIndex);o+=r.length,d.explanation.push({content:r,scopes:"scopeName"===s.includeExplanation?In(n.scopes):On(e,n.scopes)}),y+=1}}p.push(d)}d.push(p),p=[],u=_.ruleStack}return{tokens:d,stateStack:u}}function In(e){return e.map(e=>({scopeName:e}))}function On(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const o=t[r];n[r]={scopeName:o,themeMatches:Bn(e,o,t.slice(0,r))}}return n}function Mn(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function Gn(e,t,n){if(!Mn(e[e.length-1],t))return!1;let r=e.length-2,o=n.length-1;for(;r>=0&&o>=0;)Mn(e[r],n[o])&&(r-=1),o-=1;return-1===r}function Bn(e,t,n){const r=[];for(const{selectors:o,settings:s}of e)for(const e of o)if(Gn(e,t,n)){r.push(s);break}return r}function Dn(e,t,n){const r=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),o=r.map(r=>{const o=Ln(e,t,{...n,theme:r.theme});return{tokens:o,state:mn(o),theme:"string"==typeof r.theme?r.theme:r.theme.name}}),s=function(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const o=e.map(e=>e[r]),s=t.map(()=>[]);t.forEach((e,t)=>e.push(s[t]));const a=o.map(()=>0),i=o.map(e=>e[0]);for(;i.every(e=>e);){const e=Math.min(...i.map(e=>e.content.length));for(let t=0;t<n;t++){const n=i[t];n.content.length===e?(s[t].push(n),a[t]+=1,i[t]=o[t][a[t]]):(s[t].push({...n,content:n.content.slice(0,e)}),i[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...o.map(e=>e.tokens)),a=s[0].map((e,t)=>e.map((e,o)=>{const a={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(a.explanation=e.explanation),s.forEach((e,n)=>{const{content:s,explanation:i,offset:l,...c}=e[t][o];a.variants[r[n].color]=c}),a})),i=o[0].state?new fn(Object.fromEntries(o.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),o[0].state.lang):void 0;return i&&gn(a,i),a}function $n(t,n,r){let o,s,a,i,l,c;if("themes"in r){const{defaultColor:u="light",cssVariablePrefix:p="--shiki-",colorsRendering:d="css-vars"}=r,g=Object.entries(r.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 e("`themes` option must not be empty");const m=Dn(t,n,r);if(c=mn(m),u&&sn!==u&&!g.find(e=>e.color===u))throw new e(`\`themes\` option must contain the defaultColor key \`${u}\``);const f=g.map(e=>t.getTheme(e.theme)),y=g.map(e=>e.color);a=m.map(e=>e.map(e=>un(e,y,p,u,d))),c&&gn(a,c);const _=g.map(e=>Vt(e.theme,r));s=jn(g,f,_,p,u,"fg",d),o=jn(g,f,_,p,u,"bg",d),i=`shiki-themes ${f.map(e=>e.name).join(" ")}`,l=u?void 0:[s,o].join(";")}else{if(!("theme"in r))throw new e("Invalid options, either `theme` or `themes` must be provided");{const e=Vt(r.theme,r);a=Ln(t,n,r);const l=t.getTheme(r.theme);o=Yt(l.bg,e),s=Yt(l.fg,e),i=l.name,c=mn(a)}}return{tokens:a,fg:s,bg:o,themeName:i,rootStyle:l,grammarState:c}}function jn(t,n,r,o,s,a,i){return t.map((l,c)=>{const u=Yt(n[c][a],r[c])||"inherit",p=`${o+l.color}${"bg"===a?"-bg":""}:${u}`;if(0===c&&s){if(s===sn&&t.length>1){const o=t.findIndex(e=>"light"===e.color),s=t.findIndex(e=>"dark"===e.color);if(-1===o||-1===s)throw new e('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Yt(n[o][a],r[o])||"inherit"}, ${Yt(n[s][a],r[s])||"inherit"});${p}`}return u}return"css-vars"===i?p:null}).filter(e=>!!e).join(";")}function Fn(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>Fn(e,t,n),codeToTokens:(t,n)=>$n(e,t,n)}){let o=t;for(const m of kn(n))o=m.preprocess?.call(r,o,n)||o;let{tokens:s,fg:a,bg:i,themeName:l,rootStyle:c,grammarState:u}=$n(e,o,n);const{mergeWhitespaces:p=!0,mergeSameStyleTokens:d=!1}=n;!0===p?s=function(e){return e.map(e=>{const t=[];let n,r="";return e.forEach((o,s)=>{const a=!(o.fontStyle&&(o.fontStyle&y.Underline||o.fontStyle&y.Strikethrough));a&&o.content.match(/^\s+$/)&&e[s+1]?(void 0===n&&(n=o.offset),r+=o.content):r?(a?t.push({...o,offset:n,content:r+o.content}):t.push({content:r,offset:n},o),n=void 0,r=""):t.push(o)}),t})}(s):"never"===p&&(s=function(e){return e.map(e=>e.flatMap(e=>{if(e.content.match(/^\s+$/))return e;const t=e.content.match(/^(\s*)(.*?)(\s*)$/);if(!t)return e;const[,n,r,o]=t;if(!n&&!o)return e;const s=[{...e,offset:e.offset+n.length,content:r}];return n&&s.unshift({content:n,offset:e.offset}),o&&s.push({content:o,offset:e.offset+n.length+r.length}),s}))}(s)),d&&(s=function(e){return e.map(e=>{const t=[];for(const n of e){if(0===t.length){t.push({...n});continue}const e=t[t.length-1],r=pn(e.htmlStyle||hn(e)),o=pn(n.htmlStyle||hn(n)),s=e.fontStyle&&(e.fontStyle&y.Underline||e.fontStyle&y.Strikethrough),a=n.fontStyle&&(n.fontStyle&y.Underline||n.fontStyle&y.Strikethrough);s||a||r!==o?t.push({...n}):e.content+=n.content}return t})}(s));const g={...r,get source(){return o}};for(const m of kn(n))s=m.tokens?.call(g,s)||s;return Un(s,{...n,fg:a,bg:i,themeName:l,rootStyle:!1!==n.rootStyle&&(n.rootStyle??c)},g,u)}function Un(e,t,n,r=mn(e)){const o=kn(t),s=[],a={type:"root",children:[]},{structure:i="classic",tabindex:l="0"}=t,c={class:`shiki ${t.themeName||""}`};!1!==t.rootStyle&&(null!=t.rootStyle?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`),!1!==l&&null!=l&&(c.tabindex=l.toString());for(const[f,y]of Object.entries(t.meta||{}))f.startsWith("_")||(c[f]=y);let u={type:"element",tagName:"pre",properties:c,children:[],data:t.data},p={type:"element",tagName:"code",properties:{},children:s};const d=[],g={...n,structure:i,addClassToHast:nn,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return a},get pre(){return u},get code(){return p},get lines(){return d}};if(e.forEach((e,t)=>{t&&("inline"===i?a.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===i&&s.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},r=0;for(const s of e){let e={type:"element",tagName:"span",properties:{...s.htmlAttrs},children:[{type:"text",value:s.content}]};const l=pn(s.htmlStyle||hn(s));l&&(e.properties.style=l);for(const a of o)e=a?.span?.call(g,e,t+1,r,n,s)||e;"inline"===i?a.children.push(e):"classic"===i&&n.children.push(e),r+=s.content.length}if("classic"===i){for(const e of o)n=e?.line?.call(g,n,t+1)||n;d.push(n),s.push(n)}else"inline"===i&&d.push(n)}),"classic"===i){for(const e of o)p=e?.code?.call(g,p)||p;u.children.push(p);for(const e of o)u=e?.pre?.call(g,u)||u;a.children.push(u)}else if("inline"===i){const e=[];let t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const r of a.children)"element"===r.type&&"br"===r.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):"element"!==r.type&&"text"!==r.type||t.children.push(r);e.push(t);let n={type:"element",tagName:"code",properties:{},children:e};for(const r of o)n=r?.code?.call(g,n)||n;a.children=[];for(let r=0;r<n.children.length;r++){r>0&&a.children.push({type:"element",tagName:"br",properties:{},children:[]});const e=n.children[r];"element"===e.type&&a.children.push(...e.children)}}let m=a;for(const f of o)m=f?.root?.call(g,m)||m;return r&&gn(m,r),m}const Wn=function(e,t){const n=t||Wt,r=n.quote||'"',o='"'===r?"'":'"';if('"'!==r&&"'"!==r)throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:Ht,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||ke,characterReferences:n.characterReferences||qt,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?Ze:Qe,quote:r,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)};function qn(e,t,n){const r={meta:{},options:n,codeToHast:(t,n)=>Fn(e,t,n),codeToTokens:(t,n)=>$n(e,t,n)};let o=Wn(Fn(e,t,n,r));for(const s of kn(n))o=s.postprocess?.call(r,o,n)||o;return o}const zn="#333333",Hn="#bbbbbb",Kn="#fffffe",Vn="#1e1e1e",Yn="__shiki_resolved";function Xn(e){if(e?.[Yn])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){const e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r="light"===t.type?zn:Hn),n||(n="light"===t.type?Kn:Vn),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let o=0;const s=/* @__PURE__ */new Map;function a(e){if(s.has(e))return s.get(e);o+=1;const n=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?a(e):(s.set(e,n),n)}t.settings=t.settings.map(e=>{const n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),r=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!r)return e;const o={...e,settings:{...e.settings}};if(n){const n=a(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,o.settings.foreground=n}if(r){const n=a(e.settings.background);t.colorReplacements[n]=e.settings.background,o.settings.background=n}return o});for(const i of Object.keys(t.colors||{}))if(("editor.foreground"===i||"editor.background"===i||i.startsWith("terminal.ansi"))&&!t.colors[i]?.startsWith("#")){const e=a(t.colors[i]);t.colorReplacements[e]=t.colors[i],t.colors[i]=e}return Object.defineProperty(t,Yn,{enumerable:!1,writable:!1,value:!0}),t}async function Jn(e){return Array.from(new Set((await Promise.all(e.filter(e=>!Zt(e)).map(async e=>await Jt(e).then(e=>Array.isArray(e)?e:[e])))).flat()))}async function Qn(e){return(await Promise.all(e.map(async e=>tn(e)?null:Xn(await Jt(e))))).filter(e=>!!e)}function Zn(e,t=3){t>3||console.trace(`[SHIKI DEPRECATE]: ${e}`)}class er extends Error{constructor(e){super(e),this.name="ShikiError"}}function tr(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 er(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return e}class nr extends _e{constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}_resolvedThemes=/* @__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=Xn(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=p.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=tr(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 r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(const o of t)this._resolvedGrammars.delete(o.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(o.scopeName),this._syncRegistry?._grammars?.delete(o.scopeName),this.loadLanguage(this._langMap.get(o.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const r of e)this.resolveEmbeddedLanguages(r);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 r=t.embeddedLanguages||t.embeddedLangs;return r?.some(e=>n.map(([e])=>e).includes(e))}).filter(e=>!n.includes(e));throw new er(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(const[r,o]of t)this._resolver.addLanguage(o);for(const[r,o]of t)this.loadLanguage(o)}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 rr{_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 r=1;r<=t.length;r++){const e=t.slice(0,r).join(".");n=[...n,...this._injections.get(e)||[]]}return n}}let or=0;function sr(e){or+=1,!1!==e.warnings&&or>=10&&or%10==0&&console.warn(`[Shiki] ${or} 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 er("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Xn),o=new rr(e.engine,n),s=new nr(o,r,n,e.langAlias);let a;function i(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};u();const t=s.getTheme(e);if(!t)throw new er(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(...e){u(),s.loadLanguages(e.flat(1))}function c(...e){u();for(const t of e.flat(1))s.loadTheme(t)}function u(){if(t)throw new er("Shiki instance has been disposed")}function p(){t||(t=!0,s.dispose(),or-=1)}return{setTheme:function(e){u();const t=i(e);return a!==e&&(s.setTheme(t),a=e),{theme:t,colorMap:s.getColorMap()}},getTheme:i,getLanguage:function(e){u();const t=s.getGrammar("string"==typeof e?e:e.name);if(!t)throw new er(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return u(),s.getLoadedThemes()},getLoadedLanguages:function(){return u(),s.getLoadedLanguages()},resolveLangAlias:function(t){return tr(t,e.langAlias)},loadLanguage:async function(...e){return l(await Jn(e))},loadLanguageSync:l,loadTheme:async function(...e){return u(),c(await Qn(e))},loadThemeSync:c,dispose:p,[Symbol.dispose]:p}}async function ar(e){e.engine||Zn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([Qn(e.themes||[]),Jn(e.langs||[]),e.engine]);return sr({...e,themes:t,langs:n,engine:r})}async function ir(t){const n=await ar(t);return{getLastGrammarState:(...t)=>function(...t){if(2===t.length)return mn(t[1]);const[n,r,o={}]=t,{lang:s="text",theme:a=n.getLoadedThemes()[0]}=o;if(Qt(s)||en(a))throw new e("Plain language does not have grammar state");if("ansi"===s)throw new e("ANSI language does not have grammar state");const{theme:i,colorMap:l}=n.setTheme(a),c=n.getLanguage(s);return new fn(En(r,c,i,l,o).stateStack,c.name,i.name)}(n,...t),codeToTokensBase:(e,t)=>Ln(n,e,t),codeToTokensWithThemes:(e,t)=>Dn(n,e,t),codeToTokens:(e,t)=>$n(n,e,t),codeToHast:(e,t)=>Fn(n,e,t),codeToHtml:(e,t)=>qn(n,e,t),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...n,getInternalContext:()=>n}}export{e as ShikiError,nn as addClassToHast,Yt as applyColorReplacements,Fn as codeToHast,qn as codeToHtml,$n as codeToTokens,Ln as codeToTokensBase,Dn as codeToTokensWithThemes,ir as createHighlighterCore,on as createPositionConverter,ar as createShikiInternal,sr as createShikiInternalSync,un as flatTokenVariants,hn as getTokenStyleObject,Wn as hastToHtml,en as isNoneTheme,Qt as isPlainLang,Zt as isSpecialLang,tn as isSpecialTheme,Jt as normalizeGetter,Xn as normalizeTheme,Vt as resolveColorReplacements,rn as splitLines,ln as splitToken,cn as splitTokens,pn as stringifyTokenStyle,Xt as toArray,Rn as tokenizeAnsiWithTheme,Tn as tokenizeWithTheme,Un as tokensToHast,yn as transformerDecorations,Zn as warnDeprecated};
@@ -1 +0,0 @@
1
- const e={buttons:{edit:"Modifica questa pagina",retryPublish:"Riprova a pubblicare",reloadApp:"Ricarica applicazione",reload:"Ricarica",signOut:"Disconnetti",review:"Rivedi",publish:"Pubblica",back:"Indietro",backToEdition:"Torna all'edizione",seeChanges:"Vedi differenze"},headings:{directories:"Cartelle",files:"File",media:"Media",pageSettings:"Impostazioni pagina"},tooltips:{toggleStudio:"Attiva/Disattiva Studio",unlinkEditor:"Scollega editor e anteprima",linkEditor:"Collega editor e anteprima",copiedToClipboard:"Copiato negli appunti",copyToClipboard:"Copia negli appunti",publishChanges:"Pubblica modifiche",backToContent:"Torna al contenuto"},notifications:{error:{unknown:"Si è verificato un errore sconosciuto"}},publish:{failedTitle:"Pubblicazione fallita",summary:"su {branch} del repository {repo}",errorTitle:"Errore durante la pubblicazione su {providerName}",failedGeneric:"Impossibile pubblicare le modifiche"},review:{title:"Rivedi modifiche",created:"Creato",updated:"Aggiornato",renamed:"Rinominato",deleted:"Eliminato"},publishSuccess:{title:"Modifiche pubblicate",summary:"{count} modifica pubblicata su {branch} del repository {repo} | {count} modifiche pubblicate su {branch} del repository {repo}",alertTitleWaiting:"Pubblicazione in corso...",alertTitleComplete:"Pubblicazione completata",alertDescWaiting:"Il sito web deve essere pubblicato affinché le modifiche siano visibili in Studio.",alertDescComplete:"Una nuova versione del tuo sito web è stata pubblicata. Ricarica l'app per vedere le modifiche in Studio."},newVersionBanner:{title:"Nuova versione del sito web rilevata",description:"Una nuova versione del tuo sito web è stata pubblicata. Ricarica l'app per vedere le ultime modifiche.",reloadButton:"Ricarica"},footer:{developer_view:"Vista sviluppatore",localFilesystem:"Filesystem locale in uso",debugMode:"Modalità Debug"},alert:{mdcFormatting:"Formattazione applicata per allinearsi allo standard di sintassi MDC."},conflict:{title:"Conflitto rilevato",repository:"Repository",branch:"Branch",file:"File",description:"Il contenuto su {providerName} differisce dalla versione del tuo sito web. Assicurati che le tue ultime modifiche siano pubblicate e aggiorna la pagina.",websiteVersion:"Sito web"},nav:{content:"Content",media:"Media"},placeholders:{commitMessage:"Messaggio di commit",order:"N°",fileName:"Nome file"},validation:{commitRequired:"Il messaggio di commit è obbligatorio",nameEmpty:"Il nome non può essere vuoto",nameEndsWithDot:"Il nome non può terminare con '.'",nameStartsWithSlash:"Il nome non può iniziare con '/'",nameExists:"Il nome esiste già",prefixDigitsOnly:"Il prefisso deve essere una stringa contenente solo cifre",prefixNonNegativeInteger:"Il prefisso deve essere un intero non negativo"},media:{altFilePreview:"Anteprima file",altImagePreview:"Anteprima immagine",playAudio:"Riproduci audio",audioTagNotSupported:"Il tuo browser non supporta il tag audio.",playVideo:"Riproduci video",videoTagNotSupported:"Il tuo browser non supporta il tag video.",metaWidth:"Larghezza",metaHeight:"Altezza",metaType:"Tipo",metaDuration:"Durata",metaSize:"Dimensione",fileName:"Nome file",publicPath:"Percorso pubblico",providerPath:"Percorso {providerName}",markdown:"Markdown"},aria:{openActions:"Apri azioni",cancel:"Annulla",submit:"Invia"},actions:{confirmAction:"Clicca nuovamente per {action}",verbs:{create:"creare",delete:"eliminare",rename:"rinominare",upload:"caricare",duplicate:"duplicare"},labels:{createDocument:"Nuovo file",createDocumentFolder:"Nuova cartella",createMediaFolder:"Nuova cartella media",renameItem:"Rinomina",deleteItem:"Elimina",uploadMedia:"Carica media",duplicateItem:"Duplica",revertItem:"Ripristina modifiche",publishBranch:"Pubblica branch",openGitProvider:"Apri su {providerName}",switchToTipTap:"Usa editor visuale",switchToCode:"Usa editor di codice"},tooltips:{createDocument:"Crea un nuovo file",createDocumentFolder:"Crea una nuova cartella",createMediaFolder:"Crea una nuova cartella",renameItem:"Rinomina file",deleteItem:"Elimina file",uploadMedia:"Carica media",duplicateItem:"Duplica file",revertItem:"Ripristina modifiche",publishBranch:"Pubblica branch"}},items:{itemCount:"1 elemento | {count} elementi"},monaco:{headings:{h1:"Titolo 1",h2:"Titolo 2",h3:"Titolo 3"},styles:{bold:"Grassetto",italic:"Corsivo"},lists:{bulleted:"Elenco puntato",numbered:"Elenco numerato"},other:{emojis:"Emoji",blockquote:"Citazione",code:"Codice",inlineCode:"Codice in linea",link:"Link",image:"Immagine"},writeSomething:"Scrivi qualcosa",snippets:{title:"titolo",item1:"Elemento 1",item2:"Elemento 2",language:"lingua",code:"codice",link:"link",alt:"alt",src:"src",value:"valore"},docs:{path:"Percorso nel progetto:",props:"Props",slots:"Slots",type:"tipo",required:"obbligatorio",default:"predefinito"}},tiptap:{editor:{placeholder:"Scrivi, digita '/' per i comandi...",components:"Componenti"},toolbar:{h1:"Titolo 1",h2:"Titolo 2",h3:"Titolo 3",h4:"Titolo 4",bulletList:"Elenco puntato",orderedList:"Elenco numerato",blockquote:"Citazione",codeBlock:"Blocco di codice",bold:"Grassetto",italic:"Corsivo",strike:"Barrato",code:"Codice",headings:"Titoli"},suggestion:{style:"Stile",paragraph:"Paragrafo",insert:"Inserisci",image:"Immagine",video:"Video",horizontalRule:"Linea orizzontale"},drag:{turnInto:"Trasforma in",resetFormatting:"Reimposta formattazione",duplicate:"Duplica",copyToClipboard:"Copia negli appunti",moveUp:"Sposta su",moveDown:"Sposta giù",insertBefore:"Inserisci prima",insertAfter:"Inserisci dopo",delete:"Elimina"},element:{addSlot:"Aggiungi slot",editProps:"Modifica props",delete:"Elimina",prop:"prop",props:{label:"props",itemsCount:"{count} elemento | {count} elementi",fieldsCount:"{count} campo | {count} campi",edit:"Modifica {type}"}},slot:{searchPlaceholder:"Cerca o crea uno slot...",deleteSlot:"Elimina slot",noSlotsAvailable:"Nessuno slot predefinito disponibile"},inlineElement:{editContent:"Modifica contenuto",editProps:"Modifica props",delete:"Elimina",editContentLabel:"Modifica contenuto {name}",enterContentPlaceholder:"Inserisci contenuto...",apply:"Applica"},codeBlock:{filenamePlaceholder:"filename.js"},link:{pasteLinkPlaceholder:"Incolla un link...",applyLink:"Applica link",openInNewWindow:"Apri in una nuova finestra",removeLink:"Rimuovi link"},spanStyle:{label:"Stile span",stylePlaceholder:"Stili: es. color: tomato; font-weight: 600;",classPlaceholder:"Classi: separate da spazi",apply:"Applica",remove:"Rimuovi"},binding:{variablePlaceholder:"Nome variabile",defaultValuePlaceholder:"Valore predefinito"},image:{source:"URL origine immagine",altText:"Testo alternativo",title:"Titolo immagine",width:"Larghezza",height:"Altezza",noSource:"Nessuna fonte immagine",edit:"Modifica immagine",delete:"Elimina immagine"}},mediaPicker:{image:{title:"Seleziona immagine",description:"Scegli un'immagine dalla tua libreria media",notAvailable:"Nessuna immagine disponibile nella tua libreria media",upload:"Carica"},video:{title:"Seleziona video",description:"Scegli un video dalla tua libreria media",notAvailable:"Nessun video disponibile nella tua libreria media",upload:"Carica"}},form:{array:{addItem:"Aggiungi {label}",deleteItem:"Elimina elemento",editItem:"Modifica elemento",unsupportedType:"Tipo di array {type} non supportato"},object:{noProperties:"Nessuna proprietà definita",enterPlaceholder:"Inserisci {field}..."},section:{propertyCount:"1 proprietà | {count} proprietà"},media:{placeholder:"Percorso relativo o URL pubblico...",searchPlaceholder:"Cerca immagini...",noImagesFound:"Nessuna immagine trovata",noImagesAvailable:"Nessuna immagine disponibile",imageCount:"{count} di {total} immagine | {count} di {total} immagini"},icon:{placeholder:"i-lucide-icon",searchPlaceholder:"Cerca icone...",noIconsFound:"Nessuna icona trovata",searchHint:"Digita almeno 2 caratteri per cercare",libraries:"Librerie:",allLibraries:"Tutte"},text:{placeholder:"Inserisci testo...",selectPlaceholder:"Seleziona un'opzione..."},date:{selectDate:"Seleziona data"},number:{placeholder:"0"}}},i={studio:e};export{i as default,e as studio};