@malloy-publisher/sdk 0.0.181 → 0.0.183-dev

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 (32) hide show
  1. package/dist/ServerProvider-lOQXDlqB.cjs.js +1 -0
  2. package/dist/{ServerProvider-DN2wSIAZ.es.js → ServerProvider-on-8FH5Z.es.js} +1259 -764
  3. package/dist/client/api.d.ts +674 -20
  4. package/dist/client/index.cjs.js +1 -1
  5. package/dist/client/index.es.js +57 -44
  6. package/dist/core-CjeTkq8O.es.js +7515 -0
  7. package/dist/core-YNpOLuB1.cjs.js +148 -0
  8. package/dist/engine-oniguruma-BkproSVE.cjs.js +1 -0
  9. package/dist/engine-oniguruma-C4vnmooL.es.js +272 -0
  10. package/dist/github-light-BFTOhCbz.cjs.js +1 -0
  11. package/dist/github-light-JYsPkUQd.es.js +4 -0
  12. package/dist/hooks/useDimensionFilters.d.ts +2 -0
  13. package/dist/hooks/useDimensionalFilterRangeData.d.ts +19 -5
  14. package/dist/index-BOLBP6_i.cjs.js +233 -0
  15. package/dist/index-DRDu9kIV.es.js +53627 -0
  16. package/dist/index.cjs.js +1 -244
  17. package/dist/index.es.js +48 -58039
  18. package/dist/json-71t8ZF9g.es.js +6 -0
  19. package/dist/json-y-J1j5EW.cjs.js +1 -0
  20. package/dist/sql-BqWZrLHB.cjs.js +1 -0
  21. package/dist/sql-DCkt643-.es.js +6 -0
  22. package/dist/typescript-BqvpT6pB.cjs.js +1 -0
  23. package/dist/typescript-buWNZFwO.es.js +6 -0
  24. package/package.json +6 -8
  25. package/src/components/Notebook/Notebook.tsx +162 -108
  26. package/src/components/ServerProvider.tsx +8 -0
  27. package/src/components/filter/DimensionFilter.tsx +68 -39
  28. package/src/components/highlighter.ts +54 -32
  29. package/src/hooks/useDimensionFilters.ts +2 -0
  30. package/src/hooks/useDimensionalFilterRangeData.ts +27 -13
  31. package/src/index.ts +0 -5
  32. package/dist/ServerProvider-DSeOLGfV.cjs.js +0 -1
@@ -0,0 +1,148 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const me=require("./engine-oniguruma-BkproSVE.cjs.js"),P=require("./index-BOLBP6_i.cjs.js");let q=class extends Error{constructor(e){super(e),this.name="ShikiError"}},$e=!1,In=!1;function zr(t=!0,e=!1){$e=t,In=e}function B(t,e=3){if($e&&!(typeof $e=="number"&&e>$e)){if(In)throw new Error(`[SHIKI DEPRECATE]: ${t}`);console.trace(`[SHIKI DEPRECATE]: ${t}`)}}function Vr(t){return Tt(t)}function Tt(t){return Array.isArray(t)?Kr(t):t instanceof RegExp?t:typeof t=="object"?Qr(t):t}function Kr(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=Tt(t[n]);return e}function Qr(t){let e={};for(let n in t)e[n]=Tt(t[n]);return e}function Nn(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function xn(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?xn(t.substring(0,t.length-1)):t.substr(~e+1)}var st=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Re=class{static hasCaptures(t){return t===null?!1:(st.lastIndex=0,st.test(t))}static replaceCaptures(t,e,n){return t.replace(st,(r,s,a,i)=>{let o=n[parseInt(s||a,10)];if(o){let c=e.substring(o.start,o.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Tn(t,e){return t<e?-1:t>e?1:0}function $n(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let a=Tn(t[s],e[s]);if(a!==0)return a}return 0}return n-r}function Qt(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function Gn(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ln=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},Oe=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Zr(t),e)}static createFromParsedTheme(t,e){return es(t,e)}_cachedMatchRoot=new Ln(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,r=this._cachedMatchRoot.get(e).find(s=>Jr(t.parent,s.parentScopes));return r?new Pn(r.fontStyle,r.foreground,r.background):null}},at=class Ge{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new Ge(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new Ge(n,e[r]);return n}push(e){return new Ge(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function Jr(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!Xr(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function Xr(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var Pn=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Zr(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,a=e.length;s<a;s++){let i=e[s];if(!i.settings)continue;let o;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),o=h.split(",")}else Array.isArray(i.scope)?o=i.scope:o=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.settings.fontStyle.split(" ");for(let g=0,f=h.length;g<f;g++)switch(h[g]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof i.settings.foreground=="string"&&Qt(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Qt(i.settings.background)&&(u=i.settings.background);for(let h=0,g=o.length;h<g;h++){let p=o[h].trim().split(" "),b=p[p.length-1],m=null;p.length>1&&(m=p.slice(0,p.length-1),m.reverse()),n[r++]=new Yr(b,m,s,c,l,u)}}return n}var Yr=class{constructor(t,e,n,r,s,a){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=a}},H=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(H||{});function es(t,e){t.sort((c,l)=>{let u=Tn(c.scope,l.scope);return u!==0||(u=$n(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let c=t.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let a=new ts(e),i=new Pn(n,a.getId(r),a.getId(s)),o=new rs(new Ct(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];o.insert(0,u.scope,u.parentScopes,u.fontStyle,a.getId(u.foreground),a.getId(u.background))}return new Oe(a,i,o)}var ts=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},ns=Object.freeze([]),Ct=class On{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,a){this.scopeDepth=e,this.parentScopes=n||ns,this.fontStyle=r,this.foreground=s,this.background=a}clone(){return new On(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},rs=class _t{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const a=n.parentScopes[s].length-e.parentScopes[r].length;if(a!==0)return a;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,a;if(r===-1?(s=e,a=""):(s=e.substring(0,r),a=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(a)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(_t._cmpBySpecificity),n}insert(e,n,r,s,a,i){if(n===""){this._doInsertHere(e,r,s,a,i);return}let o=n.indexOf("."),c,l;o===-1?(c=n,l=""):(c=n.substring(0,o),l=n.substring(o+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new _t(this._mainRule.clone(),Ct.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(e+1,l,r,s,a,i)}_doInsertHere(e,n,r,s,a){if(n===null){this._mainRule.acceptOverwrite(e,r,s,a);return}for(let i=0,o=this._rulesWithParentScopes.length;i<o;i++){let c=this._rulesWithParentScopes[i];if($n(c.parentScopes,n)===0){c.acceptOverwrite(e,r,s,a);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),a===0&&(a=this._mainRule.background),this._rulesWithParentScopes.push(new Ct(e,n,r,s,a))}},ne=class M{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=M.getLanguageId(e),r=M.getTokenType(e),s=M.getFontStyle(e),a=M.getForeground(e),i=M.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:a,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,a,i,o){let c=M.getLanguageId(e),l=M.getTokenType(e),u=M.containsBalancedBrackets(e)?1:0,h=M.getFontStyle(e),g=M.getForeground(e),f=M.getBackground(e);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),a!==-1&&(h=a),i!==0&&(g=i),o!==0&&(f=o),(c<<0|l<<8|u<<10|h<<11|g<<15|f<<24)>>>0}};function Me(t,e){const n=[],r=ss(t);let s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=i();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function a(){if(s==="-"){s=r.next();const c=a();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=o();return s===")"&&(s=r.next()),c}if(Jt(s)){const c=[];do c.push(s),s=r.next();while(Jt(s));return l=>e(c,l)}return null}function i(){const c=[];let l=a();for(;l;)c.push(l),l=a();return u=>c.every(h=>h(u))}function o(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return u=>c.some(h=>h(u))}}function Jt(t){return!!t&&!!t.match(/[\w\.:]+/)}function ss(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Mn(t){typeof t.dispose=="function"&&t.dispose()}var Ce=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},as=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},is=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},os=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ce(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const t=this.Q;this.Q=[];const e=new is;for(const n of t)cs(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Ce){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function cs(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const a=n.lookup(e);t instanceof Ce?Le({baseGrammar:a,selfGrammar:s},r):yt(t.ruleName,{baseGrammar:a,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const o of i)r.add(new Ce(o))}function yt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];Fe([r],e,n)}}function Le(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&Fe(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&Fe(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function Fe(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Nn({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&Fe(r.patterns,{...e,repository:s},n);const a=r.include;if(!a)continue;const i=Fn(a);switch(i.kind){case 0:Le({...e,selfGrammar:e.baseGrammar},n);break;case 1:Le(e,n);break;case 2:yt(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const o=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(o){const c={baseGrammar:e.baseGrammar,selfGrammar:o,repository:s};i.kind===4?yt(i.ruleName,c,n):Le(c,n)}else i.kind===4?n.add(new as(i.scopeName,i.ruleName)):n.add(new Ce(i.scopeName));break}}}var ls=class{kind=0},us=class{kind=1},hs=class{constructor(t){this.ruleName=t}kind=2},fs=class{constructor(t){this.scopeName=t}kind=3},ps=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function Fn(t){if(t==="$base")return new ls;if(t==="$self")return new us;const e=t.indexOf("#");if(e===-1)return new fs(t);if(e===0)return new hs(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new ps(n,r)}}var gs=/\\(\d+)/,Xt=/\\(\d+)/g,ds=-1,Bn=-2;var ke=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=Re.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Re.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${xn(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:Re.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Re.replaceCaptures(this._contentName,t,e)}},ms=class extends ke{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},Cs=class extends ke{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new _e(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ye,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Zt=class extends ke{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(const n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ye,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},bt=class extends ke{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,a,i,o,c,l){super(t,e,n,r),this._begin=new _e(s,this.id),this.beginCaptures=a,this._end=new _e(i||"￿",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ye;for(const n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},Be=class extends ke{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,a,i,o,c){super(t,e,n,r),this._begin=new _e(s,this.id),this.beginCaptures=a,this.whileCaptures=o,this._while=new _e(i,Bn),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ye;for(const e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ye,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"￿"),this._cachedCompiledWhilePatterns}},jn=class T{static createCaptureRule(e,n,r,s,a){return e.registerRule(i=>new ms(n,i,r,s,a))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new Cs(e.$vscodeTextmateLocation,e.id,e.name,e.match,T._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=Nn({},r,e.repository));let a=e.patterns;return typeof a>"u"&&e.include&&(a=[{include:e.include}]),new Zt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,T._compilePatterns(a,n,r))}return e.while?new Be(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,T._compileCaptures(e.whileCaptures||e.captures,n,r),T._compilePatterns(e.patterns,n,r)):new bt(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,T._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,T._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,T._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let a=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);o>a&&(a=o)}for(let i=0;i<=a;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const o=parseInt(i,10);let c=0;e[i].patterns&&(c=T.getCompiledRuleId(e[i],n,r)),s[o]=T.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let a=0,i=e.length;a<i;a++){const o=e[a];let c=-1;if(o.include){const l=Fn(o.include);switch(l.kind){case 0:case 1:c=T.getCompiledRuleId(r[o.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=T.getCompiledRuleId(u,n,r));break;case 3:case 4:const h=l.scopeName,g=l.kind===4?l.ruleName:null,f=n.getExternalGrammar(h,r);if(f)if(g){let p=f.repository[g];p&&(c=T.getCompiledRuleId(p,n,f.repository))}else c=T.getCompiledRuleId(f.repository.$self,n,f.repository);break}}else c=T.getCompiledRuleId(o,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof Zt||l instanceof bt||l instanceof Be)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},_e=class Dn{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){const r=e.length;let s=0,a=[],i=!1;for(let o=0;o<r;o++)if(e.charAt(o)==="\\"&&o+1<r){const l=e.charAt(o+1);l==="z"?(a.push(e.substring(s,o)),a.push("$(?!\\n)(?<!\\n)"),s=o+2):(l==="A"||l==="G")&&(i=!0),o++}this.hasAnchor=i,s===0?this.source=e:(a.push(e.substring(s,r)),this.source=a.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=gs.test(this.source):this.hasBackReferences=!1}clone(){return new Dn(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return Xt.lastIndex=0,this.source.replace(Xt,(s,a)=>Gn(r[parseInt(a,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],s=[],a,i,o,c;for(a=0,i=this.source.length;a<i;a++)o=this.source.charAt(a),e[a]=o,n[a]=o,r[a]=o,s[a]=o,o==="\\"&&a+1<i&&(c=this.source.charAt(a+1),c==="A"?(e[a+1]="￿",n[a+1]="￿",r[a+1]="A",s[a+1]="A"):c==="G"?(e[a+1]="￿",n[a+1]="G",r[a+1]="￿",s[a+1]="G"):(e[a+1]=c,n[a+1]=c,r[a+1]=c,s[a+1]=c),a++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ye=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new Yt(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new Yt(t,r,this._items.map(s=>s.ruleId))}},Yt=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
2
+ `)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},it=class{constructor(t,e){this.languageId=t,this.tokenType=e}},_s=class wt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new it(e,8),this._embeddedLanguagesMatcher=new ys(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?wt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new it(0,0);_getBasicScopeAttributes=new Ln(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new it(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(wt.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},ys=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>Gn(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}};typeof process<"u"&&process.env.VSCODE_TEXTMATE_DEBUG;var en=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function Un(t,e,n,r,s,a,i,o){const c=e.content.length;let l=!1,u=-1;if(i){const f=bs(t,e,n,r,s,a);s=f.stack,r=f.linePos,n=f.isFirstLine,u=f.anchorPosition}const h=Date.now();for(;!l;){if(o!==0&&Date.now()-h>o)return new en(s,!0);g()}return new en(s,!1);function g(){const f=ws(t,e,n,r,s,u);if(!f){a.produce(s,c),l=!0;return}const p=f.captureIndices,b=f.matchedRuleId,m=p&&p.length>0?p[0].end>r:!1;if(b===ds){const w=s.getRule(t);a.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),pe(t,e,n,s,a,w.endCaptures,p),a.produce(s,p[0].end);const C=s;if(s=s.parent,u=C.getAnchorPos(),!m&&C.getEnterPos()===r){s=C,a.produce(s,c),l=!0;return}}else{const w=t.getRule(b);a.produce(s,p[0].start);const C=s,S=w.getName(e.content,p),N=s.contentNameScopesList.pushAttributed(S,t);if(s=s.push(b,r,u,p[0].end===c,null,N,N),w instanceof bt){const A=w;pe(t,e,n,s,a,A.beginCaptures,p),a.produce(s,p[0].end),u=p[0].end;const D=A.getContentName(e.content,p),L=N.pushAttributed(D,t);if(s=s.withContentNameScopesList(L),A.endHasBackReferences&&(s=s.withEndRule(A.getEndWithResolvedBackReferences(e.content,p))),!m&&C.hasSameRuleAs(s)){s=s.pop(),a.produce(s,c),l=!0;return}}else if(w instanceof Be){const A=w;pe(t,e,n,s,a,A.beginCaptures,p),a.produce(s,p[0].end),u=p[0].end;const D=A.getContentName(e.content,p),L=N.pushAttributed(D,t);if(s=s.withContentNameScopesList(L),A.whileHasBackReferences&&(s=s.withEndRule(A.getWhileWithResolvedBackReferences(e.content,p))),!m&&C.hasSameRuleAs(s)){s=s.pop(),a.produce(s,c),l=!0;return}}else if(pe(t,e,n,s,a,w.captures,p),a.produce(s,p[0].end),s=s.pop(),!m){s=s.safePop(),a.produce(s,c),l=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function bs(t,e,n,r,s,a){let i=s.beginRuleCapturedEOL?0:-1;const o=[];for(let c=s;c;c=c.pop()){const l=c.getRule(t);l instanceof Be&&o.push({rule:l,stack:c})}for(let c=o.pop();c;c=o.pop()){const{ruleScanner:l,findOptions:u}=vs(c.rule,t,c.stack.endRule,n,r===i),h=l.findNextMatchSync(e,r,u);if(h){if(h.ruleId!==Bn){s=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(a.produce(c.stack,h.captureIndices[0].start),pe(t,e,n,c.stack,a,c.rule.whileCaptures,h.captureIndices),a.produce(c.stack,h.captureIndices[0].end),i=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,n=!1))}else{s=c.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function ws(t,e,n,r,s,a){const i=Ss(t,e,n,r,s,a),o=t.getInjections();if(o.length===0)return i;const c=ks(o,t,e,n,r,s,a);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:i}function Ss(t,e,n,r,s,a){const i=s.getRule(t),{ruleScanner:o,findOptions:c}=Wn(i,t,s.endRule,n,r===a),l=o.findNextMatchSync(e,r,c);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function ks(t,e,n,r,s,a,i){let o=Number.MAX_VALUE,c=null,l,u=0;const h=a.contentNameScopesList.getScopeNames();for(let g=0,f=t.length;g<f;g++){const p=t[g];if(!p.matcher(h))continue;const b=e.getRule(p.ruleId),{ruleScanner:m,findOptions:w}=Wn(b,e,null,r,s===i),C=m.findNextMatchSync(n,s,w);if(!C)continue;const S=C.captureIndices[0].start;if(!(S>=o)&&(o=S,c=C.captureIndices,l=C.ruleId,u=p.priority,o===s))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Wn(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function vs(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function pe(t,e,n,r,s,a,i){if(a.length===0)return;const o=e.content,c=Math.min(a.length,i.length),l=[],u=i[0].end;for(let h=0;h<c;h++){const g=a[h];if(g===null)continue;const f=i[h];if(f.length===0)continue;if(f.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=f.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,f.start):s.produce(r,f.start),g.retokenizeCapturedWithRuleId){const b=g.getName(o,i),m=r.contentNameScopesList.pushAttributed(b,t),w=g.getContentName(o,i),C=m.pushAttributed(w,t),S=r.push(g.retokenizeCapturedWithRuleId,f.start,-1,!1,null,m,C),N=t.createOnigString(o.substring(0,f.end));Un(t,N,n&&f.start===0,f.start,S,s,!1,0),Mn(N);continue}const p=g.getName(o,i);if(p!==null){const m=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);l.push(new As(m,f.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var As=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function Es(t,e,n,r,s,a,i,o){return new Is(t,e,n,r,s,a,i,o)}function tn(t,e,n,r,s){const a=Me(e,je),i=jn.getCompiledRuleId(n,r,s.repository);for(const o of a)t.push({debugSelector:e,matcher:o.matcher,ruleId:i,grammar:s,priority:o.priority})}function je(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(Rs(e[s],r))return n=s+1,!0;return!1})}function Rs(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var Is=class{constructor(t,e,n,r,s,a,i,o){if(this._rootScopeName=t,this.balancedBracketSelectors=a,this._onigLib=o,this._basicScopeAttributesProvider=new _s(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=nn(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const c of Object.keys(s)){const l=Me(c,je);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)tn(e,i,s[i],this,r);const a=this._grammarRepository.injections(n);a&&a.forEach(i=>{const o=this.getExternalGrammar(i);if(o){const c=o.injectionSelector;c&&tn(e,c,o,this,o)}})}return e.sort((s,a)=>s.priority-a.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=nn(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=jn.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===St.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=ne.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),g=this.getRule(this._rootId).getName(null,null);let f;g?f=ge.createRootAndLookUpScopeName(g,h,this):f=ge.createRoot("unknown",h),e=new St(null,this._rootId,-1,-1,!1,null,f,f)}else s=!1,e.reset();t=t+`
3
+ `;const a=this.createOnigString(t),i=a.content.length,o=new xs(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Un(this,a,s,0,e,o,!0,r);return Mn(a),{lineLength:i,lineTokens:o,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function nn(t,e){return t=Vr(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var ge=class U{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(const a of n)s=at.push(s,a.scopeNames),r=new U(r,s,a.encodedTokenAttributes);return r}static createRoot(e,n){return new U(null,new at(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),a=new at(null,e),i=r.themeProvider.themeMatch(a),o=U.mergeAttributes(n,s,i);return new U(null,a,o)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return U.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,a=0,i=0;return r!==null&&(s=r.fontStyle,a=r.foregroundId,i=r.backgroundId),ne.set(e,n.languageId,n.tokenType,null,s,a,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return U._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const a of r)s=U._pushAttributed(s,a,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),a=e.scopePath.push(n),i=r.themeProvider.themeMatch(a),o=U.mergeAttributes(e.tokenAttributes,s,i);return new U(e,a,o)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},St=class ee{constructor(e,n,r,s,a,i,o,c){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=a,this.endRule=i,this.nameScopesList=o,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new ee(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:ee._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?ge.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){ee._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,a,i,o){return new ee(this,e,n,r,s,a,i,o)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new ee(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){const r=ge.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new ee(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,ge.fromExtension(r,n.contentNameScopesList))}},Ns=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Me(n,je).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>Me(n,je).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},xs=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const a=t?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(a)&&(r=ne.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(a))}if(s&&(r=ne.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}const n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},Ts=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,r,s){if(!this._grammars.has(t)){let a=this._rawGrammars.get(t);if(!a)return null;this._grammars.set(t,Es(t,a,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},$s=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Ts(Oe.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(Oe.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new Ns(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,s,a){const i=new os(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(o=>this._loadSingleGrammar(o.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,r,s,a)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,n=0,r=null,s=null,a=null){return this._syncRegistry.grammarForScopeName(e,n,r,s,a)}},kt=St.NULL;const Gs=/["&'<>`]/g,Ls=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Ps=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Os=/[|\\{}()[\]^$+*?.]/g,rn=new WeakMap;function Ms(t,e){if(t=t.replace(e.subset?Fs(e.subset):Gs,r),e.subset||e.escapeOnly)return t;return t.replace(Ls,n).replace(Ps,r);function n(s,a,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(a+2),e)}function r(s,a,i){return e.format(s.charCodeAt(0),i.charCodeAt(a+1),e)}}function Fs(t){let e=rn.get(t);return e||(e=Bs(t),rn.set(t,e)),e}function Bs(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(Os,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const js=/[\dA-Fa-f]/;function Ds(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!js.test(String.fromCharCode(e))?r:r+";"}const Us=/\d/;function Ws(t,e,n){const r="&#"+String(t);return n&&e&&!Us.test(String.fromCharCode(e))?r:r+";"}const Hs=["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"],ot={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:"€"},qs=["cent","copy","divide","gt","lt","not","para","times"],Hn={}.hasOwnProperty,vt={};let Ie;for(Ie in ot)Hn.call(ot,Ie)&&(vt[ot[Ie]]=Ie);const zs=/[^\dA-Za-z]/;function Vs(t,e,n,r){const s=String.fromCharCode(t);if(Hn.call(vt,s)){const a=vt[s],i="&"+a;return n&&Hs.includes(a)&&!qs.includes(a)&&(!r||e&&e!==61&&zs.test(String.fromCharCode(e)))?i:i+";"}return""}function Ks(t,e,n){let r=Ds(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Vs(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const a=Ws(t,e,n.omitOptionalSemicolons);a.length<r.length&&(r=a)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function oe(t,e){return Ms(t,Object.assign({format:Ks},e))}const Qs=/^>|^->|<!--|-->|--!>|<!-$/g,Js=[">"],Xs=["<",">"];function Zs(t,e,n,r){return r.settings.bogusComments?"<?"+oe(t.value,Object.assign({},r.settings.characterReferences,{subset:Js}))+">":"<!--"+t.value.replace(Qs,s)+"-->";function s(a){return oe(a,Object.assign({},r.settings.characterReferences,{subset:Xs}))}}function Ys(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const I=zn(1),qn=zn(-1),ea=[];function zn(t){return e;function e(n,r,s){const a=n?n.children:ea;let i=(r||0)+t,o=a[i];if(!s)for(;o&&P.whitespace(o);)i+=t,o=a[i];return o}}const ta={}.hasOwnProperty;function Vn(t){return e;function e(n,r,s){return ta.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const $t=Vn({body:ra,caption:ct,colgroup:ct,dd:oa,dt:ia,head:ct,html:na,li:aa,optgroup:ca,option:la,p:sa,rp:sn,rt:sn,tbody:ha,td:an,tfoot:fa,th:an,thead:ua,tr:pa});function ct(t,e,n){const r=I(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&P.whitespace(r.value.charAt(0)))}function na(t,e,n){const r=I(n,e);return!r||r.type!=="comment"}function ra(t,e,n){const r=I(n,e);return!r||r.type!=="comment"}function sa(t,e,n){const r=I(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function aa(t,e,n){const r=I(n,e);return!r||r.type==="element"&&r.tagName==="li"}function ia(t,e,n){const r=I(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function oa(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function sn(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function ca(t,e,n){const r=I(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function la(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function ua(t,e,n){const r=I(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function ha(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function fa(t,e,n){return!I(n,e)}function pa(t,e,n){const r=I(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function an(t,e,n){const r=I(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const ga=Vn({body:Ca,colgroup:_a,head:ma,html:da,tbody:ya});function da(t){const e=I(t,-1);return!e||e.type!=="comment"}function ma(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function Ca(t){const e=I(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&P.whitespace(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function _a(t,e,n){const r=qn(n,e),s=I(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&$t(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function ya(t,e,n){const r=qn(n,e),s=I(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&$t(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Ne={name:[[`
4
+ \f\r &/=>`.split(""),`
5
+ \f\r "&'/=>\``.split("")],[`\0
6
+ \f\r "&'/<=>`.split(""),`\0
7
+ \f\r "&'/<=>\``.split("")]],unquoted:[[`
8
+ \f\r &>`.split(""),`\0
9
+ \f\r "&'<=>\``.split("")],[`\0
10
+ \f\r "&'<=>\``.split(""),`\0
11
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function ba(t,e,n,r){const s=r.schema,a=s.space==="svg"?!1:r.settings.omitOptionalTags;let i=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const o=[];let c;s.space==="html"&&t.tagName==="svg"&&(r.schema=P.svg);const l=wa(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(i=!1),(l||!a||!ga(t,e,n))&&(o.push("<",t.tagName,l?" "+l:""),i&&(s.space==="svg"||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&o.push(" "),o.push("/")),o.push(">")),o.push(u),!i&&(!a||!$t(t,e,n))&&o.push("</"+t.tagName+">"),o.join("")}function wa(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const a=Sa(t,s,e[s]);a&&n.push(a)}}for(;++r<n.length;){const a=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&a!=='"'&&a!=="'"&&(n[r]+=" ")}return n.join("")}function Sa(t,e,n){const r=P.find(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,a=t.settings.allowDangerousCharacters?0:1;let i=t.quote,o;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const c=oe(r.attribute,Object.assign({},t.settings.characterReferences,{subset:Ne.name[s][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?P.stringify:P.stringify$1)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?c:(t.settings.preferUnquoted&&(o=oe(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Ne.unquoted[s][a]}))),o!==n&&(t.settings.quoteSmart&&P.ccount(n,i)>P.ccount(n,t.alternative)&&(i=t.alternative),o=i+oe(n,Object.assign({},t.settings.characterReferences,{subset:(i==="'"?Ne.single:Ne.double)[s][a],attribute:!0}))+i),c+(o&&"="+o))}const ka=["<","&"];function Kn(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:oe(t.value,Object.assign({},r.settings.characterReferences,{subset:ka}))}function va(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Kn(t,e,n,r)}function Aa(t,e,n,r){return r.all(t)}const Ea=P.zwitch("type",{invalid:Ra,unknown:Ia,handlers:{comment:Zs,doctype:Ys,element:ba,raw:va,root:Aa,text:Kn}});function Ra(t){throw new Error("Expected node, not `"+t+"`")}function Ia(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const Na={},xa={},Ta=[];function Qn(t,e){const n=e||Na,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:$a,all:Ga,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||P.htmlVoidElements,characterReferences:n.characterReferences||xa,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?P.svg:P.html,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function $a(t,e,n){return Ea(t,e,n,this)}function Ga(t){const e=[],n=t&&t.children||Ta;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}const Gt=String.raw,on=Gt`(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})`,cn=Gt`\u{E0061}-\u{E007A}`,La=()=>new RegExp(Gt`[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[${cn}]{2}[\u{E0030}-\u{E0039}${cn}]{1,3}\u{E007F}|${on}(?:\u200D${on})*`,"gu"),F=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function ze(t,e,n,r){const s=new RegExp(String.raw`${e}|(?<$skip>\[\^?|\\?.)`,"gsu"),a=[!1];let i=0,o="";for(const c of t.matchAll(s)){const{0:l,groups:{$skip:u}}=c;if(!u&&(!r||r===F.DEFAULT==!i)){n instanceof Function?o+=n(c,{context:i?F.CHAR_CLASS:F.DEFAULT,negated:a[a.length-1]}):o+=n;continue}l[0]==="["?(i++,a.push(l[1]==="^")):l==="]"&&i&&(i--,a.pop()),o+=l}return o}function Pa(t,e,n,r){ze(t,e,n,r)}function Oa(t,e,n=0,r){if(!new RegExp(e,"su").test(t))return null;const s=new RegExp(`${e}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let a=0,i;for(;i=s.exec(t);){const{0:o,groups:{$skip:c}}=i;if(!c&&(!r||r===F.DEFAULT==!a))return i;o==="["?a++:o==="]"&&a&&a--,s.lastIndex==i.index&&s.lastIndex++}return null}function xe(t,e,n){return!!Oa(t,e,0,n)}function Ma(t,e){const n=/\\?./gsu;n.lastIndex=e;let r=t.length,s=0,a=1,i;for(;i=n.exec(t);){const[o]=i;if(o==="[")s++;else if(s)o==="]"&&s--;else if(o==="(")a++;else if(o===")"&&(a--,!a)){r=i.index;break}}return t.slice(e,r)}const re="$E$";class Lt extends RegExp{_captureMap;_namesByIndex;constructor(e,n,r){if(e instanceof RegExp&&r)throw new Error("Cannot provide options when copying a regexp");const s=!!r?.useEmulationGroups,a=s?Fa(e):null;super(a?.expression||e,n);const i=s?a:e instanceof Lt?e:null;i&&(this._captureMap=i._captureMap,this._namesByIndex=i._namesByIndex)}exec(e){const n=RegExp.prototype.exec.call(this,e);if(!n||!this._captureMap)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);for(let a=1;a<r.length;a++)if(this._captureMap[a].exclude){const i=this._captureMap[a].transfer;if(i&&n.length>i){n[i]=r[a];const o=this._namesByIndex[i];o&&(n.groups[o]=r[a],this.hasIndices&&(n.indices.groups[o]=s[a])),this.hasIndices&&(n.indices[i]=s[a])}}else n.push(r[a]),this.hasIndices&&n.indices.push(s[a]);return n}}function Fa(t){const e=re.replace(/\$/g,"\\$"),n=[{exclude:!1}],r={0:""};let s=0;return t=ze(t,String.raw`\((?:(?!\?)|\?<(?![=!])(?<name>[^>]+)>)(?<mark>(?:\$(?<transfer>[1-9]\d*))?${e})?`,({0:a,groups:{name:i,mark:o,transfer:c}})=>o?(n.push({exclude:!0,transfer:c&&+c}),a.slice(0,-o.length)):(s++,i&&(r[s]=i),n.push({exclude:!1}),a),F.DEFAULT),{_captureMap:n,_namesByIndex:r,expression:t}}const Ba=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function ja(t,e,n,r){return t.slice(0,e)+r+t.slice(e+n.length)}const ln=new RegExp(String.raw`(?<noncapturingStart>${Ba})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Da(t,e){if(!/\(\?>/.test(t))return t;const n="(?>",r=`(?:(?=(${e?.useEmulationGroups?re:""}`,s=[0];let a=0,i=0,o=NaN,c;do{c=!1;let l=0,u=0,h=!1,g;for(ln.lastIndex=Number.isNaN(o)?0:o+r.length;g=ln.exec(t);){const{0:f,index:p,groups:{capturingStart:b,noncapturingStart:m}}=g;if(f==="[")l++;else if(l)f==="]"&&l--;else if(f===n&&!h)o=p,h=!0;else if(h&&m)u++;else if(b)h?u++:(a++,s.push(a+i));else if(f===")"&&h){if(!u){i++,t=`${t.slice(0,o)}${r}${t.slice(o+n.length,p)}))<$$${i+a}>)${t.slice(p+1)}`,c=!0;break}u--}}}while(c);return t=ze(t,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:l,groups:{backrefNum:u,wrappedBackrefNum:h}})=>{if(u){const g=+u;if(g>s.length-1)throw new Error(`Backref "${l}" greater than number of captures`);return`\\${s[g]}`}return`\\${h}`},F.DEFAULT),t}const Jn=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,lt=new RegExp(String.raw`
12
+ \\(?: \d+
13
+ | c[A-Za-z]
14
+ | [gk]<[^>]+>
15
+ | [pPu]\{[^\}]+\}
16
+ | u[A-Fa-f\d]{4}
17
+ | x[A-Fa-f\d]{2}
18
+ )
19
+ | \((?: \? (?: [:=!>]
20
+ | <(?:[=!]|[^>]+>)
21
+ | [A-Za-z\-]+:
22
+ | \(DEFINE\)
23
+ ))?
24
+ | (?<qBase>${Jn})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
25
+ | \\?.
26
+ `.replace(/\s+/g,""),"gsu");function Ua(t){if(!new RegExp(`${Jn}\\+`).test(t))return t;const e=[];let n=null,r=null,s="",a=0,i;for(lt.lastIndex=0;i=lt.exec(t);){const{0:o,index:c,groups:{qBase:l,qMod:u,invalidQ:h}}=i;if(o==="[")a||(r=c),a++;else if(o==="]")a?a--:r=null;else if(!a)if(u==="+"&&s&&!s.startsWith("(")){if(h)throw new Error(`Invalid quantifier "${o}"`);let g=-1;if(/^\{\d+\}$/.test(l))t=ja(t,c+l.length,u,"");else{if(s===")"||s==="]"){const f=s===")"?n:r;if(f===null)throw new Error(`Invalid unmatched "${s}"`);t=`${t.slice(0,f)}(?>${t.slice(f,c)}${l})${t.slice(c+o.length)}`}else t=`${t.slice(0,c-s.length)}(?>${s}${l})${t.slice(c+o.length)}`;g+=4}lt.lastIndex+=g}else o[0]==="("?e.push(c):o===")"&&(n=e.length?e.pop():null);s=o}return t}const O=String.raw,Wa=O`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,At=O`\(\?R=(?<rDepth>[^\)]+)\)|${Wa}`,Ve=O`\(\?<(?![=!])(?<captureName>[^>]+)>`,J=new RegExp(O`${Ve}|${At}|\(\?|\\?.`,"gsu"),ut="Cannot use multiple overlapping recursions",Et=new RegExp(O`(?:\$[1-9]\d*)?${re.replace(/\$/g,O`\$`)}`,"y");function Ha(t,e){if(!new RegExp(At,"su").test(t))return t;if(xe(t,O`\(\?\(DEFINE\)`,F.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const n=!!e?.useEmulationGroups,r=xe(t,O`\\[1-9]`,F.DEFAULT),s=new Map,a=[];let i=!1,o=0,c=0,l;for(J.lastIndex=0;l=J.exec(t);){const{0:u,groups:{captureName:h,rDepth:g,gRNameOrNum:f,gRDepth:p}}=l;if(u==="[")o++;else if(o)u==="]"&&o--;else if(g){if(un(g),i)throw new Error(ut);if(r)throw new Error("Numbered backrefs cannot be used with global recursion");const b=t.slice(0,l.index),m=t.slice(J.lastIndex);if(xe(m,At,F.DEFAULT))throw new Error(ut);return hn(b,m,+g,!1,n)}else if(f){un(p);let b=!1;for(const L of a)if(L.name===f||L.num===+f){if(b=!0,L.hasRecursedWithin)throw new Error(ut);break}if(!b)throw new Error(O`Recursive \g cannot be used outside the referenced group "\g<${f}&R=${p}>"`);const m=s.get(f),w=Ma(t,m);if(r&&xe(w,O`${Ve}|\((?!\?)`,F.DEFAULT))throw new Error("Numbered backrefs cannot be used with recursion of capturing groups");const C=t.slice(m,l.index),S=w.slice(C.length+u.length),N=hn(C,S,+p,!0,n),A=t.slice(0,m),D=t.slice(m+w.length);t=`${A}${N}${D}`,J.lastIndex+=N.length-u.length-C.length-S.length,a.forEach(L=>L.hasRecursedWithin=!0),i=!0}else if(h)c++,s.set(String(c),J.lastIndex),s.set(h,J.lastIndex),a.push({num:c,name:h});else if(u.startsWith("(")){const b=u==="(";b&&(c++,s.set(String(c),J.lastIndex+(n?qa(t,J.lastIndex):0))),a.push(b?{num:c}:{})}else u===")"&&a.pop()}return t}function un(t){const e=`Max depth must be integer between 2 and 100; used ${t}`;if(!/^[1-9]\d*$/.test(t))throw new Error(e);if(t=+t,t<2||t>100)throw new Error(e)}function hn(t,e,n,r,s){const a=new Set;r&&Pa(t+e,Ve,({groups:{captureName:o}})=>{a.add(o)},F.DEFAULT);const i=n-1;return`${t}${fn(`(?:${t}`,i,r?a:null,"forward",s)}(?:)${fn(`${e})`,i,r?a:null,"backward",s)}${e}`}function fn(t,e,n,r,s){const i=c=>r==="backward"?e-c+2-1:c+2;let o="";for(let c=0;c<e;c++){const l=i(c);o+=ze(t,O`${Ve}|\\k<(?<backref>[^>]+)>${s?O`|(?<unnamed>\()(?!\?)(?:${Et.source})?`:""}`,({0:u,index:h,groups:{captureName:g,backref:f,unnamed:p}})=>{if(f&&n&&!n.has(f))return u;if(p)return`(${re}`;const b=`_$${l}`;return g?`(?<${g}${b}>${s?re:""}`:O`\k<${f}${b}>`},F.DEFAULT)}return o}function qa(t,e){Et.lastIndex=e;const n=Et.exec(t);return n?n[0].length:0}var R=String.fromCodePoint,y=String.raw,za=(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),Va=(()=>{try{new RegExp("","v")}catch{return!1}return!0})();function De(t,{enable:e,disable:n}){return{dotAll:!n?.dotAll&&!!(e?.dotAll||t.dotAll),ignoreCase:!n?.ignoreCase&&!!(e?.ignoreCase||t.ignoreCase)}}function Ue(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}function Rt(t,e){return pn[t]>=pn[e]}function Q(t,e){if(!t)throw new Error(e??"Value expected");return t}var pn={ES2025:2025,ES2024:2024,ES2018:2018},Ka={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Xn(t){if(t?.target!==void 0&&!Ka[t.target])throw new Error(`Unexpected target "${t.target}"`);const e={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,target:"auto",verbose:!1,...t,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...t?.rules}};return e.target==="auto"&&(e.target=za?"ES2025":Va?"ES2024":"ES2018"),e}var Qa=new Set([R(304),R(305)]);function Zn(t){if(Qa.has(t))return[t];const e=new Set,n=t.toLowerCase(),r=n.toUpperCase(),s=Ya.get(n),a=Xa.get(n),i=Za.get(n);return[...r].length===1&&e.add(r),i&&e.add(i),s&&e.add(s),e.add(n),a&&e.add(a),[...e]}var Yn=new Set(`C Other
27
+ Cc Control cntrl
28
+ Cf Format
29
+ Cn Unassigned
30
+ Co Private_Use
31
+ Cs Surrogate
32
+ L Letter
33
+ LC Cased_Letter
34
+ Ll Lowercase_Letter
35
+ Lm Modifier_Letter
36
+ Lo Other_Letter
37
+ Lt Titlecase_Letter
38
+ Lu Uppercase_Letter
39
+ M Mark Combining_Mark
40
+ Mc Spacing_Mark
41
+ Me Enclosing_Mark
42
+ Mn Nonspacing_Mark
43
+ N Number
44
+ Nd Decimal_Number digit
45
+ Nl Letter_Number
46
+ No Other_Number
47
+ P Punctuation punct
48
+ Pc Connector_Punctuation
49
+ Pd Dash_Punctuation
50
+ Pe Close_Punctuation
51
+ Pf Final_Punctuation
52
+ Pi Initial_Punctuation
53
+ Po Other_Punctuation
54
+ Ps Open_Punctuation
55
+ S Symbol
56
+ Sc Currency_Symbol
57
+ Sk Modifier_Symbol
58
+ Sm Math_Symbol
59
+ So Other_Symbol
60
+ Z Separator
61
+ Zl Line_Separator
62
+ Zp Paragraph_Separator
63
+ Zs Space_Separator
64
+ ASCII
65
+ ASCII_Hex_Digit AHex
66
+ Alphabetic Alpha
67
+ Any
68
+ Assigned
69
+ Bidi_Control Bidi_C
70
+ Bidi_Mirrored Bidi_M
71
+ Case_Ignorable CI
72
+ Cased
73
+ Changes_When_Casefolded CWCF
74
+ Changes_When_Casemapped CWCM
75
+ Changes_When_Lowercased CWL
76
+ Changes_When_NFKC_Casefolded CWKCF
77
+ Changes_When_Titlecased CWT
78
+ Changes_When_Uppercased CWU
79
+ Dash
80
+ Default_Ignorable_Code_Point DI
81
+ Deprecated Dep
82
+ Diacritic Dia
83
+ Emoji
84
+ Emoji_Component EComp
85
+ Emoji_Modifier EMod
86
+ Emoji_Modifier_Base EBase
87
+ Emoji_Presentation EPres
88
+ Extended_Pictographic ExtPict
89
+ Extender Ext
90
+ Grapheme_Base Gr_Base
91
+ Grapheme_Extend Gr_Ext
92
+ Hex_Digit Hex
93
+ IDS_Binary_Operator IDSB
94
+ IDS_Trinary_Operator IDST
95
+ ID_Continue IDC
96
+ ID_Start IDS
97
+ Ideographic Ideo
98
+ Join_Control Join_C
99
+ Logical_Order_Exception LOE
100
+ Lowercase Lower
101
+ Math
102
+ Noncharacter_Code_Point NChar
103
+ Pattern_Syntax Pat_Syn
104
+ Pattern_White_Space Pat_WS
105
+ Quotation_Mark QMark
106
+ Radical
107
+ Regional_Indicator RI
108
+ Sentence_Terminal STerm
109
+ Soft_Dotted SD
110
+ Terminal_Punctuation Term
111
+ Unified_Ideograph UIdeo
112
+ Uppercase Upper
113
+ Variation_Selector VS
114
+ White_Space space
115
+ XID_Continue XIDC
116
+ XID_Start XIDS`.split(/\s/)),er=new Map;for(const t of Yn)er.set(Ke(t),t);var Ja=new Set(["Basic_Emoji","Emoji_Keycap_Sequence","RGI_Emoji","RGI_Emoji_Flag_Sequence","RGI_Emoji_Modifier_Sequence","RGI_Emoji_Tag_Sequence","RGI_Emoji_ZWJ_Sequence"]),tr=new Map;for(const t of Ja)tr.set(Ke(t),t);var Xa=new Map([["s",R(383)],[R(383),"s"]]),Za=new Map([[R(223),R(7838)],[R(107),R(8490)],[R(229),R(8491)],[R(969),R(8486)]]),Ya=new Map([X(453),X(456),X(459),X(498),...ht(8072,8079),...ht(8088,8095),...ht(8104,8111),X(8124),X(8140),X(8188)]),nr=new Map([["alnum",y`[\p{Alpha}\p{Nd}]`],["alpha",y`\p{Alpha}`],["ascii",y`\p{ASCII}`],["blank",y`[\p{Zs}\t]`],["cntrl",y`\p{cntrl}`],["digit",y`\p{Nd}`],["graph",y`[\P{space}&&\P{cntrl}&&\P{Cn}&&\P{Cs}]`],["lower",y`\p{Lower}`],["print",y`[[\P{space}&&\P{cntrl}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",y`[\p{P}\p{S}]`],["space",y`\p{space}`],["upper",y`\p{Upper}`],["word",y`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",y`\p{AHex}`]]),ei=new Set(["alnum","blank","graph","print","word","xdigit"]);function ti(t,e){const n=[];for(let r=t;r<=e;r++)n.push(r);return n}function Ke(t){return t.replace(/[- _]+/g,"").toLowerCase()}function X(t){const e=R(t);return[e.toLowerCase(),e]}function ht(t,e){return ti(t,e).map(n=>X(n))}var rr=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]),_={Alternator:"Alternator",Assertion:"Assertion",Backreference:"Backreference",Character:"Character",CharacterClassClose:"CharacterClassClose",CharacterClassHyphen:"CharacterClassHyphen",CharacterClassIntersector:"CharacterClassIntersector",CharacterClassOpen:"CharacterClassOpen",CharacterSet:"CharacterSet",Directive:"Directive",GroupClose:"GroupClose",GroupOpen:"GroupOpen",Subroutine:"Subroutine",Quantifier:"Quantifier",VariableLengthCharacterSet:"VariableLengthCharacterSet",EscapedNumber:"EscapedNumber"},x={any:"any",digit:"digit",dot:"dot",hex:"hex",non_newline:"non_newline",posix:"posix",property:"property",space:"space",word:"word"},Qe={flags:"flags",keep:"keep"},$={absent_repeater:"absent_repeater",atomic:"atomic",capturing:"capturing",group:"group",lookahead:"lookahead",lookbehind:"lookbehind"},gn=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]),sr=y`\[\^?`,ar=`c.? | C(?:-.?)?|${y`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${y`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${y`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${y`o\{[^\}]*\}?`}|${y`\d{1,3}`}`,ir=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Te=new RegExp(y`
117
+ \\ (?:
118
+ ${ar}
119
+ | [gk]<[^>]*>?
120
+ | [gk]'[^']*'?
121
+ | .
122
+ )
123
+ | \( (?: \? (?:
124
+ [:=!>(]
125
+ | <[=!]
126
+ | <[^>]*>
127
+ | '[^']*'
128
+ | ~\|?
129
+ | # (?:[^)\\] | \\.?)*
130
+ | [imx\-]+[:)]
131
+ )?)?
132
+ | ${ir.source}
133
+ | ${sr}
134
+ | .
135
+ `.replace(/\s+/g,""),"gsu"),ft=new RegExp(y`
136
+ \\ (?:
137
+ ${ar}
138
+ | .
139
+ )
140
+ | \[:[^:]*:\]
141
+ | ${sr}
142
+ | &&
143
+ | .
144
+ `.replace(/\s+/g,""),"gsu");function or(t,e="",n){if(n={captureGroup:!1,singleline:!1,...n},typeof t!="string")throw new Error("String expected as pattern");if(!/^[imxDSW]*$/.test(e))throw new Error(`Flags "${e}" includes unsupported value`);const r=e.includes("x"),s=[r],a={captureGroup:n.captureGroup,getCurrentModX:()=>s.at(-1),numOpenGroups:0,popModX(){s.pop()},pushModX(h){s.push(h)},replaceCurrentModX(h){s[s.length-1]=h},singleline:n.singleline};let i=[],o;for(Te.lastIndex=0;o=Te.exec(t);){const h=ni(a,t,o[0],Te.lastIndex);h.tokens?i.push(...h.tokens):h.token&&i.push(h.token),h.lastIndex!==void 0&&(Te.lastIndex=h.lastIndex)}const c=[];let l=0;i.forEach(h=>{h.type===_.GroupOpen&&(h.kind===$.capturing?h.number=++l:h.raw==="("&&c.push(h))}),l||c.forEach((h,g)=>{h.kind=$.capturing,h.number=g+1});const u=l||c.length;return i=i.map(h=>h.type===_.EscapedNumber?hi(h,u):h).flat(),{tokens:i,flags:{ignoreCase:e.includes("i"),dotAll:e.includes("m"),extended:r,digitIsAscii:e.includes("D"),spaceIsAscii:e.includes("S"),wordIsAscii:e.includes("W")},rules:n}}function ni(t,e,n,r){const[s,a,i]=n;if(s==="["){const o=ri(e,n,r);return{tokens:o.tokens,lastIndex:o.lastIndex}}if(s==="\\"){if("AbBGzZ".includes(a))return{token:k(_.Assertion,n,{kind:n})};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:k(_.Subroutine,n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:k(_.Backreference,n)}}if(a==="K")return{token:k(_.Directive,n,{kind:Qe.keep})};if(a==="N")return{token:k(_.CharacterSet,n,{kind:x.non_newline})};if(a==="O")return{token:k(_.CharacterSet,n,{kind:x.any})};if("RX".includes(a))return{token:k(_.VariableLengthCharacterSet,n,{kind:n})};if("yY".includes(a))throw new Error(`Unsupported grapheme boundary "${n}"`);const o=cr(n,{inCharClass:!1});return Array.isArray(o)?{tokens:o}:{token:o}}if(s==="("){if(i==="#"){if(e[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if("-imx".includes(i))return{token:ii(n,t)};if(t.pushModX(t.getCurrentModX()),t.numOpenGroups++,n==="("&&!t.captureGroup||n==="(?:")return{token:k(_.GroupOpen,n,{kind:$.group})};if(n==="(?>")return{token:k(_.GroupOpen,n,{kind:$.atomic})};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:k(_.GroupOpen,n,{kind:i==="<"?$.lookbehind:$.lookahead,negate:n.endsWith("!")})};if(i==="<"||i==="'"||n==="("&&t.captureGroup){const o=k(_.GroupOpen,n,{kind:$.capturing});return n!=="("&&(o.name=n.slice(3,-1)),{token:o}}if(i==="~"){if(n==="(?~|")throw new Error(`Unsupported absent function kind "${n}"`);return{token:k(_.GroupOpen,n,{kind:$.absent_repeater})}}throw i==="("?new Error(`Unsupported conditional "${n}"`):n==="(?"?new Error("Invalid group"):new Error(`Unexpected group "${n}"`)}if(n===")"){if(t.popModX(),t.numOpenGroups--,t.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:k(_.GroupClose,n)}}if(n==="#"&&t.getCurrentModX()){const o=e.indexOf(`
145
+ `,r);return{lastIndex:o===-1?e.length:o}}if(/^\s$/.test(n)&&t.getCurrentModX()){const o=/\s+/y;return o.lastIndex=r,{lastIndex:o.exec(e)?o.lastIndex:r}}if(n===".")return{token:k(_.CharacterSet,n,{kind:x.dot})};if(n==="^"||n==="$"){const o=t.singleline?{"^":y`\A`,$:y`\Z`}[n]:n;return{token:k(_.Assertion,n,{kind:o})}}return n==="|"?{token:k(_.Alternator,n)}:ir.test(n)?{token:oi(n)}:(lr(n),{token:k(_.Character,n,{value:n.codePointAt(0)})})}function ri(t,e,n){const r=[k(_.CharacterClassOpen,e,{negate:e[1]==="^"})];let s=1,a;for(ft.lastIndex=n;a=ft.exec(t);){const i=a[0];if(i[0]==="["&&i[1]!==":")s++,r.push(k(_.CharacterClassOpen,i,{negate:i[1]==="^"}));else if(i==="]"){if(r.at(-1).type===_.CharacterClassOpen)r.push(k(_.Character,i,{value:93}));else if(s--,r.push(k(_.CharacterClassClose,i)),!s)break}else{const o=si(i);Array.isArray(o)?r.push(...o):r.push(o)}}return{tokens:r,lastIndex:ft.lastIndex||t.length}}function si(t){if(t[0]==="\\")return cr(t,{inCharClass:!0});if(t[0]==="["){const e=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(t);if(!e||!nr.get(e.groups.name))throw new Error(`Invalid POSIX class "${t}"`);return k(_.CharacterSet,t,{kind:x.posix,negate:!!e.groups.negate,value:e.groups.name})}return t==="-"?k(_.CharacterClassHyphen,t):t==="&&"?k(_.CharacterClassIntersector,t):(lr(t),k(_.Character,t,{value:t.codePointAt(0)}))}function cr(t,{inCharClass:e}){const n=t[1];if(n==="c"||n==="C")return ai(t);if("dDhHsSwW".includes(n))return ci(t);if(t.startsWith(y`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${t}"`);if(/^\\[pP]\{/.test(t)){if(t.length===3)throw new Error(`Incomplete or invalid Unicode property "${t}"`);return li(t)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(t))try{const r=t.split(/\\x/).slice(1).map(o=>parseInt(o,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(r)),a=new TextEncoder;return[...s].map(o=>{const c=[...a.encode(o)].map(l=>`\\x${l.toString(16)}`).join("");return k(_.Character,c,{value:o.codePointAt(0)})})}catch{throw new Error(`Multibyte code "${t}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return k(_.Character,t,{value:ui(t)});if(gn.has(n))return k(_.Character,t,{value:gn.get(n)});if(/\d/.test(n))return k(_.EscapedNumber,t,{inCharClass:e});if(t==="\\")throw new Error(y`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${t}"`);if([...t].length===2)return k(_.Character,t,{value:t.codePointAt(1)});throw new Error(`Unexpected escape "${t}"`)}function k(t,e,n){return{type:t,raw:e,...n}}function ai(t){const e=t[1]==="c"?t[2]:t[3];if(!e||!/[A-Za-z]/.test(e))throw new Error(`Unsupported control character "${t}"`);return k(_.Character,t,{value:e.toUpperCase().codePointAt(0)-64})}function ii(t,e){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[imx\-]*))?/.exec(t).groups;r??="";const s=(e.getCurrentModX()||n.includes("x"))&&!r.includes("x"),a=dn(n),i=dn(r),o={};if(a&&(o.enable=a),i&&(o.disable=i),t.endsWith(")"))return e.replaceCurrentModX(s),k(_.Directive,t,{kind:Qe.flags,flags:o});if(t.endsWith(":")){e.pushModX(s),e.numOpenGroups++;const c=k(_.GroupOpen,t,{kind:$.group});return(a||i)&&(c.flags=o),c}throw new Error(`Unexpected flag modifier "${t}"`)}function oi(t){const e={};if(t[0]==="{"){const{min:n,max:r}=/^\{(?<min>\d*)(?:,(?<max>\d*))?/.exec(t).groups,s=1e5;if(+n>s||+r>s)throw new Error("Quantifier value unsupported in Oniguruma");e.min=+n,e.max=r===void 0?+n:r===""?1/0:+r,e.greedy=!t.endsWith("?"),e.possessive=!1}else e.min=t[0]==="+"?1:0,e.max=t[0]==="?"?1:1/0,e.greedy=t[1]!=="?",e.possessive=t[1]==="+";return k(_.Quantifier,t,e)}function ci(t){const e=t[1].toLowerCase();return k(_.CharacterSet,t,{kind:{d:x.digit,h:x.hex,s:x.space,w:x.word}[e],negate:t[1]!==e})}function li(t){const{p:e,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(t).groups,s=e==="P"&&!n||e==="p"&&!!n;return k(_.CharacterSet,t,{kind:x.property,negate:s,value:r})}function dn(t){const e={};return t.includes("i")&&(e.ignoreCase=!0),t.includes("m")&&(e.dotAll=!0),t.includes("x")&&(e.extended=!0),Object.keys(e).length?e:null}function ui(t){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(t))throw new Error(`Incomplete or invalid escape "${t}"`);const e=t[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(t).groups.hex:t.slice(2);return parseInt(e,16)}function hi(t,e){const{raw:n,inCharClass:r}=t,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=e))return[k(_.Backreference,n)];const a=[],i=s.match(/^[0-7]+|\d/g);for(let o=0;o<i.length;o++){const c=i[o];let l;if(o===0&&c!=="8"&&c!=="9"){if(l=parseInt(c,8),l>127)throw new Error(y`Octal encoded byte above 177 unsupported "${n}"`)}else l=c.codePointAt(0);a.push(k(_.Character,(o===0?"\\":"")+c,{value:l}))}return a}function lr(t){if([...t].length!==1)throw new Error(`Expected "${t}" to be a single code point`)}function Pt({alternatives:t},e){return t.length===1&&t[0].elements.length===1&&(!e||e(t[0].elements[0]))}function fi({type:t}){return t===d.Assertion||t===d.Directive}function pi(t){const e=[d.Character,d.CharacterClass,d.CharacterSet];return e.includes(t.type)||t.type===d.Quantifier&&t.min&&e.includes(t.element.type)}function ur({type:t}){return t===d.CapturingGroup||t===d.Group}function ve({type:t,kind:e}){return t===d.Assertion&&(e===v.lookahead||e===v.lookbehind)}function ce(t,e,n){let r=t.node;for(;r.parent;)r=r.parent;function s(i,o){for(let c=0;c<i.length;c++){const l=a(i[c],o,c,i);c=Math.max(-1,c+l)}}function a(i,o=null,c=null,l=null){let u=0,h=!1;const g={node:i,parent:o,key:c,container:l,ast:r,remove(){Q(l,"Container expected").splice(Math.max(0,c+u),1),u-=1},removeAllNextSiblings(){return Q(l,"Container expected").splice(c+1)},removeAllPrevSiblings(){const w=c+u;return u-=w,Q(l,"Container expected").splice(0,Math.max(0,w))},replaceWith(w){di(w,o),l?l[Math.max(0,c+u)]=w:o[c]=w},skip(){h=!0}},f=gi(i).find(w=>!!n[w]),p=f&&n[f],b=typeof p=="function"?p:p?.enter,m=p?.exit;if(b?.(g,e),!h)switch(i.type){case d.Regex:a(i.pattern,i,"pattern"),a(i.flags,i,"flags");break;case d.Alternative:case d.CharacterClass:s(i.elements,i);break;case d.Assertion:ve(i)&&s(i.alternatives,i);break;case d.Backreference:case d.Character:case d.CharacterSet:case d.Directive:case d.Flags:case d.Recursion:case d.Subroutine:case d.VariableLengthCharacterSet:break;case d.AbsentFunction:case d.CapturingGroup:case d.Group:case d.Pattern:s(i.alternatives,i);break;case d.CharacterClassIntersection:s(i.classes,i);break;case d.CharacterClassRange:a(i.min,i,"min"),a(i.max,i,"max");break;case d.Quantifier:a(i.element,i,"element");break;default:throw new Error(`Unexpected node type "${i.type}"`)}return m?.(g,e),u}a(t.node,t.parent,t.key,t.container)}var mn={AnyGroup:"AnyGroup",AnyNode:"AnyNode"};function gi(t){const e=[mn.AnyNode];return(ur(t)||ve(t))&&e.push(mn.AnyGroup),e.push(t.type),e}function di(t,e){"parent"in e&&(t.parent=e)}var d={AbsentFunction:"AbsentFunction",Alternative:"Alternative",Assertion:"Assertion",Backreference:"Backreference",CapturingGroup:"CapturingGroup",Character:"Character",CharacterClass:"CharacterClass",CharacterClassIntersection:"CharacterClassIntersection",CharacterClassRange:"CharacterClassRange",CharacterSet:"CharacterSet",Directive:"Directive",Flags:"Flags",Group:"Group",Pattern:"Pattern",Quantifier:"Quantifier",Regex:"Regex",Subroutine:"Subroutine",VariableLengthCharacterSet:"VariableLengthCharacterSet",Recursion:"Recursion"},mi={repeater:"repeater"},v={line_end:"line_end",line_start:"line_start",lookahead:"lookahead",lookbehind:"lookbehind",search_start:"search_start",string_end:"string_end",string_end_newline:"string_end_newline",string_start:"string_start",word_boundary:"word_boundary"},E=x,Pe=Qe,We={grapheme:"grapheme",newline:"newline"};function hr({tokens:t,flags:e,rules:n},r){const s={skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,verbose:!1,...r},a={capturingGroups:[],current:0,hasNumberedRef:!1,namedGroupsByName:new Map,parent:null,skipBackrefValidation:s.skipBackrefValidation,skipLookbehindValidation:s.skipLookbehindValidation,skipPropertyNameValidation:s.skipPropertyNameValidation,subroutines:[],token:null,tokens:t,verbose:s.verbose,walk:i};function i(f,p){const b=t[a.current];switch(a.parent=f,a.token=b,a.current++,b.type){case _.Alternator:return Y();case _.Assertion:return Ai(b);case _.Backreference:return Ci(a);case _.Character:return gr(b.value,{useLastValid:!!p.isCheckingRangeEnd});case _.CharacterClassHyphen:return _i(a,p);case _.CharacterClassOpen:return yi(a,p);case _.CharacterSet:return bi(a);case _.Directive:return Ni(b);case _.GroupOpen:return wi(a,p);case _.Quantifier:return Si(a);case _.Subroutine:return ki(a);case _.VariableLengthCharacterSet:return Li(b.kind);default:throw new Error(`Unexpected token type "${b.type}"`)}}const o=$i(Ti(),xi(e));let c=o.pattern.alternatives[0];for(;a.current<t.length;){const f=i(c,{});f.type===d.Alternative?(o.pattern.alternatives.push(f),c=f):c.elements.push(f)}const{capturingGroups:l,hasNumberedRef:u,namedGroupsByName:h,subroutines:g}=a;if(u&&h.size&&!n.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:f}of g)if(typeof f=="number"){if(f>l.length)throw new Error("Subroutine uses a group number that's not defined")}else if(h.has(f)){if(h.get(f).length>1)throw new Error(y`Subroutine uses a duplicate group name "\g<${f}>"`)}else throw new Error(y`Subroutine uses a group name that's not defined "\g<${f}>"`);return ce({node:o},null,{AnyNode({node:f,parent:p}){f.parent=p}}),o}function Ci(t){const{raw:e}=t.token,n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),s=(a,i=!1)=>{const o=t.capturingGroups.length;let c=!1;if(a>o)if(t.skipBackrefValidation)c=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,It(i?o+1-a:a,{orphan:c})};if(n){const a=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(a)return s(+a.groups.num,!!a.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${e}"`);return It(r)}return s(+r)}function _i(t,e){const{parent:n,tokens:r,walk:s}=t,a=n.elements.at(-1),i=r[t.current];if(!e.isCheckingRangeEnd&&a&&a.type!==d.CharacterClass&&a.type!==d.CharacterClassRange&&i&&i.type!==_.CharacterClassOpen&&i.type!==_.CharacterClassClose&&i.type!==_.CharacterClassIntersector){const o=s(n,{...e,isCheckingRangeEnd:!0});if(a.type===d.Character&&o.type===d.Character)return n.elements.pop(),Ii(a,o);throw new Error("Invalid character class range")}return gr(45)}function yi(t,e){const{token:n,tokens:r,verbose:s,walk:a}=t,i=r[t.current];let o=Nt({negate:n.negate});const c=o.elements[0];let l=Cn(i);for(;l.type!==_.CharacterClassClose;){if(l.type===_.CharacterClassIntersector)c.classes.push(Nt({negate:!1,baseOnly:!0})),t.current++;else{const u=c.classes.at(-1);u.elements.push(a(u,e))}l=Cn(r[t.current],i)}if(s||Fi(c),c.classes.length===1){const u=c.classes[0];u.negate=o.negate!==u.negate,o=u}return t.current++,o}function bi({token:t,skipPropertyNameValidation:e}){let{kind:n,negate:r,value:s}=t;if(n===x.property){const a=Ke(s);if(ei.has(a))n=x.posix,s=a;else return ae(s,{negate:r,skipPropertyNameValidation:e})}return n===x.posix?{type:d.CharacterSet,kind:E.posix,negate:r,value:s}:xt(n,{negate:r})}function wi(t,e){const{token:n,tokens:r,capturingGroups:s,namedGroupsByName:a,skipLookbehindValidation:i,verbose:o,walk:c}=t;let l=Ei(n);const u=l.type===d.AbsentFunction,h=l.kind===v.lookbehind,g=h&&l.negate;if(l.type===d.CapturingGroup&&(s.push(l),l.name&&Ue(a,l.name,[]).push(l)),u&&e.isInAbsentFunction)throw new Error("Nested absent function not supported by Oniguruma");let f=_n(r[t.current]);for(;f.type!==_.GroupClose;){if(f.type===_.Alternator)l.alternatives.push(Y()),t.current++;else{const p=l.alternatives.at(-1),b=c(p,{...e,isInAbsentFunction:e.isInAbsentFunction||u,isInLookbehind:e.isInLookbehind||h,isInNegLookbehind:e.isInNegLookbehind||g});if(p.elements.push(b),(h||e.isInLookbehind)&&!i){const m="Lookbehind includes a pattern not allowed by Oniguruma";if(g||e.isInNegLookbehind){if(b.kind===v.lookahead||b.type===d.CapturingGroup)throw new Error(m)}else if(b.kind===v.lookahead||b.kind===v.lookbehind&&b.negate)throw new Error(m)}}f=_n(r[t.current])}return o||(l=Oi(l)),t.current++,l}function Si({token:t,parent:e}){const{min:n,max:r,greedy:s,possessive:a}=t,i=e.elements.at(-1);if(!i||i.type===d.Assertion||i.type===d.Directive)throw new Error("Quantifier requires a repeatable token");const o=dr(i,n,r,s,a);return e.elements.pop(),o}function ki(t){const{token:e,capturingGroups:n,subroutines:r}=t;let s=e.raw.slice(3,-1);const a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(a){const o=+a.groups.num,c=n.length;if(t.hasNumberedRef=!0,s={"":o,"+":c+o,"-":c+1-o}[a.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=Gi(s);return r.push(i),i}function vi(t){return{type:d.AbsentFunction,kind:t,alternatives:[Y()]}}function Y(){return{type:d.Alternative,elements:[]}}function fr(t,e){const n=!!e?.negate;return{type:d.Assertion,kind:t,...t===v.word_boundary&&{negate:n}}}function Ai({kind:t}){return fr(Q({"^":v.line_start,$:v.line_end,"\\A":v.string_start,"\\b":v.word_boundary,"\\B":v.word_boundary,"\\G":v.search_start,"\\z":v.string_end,"\\Z":v.string_end_newline}[t],`Unexpected assertion kind "${t}"`),{negate:t===y`\B`})}function It(t,e){const n=!!e?.orphan;return{type:d.Backreference,...n&&{orphan:n},ref:t}}function Ei({flags:t,kind:e,name:n,negate:r,number:s}){switch(e){case $.absent_repeater:return vi(mi.repeater);case $.atomic:return W({atomic:!0});case $.capturing:return pr(s,n);case $.group:return W({flags:t});case $.lookahead:case $.lookbehind:return de({behind:e===$.lookbehind,negate:r});default:throw new Error(`Unexpected group kind "${e}"`)}}function pr(t,e){const n=e!==void 0;if(n&&!Mi(e))throw new Error(`Group name "${e}" invalid in Oniguruma`);return{type:d.CapturingGroup,number:t,...n&&{name:e},alternatives:[Y()]}}function gr(t,e){const n={useLastValid:!1,...e};if(t>1114111){const r=t.toString(16);if(n.useLastValid)t=1114111;else throw t>1310719?new Error(`Invalid code point out of range "\\x{${r}}"`):new Error(`Invalid code point out of range in JS "\\x{${r}}"`)}return{type:d.Character,value:t}}function Nt(t){const e={baseOnly:!1,negate:!1,...t};return{type:d.CharacterClass,negate:e.negate,elements:e.baseOnly?[]:[Ri()]}}function Ri(){return{type:d.CharacterClassIntersection,classes:[Nt({negate:!1,baseOnly:!0})]}}function Ii(t,e){if(e.value<t.value)throw new Error("Character class range out of order");return{type:d.CharacterClassRange,min:t,max:e}}function xt(t,{negate:e}){const n={type:d.CharacterSet,kind:Q(E[t],`Unexpected character set kind "${t}"`)};return(t===x.digit||t===x.hex||t===x.space||t===x.word)&&(n.negate=e),n}function Ni({kind:t,flags:e}){const n={type:d.Directive,kind:Q(Pe[t],`Unexpected directive kind "${t}"`)};return t===Qe.flags&&(n.flags=e),n}function xi({ignoreCase:t,dotAll:e,extended:n,digitIsAscii:r,spaceIsAscii:s,wordIsAscii:a}){return{type:d.Flags,ignoreCase:t,dotAll:e,extended:n,digitIsAscii:r,spaceIsAscii:s,wordIsAscii:a}}function W(t){const e=t?.atomic,n=t?.flags;return{type:d.Group,...e&&{atomic:e},...n&&{flags:n},alternatives:[Y()]}}function de(t){const e={behind:!1,negate:!1,...t};return{type:d.Assertion,kind:e.behind?v.lookbehind:v.lookahead,negate:e.negate,alternatives:[Y()]}}function Ti(){return{type:d.Pattern,alternatives:[Y()]}}function dr(t,e,n,r=!0,s=!1){const a={type:d.Quantifier,min:e,max:n,greedy:r,possessive:s,element:t};return n<e?{...a,min:n,max:e,possessive:!0}:a}function $i(t,e){return{type:d.Regex,pattern:t,flags:e}}function Gi(t){return{type:d.Subroutine,ref:t}}function ae(t,e){const n={negate:!1,skipPropertyNameValidation:!1,...e};return{type:d.CharacterSet,kind:E.property,value:n.skipPropertyNameValidation?t:Pi(t),negate:n.negate}}function Li(t){return{type:d.VariableLengthCharacterSet,kind:Q({"\\R":We.newline,"\\X":We.grapheme}[t],`Unexpected varcharset kind "${t}"`)}}function Pi(t){const e=Ke(t);if(tr.has(e))throw new Error(y`Unicode property "\p{${t}}" unsupported in Oniguruma`);const n=er.get(e);return n||t.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,r=>r[0].toUpperCase()+r.slice(1).toLowerCase())}function Oi(t){const e=t.alternatives[0].elements[0];return t.type===d.Group&&Pt(t,n=>n.type===d.Group)&&!(t.atomic&&e.flags)&&!(t.flags&&(e.atomic||e.flags))?(t.atomic?e.atomic=!0:t.flags&&(e.flags=t.flags),e):t}function Mi(t){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(t)}function Fi(t){for(let e=0;e<t.classes.length;e++){const n=t.classes[e],r=n.elements[0];n.elements.length===1&&r.type===d.CharacterClass&&(t.classes[e]=r,r.negate=n.negate!==r.negate)}}function Cn(t,e){return Q(t,`${e?.value===93?"Empty":"Unclosed"} character class`)}function _n(t){return Q(t,"Unclosed group")}function Bi(t,e){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...e},r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Rt(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:t.flags.digitIsAscii,spaceIsAscii:t.flags.spaceIsAscii,wordIsAscii:t.flags.wordIsAscii};ce({node:t},r,mr);const s={dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},a={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};ce({node:t},a,Cr);const i={groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer};return ce({node:t},i,ji),t._strategy=r.strategy,t}var mr={AbsentFunction({node:t,replaceWith:e}){const n=K(W(),[be(de({negate:!0}),t.alternatives),ae("Any")]),r=dr(n,0,1/0);n.parent=r,e(K(W(),[r]))},Alternative:{enter({node:t,parent:e,key:n},{flagDirectivesByAlt:r}){const s=t.elements.filter(a=>a.kind===Pe.flags);for(let a=n+1;a<e.alternatives.length;a++){const i=e.alternatives[a];Ue(r,i,[]).push(...s)}},exit({node:t},{flagDirectivesByAlt:e}){if(e.get(t)?.length){const n=yr(e.get(t));if(n){const r=K(W({flags:n}),t.elements);r.parent=t,t.elements=[r]}}}},Assertion({node:t,key:e,container:n,ast:r,remove:s,replaceWith:a},i){const{kind:o,negate:c}=t,{asciiWordBoundaries:l,avoidSubclass:u,supportedGNodes:h,wordIsAscii:g}=i;if(o===v.line_end)a(j(y`(?=\z|\n)`));else if(o===v.line_start)a(j(y`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}));else if(o===v.lookbehind)i.passedLookbehind=!0;else if(o===v.search_start)if(h.has(t))r.flags.sticky=!0,s();else{const f=n[e-1];if(f&&pi(f))a(K(de({negate:!0})));else{if(u)throw new Error(y`Uses "\G" in a way that requires a subclass`);a(fr(v.string_start)),i.strategy="search_start_clip"}}else if(o===v.string_end_newline)a(j(y`(?=\n?\z)`));else if(o===v.word_boundary&&!g&&!l){const f=`(?:(?<=${V})(?!${V})|(?<!${V})(?=${V}))`,p=`(?:(?<=${V})(?=${V})|(?<!${V})(?!${V}))`;a(j(c?p:f))}},Backreference({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!gt(n)&&(n=pt(n,e),t.ref=n)},CapturingGroup({node:t},{jsGroupNameMap:e,subroutineRefMap:n}){let{name:r}=t;r&&!gt(r)&&(r=pt(r,e),t.name=r),n.set(t.number,t),r&&n.set(r,t)},CharacterSet({node:t,replaceWith:e},{accuracy:n,minTargetEs2024:r,digitIsAscii:s,spaceIsAscii:a,wordIsAscii:i}){const{kind:o,negate:c,value:l}=t;if(s&&(o===E.digit||l==="digit")){e(xt(E.digit,{negate:c}));return}if(a&&(o===E.space||l==="space")){e(dt(j(Di),c));return}if(i&&(o===E.word||l==="word")){e(xt(E.word,{negate:c}));return}if(o===E.any)e(ae("Any"));else if(o===E.digit)e(ae("Nd",{negate:c}));else if(o===E.hex)e(ae("AHex",{negate:c}));else if(o===E.non_newline)e(j(y`[^\n]`));else if(o===E.space)e(ae("space",{negate:c}));else if(o===E.word)e(dt(j(V),c));else if(o===E.property)Yn.has(l)||(t.key="sc");else if(o===E.posix)if(!r&&(l==="graph"||l==="print")){if(n==="strict")throw new Error(`POSIX class "${l}" requires min target ES2024 or non-strict accuracy`);let u={graph:"!-~",print:" -~"}[l];c&&(u=`\0-${R(u.codePointAt(0)-1)}${R(u.codePointAt(2)+1)}-􏿿`),e(j(`[${u}]`))}else e(dt(j(nr.get(l)),c))},Directive(t,e){const{node:n,parent:r,ast:s,remove:a,replaceWith:i,removeAllPrevSiblings:o,removeAllNextSiblings:c}=t,{kind:l,flags:u}=n;if(l===Pe.flags)if(!u.enable&&!u.disable)a();else{const h=K(W({flags:u}),c());i(h),kr(h,t,e,mr)}else if(l===Pe.keep){const h=s.pattern.alternatives[0].elements[0],f=Pt(s.pattern,p=>p.type===d.Group)&&h.alternatives.length===1?h:s.pattern;if(r.parent!==f||f.alternatives.length>1)throw new Error(y`Uses "\K" in a way that's unsupported`);i(K(de({behind:!0}),o()))}},Flags({node:t,parent:e}){["digitIsAscii","extended","spaceIsAscii","wordIsAscii"].forEach(n=>delete t[n]),Object.assign(t,{global:!1,hasIndices:!1,multiline:!1,sticky:t.sticky??!1}),e.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:t}){if(!t.flags)return;const{enable:e,disable:n}=t.flags;e?.extended&&delete e.extended,n?.extended&&delete n.extended,e?.dotAll&&n?.dotAll&&delete e.dotAll,e?.ignoreCase&&n?.ignoreCase&&delete e.ignoreCase,e&&!Object.keys(e).length&&delete t.flags.enable,n&&!Object.keys(n).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},Pattern:{enter({node:t},{supportedGNodes:e}){const n=[];let r=!1,s=!1;for(const a of t.alternatives)if(a.elements.length===1&&a.elements[0].kind===v.search_start)a.elements.pop();else{const i=wr(a.elements);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(a=>e.add(a))},exit(t,{accuracy:e,passedLookbehind:n,strategy:r}){if(e==="strict"&&n&&r)throw new Error(y`Uses "\G" in a way that requires non-strict accuracy`)}},Quantifier({node:t}){if(t.element.type===d.Quantifier){const e=K(W(),[t.element]);e.parent=t,t.element=e}},Subroutine({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!gt(n)&&(n=pt(n,e),t.ref=n)},VariableLengthCharacterSet({node:t,replaceWith:e},{accuracy:n,minTargetEs2024:r}){const{kind:s}=t;if(s===We.newline)e(j(`(?>\r
146
+ ?|[
147
+ \v\f…\u2028\u2029])`));else if(s===We.grapheme){if(n==="strict")throw new Error(y`Use of "\X" requires non-strict accuracy`);const a=r?y`\p{RGI_Emoji}`:La().source.replace(/\\u\{/g,"\\x{");e(j(y`(?>\r\n|${a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}))}else throw new Error(`Unexpected varcharset kind "${s}"`)}},Cr={Backreference({node:t},{multiplexCapturesToLeftByRef:e,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=t;r||n.set(t,[...e.get(s).map(({node:a})=>a)])},CapturingGroup:{enter({node:t,replaceWith:e,skip:n},{groupOriginByCopy:r,groupsByName:s,multiplexCapturesToLeftByRef:a,openRefs:i,reffedNodesByReferencer:o}){const c=r.get(t);if(c&&i.has(t.number)){const u=yn(t.number);o.set(u,i.get(t.number)),e(u),n();return}i.set(t.number,t),a.set(t.number,[]),t.name&&Ue(a,t.name,[]);const l=a.get(t.name??t.number);for(let u=0;u<l.length;u++){const h=l[u];if(c===h.node||c&&c===h.origin||t===h.origin){l.splice(u,1);break}}if(a.get(t.number).push({node:t,origin:c}),t.name&&a.get(t.name).push({node:t,origin:c}),t.name){const u=Ue(s,t.name,new Map);let h=!1;if(c)h=!0;else for(const g of u.values())if(!g.hasDuplicateNameToRemove){h=!0;break}s.get(t.name).set(t,{node:t,hasDuplicateNameToRemove:h})}c&&(t._originNumber=c.number)},exit({node:t},{openRefs:e}){e.delete(t.number)}},Group:{enter({node:t},e){e.prevFlags=e.currentFlags,t.flags&&(e.currentFlags=De(e.currentFlags,t.flags))},exit(t,e){e.currentFlags=e.prevFlags}},Recursion({node:t,parent:e},{reffedNodesByReferencer:n}){const{ref:r}=t;let s=e;for(;(s=s.parent)&&!(s.type===d.CapturingGroup&&(s.name===r||s.number===r)););n.set(t,s)},Subroutine(t,e){const{node:n,replaceWith:r}=t,{ref:s}=n,a=e.subroutineRefMap.get(s),i=s===0,o=i?yn(0):_r(a,e.groupOriginByCopy,null);let c=o;if(!i){const l=yr(Hi(a,h=>h.type===d.Group&&!!h.flags)),u=l?De(e.globalFlags,l):e.globalFlags;Ui(u,e.currentFlags)||(c=K(W({flags:qi(u)}),[o]))}r(c),i||kr(c,t,e,Cr)}},ji={Backreference({node:t,replaceWith:e},n){if(t.orphan){n.highestOrphanBackref=Math.max(n.highestOrphanBackref,t.ref);return}const s=n.reffedNodesByReferencer.get(t).filter(a=>Wi(a,t));if(!s.length)e(K(de({negate:!0})));else if(s.length>1){const a=s.map(i=>be(Y(),[It(i.number)]));e(be(W(),a))}else t.ref=s[0].number},CapturingGroup({node:t},e){t.number=++e.numCapturesToLeft,t.name&&e.groupsByName.get(t.name).get(t).hasDuplicateNameToRemove&&delete t.name},Recursion({node:t},e){t.ref!==0&&(t.ref=e.reffedNodesByReferencer.get(t).number)},Regex:{exit({node:t},e){const n=Math.max(e.highestOrphanBackref-e.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=pr();t.pattern.alternatives.at(-1).elements.push(s)}}}},Di="[ -\r ]",V=y`[\p{L}\p{M}\p{N}\p{Pc}]`;function be(t,e){return e.forEach(n=>n.parent=t),t[Ot(t)]=e,t}function Ui(t,e){return t.dotAll===e.dotAll&&t.ignoreCase===e.ignoreCase}function Wi(t,e){let n=e;do{if(n.type===d.Pattern)return!1;if(n.type===d.Alternative)continue;if(n===t)return!1;const r=br(n.parent);for(const s of r){if(s===n)break;if(s===t||Sr(s,t))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function _r(t,e,n,r){const s=Array.isArray(t)?[]:{};for(const[a,i]of Object.entries(t))a==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[a]=_r(i,e,s,n):(a==="type"&&i===d.CapturingGroup&&e.set(s,e.get(t)??t),s[a]=i);return s}function yn(t){return{type:d.Recursion,ref:t}}function Hi(t,e){const n=[];for(;t=t.parent;)(!e||e(t))&&n.push(t);return n}function pt(t,e){if(e.has(t))return e.get(t);const n=`$${e.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return e.set(t,n),n}function Ot(t){for(const e of["alternatives","classes","elements"])if(t[e])return e;return null}function yr(t){const e=["dotAll","ignoreCase"],n={enable:{},disable:{}};return t.forEach(({flags:r})=>{e.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function qi({dotAll:t,ignoreCase:e}){const n={};return(t||e)&&(n.enable={},t&&(n.enable.dotAll=!0),e&&(n.enable.ignoreCase=!0)),(!t||!e)&&(n.disable={},!t&&(n.disable.dotAll=!0),!e&&(n.disable.ignoreCase=!0)),n}function br(t){if(!t)throw new Error("Node expected");if(t.type===d.Quantifier)return[t.element];const e=Ot(t);return e&&t[e]}function wr(t){const e=t.find(n=>n.kind===v.search_start||zi(n,{negate:!1})||!fi(n));if(!e)return null;if(e.kind===v.search_start)return e;if(ve(e))return e.alternatives[0].elements[0];if(ur(e)){const n=[];for(const r of e.alternatives){const s=wr(r.elements);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Sr(t,e){const n=br(t)??[];for(const r of n)if(r===e||Sr(r,e))return!0;return!1}function zi(t,e){const n={negate:null,...e};return ve(t)&&(n.negate===null||t.negate===n.negate)&&Pt(t,r=>r.kind===v.search_start)}function gt(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function j(t,e){const r=hr(or(t),e).pattern.alternatives;return r.length>1||r[0].elements.length>1?be(W(),r):r[0].elements[0]}function K(t,e){const n=Ot(t);return t[n][0].parent=t,e&&be(t[n][0],e),t}function dt(t,e){return t.negate=e,t}function kr(t,{parent:e,key:n,container:r},s,a){ce({node:t,parent:e,key:n,container:r},s,a)}function Vi(t,e){const n=Xn(e),r=Rt(n.target,"ES2024"),s=Rt(n.target,"ES2025"),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,o=null;if(!s){const f=[t.flags.ignoreCase];ce({node:t},{getCurrentModI:()=>f.at(-1),popModI(){f.pop()},pushModI(p){f.push(p)},setHasCasedChar(){f.at(-1)?i=!0:o=!0}},Ki)}const c={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||i)&&!o)};let l=null;const u={accuracy:n.accuracy,appliedGlobalFlags:c,avoidSubclass:n.avoidSubclass,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:l,recursionLimit:a,useAppliedIgnoreCase:!!(!s&&i&&o),useFlagMods:s,useFlagV:r,verbose:n.verbose};function h(f){switch(u.lastNode=l,l=f,f.type){case d.Regex:return{pattern:h(f.pattern),flags:h(f.flags),options:{...f.options}};case d.Alternative:return f.elements.map(h).join("");case d.Assertion:return Yi(f,u,h);case d.Backreference:return eo(f,u);case d.CapturingGroup:return to(f,u,h);case d.Character:return no(f,u);case d.CharacterClass:return ro(f,u,h);case d.CharacterClassIntersection:if(!u.useFlagV)throw new Error("Use of class intersection requires min target ES2024");return f.classes.map(h).join("&&");case d.CharacterClassRange:return so(f,u);case d.CharacterSet:return ao(f,u);case d.Flags:return io(f,u);case d.Group:return oo(f,u,h);case d.Pattern:return f.alternatives.map(h).join("|");case d.Quantifier:return h(f.element)+ho(f);case d.Recursion:return co(f,u);default:throw new Error(`Unexpected node type "${f.type}"`)}}const g=h(t);return r||(delete g.options.force.v,g.options.disable.v=!0,g.options.unicodeSetsPlugin=null),g}var Ki={AnyGroup:{enter({node:t},e){const n=e.getCurrentModI();e.pushModI(t.flags?De({ignoreCase:n},t.flags).ignoreCase:n)},exit(t,e){e.popModI()}},Backreference(t,e){e.setHasCasedChar()},Character({node:t},e){Mt(R(t.value))&&e.setHasCasedChar()},CharacterClassRange({node:t,skip:e},n){e(),vr(t,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:t},e){t.kind===E.property&&rr.has(t.value)&&e.setHasCasedChar()}},Qi=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Ji=new Set(["-","\\","]","^","["]),Xi=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),bn=new Map([[9,y`\t`],[10,y`\n`],[11,y`\v`],[12,y`\f`],[13,y`\r`],[8232,y`\u2028`],[8233,y`\u2029`],[65279,y`\uFEFF`]]),Zi=/^\p{Cased}$/u;function Mt(t){return Zi.test(t)}function Yi(t,e,n){const{kind:r,negate:s,alternatives:a}=t;if(ve(t))return`(?${`${r===v.lookahead?"":"<"}${s?"!":"="}`}${a.map(n).join("|")})`;if(r===v.string_end)return"$";if(r===v.string_start)return"^";if(r===v.word_boundary)return s?y`\B`:y`\b`;throw new Error(`Unexpected assertion kind "${r}"`)}function eo({ref:t},e){if(typeof t!="number")throw new Error("Unexpected named backref in transformed AST");if(!e.useFlagMods&&e.accuracy==="strict"&&e.currentFlags.ignoreCase&&!e.captureMap.get(t).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+t}function to({name:t,number:e,alternatives:n,_originNumber:r},s,a){return s.captureMap.set(e,{ignoreCase:s.currentFlags.ignoreCase}),`(${t?`?<${t}>`:""}${!s.avoidSubclass&&r?`${r<e?`$${r}`:""}${re}`:""}${n.map(a).join("|")})`}function no({value:t},e){const n=R(t),r=ie(t,{isAfterBackref:e.lastNode.type===d.Backreference,inCharClass:e.inCharClass,useFlagV:e.useFlagV});if(r!==n)return r;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&Mt(n)){const s=Zn(n);return e.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n}function ro({negate:t,parent:e,elements:n},r,s){const a=()=>`[${t?"^":""}${n.map(s).join("")}]`;if(!r.inCharClass){r.inCharClass=!0;const o=a();return r.inCharClass=!1,o}const i=n[0]?.type;if(!t&&i&&((!r.useFlagV||!r.verbose)&&e.type===d.CharacterClass&&i!==d.CharacterClassIntersection||!r.verbose&&e.type===d.CharacterClassIntersection&&n.length===1&&i!==d.CharacterClass&&i!==d.CharacterClassRange))return n.map(s).join("");if(!r.useFlagV&&e.type===d.CharacterClass)throw new Error("Use of nested character class requires min target ES2024");return a()}function so(t,e){const n=t.min.value,r=t.max.value,s={isAfterBackref:!1,inCharClass:!0,useFlagV:e.useFlagV},a=ie(n,s),i=ie(r,s),o=new Set;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase){const c=vr(t);lo(c).forEach(u=>{o.add(Array.isArray(u)?`${ie(u[0],s)}-${ie(u[1],s)}`:ie(u,s))})}return`${a}-${i}${[...o].join("")}`}function ao({kind:t,negate:e,value:n,key:r},s){if(t===E.dot)return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":y`[^\n]`;if(t===E.digit)return e?y`\D`:y`\d`;if(t===E.property){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&rr.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${e?y`\P`:y`\p`}{${r?`${r}=`:""}${n}}`}if(t===E.word)return e?y`\W`:y`\w`;throw new Error(`Unexpected character set kind "${t}"`)}function io(t,e){return(e.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")}function oo({atomic:t,flags:e,parent:n,alternatives:r},s,a){const i=s.currentFlags;e&&(s.currentFlags=De(i,e));const o=r.map(a).join("|"),c=!s.verbose&&r.length===1&&n.type!==d.Quantifier&&!t&&(!s.useFlagMods||!e)?o:`(?${uo(t,e,s.useFlagMods)}${o})`;return s.currentFlags=i,c}function co({ref:t},e){const n=e.recursionLimit;return t===0?`(?R=${n})`:y`\g<${t}&R=${n}>`}function vr(t,e){const n=!!e?.firstOnly,r=t.min.value,s=t.max.value,a=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return a;for(let i=r;i<=s;i++){const o=R(i);if(!Mt(o))continue;const c=Zn(o).filter(l=>{const u=l.codePointAt(0);return u<r||u>s});if(c.length&&(a.push(...c),n))break}return a}function ie(t,{isAfterBackref:e,inCharClass:n,useFlagV:r}){if(bn.has(t))return bn.get(t);if(t<32||t>126&&t<160||t>262143||e&&fo(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?Xi:Ji:Qi,a=R(t);return(s.has(a)?"\\":"")+a}function lo(t){const e=t.map(s=>s.codePointAt(0)).sort((s,a)=>s-a),n=[];let r=null;for(let s=0;s<e.length;s++)e[s+1]===e[s]+1?r??=e[s]:r===null?n.push(e[s]):(n.push([r,e[s]]),r=null);return n}function uo(t,e,n){if(t)return">";let r="";if(e&&n){const{enable:s,disable:a}=e;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(a?"-":"")+(a?.ignoreCase?"i":"")+(a?.dotAll?"s":"")}return`${r}:`}function ho({min:t,max:e,greedy:n,possessive:r}){let s;return!t&&e===1?s="?":!t&&e===1/0?s="*":t===1&&e===1/0?s="+":t===e?s=`{${t}}`:s=`{${t},${e===1/0?"":e}}`,s+(r?"+":n?"":"?")}function fo(t){return t>47&&t<58}var po=class Ar extends Lt{#e;rawArgs;constructor(e,n,r){if(e instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");super(e,n),e instanceof Ar?(this.#e=e.#e,this.rawArgs=e.rawArgs):(this.#e=null,this.rawArgs={pattern:e.source,flags:e.flags,options:{}}),n!==void 0&&(this.rawArgs.flags=n)}else{const s={strategy:null,useEmulationGroups:!1,...r};super(e,n,{useEmulationGroups:s.useEmulationGroups}),this.#e=s.strategy,this.rawArgs={pattern:e,flags:n??"",options:{...s.strategy&&{strategy:s.strategy},...s.useEmulationGroups&&{useEmulationGroups:!0}}}}}exec(e){const n=super.exec,r=this.global||this.sticky,s=this.lastIndex;if(this.#e==="search_start_clip"&&r&&s){this.lastIndex=0;const a=n.call(this,e.slice(s));return a&&(go(a,this,e,s),this.lastIndex+=s),a}return n.call(this,e)}};function go(t,e,n,r){if(t.input=n,t.index+=r,e.hasIndices){const s=t.indices;for(let i=0;i<s.length;i++){const o=s[i];o&&(s[i]=[o[0]+r,o[1]+r])}const a=s.groups;a&&Object.keys(a).forEach(i=>{const o=a[i];o&&(a[i]=[o[0]+r,o[1]+r])})}}function mo(t,e){const n=Xn(e),r=n.avoidSubclass,s=or(t,n.flags,{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}),a=hr(s,{skipBackrefValidation:n.rules.allowOrphanBackrefs,verbose:n.verbose}),i=Bi(a,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:r,bestEffortTarget:n.target}),o=Vi(i,n),c={useEmulationGroups:!r},l={pattern:Da(Ua(Ha(o.pattern,c)),c),flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`},u=!r&&l.pattern.includes(re),h=i._strategy;return(u||h)&&(l.options={...h&&{strategy:h},...u&&{useEmulationGroups:u}}),l}function Co(t,e){const n=mo(t,e);return n.options?new po(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}const wn=4294967295;class _o{constructor(e,n={}){this.patterns=e,this.options=n;const{forgiving:r=!1,cache:s,regexConstructor:a}=n;if(!a)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(i=>{if(typeof i!="string")return i;const o=s?.get(i);if(o){if(o instanceof RegExp)return o;if(r)return null;throw o}try{const c=a(i);return s?.set(i,c),c}catch(c){if(s?.set(i,c),r)return null;throw c}})}regexps;findNextMatchSync(e,n,r){const s=typeof e=="string"?e:e.content,a=[];function i(o,c,l=0){return{index:o,captureIndices:c.indices.map(u=>u==null?{start:wn,end:wn,length:0}:{start:u[0]+l,end:u[1]+l,length:u[1]-u[0]})}}for(let o=0;o<this.regexps.length;o++){const c=this.regexps[o];if(c)try{c.lastIndex=n;const l=c.exec(s);if(!l)continue;if(l.index===n)return i(o,l,0);a.push([o,l,0])}catch(l){if(this.options.forgiving)continue;throw l}}if(a.length){const o=Math.min(...a.map(c=>c[1].index));for(const[c,l,u]of a)if(l.index===o)return i(c,l,u)}return null}}function Er(t,e){return Co(t,{global:!0,hasIndices:!0,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...e})}function yo(t={}){const e=Object.assign({target:"auto",cache:new Map},t);return e.regexConstructor||=n=>Er(n,{target:e.target}),{createScanner(n){return new _o(n,e)},createString(n){return{content:n}}}}function Rr(t){return B("import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),me.createOnigurumaEngine(t)}function bo(t){return B("import `createOnigurumaEngine` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),me.createOnigurumaEngine(t)}function wo(t){return B("import `loadWasm` from `@shikijs/engine-oniguruma` or `shiki/engine/oniguruma` instead"),me.loadWasm(t)}function Ir(t){return Array.isArray(t)?t:[t]}function Ae(t,e=!1){const n=t.split(/(\r?\n)/g);let r=0;const s=[];for(let a=0;a<n.length;a+=2){const i=e?n[a]+(n[a+1]||""):n[a];s.push([i,r]),r+=n[a].length,r+=n[a+1]?.length||0}return s}function Je(t){return!t||["plaintext","txt","text","plain"].includes(t)}function Ft(t){return t==="ansi"||Je(t)}function Xe(t){return t==="none"}function Bt(t){return Xe(t)}function jt(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(/\s+/g)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(/\s+/g);for(const r of n)r&&!t.properties.class.includes(r)&&t.properties.class.push(r);return t}function Nr(t,e){let n=0;const r=[];for(const s of e)s>n&&r.push({...t,content:t.content.slice(n,s),offset:t.offset+n}),n=s;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function xr(t,e){const n=Array.from(e instanceof Set?e:new Set(e)).sort((r,s)=>r-s);return n.length?t.map(r=>r.flatMap(s=>{const a=n.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,o)=>i-o);return a.length?Nr(s,a):s})):t}async function Dt(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function we(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[s,a]of Object.entries(e?.colorReplacements||{}))typeof a=="string"?n[s]=a:s===r&&Object.assign(n,a);return n}function Z(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function Ut(t){const e={};return t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle&&(t.fontStyle&H.Italic&&(e["font-style"]="italic"),t.fontStyle&H.Bold&&(e["font-weight"]="bold"),t.fontStyle&H.Underline&&(e["text-decoration"]="underline")),e}function Tr(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}function $r(t){const e=Ae(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e[e.length-1].length};let a=s,i=0;for(const o of e){if(a<o.length)break;a-=o.length,i++}return{line:i,character:a}}function r(s,a){let i=0;for(let o=0;o<s;o++)i+=e[o].length;return i+=a,i}return{lines:e,indexToPos:n,posToIndex:r}}class G extends Error{constructor(e){super(e),this.name="ShikiError"}}const Gr=new WeakMap;function Ze(t,e){Gr.set(t,e)}function Se(t){return Gr.get(t)}class he{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new he(Object.fromEntries(Ir(n).map(r=>[r,kt])),e)}constructor(...e){if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}get scopes(){return B("GrammarState.scopes is deprecated, use GrammarState.getScopes() instead"),Sn(this._stacks[this.theme])}getScopes(e=this.theme){return Sn(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function Sn(t){const e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const a=s?.nameScopesList?.scopeName;a&&e.push(a),s.parent&&r(s.parent)}return r(t),e}function So(t,e){if(!(t instanceof he))throw new G("Invalid grammar state");return t.getInternalStack(e)}function Lr(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let r=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new G(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...s.indexToPos(i),offset:i}}else{const o=s.lines[i.line];if(o===void 0)throw new G(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${s.lines.length}`);if(i.character<0||i.character>o.length)throw new G(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${o.length}`);return{...i,offset:s.posToIndex(i.line,i.character)}}};const s=$r(n.source),a=(n.options.decorations||[]).map(i=>({...i,start:r(i.start),end:r(i.end)}));ko(a),t.set(n.meta,{decorations:a,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(!this.options.decorations?.length)return;const s=e(this).decorations.flatMap(i=>[i.start.offset,i.end.offset]);return xr(n,s)},code(n){if(!this.options.decorations?.length)return;const r=e(this),s=Array.from(n.children).filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new G(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function a(u,h,g,f){const p=s[u];let b="",m=-1,w=-1;if(h===0&&(m=0),g===0&&(w=0),g===Number.POSITIVE_INFINITY&&(w=p.children.length),m===-1||w===-1)for(let S=0;S<p.children.length;S++)b+=Pr(p.children[S]),m===-1&&b.length===h&&(m=S+1),w===-1&&b.length===g&&(w=S+1);if(m===-1)throw new G(`Failed to find start index for decoration ${JSON.stringify(f.start)}`);if(w===-1)throw new G(`Failed to find end index for decoration ${JSON.stringify(f.end)}`);const C=p.children.slice(m,w);if(!f.alwaysWrap&&C.length===p.children.length)o(p,f,"line");else if(!f.alwaysWrap&&C.length===1&&C[0].type==="element")o(C[0],f,"token");else{const S={type:"element",tagName:"span",properties:{},children:C};o(S,f,"wrapper"),p.children.splice(m,C.length,S)}}function i(u,h){s[u]=o(s[u],h,"line")}function o(u,h,g){const f=h.properties||{},p=h.transform||(b=>b);return u.tagName=h.tagName||"span",u.properties={...u.properties,...f,class:u.properties.class},h.properties?.class&&jt(u,h.properties.class),u=p(u,g)||u,u}const c=[],l=r.decorations.sort((u,h)=>h.start.offset-u.start.offset);for(const u of l){const{start:h,end:g}=u;if(h.line===g.line)a(h.line,h.character,g.character,u);else if(h.line<g.line){a(h.line,h.character,Number.POSITIVE_INFINITY,u);for(let f=h.line+1;f<g.line;f++)c.unshift(()=>i(f,u));a(g.line,0,g.character,u)}}c.forEach(u=>u())}}}function ko(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new G(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){const s=t[r],a=n.start.offset<s.start.offset&&s.start.offset<n.end.offset,i=n.start.offset<s.end.offset&&s.end.offset<n.end.offset,o=s.start.offset<n.start.offset&&n.start.offset<s.end.offset,c=s.start.offset<n.end.offset&&n.end.offset<s.end.offset;if(a||i||o||c){if(i&&i||o&&c)continue;throw new G(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Pr(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(Pr).join(""):""}const vo=[Lr()];function He(t){return[...t.transformers||[],...vo]}var te=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],mt={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function Ao(t,e){const n=t.indexOf("\x1B[",e);if(n!==-1){const r=t.indexOf("m",n);return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function kn(t,e){let n=1;const r=t[e+n++];let s;if(r==="2"){const a=[t[e+n++],t[e+n++],t[e+n]].map(i=>Number.parseInt(i));a.length===3&&!a.some(i=>Number.isNaN(i))&&(s={type:"rgb",rgb:a})}else if(r==="5"){const a=Number.parseInt(t[e+n]);Number.isNaN(a)||(s={type:"table",index:Number(a)})}return[n,s]}function Eo(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n],s=Number.parseInt(r);if(!Number.isNaN(s))if(s===0)e.push({type:"resetAll"});else if(s<=9)mt[s]&&e.push({type:"setDecoration",value:mt[s]});else if(s<=29){const a=mt[s-20];a&&e.push({type:"resetDecoration",value:a})}else if(s<=37)e.push({type:"setForegroundColor",value:{type:"named",name:te[s-30]}});else if(s===38){const[a,i]=kn(t,n);i&&e.push({type:"setForegroundColor",value:i}),n+=a}else if(s===39)e.push({type:"resetForegroundColor"});else if(s<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:te[s-40]}});else if(s===48){const[a,i]=kn(t,n);i&&e.push({type:"setBackgroundColor",value:i}),n+=a}else s===49?e.push({type:"resetBackgroundColor"}):s>=90&&s<=97?e.push({type:"setForegroundColor",value:{type:"named",name:te[s-90+8]}}):s>=100&&s<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:te[s-100+8]}})}return e}function Ro(){let t=null,e=null,n=new Set;return{parse(r){const s=[];let a=0;do{const i=Ao(r,a),o=i.sequence?r.substring(a,i.startPosition):r.substring(a);if(o.length>0&&s.push({value:o,foreground:t,background:e,decorations:new Set(n)}),i.sequence){const c=Eo(i.sequence);for(const l of c)l.type==="resetAll"?(t=null,e=null,n.clear()):l.type==="resetForegroundColor"?t=null:l.type==="resetBackgroundColor"?e=null:l.type==="resetDecoration"&&n.delete(l.value);for(const l of c)l.type==="setForegroundColor"?t=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&n.add(l.value)}a=i.position}while(a<r.length);return s}}}var Io={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 No(t=Io){function e(o){return t[o]}function n(o){return`#${o.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let l=0;l<te.length;l++)r.push(e(te[l]));let o=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let h=0;h<6;h++)r.push(n([o[l],o[u],o[h]]));let c=8;for(let l=0;l<24;l++,c+=10)r.push(n([c,c,c]));return r}function a(o){return s()[o]}function i(o){switch(o.type){case"named":return e(o.name);case"rgb":return n(o.rgb);case"table":return a(o.index)}}return{value:i}}function Or(t,e,n){const r=we(t,n),s=Ae(e),a=No(Object.fromEntries(te.map(o=>[o,t.colors?.[`terminal.ansi${o[0].toUpperCase()}${o.substring(1)}`]]))),i=Ro();return s.map(o=>i.parse(o[0]).map(c=>{let l,u;c.decorations.has("reverse")?(l=c.background?a.value(c.background):t.bg,u=c.foreground?a.value(c.foreground):t.fg):(l=c.foreground?a.value(c.foreground):t.fg,u=c.background?a.value(c.background):void 0),l=Z(l,r),u=Z(u,r),c.decorations.has("dim")&&(l=xo(l));let h=H.None;return c.decorations.has("bold")&&(h|=H.Bold),c.decorations.has("italic")&&(h|=H.Italic),c.decorations.has("underline")&&(h|=H.Underline),{content:c.value,offset:o[1],color:l,bgColor:u,fontStyle:h}}))}function xo(t){const e=t.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(e)if(e[3]){const r=Math.round(Number.parseInt(e[3],16)/2).toString(16).padStart(2,"0");return`#${e[1]}${e[2]}${r}`}else return e[2]?`#${e[1]}${e[2]}80`:`#${Array.from(e[1]).map(r=>`${r}${r}`).join("")}80`;const n=t.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return n?`var(${n[1]}-dim)`:t}function Ee(t,e,n={}){const{lang:r="text",theme:s=t.getLoadedThemes()[0]}=n;if(Je(r)||Xe(s))return Ae(e).map(c=>[{content:c[0],offset:c[1]}]);const{theme:a,colorMap:i}=t.setTheme(s);if(r==="ansi")return Or(a,e,n);const o=t.getLanguage(r);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new q(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(a.name))throw new q(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${a.name}"`)}return Fr(e,o,a,i,n)}function Mr(...t){if(t.length===2)return Se(t[1]);const[e,n,r={}]=t,{lang:s="text",theme:a=e.getLoadedThemes()[0]}=r;if(Je(s)||Xe(a))throw new q("Plain language does not have grammar state");if(s==="ansi")throw new q("ANSI language does not have grammar state");const{theme:i,colorMap:o}=e.setTheme(a),c=e.getLanguage(s);return new he(qe(n,c,i,o,r).stateStack,c.name,i.name)}function Fr(t,e,n,r,s){const a=qe(t,e,n,r,s),i=new he(qe(t,e,n,r,s).stateStack,e.name,n.name);return Ze(a.tokens,i),a.tokens}function qe(t,e,n,r,s){const a=we(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:o=500}=s,c=Ae(t);let l=s.grammarState?So(s.grammarState,n.name)??kt:s.grammarContextCode!=null?qe(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:kt,u=[];const h=[];for(let g=0,f=c.length;g<f;g++){const[p,b]=c[g];if(p===""){u=[],h.push([]);continue}if(i>0&&p.length>=i){u=[],h.push([{content:p,offset:b,color:"",fontStyle:0}]);continue}let m,w,C;s.includeExplanation&&(m=e.tokenizeLine(p,l),w=m.tokens,C=0);const S=e.tokenizeLine2(p,l,o),N=S.tokens.length/2;for(let A=0;A<N;A++){const D=S.tokens[2*A],L=A+1<N?S.tokens[2*A+2]:p.length;if(D===L)continue;const zt=S.tokens[2*A+1],Hr=Z(r[ne.getForeground(zt)],a),qr=ne.getFontStyle(zt),nt={content:p.substring(D,L),offset:b+D,color:Hr,fontStyle:qr};if(s.includeExplanation){const Vt=[];if(s.includeExplanation!=="scopeName")for(const z of n.settings){let se;switch(typeof z.scope){case"string":se=z.scope.split(/,/).map(rt=>rt.trim());break;case"object":se=z.scope;break;default:continue}Vt.push({settings:z,selectors:se.map(rt=>rt.split(/ /))})}nt.explanation=[];let Kt=0;for(;D+Kt<L;){const z=w[C],se=p.substring(z.startIndex,z.endIndex);Kt+=se.length,nt.explanation.push({content:se,scopes:s.includeExplanation==="scopeName"?To(z.scopes):$o(Vt,z.scopes)}),C+=1}}u.push(nt)}h.push(u),u=[],l=S.ruleStack}return{tokens:h,stateStack:l}}function To(t){return t.map(e=>({scopeName:e}))}function $o(t,e){const n=[];for(let r=0,s=e.length;r<s;r++){const a=e[r];n[r]={scopeName:a,themeMatches:Lo(t,a,e.slice(0,r))}}return n}function vn(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function Go(t,e,n){if(!vn(t[t.length-1],e))return!1;let r=t.length-2,s=n.length-1;for(;r>=0&&s>=0;)vn(t[r],n[s])&&(r-=1),s-=1;return r===-1}function Lo(t,e,n){const r=[];for(const{selectors:s,settings:a}of t)for(const i of s)if(Go(i,e,n)){r.push(a);break}return r}function Ye(t,e,n){const r=Object.entries(n.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),s=r.map(c=>{const l=Ee(t,e,{...n,theme:c.theme}),u=Se(l),h=typeof c.theme=="string"?c.theme:c.theme.name;return{tokens:l,state:u,theme:h}}),a=Po(...s.map(c=>c.tokens)),i=a[0].map((c,l)=>c.map((u,h)=>{const g={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(g.explanation=u.explanation),a.forEach((f,p)=>{const{content:b,explanation:m,offset:w,...C}=f[l][h];g.variants[r[p].color]=C}),g})),o=s[0].state?new he(Object.fromEntries(s.map(c=>[c.theme,c.state?.getInternalStack(c.theme)])),s[0].state.lang):void 0;return o&&Ze(i,o),i}function Po(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){const s=t.map(c=>c[r]),a=e.map(()=>[]);e.forEach((c,l)=>c.push(a[l]));const i=s.map(()=>0),o=s.map(c=>c[0]);for(;o.every(c=>c);){const c=Math.min(...o.map(l=>l.content.length));for(let l=0;l<n;l++){const u=o[l];u.content.length===c?(a[l].push(u),i[l]+=1,o[l]=s[l][i[l]]):(a[l].push({...u,content:u.content.slice(0,c)}),o[l]={...u,content:u.content.slice(c),offset:u.offset+c})}}}return e}function le(t,e,n){let r,s,a,i,o,c;if("themes"in n){const{defaultColor:l="light",cssVariablePrefix:u="--shiki-"}=n,h=Object.entries(n.themes).filter(m=>m[1]).map(m=>({color:m[0],theme:m[1]})).sort((m,w)=>m.color===l?-1:w.color===l?1:0);if(h.length===0)throw new q("`themes` option must not be empty");const g=Ye(t,e,n);if(c=Se(g),l&&!h.find(m=>m.color===l))throw new q(`\`themes\` option must contain the defaultColor key \`${l}\``);const f=h.map(m=>t.getTheme(m.theme)),p=h.map(m=>m.color);a=g.map(m=>m.map(w=>Oo(w,p,u,l))),c&&Ze(a,c);const b=h.map(m=>we(m.theme,n));s=h.map((m,w)=>(w===0&&l?"":`${u+m.color}:`)+(Z(f[w].fg,b[w])||"inherit")).join(";"),r=h.map((m,w)=>(w===0&&l?"":`${u+m.color}-bg:`)+(Z(f[w].bg,b[w])||"inherit")).join(";"),i=`shiki-themes ${f.map(m=>m.name).join(" ")}`,o=l?void 0:[s,r].join(";")}else if("theme"in n){const l=we(n.theme,n);a=Ee(t,e,n);const u=t.getTheme(n.theme);r=Z(u.bg,l),s=Z(u.fg,l),i=u.name,c=Se(a)}else throw new q("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:s,bg:r,themeName:i,rootStyle:o,grammarState:c}}function Oo(t,e,n,r){const s={content:t.content,explanation:t.explanation,offset:t.offset},a=e.map(c=>Ut(t.variants[c])),i=new Set(a.flatMap(c=>Object.keys(c))),o={};return a.forEach((c,l)=>{for(const u of i){const h=c[u]||"inherit";if(l===0&&r)o[u]=h;else{const g=u==="color"?"":u==="background-color"?"-bg":`-${u}`,f=n+e[l]+(u==="color"?"":g);o[f]=h}}}),s.htmlStyle=o,s}function ue(t,e,n,r={meta:{},options:n,codeToHast:(s,a)=>ue(t,s,a),codeToTokens:(s,a)=>le(t,s,a)}){let s=e;for(const f of He(n))s=f.preprocess?.call(r,s,n)||s;let{tokens:a,fg:i,bg:o,themeName:c,rootStyle:l,grammarState:u}=le(t,s,n);const{mergeWhitespaces:h=!0}=n;h===!0?a=Mo(a):h==="never"&&(a=Fo(a));const g={...r,get source(){return s}};for(const f of He(n))a=f.tokens?.call(g,a)||a;return Br(a,{...n,fg:i,bg:o,themeName:c,rootStyle:l},g,u)}function Br(t,e,n,r=Se(t)){const s=He(e),a=[],i={type:"root",children:[]},{structure:o="classic",tabindex:c="0"}=e;let l={type:"element",tagName:"pre",properties:{class:`shiki ${e.themeName||""}`,style:e.rootStyle||`background-color:${e.bg};color:${e.fg}`,...c!==!1&&c!=null?{tabindex:c.toString()}:{},...Object.fromEntries(Array.from(Object.entries(e.meta||{})).filter(([p])=>!p.startsWith("_")))},children:[]},u={type:"element",tagName:"code",properties:{},children:a};const h=[],g={...n,structure:o,addClassToHast:jt,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return i},get pre(){return l},get code(){return u},get lines(){return h}};if(t.forEach((p,b)=>{b&&(o==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):o==="classic"&&a.push({type:"text",value:`
148
+ `}));let m={type:"element",tagName:"span",properties:{class:"line"},children:[]},w=0;for(const C of p){let S={type:"element",tagName:"span",properties:{...C.htmlAttrs},children:[{type:"text",value:C.content}]};typeof C.htmlStyle=="string"&&B("`htmlStyle` as a string is deprecated. Use an object instead.");const N=Tr(C.htmlStyle||Ut(C));N&&(S.properties.style=N);for(const A of s)S=A?.span?.call(g,S,b+1,w,m,C)||S;o==="inline"?i.children.push(S):o==="classic"&&m.children.push(S),w+=C.content.length}if(o==="classic"){for(const C of s)m=C?.line?.call(g,m,b+1)||m;h.push(m),a.push(m)}}),o==="classic"){for(const p of s)u=p?.code?.call(g,u)||u;l.children.push(u);for(const p of s)l=p?.pre?.call(g,l)||l;i.children.push(l)}let f=i;for(const p of s)f=p?.root?.call(g,f)||f;return r&&Ze(f,r),f}function Mo(t){return t.map(e=>{const n=[];let r="",s=0;return e.forEach((a,i)=>{const c=!(a.fontStyle&&a.fontStyle&H.Underline);c&&a.content.match(/^\s+$/)&&e[i+1]?(s||(s=a.offset),r+=a.content):r?(c?n.push({...a,offset:s,content:r+a.content}):n.push({content:r,offset:s},a),s=0,r=""):n.push(a)}),n})}function Fo(t){return t.map(e=>e.flatMap(n=>{if(n.content.match(/^\s+$/))return n;const r=n.content.match(/^(\s*)(.*?)(\s*)$/);if(!r)return n;const[,s,a,i]=r;if(!s&&!i)return n;const o=[{...n,offset:n.offset+s.length,content:a}];return s&&o.unshift({content:s,offset:n.offset}),i&&o.push({content:i,offset:n.offset+s.length+a.length}),o}))}function Wt(t,e,n){const r={meta:{},options:n,codeToHast:(a,i)=>ue(t,a,i),codeToTokens:(a,i)=>le(t,a,i)};let s=Qn(ue(t,e,n,r));for(const a of He(n))s=a.postprocess?.call(r,s,n)||s;return s}const An={light:"#333333",dark:"#bbbbbb"},En={light:"#fffffe",dark:"#1e1e1e"},Rn="__shiki_resolved";function et(t){if(t?.[Rn])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){const o=e.settings?e.settings.find(c=>!c.name&&!c.scope):void 0;o?.settings?.foreground&&(r=o.settings.foreground),o?.settings?.background&&(n=o.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?An.light:An.dark),n||(n=e.type==="light"?En.light:En.dark),e.fg=r,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const a=new Map;function i(o){if(a.has(o))return a.get(o);s+=1;const c=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${c}`]?i(o):(a.set(o,c),c)}e.settings=e.settings.map(o=>{const c=o.settings?.foreground&&!o.settings.foreground.startsWith("#"),l=o.settings?.background&&!o.settings.background.startsWith("#");if(!c&&!l)return o;const u={...o,settings:{...o.settings}};if(c){const h=i(o.settings.foreground);e.colorReplacements[h]=o.settings.foreground,u.settings.foreground=h}if(l){const h=i(o.settings.background);e.colorReplacements[h]=o.settings.background,u.settings.background=h}return u});for(const o of Object.keys(e.colors||{}))if((o==="editor.foreground"||o==="editor.background"||o.startsWith("terminal.ansi"))&&!e.colors[o]?.startsWith("#")){const c=i(e.colors[o]);e.colorReplacements[c]=e.colors[o],e.colors[o]=c}return Object.defineProperty(e,Rn,{enumerable:!1,writable:!1,value:!0}),e}async function jr(t){return Array.from(new Set((await Promise.all(t.filter(e=>!Ft(e)).map(async e=>await Dt(e).then(n=>Array.isArray(n)?n:[n])))).flat()))}async function Dr(t){return(await Promise.all(t.map(async n=>Bt(n)?null:et(await Dt(n))))).filter(n=>!!n)}class Bo extends $s{constructor(e,n,r,s={}){super(e),this._resolver=e,this._themes=n,this._langs=r,this._alias=s,this._themes.map(a=>this.loadTheme(a)),this.loadLanguages(this._langs)}_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const n=et(e);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let n=this._textmateThemeCache.get(e);n||(n=Oe.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){if(this._alias[e]){const n=new Set([e]);for(;this._alias[e];){if(e=this._alias[e],n.has(e))throw new G(`Circular alias \`${Array.from(n).join(" -> ")} -> ${e}\``);n.add(e)}}return this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const n=new Set([...this._langMap.values()].filter(a=>a.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(a=>{this._alias[a]=e.name}),this._loadedLanguagesCache=null,n.size)for(const a of n)this._resolvedGrammars.delete(a.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(a.scopeName),this._syncRegistry?._grammars?.delete(a.scopeName),this.loadLanguage(this._langMap.get(a.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const n=Array.from(this._langGraph.entries()),r=n.filter(([s,a])=>!a);if(r.length){const s=n.filter(([a,i])=>i&&i.embeddedLangs?.some(o=>r.map(([c])=>c).includes(o))).filter(a=>!r.includes(a));throw new G(`Missing languages ${r.map(([a])=>`\`${a}\``).join(", ")}, required by ${s.map(([a])=>`\`${a}\``).join(", ")}`)}for(const[s,a]of n)this._resolver.addLanguage(a);for(const[s,a]of n)this.loadLanguage(a)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){if(this._langMap.set(e.name,e),this._langGraph.set(e.name,e),e.embeddedLangs)for(const n of e.embeddedLangs)this._langGraph.set(n,this._langMap.get(n))}}class jo{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,n){this._onigLib={createOnigScanner:r=>e.createScanner(r),createOnigString:r=>e.createString(r)},n.forEach(r=>this.addLanguage(r))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(n=>{this._langs.set(n,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(n=>{this._injections.get(n)||this._injections.set(n,[]),this._injections.get(n).push(e.scopeName)})}getInjections(e){const n=e.split(".");let r=[];for(let s=1;s<=n.length;s++){const a=n.slice(0,s).join(".");r=[...r,...this._injections.get(a)||[]]}return r}}let fe=0;function Ht(t){fe+=1,t.warnings!==!1&&fe>=10&&fe%10===0&&console.warn(`[Shiki] ${fe} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new G("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(et),s=new jo(t.engine,n),a=new Bo(s,r,n,t.langAlias);let i;function o(C){m();const S=a.getGrammar(typeof C=="string"?C:C.name);if(!S)throw new G(`Language \`${C}\` not found, you may need to load it first`);return S}function c(C){if(C==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};m();const S=a.getTheme(C);if(!S)throw new G(`Theme \`${C}\` not found, you may need to load it first`);return S}function l(C){m();const S=c(C);i!==C&&(a.setTheme(S),i=C);const N=a.getColorMap();return{theme:S,colorMap:N}}function u(){return m(),a.getLoadedThemes()}function h(){return m(),a.getLoadedLanguages()}function g(...C){m(),a.loadLanguages(C.flat(1))}async function f(...C){return g(await jr(C))}function p(...C){m();for(const S of C.flat(1))a.loadTheme(S)}async function b(...C){return m(),p(await Dr(C))}function m(){if(e)throw new G("Shiki instance has been disposed")}function w(){e||(e=!0,a.dispose(),fe-=1)}return{setTheme:l,getTheme:c,getLanguage:o,getLoadedThemes:u,getLoadedLanguages:h,loadLanguage:f,loadLanguageSync:g,loadTheme:b,loadThemeSync:p,dispose:w,[Symbol.dispose]:w}}async function qt(t={}){t.loadWasm&&B("`loadWasm` option is deprecated. Use `engine: createOnigurumaEngine(loadWasm)` instead.");const[e,n,r]=await Promise.all([Dr(t.themes||[]),jr(t.langs||[]),t.engine||me.createOnigurumaEngine(t.loadWasm||me.getDefaultWasmLoader())]);return Ht({...t,themes:e,langs:n,engine:r})}function Do(t={}){return B("`getShikiInternal` is deprecated. Use `createShikiInternal` instead."),qt(t)}async function tt(t={}){const e=await qt(t);return{getLastGrammarState:(...n)=>Mr(e,...n),codeToTokensBase:(n,r)=>Ee(e,n,r),codeToTokensWithThemes:(n,r)=>Ye(e,n,r),codeToTokens:(n,r)=>le(e,n,r),codeToHast:(n,r)=>ue(e,n,r),codeToHtml:(n,r)=>Wt(e,n,r),...e,getInternalContext:()=>e}}function Uo(t={}){const e=Ht(t);return{getLastGrammarState:(...n)=>Mr(e,...n),codeToTokensBase:(n,r)=>Ee(e,n,r),codeToTokensWithThemes:(n,r)=>Ye(e,n,r),codeToTokens:(n,r)=>le(e,n,r),codeToHast:(n,r)=>ue(e,n,r),codeToHtml:(n,r)=>Wt(e,n,r),...e,getInternalContext:()=>e}}function Ur(t){let e;async function n(r={}){if(e){const s=await e;return await Promise.all([s.loadTheme(...r.themes||[]),s.loadLanguage(...r.langs||[])]),s}else return e=t({...r,themes:r.themes||[],langs:r.langs||[]}),e}return n}const Wo=Ur(tt);function Ho(t={}){return B("`getHighlighterCore` is deprecated. Use `createHighlighterCore` or `getSingletonHighlighterCore` instead."),tt(t)}function qo(t,e,n){let r,s,a;if(e)B("`createdBundledHighlighter` signature with `bundledLanguages` and `bundledThemes` is deprecated. Use the options object signature instead."),r=t,s=e,a=()=>Rr(n);else{const o=t;r=o.langs,s=o.themes,a=o.engine}async function i(o){function c(f){if(typeof f=="string"){if(Ft(f))return[];const p=r[f];if(!p)throw new q(`Language \`${f}\` is not included in this bundle. You may want to load it from external source.`);return p}return f}function l(f){if(Bt(f))return"none";if(typeof f=="string"){const p=s[f];if(!p)throw new q(`Theme \`${f}\` is not included in this bundle. You may want to load it from external source.`);return p}return f}const u=(o.themes??[]).map(f=>l(f)),h=(o.langs??[]).map(f=>c(f)),g=await tt({engine:o.engine??a(),...o,themes:u,langs:h});return{...g,loadLanguage(...f){return g.loadLanguage(...f.map(c))},loadTheme(...f){return g.loadTheme(...f.map(l))}}}return i}function Wr(t){let e;async function n(r={}){if(e){const s=await e;return await Promise.all([s.loadTheme(...r.themes||[]),s.loadLanguage(...r.langs||[])]),s}else return e=t({...r,themes:r.themes||[],langs:r.langs||[]}),e}return n}function zo(t){const e=Wr(t);return{getSingletonHighlighter(n){return e(n)},async codeToHtml(n,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToHtml(n,r)},async codeToHast(n,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToHast(n,r)},async codeToTokens(n,r){return(await e({langs:[r.lang],themes:"theme"in r?[r.theme]:Object.values(r.themes)})).codeToTokens(n,r)},async codeToTokensBase(n,r){return(await e({langs:[r.lang],themes:[r.theme]})).codeToTokensBase(n,r)},async codeToTokensWithThemes(n,r){return(await e({langs:[r.lang],themes:Object.values(r.themes).filter(Boolean)})).codeToTokensWithThemes(n,r)},async getLastGrammarState(n,r){return(await e({langs:[r.lang],themes:[r.theme]})).getLastGrammarState(n,r)}}}function Vo(t){return B("import `createJavaScriptRegexEngine` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead"),yo(t)}function Ko(t){return B("import `defaultJavaScriptRegexConstructor` from `@shikijs/engine-javascript` or `shiki/engine/javascript` instead"),Er(t)}function Qo(t={}){const{name:e="css-variables",variablePrefix:n="--shiki-",fontStyle:r=!0}=t,s=i=>t.variableDefaults?.[i]?`var(${n}${i}, ${t.variableDefaults[i]})`:`var(${n}${i})`,a={name:e,type:"dark",colors:{"editor.foreground":s("foreground"),"editor.background":s("background"),"terminal.ansiBlack":s("ansi-black"),"terminal.ansiRed":s("ansi-red"),"terminal.ansiGreen":s("ansi-green"),"terminal.ansiYellow":s("ansi-yellow"),"terminal.ansiBlue":s("ansi-blue"),"terminal.ansiMagenta":s("ansi-magenta"),"terminal.ansiCyan":s("ansi-cyan"),"terminal.ansiWhite":s("ansi-white"),"terminal.ansiBrightBlack":s("ansi-bright-black"),"terminal.ansiBrightRed":s("ansi-bright-red"),"terminal.ansiBrightGreen":s("ansi-bright-green"),"terminal.ansiBrightYellow":s("ansi-bright-yellow"),"terminal.ansiBrightBlue":s("ansi-bright-blue"),"terminal.ansiBrightMagenta":s("ansi-bright-magenta"),"terminal.ansiBrightCyan":s("ansi-bright-cyan"),"terminal.ansiBrightWhite":s("ansi-bright-white")},tokenColors:[{scope:["keyword.operator.accessor","meta.group.braces.round.function.arguments","meta.template.expression","markup.fenced_code meta.embedded.block"],settings:{foreground:s("foreground")}},{scope:"emphasis",settings:{fontStyle:"italic"}},{scope:["strong","markup.heading.markdown","markup.bold.markdown"],settings:{fontStyle:"bold"}},{scope:["markup.italic.markdown"],settings:{fontStyle:"italic"}},{scope:"meta.link.inline.markdown",settings:{fontStyle:"underline",foreground:s("token-link")}},{scope:["string","markup.fenced_code","markup.inline"],settings:{foreground:s("token-string")}},{scope:["comment","string.quoted.docstring.multi"],settings:{foreground:s("token-comment")}},{scope:["constant.numeric","constant.language","constant.other.placeholder","constant.character.format.placeholder","variable.language.this","variable.other.object","variable.other.class","variable.other.constant","meta.property-name","meta.property-value","support"],settings:{foreground:s("token-constant")}},{scope:["keyword","storage.modifier","storage.type","storage.control.clojure","entity.name.function.clojure","entity.name.tag.yaml","support.function.node","support.type.property-name.json","punctuation.separator.key-value","punctuation.definition.template-expression"],settings:{foreground:s("token-keyword")}},{scope:"variable.parameter.function",settings:{foreground:s("token-parameter")}},{scope:["support.function","entity.name.type","entity.other.inherited-class","meta.function-call","meta.instance.constructor","entity.other.attribute-name","entity.name.function","constant.keyword.clojure"],settings:{foreground:s("token-function")}},{scope:["entity.name.tag","string.quoted","string.regexp","string.interpolated","string.template","string.unquoted.plain.out.yaml","keyword.other.template"],settings:{foreground:s("token-string-expression")}},{scope:["punctuation.definition.arguments","punctuation.definition.dict","punctuation.separator","meta.function-call.arguments"],settings:{foreground:s("token-punctuation")}},{scope:["markup.underline.link","punctuation.definition.metadata.markdown"],settings:{foreground:s("token-link")}},{scope:["beginning.punctuation.definition.list.markdown"],settings:{foreground:s("token-string")}},{scope:["punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown","string.other.link.title.markdown","string.other.link.description.markdown"],settings:{foreground:s("token-keyword")}},{scope:["markup.inserted","meta.diff.header.to-file","punctuation.definition.inserted"],settings:{foreground:s("token-inserted")}},{scope:["markup.deleted","meta.diff.header.from-file","punctuation.definition.deleted"],settings:{foreground:s("token-deleted")}},{scope:["markup.changed","punctuation.definition.changed"],settings:{foreground:s("token-changed")}}]};return r||(a.tokenColors=a.tokenColors?.map(i=>(i.settings?.fontStyle&&delete i.settings.fontStyle,i))),a}exports.FontStyle=H;exports.ShikiError=q;exports.StackElementMetadata=ne;exports.addClassToHast=jt;exports.applyColorReplacements=Z;exports.codeToHast=ue;exports.codeToHtml=Wt;exports.codeToTokens=le;exports.codeToTokensBase=Ee;exports.codeToTokensWithThemes=Ye;exports.createCssVariablesTheme=Qo;exports.createHighlighterCore=tt;exports.createHighlighterCoreSync=Uo;exports.createJavaScriptRegexEngine=Vo;exports.createOnigurumaEngine=Rr;exports.createPositionConverter=$r;exports.createShikiInternal=qt;exports.createShikiInternalSync=Ht;exports.createSingletonShorthands=zo;exports.createWasmOnigEngine=bo;exports.createdBundledHighlighter=qo;exports.defaultJavaScriptRegexConstructor=Ko;exports.enableDeprecationWarnings=zr;exports.getHighlighterCore=Ho;exports.getShikiInternal=Do;exports.getSingletonHighlighterCore=Wo;exports.getTokenStyleObject=Ut;exports.hastToHtml=Qn;exports.isNoneTheme=Xe;exports.isPlainLang=Je;exports.isSpecialLang=Ft;exports.isSpecialTheme=Bt;exports.loadWasm=wo;exports.makeSingletonHighlighter=Wr;exports.makeSingletonHighlighterCore=Ur;exports.normalizeGetter=Dt;exports.normalizeTheme=et;exports.resolveColorReplacements=we;exports.splitLines=Ae;exports.splitToken=Nr;exports.splitTokens=xr;exports.stringifyTokenStyle=Tr;exports.toArray=Ir;exports.tokenizeAnsiWithTheme=Or;exports.tokenizeWithTheme=Fr;exports.tokensToHast=Br;exports.transformerDecorations=Lr;exports.warnDeprecated=B;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class B extends Error{constructor(t){super(t),this.name="ShikiError"}}function v(){return 2147483648}function D(){return typeof performance<"u"?performance.now():Date.now()}const I=(n,t)=>n+(t-n%t)%t;async function x(n){let t,r;const e={};function l(f){r=f,e.HEAPU8=new Uint8Array(f),e.HEAPU32=new Uint32Array(f)}function h(f,c,S){e.HEAPU8.copyWithin(f,c,c+S)}function o(f){try{return t.grow(f-r.byteLength+65535>>>16),l(t.buffer),1}catch{}}function s(f){const c=e.HEAPU8.length;f=f>>>0;const S=v();if(f>S)return!1;for(let L=1;L<=4;L*=2){let p=c*(1+.2/L);p=Math.min(p,f+100663296);const w=Math.min(S,I(Math.max(f,p),65536));if(o(w))return!0}return!1}const i=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function a(f,c,S=1024){const L=c+S;let p=c;for(;f[p]&&!(p>=L);)++p;if(p-c>16&&f.buffer&&i)return i.decode(f.subarray(c,p));let w="";for(;c<p;){let m=f[c++];if(!(m&128)){w+=String.fromCharCode(m);continue}const b=f[c++]&63;if((m&224)===192){w+=String.fromCharCode((m&31)<<6|b);continue}const E=f[c++]&63;if((m&240)===224?m=(m&15)<<12|b<<6|E:m=(m&7)<<18|b<<12|E<<6|f[c++]&63,m<65536)w+=String.fromCharCode(m);else{const C=m-65536;w+=String.fromCharCode(55296|C>>10,56320|C&1023)}}return w}function U(f,c){return f?a(e.HEAPU8,f,c):""}const u={emscripten_get_now:D,emscripten_memcpy_big:h,emscripten_resize_heap:s,fd_write:()=>0};async function y(){const c=await n({env:u,wasi_snapshot_preview1:u});t=c.memory,l(t.buffer),Object.assign(e,c),e.UTF8ToString=U}return await y(),e}var V=Object.defineProperty,N=(n,t,r)=>t in n?V(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,d=(n,t,r)=>(N(n,typeof t!="symbol"?t+"":t,r),r);let g=null;function F(n){throw new B(n.UTF8ToString(n.getLastOnigError()))}class T{constructor(t){d(this,"utf16Length"),d(this,"utf8Length"),d(this,"utf16Value"),d(this,"utf8Value"),d(this,"utf16OffsetToUtf8"),d(this,"utf8OffsetToUtf16");const r=t.length,e=T._utf8ByteLength(t),l=e!==r,h=l?new Uint32Array(r+1):null;l&&(h[r]=e);const o=l?new Uint32Array(e+1):null;l&&(o[e]=r);const s=new Uint8Array(e);let i=0;for(let a=0;a<r;a++){const U=t.charCodeAt(a);let u=U,y=!1;if(U>=55296&&U<=56319&&a+1<r){const f=t.charCodeAt(a+1);f>=56320&&f<=57343&&(u=(U-55296<<10)+65536|f-56320,y=!0)}l&&(h[a]=i,y&&(h[a+1]=i),u<=127?o[i+0]=a:u<=2047?(o[i+0]=a,o[i+1]=a):u<=65535?(o[i+0]=a,o[i+1]=a,o[i+2]=a):(o[i+0]=a,o[i+1]=a,o[i+2]=a,o[i+3]=a)),u<=127?s[i++]=u:u<=2047?(s[i++]=192|(u&1984)>>>6,s[i++]=128|(u&63)>>>0):u<=65535?(s[i++]=224|(u&61440)>>>12,s[i++]=128|(u&4032)>>>6,s[i++]=128|(u&63)>>>0):(s[i++]=240|(u&1835008)>>>18,s[i++]=128|(u&258048)>>>12,s[i++]=128|(u&4032)>>>6,s[i++]=128|(u&63)>>>0),y&&a++}this.utf16Length=r,this.utf8Length=e,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=h,this.utf8OffsetToUtf16=o}static _utf8ByteLength(t){let r=0;for(let e=0,l=t.length;e<l;e++){const h=t.charCodeAt(e);let o=h,s=!1;if(h>=55296&&h<=56319&&e+1<l){const i=t.charCodeAt(e+1);i>=56320&&i<=57343&&(o=(h-55296<<10)+65536|i-56320,s=!0)}o<=127?r+=1:o<=2047?r+=2:o<=65535?r+=3:r+=4,s&&e++}return r}createString(t){const r=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,r),r}}const _=class{constructor(n){if(d(this,"id",++_.LAST_ID),d(this,"_onigBinding"),d(this,"content"),d(this,"utf16Length"),d(this,"utf8Length"),d(this,"utf16OffsetToUtf8"),d(this,"utf8OffsetToUtf16"),d(this,"ptr"),!g)throw new B("Must invoke loadWasm first.");this._onigBinding=g,this.content=n;const t=new T(n);this.utf16Length=t.utf16Length,this.utf8Length=t.utf8Length,this.utf16OffsetToUtf8=t.utf16OffsetToUtf8,this.utf8OffsetToUtf16=t.utf8OffsetToUtf16,this.utf8Length<1e4&&!_._sharedPtrInUse?(_._sharedPtr||(_._sharedPtr=g.omalloc(1e4)),_._sharedPtrInUse=!0,g.HEAPU8.set(t.utf8Value,_._sharedPtr),this.ptr=_._sharedPtr):this.ptr=t.createString(g)}convertUtf8OffsetToUtf16(n){return this.utf8OffsetToUtf16?n<0?0:n>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[n]:n}convertUtf16OffsetToUtf8(n){return this.utf16OffsetToUtf8?n<0?0:n>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[n]:n}dispose(){this.ptr===_._sharedPtr?_._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let A=_;d(A,"LAST_ID",0);d(A,"_sharedPtr",0);d(A,"_sharedPtrInUse",!1);class R{constructor(t){if(d(this,"_onigBinding"),d(this,"_ptr"),!g)throw new B("Must invoke loadWasm first.");const r=[],e=[];for(let s=0,i=t.length;s<i;s++){const a=new T(t[s]);r[s]=a.createString(g),e[s]=a.utf8Length}const l=g.omalloc(4*t.length);g.HEAPU32.set(r,l/4);const h=g.omalloc(4*t.length);g.HEAPU32.set(e,h/4);const o=g.createOnigScanner(l,h,t.length);for(let s=0,i=t.length;s<i;s++)g.ofree(r[s]);g.ofree(h),g.ofree(l),o===0&&F(g),this._onigBinding=g,this._ptr=o}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,r,e){let l=0;if(typeof e=="number"&&(l=e),typeof t=="string"){t=new A(t);const h=this._findNextMatchSync(t,r,!1,l);return t.dispose(),h}return this._findNextMatchSync(t,r,!1,l)}_findNextMatchSync(t,r,e,l){const h=this._onigBinding,o=h.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(r),l);if(o===0)return null;const s=h.HEAPU32;let i=o/4;const a=s[i++],U=s[i++],u=[];for(let y=0;y<U;y++){const f=t.convertUtf8OffsetToUtf16(s[i++]),c=t.convertUtf8OffsetToUtf16(s[i++]);u[y]={start:f,end:c,length:c-f}}return{index:a,captureIndices:u}}}function j(n){return typeof n.instantiator=="function"}function k(n){return typeof n.default=="function"}function z(n){return typeof n.data<"u"}function G(n){return typeof Response<"u"&&n instanceof Response}function J(n){return typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||ArrayBuffer.isView(n))||typeof Buffer<"u"&&Buffer.isBuffer?.(n)||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&n instanceof Uint32Array}let P;function W(n){if(P)return P;async function t(){g=await x(async r=>{let e=n;return e=await e,typeof e=="function"&&(e=await e(r)),typeof e=="function"&&(e=await e(r)),j(e)?e=await e.instantiator(r):k(e)?e=await e.default(r):(z(e)&&(e=e.data),G(e)?typeof WebAssembly.instantiateStreaming=="function"?e=await K(e)(r):e=await Q(e)(r):J(e)?e=await O(e)(r):e instanceof WebAssembly.Module?e=await O(e)(r):"default"in e&&e.default instanceof WebAssembly.Module&&(e=await O(e.default)(r))),"instance"in e&&(e=e.instance),"exports"in e&&(e=e.exports),e})}return P=t(),P}function O(n){return t=>WebAssembly.instantiate(n,t)}function K(n){return t=>WebAssembly.instantiateStreaming(n,t)}function Q(n){return async t=>{const r=await n.arrayBuffer();return WebAssembly.instantiate(r,t)}}let M;function X(n){M=n}function Y(){return M}async function H(n){return n&&await W(n),{createScanner(t){return new R(t.map(r=>typeof r=="string"?r:r.source))},createString(t){return new A(t)}}}async function Z(n){return H(n)}exports.createOnigurumaEngine=H;exports.createWasmOnigEngine=Z;exports.getDefaultWasmLoader=Y;exports.loadWasm=W;exports.setDefaultWasmLoader=X;